Commit 53ebce11 authored by Ted Unangst's avatar Ted Unangst
Browse files

remove some more ifdef maziness

parent 8a024999
/* $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 <Todd.Miller@courtesan.com>
......@@ -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");
......
/* $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 /*-*/
......
/* $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);
......
/* $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)
......
/* $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 <paths.h>
#endif /*HAVE_PATHS_H*/
#ifndef CRONDIR
/* CRONDIR is where cron(8) and crontab(1) both chdir
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment