root/src/macros.h

/* [previous][next][first][last][top][bottom][index][help]  */

INCLUDED FROM


   1 /*
   2  * $Id: macros.h,v 1.9 2004/01/23 18:56:43 vixie Exp $
   3  */
   4 
   5 /*
   6  * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
   7  * Copyright (c) 1997,2000 by Internet Software Consortium, Inc.
   8  *
   9  * Permission to use, copy, modify, and distribute this software for any
  10  * purpose with or without fee is hereby granted, provided that the above
  11  * copyright notice and this permission notice appear in all copies.
  12  *
  13  * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
  14  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  15  * MERCHANTABILITY AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR
  16  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  17  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  18  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
  19  * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  20  */
  21 
  22 #ifndef CRONIE_MACROS_H
  23 #define CRONIE_MACROS_H
  24 
  25 #ifdef HAVE_LIMITS_H
  26 #include <limits.h>
  27 #endif
  28 
  29         /* these are really immutable, and are
  30          *   defined for symbolic convenience only
  31          * TRUE, FALSE, and ERR must be distinct
  32          * ERR must be < OK.
  33          */
  34 #define TRUE            1
  35 #define FALSE           0
  36         /* system calls return this on success */
  37 #define OK              0
  38         /*   or this on error */
  39 #define ERR             (-1)
  40 
  41         /* turn this on to get '-x' code */
  42 #ifndef DEBUGGING
  43 #define DEBUGGING       FALSE
  44 #endif
  45 
  46 #define INIT_PID        1       /* parent of orphans */
  47 #define READ_PIPE       0       /* which end of a pipe pair do you read? */
  48 #define WRITE_PIPE      1       /*   or write to? */
  49 #define STDIN           0       /* what is stdin's file descriptor? */
  50 #define STDOUT          1       /*   stdout's? */
  51 #define STDERR          2       /*   stderr's? */
  52 #define ERROR_EXIT      1       /* exit() with this will scare the shell */
  53 #define OK_EXIT         0       /* exit() with this is considered 'normal' */
  54 #define MAX_FNAME       PATH_MAX/* max length of internally generated fn */
  55 #define MAX_COMMAND     131072  /* max length of internally generated cmd (max sh cmd line length) */
  56 #define MAX_ENVSTR      131072  /* max length of envvar=value\0 strings */
  57 #define MAX_TEMPSTR     131072  /* obvious */
  58 #define MAX_UNAME       256     /* max length of username  */
  59 #define ROOT_UID        0       /* don't change this, it really must be root */
  60 #define ROOT_USER       "root"  /* ditto */
  61 
  62                                 /* NOTE: these correspond to DebugFlagNames,
  63                                  *      defined below.
  64                                  */
  65 #define DEXT            0x0001  /* extend flag for other debug masks */
  66 #define DSCH            0x0002  /* scheduling debug mask */
  67 #define DPROC           0x0004  /* process control debug mask */
  68 #define DPARS           0x0008  /* parsing debug mask */
  69 #define DLOAD           0x0010  /* database loading debug mask */
  70 #define DMISC           0x0020  /* misc debug mask */
  71 #define DTEST           0x0040  /* test mode: don't execute any commands */
  72 
  73 #define PPC_NULL        ((const char **)NULL)
  74 
  75 #ifndef MAXHOSTNAMELEN
  76 #define MAXHOSTNAMELEN 64
  77 #endif
  78 
  79 #define Skip_Blanks(c, f) \
  80                         while (c == '\t' || c == ' ') \
  81                                 c = get_char(f);
  82 
  83 #define Skip_Nonblanks(c, f) \
  84                         while (c!='\t' && c!=' ' && c!='\n' && c != EOF) \
  85                                 c = get_char(f);
  86 
  87 #if DEBUGGING
  88 # define Debug(mask, message) \
  89                         if ((DebugFlags & (mask)) != 0) \
  90                                 printf message
  91 #else /* !DEBUGGING */
  92 # define Debug(mask, message) \
  93                         ()
  94 #endif /* DEBUGGING */
  95 
  96 #define MkUpper(ch)     (islower(ch) ? toupper(ch) : ch)
  97 #define Set_LineNum(ln) {Debug(DPARS|DEXT,("linenum=%d\n",ln)); \
  98                          LineNumber = ln; \
  99                         }
 100 
 101 #ifdef HAVE_STRUCT_TM_TM_GMTOFF
 102 #define get_gmtoff(c, t)        ((t)->tm_gmtoff)
 103 #endif
 104 
 105 #define SECONDS_PER_MINUTE      60
 106 #define SECONDS_PER_HOUR        3600
 107 
 108 #define FIRST_MINUTE    0
 109 #define LAST_MINUTE     59
 110 #define MINUTE_COUNT    (LAST_MINUTE - FIRST_MINUTE + 1)
 111 
 112 #define FIRST_HOUR      0
 113 #define LAST_HOUR       23
 114 #define HOUR_COUNT      (LAST_HOUR - FIRST_HOUR + 1)
 115 
 116 #define FIRST_DOM       1
 117 #define LAST_DOM        31
 118 #define DOM_COUNT       (LAST_DOM - FIRST_DOM + 1)
 119 
 120 #define FIRST_MONTH     1
 121 #define LAST_MONTH      12
 122 #define MONTH_COUNT     (LAST_MONTH - FIRST_MONTH + 1)
 123 
 124 /* note on DOW: 0 and 7 are both Sunday, for compatibility reasons. */
 125 #define FIRST_DOW       0
 126 #define LAST_DOW        7
 127 #define DOW_COUNT       (LAST_DOW - FIRST_DOW + 1)
 128 
 129 /*
 130  * Because crontab/at files may be owned by their respective users we
 131  * take extreme care in opening them.  If the OS lacks the O_NOFOLLOW
 132  * we will just have to live without it.  In order for this to be an
 133  * issue an attacker would have to subvert group CRON_GROUP.
 134  */
 135 #include <fcntl.h>
 136 #ifndef O_NOFOLLOW
 137 #define O_NOFOLLOW      0
 138 #endif
 139 
 140 #endif /* CRONIE_MACROS_H */

/* [previous][next][first][last][top][bottom][index][help]  */