1*22719Sdist /* 2*22719Sdist ** Sendmail 3*22719Sdist ** Copyright (c) 1983 Eric P. Allman 4*22719Sdist ** Berkeley, California 5*22719Sdist ** 6*22719Sdist ** Copyright (c) 1983 Regents of the University of California. 7*22719Sdist ** All rights reserved. The Berkeley software License Agreement 8*22719Sdist ** specifies the terms and conditions for redistribution. 9*22719Sdist */ 10*22719Sdist 11*22719Sdist #ifndef lint 12*22719Sdist static char SccsId[] = "@(#)trace.c 5.1 (Berkeley) 06/07/85"; 13*22719Sdist #endif not lint 14*22719Sdist 157668Seric # include <ctype.h> 167668Seric # include "sendmail.h" 177668Seric 18*22719Sdist SCCSID(@(#)trace.c 5.1 06/07/85); 197668Seric 207668Seric /* 217668Seric ** TtSETUP -- set up for trace package. 227668Seric ** 237668Seric ** Parameters: 247668Seric ** vect -- pointer to trace vector. 257668Seric ** size -- number of flags in trace vector. 267668Seric ** defflags -- flags to set if no value given. 277668Seric ** 287668Seric ** Returns: 297668Seric ** none 307668Seric ** 317668Seric ** Side Effects: 327668Seric ** environment is set up. 337668Seric */ 347668Seric 357668Seric u_char *tTvect; 367668Seric int tTsize; 377668Seric static char *DefFlags; 387668Seric 397668Seric tTsetup(vect, size, defflags) 407668Seric u_char *vect; 417668Seric int size; 427668Seric char *defflags; 437668Seric { 447668Seric tTvect = vect; 457668Seric tTsize = size; 467668Seric DefFlags = defflags; 477668Seric } 487668Seric /* 497668Seric ** TtFLAG -- process an external trace flag description. 507668Seric ** 517668Seric ** Parameters: 527668Seric ** s -- the trace flag. 537668Seric ** 547668Seric ** Returns: 557668Seric ** none. 567668Seric ** 577668Seric ** Side Effects: 587668Seric ** sets/clears trace flags. 597668Seric */ 607668Seric 617668Seric tTflag(s) 627668Seric register char *s; 637668Seric { 647668Seric int first, last; 657668Seric register int i; 667668Seric 677668Seric if (*s == '\0') 687668Seric s = DefFlags; 697668Seric 707668Seric for (;;) 717668Seric { 727668Seric /* find first flag to set */ 737668Seric i = 0; 747668Seric while (isdigit(*s)) 757668Seric i = i * 10 + (*s++ - '0'); 767668Seric first = i; 777668Seric 787668Seric /* find last flag to set */ 797668Seric if (*s == '-') 807668Seric { 817668Seric i = 0; 827668Seric while (isdigit(*++s)) 837668Seric i = i * 10 + (*s - '0'); 847668Seric } 857668Seric last = i; 867668Seric 877668Seric /* find the level to set it to */ 887668Seric i = 1; 897668Seric if (*s == '.') 907668Seric { 917668Seric i = 0; 927668Seric while (isdigit(*++s)) 937668Seric i = i * 10 + (*s - '0'); 947668Seric } 957668Seric 967668Seric /* clean up args */ 977668Seric if (first >= tTsize) 987668Seric first = tTsize - 1; 997668Seric if (last >= tTsize) 1007668Seric last = tTsize - 1; 1017668Seric 1027668Seric /* set the flags */ 1037668Seric while (first <= last) 1047668Seric tTvect[first++] = i; 1057668Seric 1067668Seric /* more arguments? */ 1077668Seric if (*s++ == '\0') 1087668Seric return; 1097668Seric } 1107668Seric } 111