xref: /openbsd-src/usr.sbin/cron/structs.h (revision b2ea75c1b17e1a9a339660e7ed45cd24946b230e)
1 /*	$OpenBSD: structs.h,v 1.2 2001/02/19 14:33:33 millert Exp $	*/
2 
3 /*
4  * Copyright (c) 1997,2000 by Internet Software Consortium, Inc.
5  *
6  * Permission to use, copy, modify, and distribute this software for any
7  * purpose with or without fee is hereby granted, provided that the above
8  * copyright notice and this permission notice appear in all copies.
9  *
10  * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
11  * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
12  * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
13  * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
14  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
15  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
16  * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
17  * SOFTWARE.
18  */
19 
20 typedef	struct _entry {
21 	struct _entry	*next;
22 	uid_t		uid;
23 	gid_t		gid;
24 	char		**envp;
25 	char		*cmd;
26 	bitstr_t	bit_decl(minute, MINUTE_COUNT);
27 	bitstr_t	bit_decl(hour,   HOUR_COUNT);
28 	bitstr_t	bit_decl(dom,    DOM_COUNT);
29 	bitstr_t	bit_decl(month,  MONTH_COUNT);
30 	bitstr_t	bit_decl(dow,    DOW_COUNT);
31 	int		flags;
32 #define	MIN_STAR	0x01
33 #define	HR_STAR		0x02
34 #define	DOM_STAR	0x04
35 #define	DOW_STAR	0x08
36 #define	WHEN_REBOOT	0x10
37 #define	DONT_LOG	0x20
38 } entry;
39 
40 			/* the crontab database will be a list of the
41 			 * following structure, one element per user
42 			 * plus one for the system.
43 			 *
44 			 * These are the crontabs.
45 			 */
46 
47 typedef	struct _user {
48 	struct _user	*next, *prev;	/* links */
49 	char		*name;
50 	time_t		mtime;		/* last modtime of crontab */
51 	entry		*crontab;	/* this person's crontab */
52 } user;
53 
54 typedef	struct _cron_db {
55 	user		*head, *tail;	/* links */
56 	time_t		mtime;		/* last modtime on spooldir */
57 } cron_db;
58 				/* in the C tradition, we only create
59 				 * variables for the main program, just
60 				 * extern them elsewhere.
61 				 */
62 
63