|
|
1.1 ! root 1: /********************************************************************* ! 2: * COPYRIGHT NOTICE * ! 3: ********************************************************************** ! 4: * This software is copyright (C) 1982 by Pavel Curtis * ! 5: * * ! 6: * Permission is granted to reproduce and distribute * ! 7: * this file by any means so long as no fee is charged * ! 8: * above a nominal handling fee and so long as this * ! 9: * notice is always included in the copies. * ! 10: * * ! 11: * Other rights are reserved except as explicitly granted * ! 12: * by written permission of the author. * ! 13: * Pavel Curtis * ! 14: * Computer Science Dept. * ! 15: * 405 Upson Hall * ! 16: * Cornell University * ! 17: * Ithaca, NY 14853 * ! 18: * * ! 19: * Ph- (607) 256-4934 * ! 20: * * ! 21: * Pavel.Cornell@Udel-Relay (ARPAnet) * ! 22: * decvax!cornell!pavel (UUCPnet) * ! 23: *********************************************************************/ ! 24: ! 25: /* ! 26: * tputs.c ! 27: * ! 28: * $Log: lib_tputs.c,v $ ! 29: * Revision 1.2 92/04/13 14:38:41 bin ! 30: * update by vlad ! 31: * ! 32: * Revision 3.2 91/04/20 21:57:22 munk ! 33: * Usage of register variables ! 34: * ! 35: * Revision 3.1 84/12/13 11:21:03 john ! 36: * Revisions by Mark Horton ! 37: * ! 38: * Revision 2.1 82/10/25 14:49:31 pavel ! 39: * Added Copyright Notice ! 40: * ! 41: * Revision 2.0 82/10/24 15:18:06 pavel ! 42: * Beta-one Test Release ! 43: * ! 44: * Revision 1.3 82/08/23 22:30:52 pavel ! 45: * The REAL Alpha-one Release Version ! 46: * ! 47: * Revision 1.2 82/08/19 19:11:38 pavel ! 48: * Alpha Test Release One ! 49: * ! 50: * Revision 1.1 82/08/12 18:46:00 pavel ! 51: * Initial revision ! 52: * ! 53: * ! 54: */ ! 55: ! 56: #ifndef COHERENT ! 57: static char RCSid[] = ! 58: "$Header: /src386/usr/lib/ncurses/RCS/lib_tputs.c,v 1.2 92/04/13 14:38:41 bin Exp Locker: bin $"; ! 59: #endif ! 60: ! 61: #include <ctype.h> ! 62: #include <stdio.h> ! 63: #include "curses.h" ! 64: #include "curses.priv.h" ! 65: #include "term.h" ! 66: ! 67: ! 68: tputs(string, affcnt, outc) ! 69: register char *string; ! 70: int affcnt; ! 71: int (*outc)(); ! 72: { ! 73: float number; ! 74: int baud = baudrate(); ! 75: char null = '\0'; ! 76: register int i; ! 77: ! 78: #ifdef TRACE ! 79: if (_tracing) ! 80: _tracef("tputs(%s,%d,%o) called", string, affcnt, outc); ! 81: #endif ! 82: ! 83: if (pad_char) ! 84: null = pad_char[0]; ! 85: ! 86: while (*string) ! 87: { ! 88: if (*string != '$') ! 89: (*outc)(*string); ! 90: else ! 91: { ! 92: string++; ! 93: if (*string != '<') ! 94: { ! 95: (*outc)('$'); ! 96: (*outc)(*string); ! 97: } ! 98: else ! 99: { ! 100: ! 101: number = 0; ! 102: string++; ! 103: ! 104: if (!isdigit(*string) && *string != '.' || !index(string, '>')) { ! 105: (*outc)('$'); ! 106: (*outc)('<'); ! 107: continue; ! 108: } ! 109: while (isdigit(*string)) ! 110: { ! 111: number = number * 10 + *string - '0'; ! 112: string++; ! 113: } ! 114: ! 115: if (*string == '.') ! 116: { ! 117: string++; ! 118: if (isdigit(*string)) ! 119: { ! 120: number += (float) (*string - '0') / 10.; ! 121: string++; ! 122: } ! 123: } ! 124: ! 125: if (*string == '*') ! 126: { ! 127: number *= affcnt; ! 128: string++; ! 129: } ! 130: ! 131: if (padding_baud_rate && baud >= padding_baud_rate && !xon_xoff) ! 132: { ! 133: number = ((baud / 10.) * number) / 1000.; ! 134: ! 135: for (i=0; i < number; i++) ! 136: (*outc)(null); ! 137: } ! 138: ! 139: } /* endelse (*string == '<') */ ! 140: } /* endelse (*string == '$') */ ! 141: ! 142: if (*string == '\0') ! 143: break; ! 144: ! 145: string++; ! 146: } ! 147: } ! 148: ! 149: ! 150: void ! 151: _outc(ch) ! 152: { ! 153: putchar(ch); ! 154: } ! 155: ! 156: ! 157: putp(string) ! 158: { ! 159: #ifdef TRACE ! 160: if (_tracing) ! 161: _tracef("putp(%s) called", string); ! 162: #endif ! 163: tputs(string, 1, _outc); ! 164: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.