xref: /netbsd-src/external/bsd/cron/dist/structs.h (revision b1c86f5f087524e68db12794ee9c3e3da1ab17a0)
1 /*	$NetBSD: structs.h,v 1.2 2010/05/06 18:53:17 christos Exp $	*/
2 
3 /*
4  * Id: structs.h,v 1.7 2004/01/23 18:56:43 vixie Exp
5  */
6 
7 /*
8  * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
9  * Copyright (c) 1997,2000 by Internet Software Consortium, Inc.
10  *
11  * Permission to use, copy, modify, and distribute this software for any
12  * purpose with or without fee is hereby granted, provided that the above
13  * copyright notice and this permission notice appear in all copies.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
16  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
17  * MERCHANTABILITY AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR
18  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
19  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
20  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
21  * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
22  */
23 
24 typedef	struct _entry {
25 	struct _entry	*next;
26 	struct passwd	*pwd;
27 	char		**envp;
28 	char		*cmd;
29 	bitstr_t	bit_decl(minute, MINUTE_COUNT);
30 	bitstr_t	bit_decl(hour,   HOUR_COUNT);
31 	bitstr_t	bit_decl(dom,    DOM_COUNT);
32 	bitstr_t	bit_decl(month,  MONTH_COUNT);
33 	bitstr_t	bit_decl(dow,    DOW_COUNT);
34 	int		flags;
35 #define	MIN_STAR	0x01
36 #define	HR_STAR		0x02
37 #define	DOM_STAR	0x04
38 #define	DOW_STAR	0x08
39 #define	WHEN_REBOOT	0x10
40 #define	DONT_LOG	0x20
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