1/* 2 * Copyright (c) 1998-2000 Sendmail, Inc. and its suppliers. 3 * All rights reserved. 4 * Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved. 5 * Copyright (c) 1988, 1993 6 * The Regents of the University of California. All rights reserved. 7 * 8 * By using this file, you agree to the terms and conditions set 9 * forth in the LICENSE file which can be found at the top level of 10 * the sendmail distribution. 11 * 12 */ 13 14#ifndef lint
| 1/* 2 * Copyright (c) 1998-2000 Sendmail, Inc. and its suppliers. 3 * All rights reserved. 4 * Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved. 5 * Copyright (c) 1988, 1993 6 * The Regents of the University of California. All rights reserved. 7 * 8 * By using this file, you agree to the terms and conditions set 9 * forth in the LICENSE file which can be found at the top level of 10 * the sendmail distribution. 11 * 12 */ 13 14#ifndef lint
|
15static char id[] = "@(#)$Id: trace.c,v 8.20.22.2 2000/09/17 17:04:27 gshapiro Exp $";
| 15static char id[] = "@(#)$Id: trace.c,v 8.20.22.4 2001/08/15 13:05:43 ca Exp $";
|
16#endif /* ! lint */ 17 18#include <sendmail.h> 19 20/* 21** TtSETUP -- set up for trace package. 22** 23** Parameters: 24** vect -- pointer to trace vector. 25** size -- number of flags in trace vector. 26** defflags -- flags to set if no value given. 27** 28** Returns: 29** none 30** 31** Side Effects: 32** environment is set up. 33*/ 34 35static u_char *tTvect; 36static int tTsize; 37static char *DefFlags; 38 39void 40tTsetup(vect, size, defflags) 41 u_char *vect; 42 int size; 43 char *defflags; 44{ 45 tTvect = vect; 46 tTsize = size; 47 DefFlags = defflags; 48} 49/* 50** TtFLAG -- process an external trace flag description. 51** 52** Parameters: 53** s -- the trace flag. 54** 55** Returns: 56** none. 57** 58** Side Effects: 59** sets/clears trace flags. 60*/ 61 62void 63tTflag(s) 64 register char *s; 65{
| 16#endif /* ! lint */ 17 18#include <sendmail.h> 19 20/* 21** TtSETUP -- set up for trace package. 22** 23** Parameters: 24** vect -- pointer to trace vector. 25** size -- number of flags in trace vector. 26** defflags -- flags to set if no value given. 27** 28** Returns: 29** none 30** 31** Side Effects: 32** environment is set up. 33*/ 34 35static u_char *tTvect; 36static int tTsize; 37static char *DefFlags; 38 39void 40tTsetup(vect, size, defflags) 41 u_char *vect; 42 int size; 43 char *defflags; 44{ 45 tTvect = vect; 46 tTsize = size; 47 DefFlags = defflags; 48} 49/* 50** TtFLAG -- process an external trace flag description. 51** 52** Parameters: 53** s -- the trace flag. 54** 55** Returns: 56** none. 57** 58** Side Effects: 59** sets/clears trace flags. 60*/ 61 62void 63tTflag(s) 64 register char *s; 65{
|
66 int first, last;
| 66 unsigned int first, last;
|
67 register unsigned int i; 68 69 if (*s == '\0') 70 s = DefFlags; 71 72 for (;;) 73 { 74 /* find first flag to set */ 75 i = 0;
| 67 register unsigned int i; 68 69 if (*s == '\0') 70 s = DefFlags; 71 72 for (;;) 73 { 74 /* find first flag to set */ 75 i = 0;
|
76 while (isascii(*s) && isdigit(*s))
| 76 while (isascii(*s) && isdigit(*s) && i < tTsize)
|
77 i = i * 10 + (*s++ - '0');
| 77 i = i * 10 + (*s++ - '0');
|
| 78 79 /* 80 ** skip over rest of a too large number 81 ** Maybe we should complain if out-of-bounds values are used. 82 */ 83 84 while (isascii(*s) && isdigit(*s) && i >= tTsize) 85 s++;
|
78 first = i; 79 80 /* find last flag to set */ 81 if (*s == '-') 82 { 83 i = 0;
| 86 first = i; 87 88 /* find last flag to set */ 89 if (*s == '-') 90 { 91 i = 0;
|
84 while (isascii(*++s) && isdigit(*s))
| 92 while (isascii(*++s) && isdigit(*s) && i < tTsize)
|
85 i = i * 10 + (*s - '0');
| 93 i = i * 10 + (*s - '0');
|
| 94 95 /* skip over rest of a too large number */ 96 while (isascii(*s) && isdigit(*s) && i >= tTsize) 97 s++;
|
86 } 87 last = i; 88 89 /* find the level to set it to */ 90 i = 1; 91 if (*s == '.') 92 { 93 i = 0; 94 while (isascii(*++s) && isdigit(*s)) 95 i = i * 10 + (*s - '0'); 96 } 97 98 /* clean up args */ 99 if (first >= tTsize) 100 first = tTsize - 1; 101 if (last >= tTsize) 102 last = tTsize - 1; 103 104 /* set the flags */ 105 while (first <= last) 106 tTvect[first++] = i; 107 108 /* more arguments? */ 109 if (*s++ == '\0') 110 return; 111 } 112}
| 98 } 99 last = i; 100 101 /* find the level to set it to */ 102 i = 1; 103 if (*s == '.') 104 { 105 i = 0; 106 while (isascii(*++s) && isdigit(*s)) 107 i = i * 10 + (*s - '0'); 108 } 109 110 /* clean up args */ 111 if (first >= tTsize) 112 first = tTsize - 1; 113 if (last >= tTsize) 114 last = tTsize - 1; 115 116 /* set the flags */ 117 while (first <= last) 118 tTvect[first++] = i; 119 120 /* more arguments? */ 121 if (*s++ == '\0') 122 return; 123 } 124}
|