xref: /openbsd/usr.sbin/cron/macros.h (revision 264ca280)
1 /*	$OpenBSD: macros.h,v 1.15 2015/11/12 21:12:05 millert Exp $	*/
2 
3 /*
4  * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
5  * Copyright (c) 1997,2000 by Internet Software Consortium, Inc.
6  *
7  * Permission to use, copy, modify, and distribute this software for any
8  * purpose with or without fee is hereby granted, provided that the above
9  * copyright notice and this permission notice appear in all copies.
10  *
11  * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
12  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13  * MERCHANTABILITY AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR
14  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
17  * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18  */
19 
20 #define CRON_VERSION	"V5.0"
21 
22 #define TRUE		1
23 #define FALSE		0
24 
25 #define READ_PIPE	0	/* which end of a pipe pair do you read? */
26 #define WRITE_PIPE	1	/*   or write to? */
27 #define	MAX_COMMAND	1000	/* max length of internally generated cmd */
28 #define	MAX_ENVSTR	1000	/* max length of envvar=value\0 strings */
29 #define	MAX_TEMPSTR	100	/* obvious */
30 #define	MAX_UNAME	(_PW_NAME_LEN+1)	/* max length of username, should be overkill */
31 
32 #define	Skip_Blanks(c, f) \
33 			while (c == '\t' || c == ' ') \
34 				c = get_char(f);
35 
36 #define	Skip_Nonblanks(c, f) \
37 			while (c!='\t' && c!=' ' && c!='\n' && c != EOF) \
38 				c = get_char(f);
39 
40 #define	Set_LineNum(ln)	{ LineNumber = ln; }
41 
42 /* Data values used on cron socket */
43 #define	RELOAD_CRON	0x2
44 #define	RELOAD_AT	0x4
45 
46 #define	get_gmtoff(c, t)        ((t)->tm_gmtoff)
47 
48 #define	SECONDS_PER_MINUTE	60
49 
50 #define	FIRST_MINUTE	0
51 #define	LAST_MINUTE	59
52 #define	MINUTE_COUNT	(LAST_MINUTE - FIRST_MINUTE + 1)
53 
54 #define	FIRST_HOUR	0
55 #define	LAST_HOUR	23
56 #define	HOUR_COUNT	(LAST_HOUR - FIRST_HOUR + 1)
57 
58 #define	FIRST_DOM	1
59 #define	LAST_DOM	31
60 #define	DOM_COUNT	(LAST_DOM - FIRST_DOM + 1)
61 
62 #define	FIRST_MONTH	1
63 #define	LAST_MONTH	12
64 #define	MONTH_COUNT	(LAST_MONTH - FIRST_MONTH + 1)
65 
66 /* note on DOW: 0 and 7 are both Sunday, for compatibility reasons. */
67 #define	FIRST_DOW	0
68 #define	LAST_DOW	7
69 #define	DOW_COUNT	(LAST_DOW - FIRST_DOW + 1)
70