home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / mail / sendmail / sendmail-5.65c+IDA-1.4.4.1 / src / trace.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-04-04  |  2.6 KB  |  121 lines

  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 provided
  7.  * that: (1) source distributions retain this entire copyright notice and
  8.  * comment, and (2) distributions including binaries display the following
  9.  * acknowledgement:  ``This product includes software developed by the
  10.  * University of California, Berkeley and its contributors'' in the
  11.  * documentation or other materials provided with the distribution and in
  12.  * all advertising materials mentioning features or use of this software.
  13.  * Neither the name of the University nor the names of its contributors may
  14.  * be used to endorse or promote products derived from this software without
  15.  * specific prior written permission.
  16.  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
  17.  * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
  18.  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  19.  */
  20.  
  21. #ifndef lint
  22. static char sccsid[] = "@(#)trace.c    5.6 (Berkeley) 6/1/90";
  23. static char  rcsid[] = "@(#)$Id: trace.c,v 5.6.0.3 1991/04/05 14:55:15 paul Exp $";
  24. #endif /* not lint */
  25.  
  26. # include "sendmail.h"
  27.  
  28. /*
  29. **  TtSETUP -- set up for trace package.
  30. **
  31. **    Parameters:
  32. **        vect -- pointer to trace vector.
  33. **        size -- number of flags in trace vector.
  34. **        defflags -- flags to set if no value given.
  35. **
  36. **    Returns:
  37. **        none
  38. **
  39. **    Side Effects:
  40. **        environment is set up.
  41. */
  42.  
  43. u_char        *tTvect;
  44. int        tTsize;
  45. static const char *DefFlags;
  46.  
  47. void
  48. tTsetup(vect, size, defflags)
  49.     u_char *vect;
  50.     int size;
  51.     const char *defflags;
  52. {
  53.     tTvect = vect;
  54.     tTsize = size;
  55.     DefFlags = defflags;
  56. }
  57. /*
  58. **  TtFLAG -- process an external trace flag description.
  59. **
  60. **    Parameters:
  61. **        s -- the trace flag.
  62. **
  63. **    Returns:
  64. **        none.
  65. **
  66. **    Side Effects:
  67. **        sets/clears trace flags.
  68. */
  69.  
  70. void
  71. tTflag(s)
  72.     register const char *s;
  73. {
  74.     unsigned int first, last;
  75.     register unsigned int i;
  76.  
  77.     if (*s == '\0')
  78.         s = DefFlags;
  79.  
  80.     for (;;)
  81.     {
  82.         /* find first flag to set */
  83.         i = 0;
  84.         while (isdigit(*s))
  85.             i = i * 10 + (*s++ - '0');
  86.         first = i;
  87.  
  88.         /* find last flag to set */
  89.         if (*s == '-')
  90.         {
  91.             i = 0;
  92.             while (isdigit(*++s))
  93.                 i = i * 10 + (*s - '0');
  94.         }
  95.         last = i;
  96.  
  97.         /* find the level to set it to */
  98.         i = 1;
  99.         if (*s == '.')
  100.         {
  101.             i = 0;
  102.             while (isdigit(*++s))
  103.                 i = i * 10 + (*s - '0');
  104.         }
  105.  
  106.         /* clean up args */
  107.         if (first >= tTsize)
  108.             first = tTsize - 1;
  109.         if (last >= tTsize)
  110.             last = tTsize - 1;
  111.  
  112.         /* set the flags */
  113.         while (first <= last)
  114.             tTvect[first++] = i;
  115.  
  116.         /* more arguments? */
  117.         if (*s++ == '\0')
  118.             return;
  119.     }
  120. }
  121.