Annotation of 42BSD/usr.lib/sendmail/src/trace.c, revision 1.1.1.1

1.1       root        1: # include <ctype.h>
                      2: # include "sendmail.h"
                      3: 
                      4: SCCSID(@(#)trace.c     4.1             7/25/83);
                      5: 
                      6: /*
                      7: **  TtSETUP -- set up for trace package.
                      8: **
                      9: **     Parameters:
                     10: **             vect -- pointer to trace vector.
                     11: **             size -- number of flags in trace vector.
                     12: **             defflags -- flags to set if no value given.
                     13: **
                     14: **     Returns:
                     15: **             none
                     16: **
                     17: **     Side Effects:
                     18: **             environment is set up.
                     19: */
                     20: 
                     21: u_char         *tTvect;
                     22: int            tTsize;
                     23: static char    *DefFlags;
                     24: 
                     25: tTsetup(vect, size, defflags)
                     26:        u_char *vect;
                     27:        int size;
                     28:        char *defflags;
                     29: {
                     30:        tTvect = vect;
                     31:        tTsize = size;
                     32:        DefFlags = defflags;
                     33: }
                     34: /*
                     35: **  TtFLAG -- process an external trace flag description.
                     36: **
                     37: **     Parameters:
                     38: **             s -- the trace flag.
                     39: **
                     40: **     Returns:
                     41: **             none.
                     42: **
                     43: **     Side Effects:
                     44: **             sets/clears trace flags.
                     45: */
                     46: 
                     47: tTflag(s)
                     48:        register char *s;
                     49: {
                     50:        int first, last;
                     51:        register int i;
                     52: 
                     53:        if (*s == '\0')
                     54:                s = DefFlags;
                     55: 
                     56:        for (;;)
                     57:        {
                     58:                /* find first flag to set */
                     59:                i = 0;
                     60:                while (isdigit(*s))
                     61:                        i = i * 10 + (*s++ - '0');
                     62:                first = i;
                     63: 
                     64:                /* find last flag to set */
                     65:                if (*s == '-')
                     66:                {
                     67:                        i = 0;
                     68:                        while (isdigit(*++s))
                     69:                                i = i * 10 + (*s - '0');
                     70:                }
                     71:                last = i;
                     72: 
                     73:                /* find the level to set it to */
                     74:                i = 1;
                     75:                if (*s == '.')
                     76:                {
                     77:                        i = 0;
                     78:                        while (isdigit(*++s))
                     79:                                i = i * 10 + (*s - '0');
                     80:                }
                     81: 
                     82:                /* clean up args */
                     83:                if (first >= tTsize)
                     84:                        first = tTsize - 1;
                     85:                if (last >= tTsize)
                     86:                        last = tTsize - 1;
                     87: 
                     88:                /* set the flags */
                     89:                while (first <= last)
                     90:                        tTvect[first++] = i;
                     91: 
                     92:                /* more arguments? */
                     93:                if (*s++ == '\0')
                     94:                        return;
                     95:        }
                     96: }

unix.superglobalmegacorp.com

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