/* cron.h - header for vixie's cron
* $Header: cron.h,v 2.1 90/07/18 00:23:47 vixie Exp $
* $Source: /jove_u3/vixie/src/cron/RCS/cron.h,v $
* Revision 2.1 90/07/18 00:23:47 vixie
* Baseline for 4.4BSD release
* Revision 2.0 88/12/10 04:57:39 vixie
* Revision 1.2 88/11/29 13:05:46 vixie
* seems to work on Ultrix 3.0 FT1
* Revision 1.1 88/11/14 12:27:49 vixie
* Revision 1.4 87/05/02 17:33:08 paul
* baseline for mod.sources release
* vix 14jan87 [0 or 7 can be sunday; thanks, mwm@berkeley]
/* Copyright 1988,1990 by Paul Vixie
* Distribute freely, except: don't remove my name from the source or
* documentation (don't take credit for my work), mark your changes (don't
* get me blamed for your possible bugs), don't alter or remove this
* notice. May be sold if buildable source is provided to buyer. No
* warrantee of any kind, express or implied, is included with this
* software; use at your own risk, responsibility for damages (if any) to
* anyone resulting from the use of this software rests entirely with the
* Send bug reports, bug fixes, enhancements, requests, flames, etc., and
* I'll try to keep a version up to date. I can be reached as follows:
* Paul Vixie, 329 Noe Street, San Francisco, CA, 94114, (415) 864-7013,
* paul@vixie.sf.ca.us || {hoptoad,pacbell,decwrl,crash}!vixie!paul
/* these are really immutable, and are
* defined for symbolic convenience only
* TRUE, FALSE, and ERR must be distinct
/* system calls return this on success */
/* meaningless cookie for smart compilers that will pick their
* own register variables; this makes the code neater.
/* turn this on to get '-x' code */
#define READ_PIPE 0 /* which end of a pipe pair do you read? */
#define WRITE_PIPE 1 /* or write to? */
#define STDIN 0 /* what is stdin's file descriptor? */
#define STDOUT 1 /* stdout's? */
#define STDERR 2 /* stderr's? */
#define ERROR_EXIT 1 /* exit() with this will scare the shell */
#define OK_EXIT 0 /* exit() with this is considered 'normal' */
#define MAX_FNAME 100 /* max length of internally generated fn */
#define MAX_COMMAND 1000 /* max length of internally generated cmd */
#define MAX_ENVSTR 1000 /* max length of envvar=value\0 strings */
#define MAX_TEMPSTR 100 /* obvious */
#define MAX_UNAME 20 /* max length of username, should be overkill */
#define ROOT_UID 0 /* don't change this, it really must be root */
#define ROOT_USER "root" /* ditto */
/* NOTE: these correspond to DebugFlagNames,
#define DEXT 0x0001 /* extend flag for other debug masks */
#define DSCH 0x0002 /* scheduling debug mask */
#define DPROC 0x0004 /* process control debug mask */
#define DPARS 0x0008 /* parsing debug mask */
#define DLOAD 0x0010 /* database loading debug mask */
#define DMISC 0x0020 /* misc debug mask */
#define DTEST 0x0040 /* test mode: don't execute any commands */
/* the code does not depend on any of vfork's
* side-effects; it just uses it as a quick
#define CRON_TAB(u) "%s/%s", SPOOL_DIR, u
#define PPC_NULL ((char **)NULL)
#define MAXHOSTNAMELEN 64
#define Skip_Blanks(c, f) \
while (c == '\t' || c == ' ') \
#define Skip_Nonblanks(c, f) \
while (c!='\t' && c!=' ' && c!='\n' && c != EOF) \
#define Skip_Line(c, f) \
do {c = get_char(f);} while (c != '\n' && c != EOF);
# define Debug(mask, message) \
if ( (DebugFlags & (mask) ) == (mask) ) \
# define Debug(mask, message) \
#define MkLower(ch) (isupper(ch) ? tolower(ch) : ch)
#define MkUpper(ch) (islower(ch) ? toupper(ch) : ch)
#define Set_LineNum(ln) {Debug(DPARS|DEXT,("linenum=%d\n",ln)); \
#define MINUTE_COUNT (LAST_MINUTE - FIRST_MINUTE + 1)
#define HOUR_COUNT (LAST_HOUR - FIRST_HOUR + 1)
#define DOM_COUNT (LAST_DOM - FIRST_DOM + 1)
#define MONTH_COUNT (LAST_MONTH - FIRST_MONTH + 1)
/* note on DOW: 0 and 7 are both Sunday, for compatibility reasons. */
#define DOW_COUNT (LAST_DOW - FIRST_DOW + 1)
/* each user's crontab will be held as a list of
* the following structure.
* These are the cron commands.
bitstr_t
bit_decl(minute
, MINUTE_COUNT
);
bitstr_t
bit_decl(hour
, HOUR_COUNT
);
bitstr_t
bit_decl(dom
, DOM_COUNT
);
bitstr_t
bit_decl(month
, MONTH_COUNT
);
bitstr_t
bit_decl(dow
, DOW_COUNT
);
/* the crontab database will be a list of the
* following structure, one element per user.
* These are the crontabs.
struct _user
*next
, *prev
; /* links */
int uid
; /* uid from passwd file */
int gid
; /* gid from passwd file */
char **envp
; /* environ for commands */
time_t mtime
; /* last modtime of crontab */
entry
*crontab
; /* this person's crontab */
user
*head
, *tail
; /* links */
time_t mtime
; /* last modtime on spooldir */
/* in the C tradition, we only create
* variables for the main program, just
# if !defined(LINT) && !defined(lint)
static char *copyright
[] = {
"@(#) Copyright (C) 1988, 1989, 1990 by Paul Vixie",
"@(#) All rights reserved"
"Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec",
"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun",
char *DebugFlagNames
[] = { /* sync with #defines */
"ext", "sch", "proc", "pars", "load", "misc", "test",
NULL
}; /* NULL must be last element */
#else /* !MAIN_PROGRAM */
extern char *MonthNames
[];
extern char *ProgramName
;
extern time_t TargetTime
;
extern char *DebugFlagNames
[];
#endif /* MAIN_PROGRAM */