|
|
1.1 ! root 1: /* ! 2: ** Sendmail ! 3: ** Copyright (c) 1983 Eric P. Allman ! 4: ** Berkeley, California ! 5: ** ! 6: ** Copyright (c) 1983 Regents of the University of California. ! 7: ** All rights reserved. The Berkeley software License Agreement ! 8: ** specifies the terms and conditions for redistribution. ! 9: */ ! 10: ! 11: #ifndef lint ! 12: static char SccsId[] = "@(#)trace.c 5.2 (Berkeley) 6/7/85"; ! 13: #endif not lint ! 14: ! 15: # include <ctype.h> ! 16: # include "sendmail.h" ! 17: ! 18: /* ! 19: ** TtSETUP -- set up for trace package. ! 20: ** ! 21: ** Parameters: ! 22: ** vect -- pointer to trace vector. ! 23: ** size -- number of flags in trace vector. ! 24: ** defflags -- flags to set if no value given. ! 25: ** ! 26: ** Returns: ! 27: ** none ! 28: ** ! 29: ** Side Effects: ! 30: ** environment is set up. ! 31: */ ! 32: ! 33: u_char *tTvect; ! 34: int tTsize; ! 35: static char *DefFlags; ! 36: ! 37: tTsetup(vect, size, defflags) ! 38: u_char *vect; ! 39: int size; ! 40: char *defflags; ! 41: { ! 42: tTvect = vect; ! 43: tTsize = size; ! 44: DefFlags = defflags; ! 45: } ! 46: /* ! 47: ** TtFLAG -- process an external trace flag description. ! 48: ** ! 49: ** Parameters: ! 50: ** s -- the trace flag. ! 51: ** ! 52: ** Returns: ! 53: ** none. ! 54: ** ! 55: ** Side Effects: ! 56: ** sets/clears trace flags. ! 57: */ ! 58: ! 59: tTflag(s) ! 60: register char *s; ! 61: { ! 62: int first, last; ! 63: register int i; ! 64: ! 65: if (*s == '\0') ! 66: s = DefFlags; ! 67: ! 68: for (;;) ! 69: { ! 70: /* find first flag to set */ ! 71: i = 0; ! 72: while (isdigit(*s)) ! 73: i = i * 10 + (*s++ - '0'); ! 74: first = i; ! 75: ! 76: /* find last flag to set */ ! 77: if (*s == '-') ! 78: { ! 79: i = 0; ! 80: while (isdigit(*++s)) ! 81: i = i * 10 + (*s - '0'); ! 82: } ! 83: last = i; ! 84: ! 85: /* find the level to set it to */ ! 86: i = 1; ! 87: if (*s == '.') ! 88: { ! 89: i = 0; ! 90: while (isdigit(*++s)) ! 91: i = i * 10 + (*s - '0'); ! 92: } ! 93: ! 94: /* clean up args */ ! 95: if (first >= tTsize) ! 96: first = tTsize - 1; ! 97: if (last >= tTsize) ! 98: last = tTsize - 1; ! 99: ! 100: /* set the flags */ ! 101: while (first <= last) ! 102: tTvect[first++] = i; ! 103: ! 104: /* more arguments? */ ! 105: if (*s++ == '\0') ! 106: return; ! 107: } ! 108: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.