Update cron and gtest.
This commit is contained in:
@@ -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();
|
||||
|
||||
0
src/cmd/cron/Makefile
Executable file → Normal file
0
src/cmd/cron/Makefile
Executable file → Normal file
0
src/cmd/cron/README
Executable file → Normal file
0
src/cmd/cron/README
Executable file → Normal file
0
src/cmd/cron/README.2BSD
Executable file → Normal file
0
src/cmd/cron/README.2BSD
Executable file → Normal file
0
src/cmd/cron/bitstring.3
Executable file → Normal file
0
src/cmd/cron/bitstring.3
Executable file → Normal file
0
src/cmd/cron/bitstring.h
Executable file → Normal file
0
src/cmd/cron/bitstring.h
Executable file → Normal file
21
src/cmd/cron/compat.c
Executable file → Normal file
21
src/cmd/cron/compat.c
Executable file → Normal file
@@ -15,15 +15,9 @@
|
||||
* Paul Vixie <paul@vix.com> 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 <stdio.h>
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
6
src/cmd/cron/compat.h
Executable file → Normal file
6
src/cmd/cron/compat.h
Executable file → Normal file
@@ -15,13 +15,9 @@
|
||||
* Paul Vixie <paul@vix.com> 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
|
||||
|
||||
/*****************************************************************/
|
||||
|
||||
16
src/cmd/cron/config.h
Executable file → Normal file
16
src/cmd/cron/config.h
Executable file → Normal file
@@ -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
|
||||
|
||||
0
src/cmd/cron/cron.8
Executable file → Normal file
0
src/cmd/cron/cron.8
Executable file → Normal file
9
src/cmd/cron/cron.c
Executable file → Normal file
9
src/cmd/cron/cron.c
Executable file → Normal file
@@ -14,11 +14,6 @@
|
||||
* I'll try to keep a version up to date. I can be reached as follows:
|
||||
* Paul Vixie <paul@vix.com> 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);
|
||||
|
||||
6
src/cmd/cron/cron.h
Executable file → Normal file
6
src/cmd/cron/cron.h
Executable file → Normal file
@@ -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);
|
||||
|
||||
0
src/cmd/cron/crontab.1
Executable file → Normal file
0
src/cmd/cron/crontab.1
Executable file → Normal file
0
src/cmd/cron/crontab.5
Executable file → Normal file
0
src/cmd/cron/crontab.5
Executable file → Normal file
6
src/cmd/cron/crontab.c
Executable file → Normal file
6
src/cmd/cron/crontab.c
Executable file → Normal file
@@ -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
|
||||
|
||||
6
src/cmd/cron/database.c
Executable file → Normal file
6
src/cmd/cron/database.c
Executable file → Normal file
@@ -15,14 +15,8 @@
|
||||
* Paul Vixie <paul@vix.com> 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 <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
16
src/cmd/cron/do_command.c
Executable file → Normal file
16
src/cmd/cron/do_command.c
Executable file → Normal file
@@ -14,13 +14,9 @@
|
||||
* I'll try to keep a version up to date. I can be reached as follows:
|
||||
* Paul Vixie <paul@vix.com> 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 <sys/signal.h>
|
||||
#include <grp.h>
|
||||
#if defined(SYSLOG)
|
||||
# include <syslog.h>
|
||||
#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...
|
||||
|
||||
9
src/cmd/cron/entry.c
Executable file → Normal file
9
src/cmd/cron/entry.c
Executable file → Normal file
@@ -15,10 +15,6 @@
|
||||
* Paul Vixie <paul@vix.com> 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 <strings.h>
|
||||
|
||||
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!
|
||||
*/
|
||||
|
||||
9
src/cmd/cron/env.c
Executable file → Normal file
9
src/cmd/cron/env.c
Executable file → Normal file
@@ -14,15 +14,8 @@
|
||||
* I'll try to keep a version up to date. I can be reached as follows:
|
||||
* Paul Vixie <paul@vix.com> 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))
|
||||
|
||||
6
src/cmd/cron/externs.h
Executable file → Normal file
6
src/cmd/cron/externs.h
Executable file → Normal file
@@ -14,15 +14,9 @@
|
||||
* I'll try to keep a version up to date. I can be reached as follows:
|
||||
* Paul Vixie <paul@vix.com> uunet!decwrl!vixie!paul
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <sys/dir.h>
|
||||
|
||||
#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));
|
||||
|
||||
0
src/cmd/cron/grot/CHANGES
Executable file → Normal file
0
src/cmd/cron/grot/CHANGES
Executable file → Normal file
0
src/cmd/cron/grot/CONVERSION
Executable file → Normal file
0
src/cmd/cron/grot/CONVERSION
Executable file → Normal file
0
src/cmd/cron/grot/FEATURES
Executable file → Normal file
0
src/cmd/cron/grot/FEATURES
Executable file → Normal file
0
src/cmd/cron/grot/INSTALL
Executable file → Normal file
0
src/cmd/cron/grot/INSTALL
Executable file → Normal file
0
src/cmd/cron/grot/MAIL
Executable file → Normal file
0
src/cmd/cron/grot/MAIL
Executable file → Normal file
0
src/cmd/cron/grot/MANIFEST
Executable file → Normal file
0
src/cmd/cron/grot/MANIFEST
Executable file → Normal file
0
src/cmd/cron/grot/THANKS
Executable file → Normal file
0
src/cmd/cron/grot/THANKS
Executable file → Normal file
0
src/cmd/cron/grot/diffs
Executable file → Normal file
0
src/cmd/cron/grot/diffs
Executable file → Normal file
7
src/cmd/cron/job.c
Executable file → Normal file
7
src/cmd/cron/job.c
Executable file → Normal file
@@ -14,15 +14,8 @@
|
||||
* I'll try to keep a version up to date. I can be reached as follows:
|
||||
* Paul Vixie <paul@vix.com> 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;
|
||||
|
||||
8
src/cmd/cron/misc.c
Executable file → Normal file
8
src/cmd/cron/misc.c
Executable file → Normal file
@@ -15,15 +15,9 @@
|
||||
* Paul Vixie <paul@vix.com> 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 <sys/time.h>
|
||||
#include <sys/file.h>
|
||||
@@ -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,
|
||||
|
||||
0
src/cmd/cron/pathnames.h
Executable file → Normal file
0
src/cmd/cron/pathnames.h
Executable file → Normal file
5
src/cmd/cron/popen.c
Executable file → Normal file
5
src/cmd/cron/popen.c
Executable file → Normal file
@@ -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 <errno.h>
|
||||
#include <sys/signal.h>
|
||||
|
||||
0
src/cmd/cron/putman.sh
Executable file → Normal file
0
src/cmd/cron/putman.sh
Executable file → Normal file
9
src/cmd/cron/user.c
Executable file → Normal file
9
src/cmd/cron/user.c
Executable file → Normal file
@@ -15,17 +15,10 @@
|
||||
* Paul Vixie <paul@vix.com> 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();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/glob.h>
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/glob.h>
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include <stdio.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
void main()
|
||||
int main()
|
||||
{
|
||||
while(1)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user