Revision 12554,
1.9 KB
checked in by danw, 26 years ago
(diff) |
This commit was generated by cvs2svn to compensate for changes in r12553,
which included commits to RCS files with non-trunk default branches.
|
Line | |
---|
1 | /* |
---|
2 | * Copyright (c) 1998 Sendmail, Inc. All rights reserved. |
---|
3 | * Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved. |
---|
4 | * Copyright (c) 1988, 1993 |
---|
5 | * The Regents of the University of California. All rights reserved. |
---|
6 | * |
---|
7 | * By using this file, you agree to the terms and conditions set |
---|
8 | * forth in the LICENSE file which can be found at the top level of |
---|
9 | * the sendmail distribution. |
---|
10 | * |
---|
11 | */ |
---|
12 | |
---|
13 | #ifndef lint |
---|
14 | static char sccsid[] = "@(#)trace.c 8.12 (Berkeley) 5/19/1998"; |
---|
15 | #endif /* not lint */ |
---|
16 | |
---|
17 | # include "sendmail.h" |
---|
18 | |
---|
19 | /* |
---|
20 | ** TtSETUP -- set up for trace package. |
---|
21 | ** |
---|
22 | ** Parameters: |
---|
23 | ** vect -- pointer to trace vector. |
---|
24 | ** size -- number of flags in trace vector. |
---|
25 | ** defflags -- flags to set if no value given. |
---|
26 | ** |
---|
27 | ** Returns: |
---|
28 | ** none |
---|
29 | ** |
---|
30 | ** Side Effects: |
---|
31 | ** environment is set up. |
---|
32 | */ |
---|
33 | |
---|
34 | u_char *tTvect; |
---|
35 | int tTsize; |
---|
36 | static char *DefFlags; |
---|
37 | |
---|
38 | void |
---|
39 | tTsetup(vect, size, defflags) |
---|
40 | u_char *vect; |
---|
41 | int size; |
---|
42 | char *defflags; |
---|
43 | { |
---|
44 | tTvect = vect; |
---|
45 | tTsize = size; |
---|
46 | DefFlags = defflags; |
---|
47 | } |
---|
48 | /* |
---|
49 | ** TtFLAG -- process an external trace flag description. |
---|
50 | ** |
---|
51 | ** Parameters: |
---|
52 | ** s -- the trace flag. |
---|
53 | ** |
---|
54 | ** Returns: |
---|
55 | ** none. |
---|
56 | ** |
---|
57 | ** Side Effects: |
---|
58 | ** sets/clears trace flags. |
---|
59 | */ |
---|
60 | |
---|
61 | void |
---|
62 | tTflag(s) |
---|
63 | register char *s; |
---|
64 | { |
---|
65 | unsigned int first, last; |
---|
66 | register unsigned int i; |
---|
67 | |
---|
68 | if (*s == '\0') |
---|
69 | s = DefFlags; |
---|
70 | |
---|
71 | for (;;) |
---|
72 | { |
---|
73 | /* find first flag to set */ |
---|
74 | i = 0; |
---|
75 | while (isascii(*s) && isdigit(*s)) |
---|
76 | i = i * 10 + (*s++ - '0'); |
---|
77 | first = i; |
---|
78 | |
---|
79 | /* find last flag to set */ |
---|
80 | if (*s == '-') |
---|
81 | { |
---|
82 | i = 0; |
---|
83 | while (isascii(*++s) && isdigit(*s)) |
---|
84 | i = i * 10 + (*s - '0'); |
---|
85 | } |
---|
86 | last = i; |
---|
87 | |
---|
88 | /* find the level to set it to */ |
---|
89 | i = 1; |
---|
90 | if (*s == '.') |
---|
91 | { |
---|
92 | i = 0; |
---|
93 | while (isascii(*++s) && isdigit(*s)) |
---|
94 | i = i * 10 + (*s - '0'); |
---|
95 | } |
---|
96 | |
---|
97 | /* clean up args */ |
---|
98 | if (first >= tTsize) |
---|
99 | first = tTsize - 1; |
---|
100 | if (last >= tTsize) |
---|
101 | last = tTsize - 1; |
---|
102 | |
---|
103 | /* set the flags */ |
---|
104 | while (first <= last) |
---|
105 | tTvect[first++] = i; |
---|
106 | |
---|
107 | /* more arguments? */ |
---|
108 | if (*s++ == '\0') |
---|
109 | return; |
---|
110 | } |
---|
111 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.