Annotation of coherent/g/usr/lib/ncurses/lib_tputs.c, revision 1.1

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.11  93/04/12  14:14:34  bin
        !            30:  * Udo: third color update
        !            31:  * 
        !            32:  * Revision 1.5  92/06/02  12:05:41  bin
        !            33:  * *** empty log message ***
        !            34:  * 
        !            35:  * Revision 1.2  92/04/13  14:38:41  bin
        !            36:  * update by vlad
        !            37:  * 
        !            38:  * Revision 3.2  91/04/20  21:57:22  munk
        !            39:  * Usage of register variables
        !            40:  *
        !            41:  * Revision 3.1  84/12/13  11:21:03  john
        !            42:  * Revisions by Mark Horton
        !            43:  * 
        !            44:  * Revision 2.1  82/10/25  14:49:31  pavel
        !            45:  * Added Copyright Notice
        !            46:  * 
        !            47:  * Revision 2.0  82/10/24  15:18:06  pavel
        !            48:  * Beta-one Test Release
        !            49:  * 
        !            50:  * Revision 1.3  82/08/23  22:30:52  pavel
        !            51:  * The REAL Alpha-one Release Version
        !            52:  * 
        !            53:  * Revision 1.2  82/08/19  19:11:38  pavel
        !            54:  * Alpha Test Release One
        !            55:  * 
        !            56:  * Revision 1.1  82/08/12  18:46:00  pavel
        !            57:  * Initial revision
        !            58:  * 
        !            59:  *
        !            60:  */
        !            61: 
        !            62: #ifdef RCSHDR
        !            63: static char RCSid[] =
        !            64:        "$Header: /src386/usr/usr/lib/ncurses/RCS/lib_tputs.c,v 1.11 93/04/12 14:14:34 bin Exp Locker: bin $";
        !            65: #endif
        !            66: 
        !            67: #include <ctype.h>
        !            68: #include <stdio.h>
        !            69: #include "curses.h"
        !            70: #include "curses.priv.h"
        !            71: #include "term.h"
        !            72: 
        !            73: 
        !            74: tputs(string, affcnt, outc)
        !            75: register char  *string;
        !            76: int            affcnt;
        !            77: int            (*outc)();
        !            78: {
        !            79:        char            *index();
        !            80:        float           number;
        !            81:        int             baud = baudrate();
        !            82:        char            null = '\0';
        !            83:        register int    i;
        !            84: 
        !            85: #ifdef TRACE
        !            86:        if (_tracing)
        !            87:            _tracef("tputs(%s,%d,%o) called", string, affcnt, outc);
        !            88: #endif
        !            89: 
        !            90:        if (NULL == string)
        !            91:                return;
        !            92: 
        !            93:        if (pad_char)
        !            94:            null = pad_char[0];
        !            95: 
        !            96:        while (*string)
        !            97:        {
        !            98:            if (*string != '$')
        !            99:                (*outc)(*string);
        !           100:            else
        !           101:            {
        !           102:                string++;
        !           103:                if (*string != '<')
        !           104:                {
        !           105:                    (*outc)('$');
        !           106:                    (*outc)(*string);
        !           107:                }
        !           108:                else
        !           109:                {
        !           110: 
        !           111:                    number = 0;
        !           112:                    string++;
        !           113: 
        !           114:                    if (!isdigit(*string) &&
        !           115:                         *string != '.' || (index(string, '>') == NULL)) {
        !           116:                        (*outc)('$');
        !           117:                        (*outc)('<');
        !           118:                        continue;
        !           119:                    }
        !           120:                    while (isdigit(*string))
        !           121:                    {
        !           122:                        number = number * 10 + *string - '0';
        !           123:                        string++;
        !           124:                    }
        !           125: 
        !           126:                    if (*string == '.')
        !           127:                    {
        !           128:                        string++;
        !           129:                        if (isdigit(*string))
        !           130:                        {
        !           131:                            number += (float) (*string - '0') / 10.;
        !           132:                            string++;
        !           133:                        }
        !           134:                    }
        !           135: 
        !           136:                    if (*string == '*')
        !           137:                    {
        !           138:                        number *= affcnt;
        !           139:                        string++;
        !           140:                    }
        !           141: 
        !           142:                    if (padding_baud_rate  &&  baud >= padding_baud_rate && !xon_xoff)
        !           143:                    {
        !           144:                        number = ((baud / 10.) * number) / 1000.;
        !           145:                        
        !           146:                        for (i=0; i < number; i++)
        !           147:                            (*outc)(null);
        !           148:                    }
        !           149: 
        !           150:                } /* endelse (*string == '<') */
        !           151:            } /* endelse (*string == '$') */
        !           152: 
        !           153:            if (*string == '\0')
        !           154:                break;
        !           155: 
        !           156:            string++;
        !           157:        }
        !           158: }
        !           159: 
        !           160: 
        !           161: _outc(ch)
        !           162: {
        !           163:     putchar(ch);
        !           164: }
        !           165: 
        !           166: 
        !           167: putp(string)
        !           168: register char *string;
        !           169: {
        !           170: #ifdef TRACE
        !           171:        if (_tracing)
        !           172:            _tracef("putp(%s) called", string);
        !           173: #endif
        !           174:        tputs(string, 1, _outc);
        !           175: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.