From: tedu Date: Fri, 23 Oct 2015 18:42:55 +0000 (+0000) Subject: remove some more ifdef maziness X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=00a9809306353c726db9c66b900edc61b03feacd;p=openbsd remove some more ifdef maziness --- diff --git a/usr.sbin/cron/atrun.c b/usr.sbin/cron/atrun.c index ebe89664524..d558e71de5b 100644 --- a/usr.sbin/cron/atrun.c +++ b/usr.sbin/cron/atrun.c @@ -1,4 +1,4 @@ -/* $OpenBSD: atrun.c,v 1.31 2015/10/03 19:47:21 tedu Exp $ */ +/* $OpenBSD: atrun.c,v 1.32 2015/10/23 18:42:55 tedu Exp $ */ /* * Copyright (c) 2002-2003 Todd C. Miller @@ -177,10 +177,8 @@ atrun(at_db *db, double batch_maxload, time_t now) /* Run a single batch job if there is one pending. */ if (batch != NULL -#ifdef HAVE_GETLOADAVG && (batch_maxload == 0.0 || ((getloadavg(&la, 1) == 1) && la <= batch_maxload)) -#endif ) { snprintf(atfile, sizeof(atfile), "%s/%lld.%c", AT_DIR, (long long)batch->run_time, batch->queue); @@ -486,9 +484,6 @@ run_job(atjob *job, char *atfile) fprintf(mail, "To: %s\n", mailto); fprintf(mail, "Subject: Output from \"at\" job\n"); fprintf(mail, "Auto-Submitted: auto-generated\n"); -#ifdef MAIL_DATE - fprintf(mail, "Date: %s\n", arpadate(&StartTime)); -#endif /*MAIL_DATE*/ fprintf(mail, "\nYour \"at\" job on %s\n\"%s/%s/%s\"\n", hostname, CRONDIR, AT_DIR, atfile); fprintf(mail, "\nproduced the following output:\n\n"); diff --git a/usr.sbin/cron/config.h b/usr.sbin/cron/config.h index f81f0bd825d..48b375a4d32 100644 --- a/usr.sbin/cron/config.h +++ b/usr.sbin/cron/config.h @@ -1,4 +1,4 @@ -/* $OpenBSD: config.h,v 1.22 2015/10/06 14:58:37 tedu Exp $ */ +/* $OpenBSD: config.h,v 1.23 2015/10/23 18:42:55 tedu Exp $ */ /* Copyright 1988,1990,1993,1994 by Paul Vixie * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC") @@ -39,20 +39,6 @@ */ #define MAILARG _PATH_SENDMAIL /*-*/ -/* #define MAILFMT "%s -d %s" -*/ - /* -d = undocumented but common flag: deliver locally? - */ -/* #define MAILARG "/bin/mail",mailto -*/ - -/* #define MAILFMT "%s -mlrxto %s" -*/ -/* #define MAILARG "/usr/mmdf/bin/submit",mailto -*/ - - /* if your OS has the paths.h header */ -#define HAVE_PATHS_H /*-*/ - - /* if your OS has a getloadavg() function */ -#define HAVE_GETLOADAVG /*-*/ - /* maximum load at which batch jobs will still run */ #define BATCH_MAXLOAD 1.5 /*-*/ diff --git a/usr.sbin/cron/do_command.c b/usr.sbin/cron/do_command.c index 912f97b5d4c..7dad70e8390 100644 --- a/usr.sbin/cron/do_command.c +++ b/usr.sbin/cron/do_command.c @@ -1,4 +1,4 @@ -/* $OpenBSD: do_command.c,v 1.48 2015/10/03 19:47:21 tedu Exp $ */ +/* $OpenBSD: do_command.c,v 1.49 2015/10/23 18:42:55 tedu Exp $ */ /* Copyright 1988,1990,1993,1994 by Paul Vixie * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC") @@ -362,10 +362,6 @@ child_process(entry *e, user *u) usernm, first_word(hostname, "."), e->cmd); fprintf(mail, "Auto-Submitted: auto-generated\n"); -#ifdef MAIL_DATE - fprintf(mail, "Date: %s\n", - arpadate(&StartTime)); -#endif /*MAIL_DATE*/ for (env = e->envp; *env; env++) fprintf(mail, "X-Cron-Env: <%s>\n", *env); diff --git a/usr.sbin/cron/misc.c b/usr.sbin/cron/misc.c index 269d7df18e0..41b79e179de 100644 --- a/usr.sbin/cron/misc.c +++ b/usr.sbin/cron/misc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: misc.c,v 1.56 2015/10/06 14:58:37 tedu Exp $ */ +/* $OpenBSD: misc.c,v 1.57 2015/10/23 18:42:55 tedu Exp $ */ /* Copyright 1988,1990,1993,1994 by Paul Vixie * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC") @@ -62,9 +62,7 @@ set_cron_cwd(void) struct stat sb; struct group *grp = NULL; -#ifdef CRON_GROUP grp = getgrnam(CRON_GROUP); -#endif /* first check for CRONDIR ("/var/cron" or some such) */ if (stat(CRONDIR, &sb) < 0 && errno == ENOENT) { @@ -480,41 +478,6 @@ mkprints(src, len) return (dst); } -#ifdef MAIL_DATE -/* Sat, 27 Feb 1993 11:44:51 -0800 (CST) - * 1234567890123456789012345678901234567 - */ -char * -arpadate(clock) - time_t *clock; -{ - time_t t = clock ? *clock : time(NULL); - struct tm *tm = localtime(&t); - static char ret[64]; /* zone name might be >3 chars */ - char *qmark; - size_t len; - long gmtoff = get_gmtoff(&t, tm); - int hours = gmtoff / 3600; - int minutes = (gmtoff - (hours * 3600)) / 60; - - if (minutes < 0) - minutes = -minutes; - - /* Defensive coding (almost) never hurts... */ - len = strftime(ret, sizeof(ret), "%a, %e %b %Y %T ????? (%Z)", tm); - if (len == 0) { - ret[0] = '?'; - ret[1] = '\0'; - return (ret); - } - qmark = strchr(ret, '?'); - if (qmark && len - (qmark - ret) >= 6) { - snprintf(qmark, 6, "% .2d%.2d", hours, minutes); - qmark[5] = ' '; - } - return (ret); -} -#endif /*MAIL_DATE*/ static gid_t save_egid; int swap_gids() { save_egid = getegid(); return (setegid(getgid())); } @@ -567,9 +530,7 @@ open_socket(void) } unlink(s_un.sun_path); s_un.sun_family = AF_UNIX; -#ifdef SUN_LEN s_un.sun_len = SUN_LEN(&s_un); -#endif omask = umask(007); if (bind(sock, (struct sockaddr *)&s_un, sizeof(s_un))) { @@ -607,9 +568,7 @@ poke_daemon(const char *spool_dir, unsigned char cookie) return; } s_un.sun_family = AF_UNIX; -#ifdef SUN_LEN s_un.sun_len = SUN_LEN(&s_un); -#endif (void) signal(SIGPIPE, SIG_IGN); if ((sock = socket(AF_UNIX, SOCK_STREAM, 0)) >= 0 && connect(sock, (struct sockaddr *)&s_un, sizeof(s_un)) == 0) diff --git a/usr.sbin/cron/pathnames.h b/usr.sbin/cron/pathnames.h index fc41d2f901d..314fdffde26 100644 --- a/usr.sbin/cron/pathnames.h +++ b/usr.sbin/cron/pathnames.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pathnames.h,v 1.15 2015/10/06 14:58:37 tedu Exp $ */ +/* $OpenBSD: pathnames.h,v 1.16 2015/10/23 18:42:55 tedu Exp $ */ /* Copyright 1993,1994 by Paul Vixie * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC") @@ -20,9 +20,7 @@ #ifndef _PATHNAMES_H_ #define _PATHNAMES_H_ -#ifdef HAVE_PATHS_H # include -#endif /*HAVE_PATHS_H*/ #ifndef CRONDIR /* CRONDIR is where cron(8) and crontab(1) both chdir