|
|
1.1 root 1: /*
2: * Copyright (c) 1983 Eric P. Allman
3: * Copyright (c) 1988 Regents of the University of California.
4: * All rights reserved.
5: *
6: * Redistribution and use in source and binary forms are permitted
7: * provided that the above copyright notice and this paragraph are
8: * duplicated in all such forms and that any documentation,
9: * advertising materials, and other materials related to such
10: * distribution and use acknowledge that the software was developed
11: * by the University of California, Berkeley. The name of the
12: * University may not be used to endorse or promote products derived
13: * from this software without specific prior written permission.
14: * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
15: * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
16: * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
17: */
18:
19: #ifndef lint
20: static char sccsid[] = "@(#)trace.c 5.5 (Berkeley) 6/30/88";
21: #endif /* not lint */
22:
23: # include "sendmail.h"
24:
25: /*
26: ** TtSETUP -- set up for trace package.
27: **
28: ** Parameters:
29: ** vect -- pointer to trace vector.
30: ** size -- number of flags in trace vector.
31: ** defflags -- flags to set if no value given.
32: **
33: ** Returns:
34: ** none
35: **
36: ** Side Effects:
37: ** environment is set up.
38: */
39:
40: u_char *tTvect;
41: int tTsize;
42: static char *DefFlags;
43:
44: tTsetup(vect, size, defflags)
45: u_char *vect;
46: int size;
47: char *defflags;
48: {
49: tTvect = vect;
50: tTsize = size;
51: DefFlags = defflags;
52: }
53: /*
54: ** TtFLAG -- process an external trace flag description.
55: **
56: ** Parameters:
57: ** s -- the trace flag.
58: **
59: ** Returns:
60: ** none.
61: **
62: ** Side Effects:
63: ** sets/clears trace flags.
64: */
65:
66: tTflag(s)
67: register char *s;
68: {
69: int first, last;
70: register int i;
71:
72: if (*s == '\0')
73: s = DefFlags;
74:
75: for (;;)
76: {
77: /* find first flag to set */
78: i = 0;
79: while (isdigit(*s))
80: i = i * 10 + (*s++ - '0');
81: first = i;
82:
83: /* find last flag to set */
84: if (*s == '-')
85: {
86: i = 0;
87: while (isdigit(*++s))
88: i = i * 10 + (*s - '0');
89: }
90: last = i;
91:
92: /* find the level to set it to */
93: i = 1;
94: if (*s == '.')
95: {
96: i = 0;
97: while (isdigit(*++s))
98: i = i * 10 + (*s - '0');
99: }
100:
101: /* clean up args */
102: if (first >= tTsize)
103: first = tTsize - 1;
104: if (last >= tTsize)
105: last = tTsize - 1;
106:
107: /* set the flags */
108: while (first <= last)
109: tTvect[first++] = i;
110:
111: /* more arguments? */
112: if (*s++ == '\0')
113: return;
114: }
115: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.