diff --git a/include/unistd.h b/include/unistd.h index 0ce0a7d..e8cc693 100644 --- a/include/unistd.h +++ b/include/unistd.h @@ -61,6 +61,7 @@ void _exit(int); int access(); unsigned int alarm(); pid_t fork(); +pid_t setsid(void); gid_t getegid(); uid_t geteuid(); gid_t getgid(); diff --git a/src/cmd/cron/Makefile b/src/cmd/cron/Makefile old mode 100755 new mode 100644 diff --git a/src/cmd/cron/README b/src/cmd/cron/README old mode 100755 new mode 100644 diff --git a/src/cmd/cron/README.2BSD b/src/cmd/cron/README.2BSD old mode 100755 new mode 100644 diff --git a/src/cmd/cron/bitstring.3 b/src/cmd/cron/bitstring.3 old mode 100755 new mode 100644 diff --git a/src/cmd/cron/bitstring.h b/src/cmd/cron/bitstring.h old mode 100755 new mode 100644 diff --git a/src/cmd/cron/compat.c b/src/cmd/cron/compat.c old mode 100755 new mode 100644 index 5b7886f..4e8f1b2 --- a/src/cmd/cron/compat.c +++ b/src/cmd/cron/compat.c @@ -15,15 +15,9 @@ * Paul Vixie uunet!decwrl!vixie!paul */ -#if !defined(lint) && !defined(LINT) -static char rcsid[] = "$Id: compat.c,v 1.6 1994/01/15 20:43:43 vixie Exp $"; -#endif - /* vix 30dec93 [broke this out of misc.c - see RCS log for history] * vix 15jan87 [added TIOCNOTTY, thanks csg@pyramid] */ - - #include "cron.h" #include @@ -40,19 +34,18 @@ setsid() int newpgrp; register int fd; - newpgrp = setpgrp(0, getpid()); - if ((fd = open(_PATH_TTY, 2)) >= 0) - { + newpgrp = setpgrp(); + + if ((fd = open(_PATH_TTY, 2)) >= 0) { (void) ioctl(fd, TIOCNOTTY, (char*)0); (void) close(fd); - } - if ((fd = open(_PATH_DEVNULL, O_RDWR, 0)) != -1) - { + } + if ((fd = open(_PATH_DEVNULL, O_RDWR, 0)) != -1) { (void)dup2(fd, 0); (void)dup2(fd, 1); (void)dup2(fd, 2); - if (fd > 2) + if (fd > 2) (void)close(fd); - } + } return newpgrp; } diff --git a/src/cmd/cron/compat.h b/src/cmd/cron/compat.h old mode 100755 new mode 100644 index 30d203c..0d34773 --- a/src/cmd/cron/compat.h +++ b/src/cmd/cron/compat.h @@ -15,13 +15,9 @@ * Paul Vixie uunet!decwrl!vixie!paul */ -/* - * $Id: compat.h,v 1.8 1994/01/15 20:43:43 vixie Exp $ - */ - #ifndef __P #define __P(x) () -#define const +//#define const #endif /*****************************************************************/ diff --git a/src/cmd/cron/config.h b/src/cmd/cron/config.h old mode 100755 new mode 100644 index 7a8e2fc..0ba315b --- a/src/cmd/cron/config.h +++ b/src/cmd/cron/config.h @@ -20,10 +20,6 @@ * $Id: config.h,v 2.6 1994/01/15 20:43:43 vixie Exp $ */ -#if !defined(_PATH_SENDMAIL) -# define _PATH_SENDMAIL "/usr/lib/sendmail" -#endif /*SENDMAIL*/ - /* * these are site-dependent */ @@ -49,15 +45,15 @@ * -or0s = Option Readtimeout -- don't time out */ -/* #define MAILCMD "/bin/mail" /*-*/ -/* #define MAILARGS "%s -d %s" /*-*/ +// #define MAILCMD "/bin/mail" /*-*/ +// #define MAILARGS "%s -d %s" /*-*/ /* -d = undocumented but common flag: deliver locally? */ -/* #define MAILCMD "/usr/mmdf/bin/submit" /*-*/ -/* #define MAILARGS "%s -mlrxto %s" /*-*/ +// #define MAILCMD "/usr/mmdf/bin/submit" /*-*/ +// #define MAILARGS "%s -mlrxto %s" /*-*/ -/* #define MAIL_DATE /*-*/ +// #define MAIL_DATE /*-*/ /* should we include an ersatz Date: header in * generated mail? if you are using sendmail * for MAILCMD, it is better to let sendmail @@ -68,7 +64,7 @@ * defined but neither exists, should crontab(1) be * usable only by root? */ -/*#define ALLOW_ONLY_ROOT /*-*/ +//#define ALLOW_ONLY_ROOT /*-*/ /* if you want to use syslog(3) instead of appending * to CRONDIR/LOG_FILE (/var/cron/log, e.g.), define diff --git a/src/cmd/cron/cron.8 b/src/cmd/cron/cron.8 old mode 100755 new mode 100644 diff --git a/src/cmd/cron/cron.c b/src/cmd/cron/cron.c old mode 100755 new mode 100644 index 2212886..08cf724 --- a/src/cmd/cron/cron.c +++ b/src/cmd/cron/cron.c @@ -14,11 +14,6 @@ * I'll try to keep a version up to date. I can be reached as follows: * Paul Vixie uunet!decwrl!vixie!paul */ - -#if !defined(lint) && defined(DOSCCS) -static char sccsid[] = "@(#)cron.c 2.11.1 (2.11BSD) 1999/08/05"; -#endif - #define MAIN_PROGRAM #include "cron.h" @@ -138,7 +133,7 @@ static void cron_tick(db) cron_db *db; { - register struct tm *tm = localtime(&TargetTime); + register struct tm *tm = localtime(&TargetTime); register int minute, hour, dom, month, dow; register user *u; register entry *e; @@ -191,7 +186,7 @@ cron_tick(db) */ static void cron_sync() { - register struct tm *tm; + register struct tm *tm; TargetTime = time((time_t*)0); tm = localtime(&TargetTime); diff --git a/src/cmd/cron/cron.h b/src/cmd/cron/cron.h old mode 100755 new mode 100644 index 612e69b..281935f --- a/src/cmd/cron/cron.h +++ b/src/cmd/cron/cron.h @@ -145,12 +145,12 @@ typedef struct _entry { struct _entry *next; - uid_t uid; + uid_t uid; gid_t gid; char **envp; char *cmd; bitstr_t bit_decl(minute, MINUTE_COUNT); - bitstr_t bit_decl(hour, HOUR_COUNT); + bitstr_t bit_decl(hour, HOUR_COUNT+1); bitstr_t bit_decl(dom, DOM_COUNT); bitstr_t bit_decl(month, MONTH_COUNT); bitstr_t bit_decl(dow, DOW_COUNT); @@ -273,3 +273,5 @@ extern int DebugFlags; extern char *DebugFlagNames[]; # endif /* DEBUGGING */ #endif /*MAIN_PROGRAM*/ + +int swap_uids_back(void); diff --git a/src/cmd/cron/crontab.1 b/src/cmd/cron/crontab.1 old mode 100755 new mode 100644 diff --git a/src/cmd/cron/crontab.5 b/src/cmd/cron/crontab.5 old mode 100755 new mode 100644 diff --git a/src/cmd/cron/crontab.c b/src/cmd/cron/crontab.c old mode 100755 new mode 100644 index 2e4d4a1..6a07538 --- a/src/cmd/cron/crontab.c +++ b/src/cmd/cron/crontab.c @@ -21,7 +21,6 @@ static char sccsid[] = "@(#) crontab.c 2.13.1 (2.11BSD) 1999/8/9"; * vix 02may87 [RCS has the rest of the log] * vix 26jan87 [original] */ - #define MAIN_PROGRAM #include "cron.h" @@ -96,6 +95,7 @@ main(argc, argv) } exitstatus = OK_EXIT; switch (Option) { + case opt_unknown: break; case opt_list: list_cmd(); break; case opt_delete: delete_cmd(); @@ -109,7 +109,7 @@ main(argc, argv) exit(0); /*NOTREACHED*/ } - + static void parse_args(argc, argv) @@ -459,7 +459,7 @@ edit_cmd() { done: log_it(RealUser, Pid, "END EDIT", User); } - + /* returns 0 on success * -1 on syntax error diff --git a/src/cmd/cron/database.c b/src/cmd/cron/database.c old mode 100755 new mode 100644 index d768948..592aada --- a/src/cmd/cron/database.c +++ b/src/cmd/cron/database.c @@ -15,14 +15,8 @@ * Paul Vixie uunet!decwrl!vixie!paul */ -#if !defined(lint) && !defined(LINT) -static char rcsid[] = "$Id: database.c,v 2.8 1994/01/15 20:43:43 vixie Exp $"; -#endif - /* vix 26jan87 [RCS has the log] */ - - #include "cron.h" #include #include diff --git a/src/cmd/cron/do_command.c b/src/cmd/cron/do_command.c old mode 100755 new mode 100644 index 1bb90ca..4231350 --- a/src/cmd/cron/do_command.c +++ b/src/cmd/cron/do_command.c @@ -14,13 +14,9 @@ * I'll try to keep a version up to date. I can be reached as follows: * Paul Vixie uunet!decwrl!vixie!paul */ - -#if !defined(lint) && !defined(LINT) -static char rcsid[] = "$Id: do_command.c,v 2.12 1994/01/15 20:43:43 vixie Exp $"; -#endif - #include "cron.h" #include +#include #if defined(SYSLOG) # include #endif @@ -77,7 +73,7 @@ child_process(e, u) /* mark ourselves as different to PS command watchers by upshifting * our program name. This has no effect on some kernels. */ - for (input_data = ProgramName; ch = *input_data; input_data++) + for (input_data = ProgramName; (ch = *input_data); input_data++) *input_data = (islower(ch) ? toupper(ch) : ch); /* discover some useful and important environment settings @@ -96,7 +92,7 @@ child_process(e, u) */ pipe(stdin_pipe); /* child's stdin */ pipe(stdout_pipe); /* child's stdout */ - + /* since we are a forked process, we can diddle the command string * we were passed -- nobody else is going to use it again, right? * @@ -106,7 +102,7 @@ child_process(e, u) * but that happens later. */ escaped = FALSE; - for (input_data = e->cmd; ch = *input_data; input_data++) { + for (input_data = e->cmd; (ch = *input_data); input_data++) { if (escaped) { escaped = FALSE; continue; @@ -251,7 +247,7 @@ child_process(e, u) * % -> \n * \x -> \x for all x != % */ - while (ch = *input_data++) { + while ((ch = *input_data++)) { if (escaped) { if (ch != '%') putc('\\', out); @@ -324,7 +320,7 @@ child_process(e, u) */ mailto = usernm; } - + /* if we are supposed to be mailing, MAILTO will * be non-NULL. only in this case should we set * up the mail command and subjects and stuff... diff --git a/src/cmd/cron/entry.c b/src/cmd/cron/entry.c old mode 100755 new mode 100644 index af8289e..a8a52d6 --- a/src/cmd/cron/entry.c +++ b/src/cmd/cron/entry.c @@ -15,10 +15,6 @@ * Paul Vixie uunet!decwrl!vixie!paul */ -#if !defined(lint) && defined(DOSCCS) -static char sccsid[] = "@(#)entry.c 2.12.2 (2.11BSD) 1999/08/05"; -#endif - /* vix 26jan87 [RCS'd; rest of log is in RCS file] * vix 01jan87 [added line-level error recovery] * vix 31dec86 [added /step to the from-to range, per bob@acornrc] @@ -26,6 +22,7 @@ static char sccsid[] = "@(#)entry.c 2.12.2 (2.11BSD) 1999/08/05"; */ #include "cron.h" +#include typedef enum ecode { e_none, e_minute, e_hour, e_dom, e_month, e_dow, @@ -269,7 +266,7 @@ load_entry(file, error_func, pw, envp) * too bad we don't know in advance how long it will be, since we * need to malloc a string for it... so, we limit it to MAX_COMMAND. * XXX - should use realloc(). - */ + */ ch = get_string(cmd, MAX_COMMAND, file, "\n"); /* a file without a \n before the EOF is rude, so we'll complain... @@ -319,7 +316,7 @@ get_list(bits, low, high, names, ch, file) /* list = range {"," range} */ - + /* clear the bit string, since the default is 'off'. DONT add an * extra bit here, that's done in the macro! */ diff --git a/src/cmd/cron/env.c b/src/cmd/cron/env.c old mode 100755 new mode 100644 index 3b1620d..45b28d2 --- a/src/cmd/cron/env.c +++ b/src/cmd/cron/env.c @@ -14,15 +14,8 @@ * I'll try to keep a version up to date. I can be reached as follows: * Paul Vixie uunet!decwrl!vixie!paul */ - -#if !defined(lint) && !defined(LINT) -static char rcsid[] = "$Id: env.c,v 2.7 1994/01/26 02:25:50 vixie Exp vixie $"; -#endif - - #include "cron.h" - char ** env_init() { @@ -168,7 +161,7 @@ env_get(name, envp) register int len = strlen(name); register char *p, *q; - while (p = *envp++) { + while ((p = *envp++)) { if (!(q = strchr(p, '='))) continue; if ((q - p) == len && !strncmp(p, name, len)) diff --git a/src/cmd/cron/externs.h b/src/cmd/cron/externs.h old mode 100755 new mode 100644 index 08b6241..7c5194c --- a/src/cmd/cron/externs.h +++ b/src/cmd/cron/externs.h @@ -14,15 +14,9 @@ * I'll try to keep a version up to date. I can be reached as follows: * Paul Vixie uunet!decwrl!vixie!paul */ - #include #include #include #include #define DIR_T struct direct -//#define WEXITSTATUS(x) ((x).w_retcode) -//#define WTERMSIG(x) ((x).w_termsig) -//#define WCOREDUMP(x) ((x).w_coredump) - -extern int setsid __P((void)); diff --git a/src/cmd/cron/grot/CHANGES b/src/cmd/cron/grot/CHANGES old mode 100755 new mode 100644 diff --git a/src/cmd/cron/grot/CONVERSION b/src/cmd/cron/grot/CONVERSION old mode 100755 new mode 100644 diff --git a/src/cmd/cron/grot/FEATURES b/src/cmd/cron/grot/FEATURES old mode 100755 new mode 100644 diff --git a/src/cmd/cron/grot/INSTALL b/src/cmd/cron/grot/INSTALL old mode 100755 new mode 100644 diff --git a/src/cmd/cron/grot/MAIL b/src/cmd/cron/grot/MAIL old mode 100755 new mode 100644 diff --git a/src/cmd/cron/grot/MANIFEST b/src/cmd/cron/grot/MANIFEST old mode 100755 new mode 100644 diff --git a/src/cmd/cron/grot/THANKS b/src/cmd/cron/grot/THANKS old mode 100755 new mode 100644 diff --git a/src/cmd/cron/grot/diffs b/src/cmd/cron/grot/diffs old mode 100755 new mode 100644 diff --git a/src/cmd/cron/job.c b/src/cmd/cron/job.c old mode 100755 new mode 100644 index adaa072..9f8ddae --- a/src/cmd/cron/job.c +++ b/src/cmd/cron/job.c @@ -14,15 +14,8 @@ * I'll try to keep a version up to date. I can be reached as follows: * Paul Vixie uunet!decwrl!vixie!paul */ - -#if !defined(lint) && !defined(LINT) -static char rcsid[] = "$Id: job.c,v 1.6 1994/01/15 20:43:43 vixie Exp $"; -#endif - - #include "cron.h" - typedef struct _job { struct _job *next; entry *e; diff --git a/src/cmd/cron/misc.c b/src/cmd/cron/misc.c old mode 100755 new mode 100644 index 07a8ead..1f65f20 --- a/src/cmd/cron/misc.c +++ b/src/cmd/cron/misc.c @@ -15,15 +15,9 @@ * Paul Vixie uunet!decwrl!vixie!paul */ -#if !defined(lint) && !defined(LINT) -static char rcsid[] = "$Id: misc.c,v 2.9 1994/01/15 20:43:43 vixie Exp $"; -#endif - /* vix 26jan87 [RCS has the rest of the log] * vix 30dec86 [written] */ - - #include "cron.h" #include #include @@ -622,7 +616,7 @@ arpadate(clock) time_t t = clock ?*clock :time(0L); struct tm *tm = localtime(&t); static char ret[30]; /* zone name might be >3 chars */ - + (void) sprintf(ret, "%s, %2d %s %2d %02d:%02d:%02d %s", DowNames[tm->tm_wday], tm->tm_mday, diff --git a/src/cmd/cron/pathnames.h b/src/cmd/cron/pathnames.h old mode 100755 new mode 100644 diff --git a/src/cmd/cron/popen.c b/src/cmd/cron/popen.c old mode 100755 new mode 100644 index 700d6c1..dbe845c --- a/src/cmd/cron/popen.c +++ b/src/cmd/cron/popen.c @@ -22,11 +22,6 @@ /* this came out of the ftpd sources; it's been modified to avoid the * globbing stuff since we don't need it. also execvp instead of execv. */ - -#if !defined(lint) && defined(DOSCCS) -static char sccsid[] = "@(#)popen.c 5.7.2 (2.11BSD) 1999/08/05"; -#endif - #include "cron.h" #include #include diff --git a/src/cmd/cron/putman.sh b/src/cmd/cron/putman.sh old mode 100755 new mode 100644 diff --git a/src/cmd/cron/user.c b/src/cmd/cron/user.c old mode 100755 new mode 100644 index 81b5bb9..61f3be3 --- a/src/cmd/cron/user.c +++ b/src/cmd/cron/user.c @@ -15,17 +15,10 @@ * Paul Vixie uunet!decwrl!vixie!paul */ -#if !defined(lint) && !defined(LINT) -static char rcsid[] = "$Id: user.c,v 2.8 1994/01/15 20:43:43 vixie Exp $"; -#endif - /* vix 26jan87 [log is in RCS file] */ - - #include "cron.h" - void free_user(u) user *u; @@ -67,7 +60,7 @@ load_user(crontab_fd, pw, name) u->name = strdup(name); u->crontab = NULL; - /* + /* * init environment. this will be copied/augmented for each entry. */ envp = env_init(); diff --git a/src/cmd/gtest/globread.c b/src/cmd/gtest/globread.c index ad07e98..9958a0a 100644 --- a/src/cmd/gtest/globread.c +++ b/src/cmd/gtest/globread.c @@ -1,4 +1,4 @@ - +#include #include #include diff --git a/src/cmd/gtest/globwrite.c b/src/cmd/gtest/globwrite.c index f5c96ca..133e4c0 100644 --- a/src/cmd/gtest/globwrite.c +++ b/src/cmd/gtest/globwrite.c @@ -1,4 +1,4 @@ - +#include #include #include diff --git a/src/cmd/msec/msec.c b/src/cmd/msec/msec.c index 9015b66..ddc25c9 100644 --- a/src/cmd/msec/msec.c +++ b/src/cmd/msec/msec.c @@ -1,7 +1,7 @@ #include #include -void main() +int main() { while(1) {