xref: /netbsd/external/bsd/cron/dist/structs.h (revision bd4a2c22)
1 /*
2  * Id: structs.h,v 1.7 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 typedef	struct _entry {
23 	struct _entry	*next;
24 	struct passwd	*pwd;
25 	char		**envp;
26 	char		*cmd;
27 	bitstr_t	bit_decl(minute, MINUTE_COUNT);
28 	bitstr_t	bit_decl(hour,   HOUR_COUNT);
29 	bitstr_t	bit_decl(dom,    DOM_COUNT);
30 	bitstr_t	bit_decl(month,  MONTH_COUNT);
31 	bitstr_t	bit_decl(dow,    DOW_COUNT);
32 	int		flags;
33 #define	MIN_STAR	0x01
34 #define	HR_STAR		0x02
35 #define	DOM_STAR	0x04
36 #define	DOW_STAR	0x08
37 #define	WHEN_REBOOT	0x10
38 #define	DONT_LOG	0x20
39 #define	MAIL_WHEN_ERR	0x40
40 #define	SINGLE_JOB	0x80
41 } entry;
42 
43 			/* the crontab database will be a list of the
44 			 * following structure, one element per user
45 			 * plus one for the system.
46 			 *
47 			 * These are the crontabs.
48 			 */
49 
50 typedef	struct _user {
51 	struct _user	*next, *prev;	/* links */
52 	char		*name;
53 	time_t		mtime;		/* last modtime of crontab */
54 	entry		*crontab;	/* this person's crontab */
55 } user;
56 
57 typedef	struct _cron_db {
58 	user		*head, *tail;	/* links */
59 	time_t		mtime;		/* last modtime on spooldir */
60 } cron_db;
61 				/* in the C tradition, we only create
62 				 * variables for the main program, just
63 				 * extern them elsewhere.
64 				 */
65