xref: /netbsd/external/bsd/cron/dist/structs.h (revision bd4a2c22)
10061c6a5Schristos /*
20061c6a5Schristos  * Id: structs.h,v 1.7 2004/01/23 18:56:43 vixie Exp
30061c6a5Schristos  */
40061c6a5Schristos 
50061c6a5Schristos /*
60061c6a5Schristos  * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
70061c6a5Schristos  * Copyright (c) 1997,2000 by Internet Software Consortium, Inc.
80061c6a5Schristos  *
90061c6a5Schristos  * Permission to use, copy, modify, and distribute this software for any
100061c6a5Schristos  * purpose with or without fee is hereby granted, provided that the above
110061c6a5Schristos  * copyright notice and this permission notice appear in all copies.
120061c6a5Schristos  *
130061c6a5Schristos  * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
140061c6a5Schristos  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
150061c6a5Schristos  * MERCHANTABILITY AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR
160061c6a5Schristos  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
170061c6a5Schristos  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
180061c6a5Schristos  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
190061c6a5Schristos  * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
200061c6a5Schristos  */
210061c6a5Schristos 
220061c6a5Schristos typedef	struct _entry {
230061c6a5Schristos 	struct _entry	*next;
240061c6a5Schristos 	struct passwd	*pwd;
250061c6a5Schristos 	char		**envp;
260061c6a5Schristos 	char		*cmd;
270061c6a5Schristos 	bitstr_t	bit_decl(minute, MINUTE_COUNT);
280061c6a5Schristos 	bitstr_t	bit_decl(hour,   HOUR_COUNT);
290061c6a5Schristos 	bitstr_t	bit_decl(dom,    DOM_COUNT);
300061c6a5Schristos 	bitstr_t	bit_decl(month,  MONTH_COUNT);
310061c6a5Schristos 	bitstr_t	bit_decl(dow,    DOW_COUNT);
320061c6a5Schristos 	int		flags;
330061c6a5Schristos #define	MIN_STAR	0x01
340061c6a5Schristos #define	HR_STAR		0x02
350061c6a5Schristos #define	DOM_STAR	0x04
360061c6a5Schristos #define	DOW_STAR	0x08
370061c6a5Schristos #define	WHEN_REBOOT	0x10
380061c6a5Schristos #define	DONT_LOG	0x20
390418a325Schristos #define	MAIL_WHEN_ERR	0x40
40*bd4a2c22Schristos #define	SINGLE_JOB	0x80
410061c6a5Schristos } entry;
420061c6a5Schristos 
430061c6a5Schristos 			/* the crontab database will be a list of the
440061c6a5Schristos 			 * following structure, one element per user
450061c6a5Schristos 			 * plus one for the system.
460061c6a5Schristos 			 *
470061c6a5Schristos 			 * These are the crontabs.
480061c6a5Schristos 			 */
490061c6a5Schristos 
500061c6a5Schristos typedef	struct _user {
510061c6a5Schristos 	struct _user	*next, *prev;	/* links */
520061c6a5Schristos 	char		*name;
530061c6a5Schristos 	time_t		mtime;		/* last modtime of crontab */
540061c6a5Schristos 	entry		*crontab;	/* this person's crontab */
550061c6a5Schristos } user;
560061c6a5Schristos 
570061c6a5Schristos typedef	struct _cron_db {
580061c6a5Schristos 	user		*head, *tail;	/* links */
590061c6a5Schristos 	time_t		mtime;		/* last modtime on spooldir */
600061c6a5Schristos } cron_db;
610061c6a5Schristos 				/* in the C tradition, we only create
620061c6a5Schristos 				 * variables for the main program, just
630061c6a5Schristos 				 * extern them elsewhere.
640061c6a5Schristos 				 */
65