Change cron from including all headers in every file to only including
what each .c file needs. I have not removed cron.h since it will
be used in a future clean up of the cron's .h files. OK nicm@
···11-/* $OpenBSD: client.c,v 1.2 2015/11/03 04:16:36 guenther Exp $ */
11+/* $OpenBSD: client.c,v 1.3 2015/11/04 20:28:17 millert Exp $ */
2233/* Copyright 1988,1990,1993,1994 by Paul Vixie
44 * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
···1717 * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1818 */
19192020-#include "cron.h"
2020+#include <sys/types.h>
2121+#include <sys/socket.h>
2222+#include <sys/un.h>
2323+2424+#include <bitstring.h> /* for structs.h */
2525+#include <stdio.h>
2626+#include <stdlib.h>
2727+#include <string.h>
2828+#include <time.h> /* for structs.h */
2929+#include <unistd.h>
3030+#include <utime.h>
3131+3232+#include "pathnames.h"
3333+#include "macros.h"
3434+#include "structs.h"
3535+#include "funcs.h"
3636+#include "globals.h"
21372238/* int in_file(const char *string, FILE *file, int error)
2339 * return TRUE if one of the lines in file matches string exactly,
+20-2
usr.sbin/cron/common.c
···11-/* $OpenBSD: common.c,v 1.1 2015/10/31 12:19:41 millert Exp $ */
11+/* $OpenBSD: common.c,v 1.2 2015/11/04 20:28:17 millert Exp $ */
2233/* Copyright 1988,1990,1993,1994 by Paul Vixie
44 * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
···1717 * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1818 */
19192020-#include "cron.h"
2020+#include <sys/types.h>
2121+#include <sys/stat.h>
2222+2323+#include <bitstring.h> /* for structs.h */
2424+#include <errno.h>
2525+#include <grp.h>
2626+#include <limits.h>
2727+#include <stdio.h>
2828+#include <stdlib.h>
2929+#include <string.h>
3030+#include <time.h>
3131+#include <unistd.h>
3232+3333+#include "config.h"
3434+#include "pathnames.h"
3535+#include "macros.h"
3636+#include "structs.h"
3737+#include "funcs.h"
3838+#include "globals.h"
21392240void
2341set_cron_cwd(void)
···11-/* $OpenBSD: cron.h,v 1.11 2015/10/06 14:58:37 tedu Exp $ */
11+/* $OpenBSD: cron.h,v 1.12 2015/11/04 20:28:17 millert Exp $ */
2233/* Copyright 1988,1990,1993,1994 by Paul Vixie
44 * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
···1717 * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1818 */
19192020-#define CRON_VERSION "V5.0"
2120#include "config.h"
2222-#include "externs.h"
2321#include "pathnames.h"
2422#include "macros.h"
2523#include "structs.h"
+23-7
usr.sbin/cron/crontab.c
···11-/* $OpenBSD: crontab.c,v 1.81 2015/11/03 21:10:08 millert Exp $ */
11+/* $OpenBSD: crontab.c,v 1.82 2015/11/04 20:28:17 millert Exp $ */
2233/* Copyright 1988,1990,1993,1994 by Paul Vixie
44 * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
···1717 * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1818 */
19192020-#include <err.h>
2121-2220#define MAIN_PROGRAM
23212424-#include "cron.h"
2222+#include <sys/types.h>
2323+#include <sys/stat.h>
2424+#include <sys/wait.h>
2525+2626+#include <bitstring.h> /* for structs.h */
2727+#include <err.h>
2828+#include <errno.h>
2929+#include <locale.h>
3030+#include <pwd.h>
3131+#include <signal.h>
3232+#include <stdio.h>
3333+#include <stdlib.h>
3434+#include <string.h>
3535+#include <time.h>
3636+#include <unistd.h>
3737+3838+#include "pathnames.h"
3939+#include "macros.h"
4040+#include "structs.h"
4141+#include "funcs.h"
4242+#include "globals.h"
25432644#define NHEADER_LINES 3
27452846enum opt_t { opt_unknown, opt_list, opt_delete, opt_edit, opt_replace };
2929-3030-static char *getoptargs = "u:ler";
31473248static pid_t Pid;
3349static gid_t crontab_gid;
···133149 strlcpy(RealUser, User, sizeof(RealUser));
134150 Filename[0] = '\0';
135151 Option = opt_unknown;
136136- while (-1 != (argch = getopt(argc, argv, getoptargs))) {
152152+ while ((argch = getopt(argc, argv, "u:ler")) != -1) {
137153 switch (argch) {
138154 case 'u':
139155 if (getuid() != 0) {
+19-2
usr.sbin/cron/database.c
···11-/* $OpenBSD: database.c,v 1.27 2015/10/26 14:27:41 millert Exp $ */
11+/* $OpenBSD: database.c,v 1.28 2015/11/04 20:28:17 millert Exp $ */
2233/* Copyright 1988,1990,1993,1994 by Paul Vixie
44 * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
···1717 * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1818 */
19192020-#include "cron.h"
2020+#include <sys/types.h>
2121+#include <sys/stat.h>
2222+2323+#include <bitstring.h> /* for structs.h */
2424+#include <dirent.h>
2525+#include <fcntl.h>
2626+#include <limits.h>
2727+#include <pwd.h>
2828+#include <stdio.h>
2929+#include <stdlib.h>
3030+#include <string.h>
3131+#include <time.h> /* for structs.h */
3232+#include <unistd.h>
3333+3434+#include "pathnames.h"
3535+#include "macros.h"
3636+#include "structs.h"
3737+#include "funcs.h"
21382239#define HASH(a,b) ((a)+(b))
2340
+24-2
usr.sbin/cron/do_command.c
···11-/* $OpenBSD: do_command.c,v 1.51 2015/10/29 22:41:27 millert Exp $ */
11+/* $OpenBSD: do_command.c,v 1.52 2015/11/04 20:28:17 millert Exp $ */
2233/* Copyright 1988,1990,1993,1994 by Paul Vixie
44 * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
···1717 * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1818 */
19192020-#include "cron.h"
2020+#include <sys/types.h>
2121+#include <sys/wait.h>
2222+2323+#include <bitstring.h> /* for structs.h */
2424+#include <bsd_auth.h>
2525+#include <ctype.h>
2626+#include <errno.h>
2727+#include <fcntl.h>
2828+#include <limits.h>
2929+#include <login_cap.h>
3030+#include <pwd.h>
3131+#include <signal.h>
3232+#include <stdio.h>
3333+#include <stdlib.h>
3434+#include <string.h>
3535+#include <time.h> /* for structs.h */
3636+#include <unistd.h>
2137#include <vis.h>
3838+3939+#include "config.h"
4040+#include "pathnames.h"
4141+#include "macros.h"
4242+#include "structs.h"
4343+#include "funcs.h"
22442345static void child_process(entry *, user *);
2446
+16-2
usr.sbin/cron/entry.c
···11-/* $OpenBSD: entry.c,v 1.44 2015/11/04 12:53:05 millert Exp $ */
11+/* $OpenBSD: entry.c,v 1.45 2015/11/04 20:28:17 millert Exp $ */
2233/*
44 * Copyright 1988,1990,1993,1994 by Paul Vixie
···1818 * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1919 */
20202121-#include "cron.h"
2121+#include <sys/types.h>
2222+2323+#include <bitstring.h> /* for structs.h */
2424+#include <ctype.h>
2525+#include <pwd.h>
2626+#include <stdio.h>
2727+#include <stdlib.h>
2828+#include <string.h>
2929+#include <time.h> /* for structs.h */
3030+#include <unistd.h>
3131+3232+#include "pathnames.h"
3333+#include "macros.h"
3434+#include "structs.h"
3535+#include "funcs.h"
22362337typedef enum ecode {
2438 e_none, e_minute, e_hour, e_dom, e_month, e_dow,
+15-2
usr.sbin/cron/env.c
···11-/* $OpenBSD: env.c,v 1.31 2015/10/29 21:24:09 millert Exp $ */
11+/* $OpenBSD: env.c,v 1.32 2015/11/04 20:28:17 millert Exp $ */
2233/* Copyright 1988,1990,1993,1994 by Paul Vixie
44 * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
···1717 * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1818 */
19192020-#include "cron.h"
2020+#include <sys/types.h>
2121+2222+#include <bitstring.h> /* for structs.h */
2323+#include <ctype.h>
2424+#include <errno.h>
2525+#include <stdio.h>
2626+#include <stdlib.h>
2727+#include <string.h>
2828+#include <time.h> /* for structs.h */
2929+3030+#include "macros.h"
3131+#include "structs.h"
3232+#include "funcs.h"
3333+#include "globals.h"
21342235char **
2336env_init(void)
-50
usr.sbin/cron/externs.h
···11-/* $OpenBSD: externs.h,v 1.18 2015/11/04 12:53:05 millert Exp $ */
22-33-/* Copyright 1993,1994 by Paul Vixie
44- * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
55- * Copyright (c) 1997,2000 by Internet Software Consortium, Inc.
66- *
77- * Permission to use, copy, modify, and distribute this software for any
88- * purpose with or without fee is hereby granted, provided that the above
99- * copyright notice and this permission notice appear in all copies.
1010- *
1111- * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
1212- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
1313- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
1414- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
1515- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
1616- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
1717- * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1818- */
1919-2020-/* reorder these #include's at your peril */
2121-2222-#include <sys/types.h>
2323-#include <sys/time.h>
2424-#include <sys/wait.h>
2525-#include <sys/file.h>
2626-#include <sys/stat.h>
2727-#include <sys/socket.h>
2828-#include <sys/un.h>
2929-3030-#include <bitstring.h>
3131-#include <ctype.h>
3232-#include <dirent.h>
3333-#include <errno.h>
3434-#include <fcntl.h>
3535-#include <grp.h>
3636-#include <limits.h>
3737-#include <locale.h>
3838-#include <pwd.h>
3939-#include <signal.h>
4040-#include <stdarg.h>
4141-#include <stdio.h>
4242-#include <stdlib.h>
4343-#include <string.h>
4444-#include <time.h>
4545-#include <poll.h>
4646-#include <unistd.h>
4747-#include <utime.h>
4848-#include <syslog.h>
4949-#include <login_cap.h>
5050-#include <bsd_auth.h>
+11-2
usr.sbin/cron/job.c
···11-/* $OpenBSD: job.c,v 1.11 2015/02/09 22:35:08 deraadt Exp $ */
11+/* $OpenBSD: job.c,v 1.12 2015/11/04 20:28:17 millert Exp $ */
2233/* Copyright 1988,1990,1993,1994 by Paul Vixie
44 * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
···1717 * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1818 */
19192020-#include "cron.h"
2020+#include <sys/types.h>
2121+2222+#include <bitstring.h> /* for structs.h */
2323+#include <stdio.h>
2424+#include <stdlib.h>
2525+#include <time.h> /* for structs.h */
2626+2727+#include "macros.h"
2828+#include "structs.h"
2929+#include "funcs.h"
21302231typedef struct _job {
2332 struct _job *next;
+3-1
usr.sbin/cron/macros.h
···11-/* $OpenBSD: macros.h,v 1.13 2015/10/26 14:27:41 millert Exp $ */
11+/* $OpenBSD: macros.h,v 1.14 2015/11/04 20:28:17 millert Exp $ */
2233/*
44 * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
···1616 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
1717 * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1818 */
1919+2020+#define CRON_VERSION "V5.0"
19212022#define TRUE 1
2123#define FALSE 0
+15-4
usr.sbin/cron/misc.c
···11-/* $OpenBSD: misc.c,v 1.67 2015/11/04 14:47:02 millert Exp $ */
11+/* $OpenBSD: misc.c,v 1.68 2015/11/04 20:28:17 millert Exp $ */
2233/* Copyright 1988,1990,1993,1994 by Paul Vixie
44 * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
···1717 * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1818 */
19192020-#include "cron.h"
2020+#include <sys/types.h>
2121+#include <sys/wait.h>
2222+2323+#include <bitstring.h> /* for structs.h */
2424+#include <stdio.h>
2525+#include <stdlib.h>
2626+#include <string.h>
2727+#include <syslog.h>
2828+#include <time.h> /* for structs.h */
2929+3030+#include "macros.h"
3131+#include "structs.h"
3232+#include "funcs.h"
3333+#include "globals.h"
21342235static int syslog_open = FALSE;
2336···122135 break;
123136 syslog(*info ? LOG_INFO : LOG_WARNING, "(%s) %s (%s)", username, event,
124137 detail);
125125-126126-127138}
128139129140void
···11-/* $OpenBSD: structs.h,v 1.5 2004/06/17 22:11:55 millert Exp $ */
11+/* $OpenBSD: structs.h,v 1.6 2015/11/04 20:28:17 millert Exp $ */
2233/*
44 * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
···1616 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
1717 * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1818 */
1919+2020+struct passwd;
19212022typedef struct _entry {
2123 struct _entry *next;
+14-2
usr.sbin/cron/user.c
···11-/* $OpenBSD: user.c,v 1.15 2015/10/06 14:58:37 tedu Exp $ */
11+/* $OpenBSD: user.c,v 1.16 2015/11/04 20:28:17 millert Exp $ */
2233/* Copyright 1988,1990,1993,1994 by Paul Vixie
44 * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
···1717 * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1818 */
19192020-#include "cron.h"
2020+#include <sys/types.h>
2121+2222+#include <bitstring.h> /* for structs.h */
2323+#include <ctype.h>
2424+#include <errno.h>
2525+#include <stdio.h>
2626+#include <stdlib.h>
2727+#include <string.h>
2828+#include <time.h> /* for structs.h */
2929+3030+#include "macros.h"
3131+#include "structs.h"
3232+#include "funcs.h"
21332234void
2335free_user(user *u)