Make things static that are not used outside their respective .c
files. Also remove some unused defines.
- todd
Index: usr.sbin/cron/cron.c
===================================================================
RCS file: /cvs/src/usr.sbin/cron/cron.c,v
retrieving revision 1.60
diff -u -p -u -r1.60 cron.c
--- usr.sbin/cron/cron.c 31 Oct 2015 12:14:16 -0000 1.60
+++ usr.sbin/cron/cron.c 3 Nov 2015 22:52:06 -0000
@@ -42,6 +42,8 @@ static long GMToff;
static cron_db database;
static at_db at_database;
static double batch_maxload = BATCH_MAXLOAD;
+static int NoFork;
+static time_t StartTime;
static void
usage(void)
@@ -64,7 +66,6 @@ main(int argc, char *argv[])
setvbuf(stdout, NULL, _IOLBF, 0);
setvbuf(stderr, NULL, _IOLBF, 0);
- NoFork = 0;
parse_args(argc, argv);
bzero((char *)&sact, sizeof sact);
Index: usr.sbin/cron/entry.c
===================================================================
RCS file: /cvs/src/usr.sbin/cron/entry.c,v
retrieving revision 1.43
diff -u -p -u -r1.43 entry.c
--- usr.sbin/cron/entry.c 26 Oct 2015 14:27:41 -0000 1.43
+++ usr.sbin/cron/entry.c 3 Nov 2015 22:52:06 -0000
@@ -25,20 +25,30 @@ typedef enum ecode {
e_cmd, e_timespec, e_username, e_option, e_memory
} ecode_e;
-static const char *ecodes[] =
- {
- "no error",
- "bad minute",
- "bad hour",
- "bad day-of-month",
- "bad month",
- "bad day-of-week",
- "bad command",
- "bad time specifier",
- "bad username",
- "bad option",
- "out of memory"
- };
+static const char *ecodes[] = {
+ "no error",
+ "bad minute",
+ "bad hour",
+ "bad day-of-month",
+ "bad month",
+ "bad day-of-week",
+ "bad command",
+ "bad time specifier",
+ "bad username",
+ "bad option",
+ "out of memory"
+};
+
+static const char *MonthNames[] = {
+ "Jan", "Feb", "Mar", "Apr", "May", "Jun",
+ "Jul", "Aug", "Sep", "Oct", "Nov", "Dec",
+ NULL
+};
+
+static const char *DowNames[] = {
+ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun",
+ NULL
+};
static int get_list(bitstr_t *, int, int, const char *[], int, FILE *),
get_range(bitstr_t *, int, int, const char *[], int, FILE *),
Index: usr.sbin/cron/externs.h
===================================================================
RCS file: /cvs/src/usr.sbin/cron/externs.h,v
retrieving revision 1.17
diff -u -p -u -r1.17 externs.h
--- usr.sbin/cron/externs.h 6 Oct 2015 14:58:37 -0000 1.17
+++ usr.sbin/cron/externs.h 3 Nov 2015 22:52:06 -0000
@@ -45,18 +45,6 @@
#include <poll.h>
#include <unistd.h>
#include <utime.h>
-
-# include <syslog.h>
-
-# include <login_cap.h>
-
-# include <bsd_auth.h>
-
-#ifndef TZNAME_ALREADY_DEFINED
-extern char *tzname[2];
-#endif
-#define TZONE(tm) tzname[(tm).tm_isdst]
-
-#ifndef WCOREDUMP
-# define WCOREDUMP(st) (((st) & 0200) != 0)
-#endif
+#include <syslog.h>
+#include <login_cap.h>
+#include <bsd_auth.h>
Index: usr.sbin/cron/funcs.h
===================================================================
RCS file: /cvs/src/usr.sbin/cron/funcs.h,v
retrieving revision 1.23
diff -u -p -u -r1.23 funcs.h
--- usr.sbin/cron/funcs.h 31 Oct 2015 12:14:16 -0000 1.23
+++ usr.sbin/cron/funcs.h 3 Nov 2015 22:52:06 -0000
@@ -22,11 +22,8 @@
* We should reorg this into sections by module.
*/
-void set_cron_uid(void),
- set_cron_cwd(void),
+void set_cron_cwd(void),
load_database(cron_db *),
- open_logfile(void),
- sigpipe_func(void),
job_add(entry *, user *),
do_command(entry *, user *),
link_user(cron_db *, user *),
@@ -35,7 +32,6 @@ void set_cron_uid(void),
env_free(char **),
unget_char(int, FILE *),
free_entry(entry *),
- acquire_daemonlock(int),
skip_comments(FILE *),
log_it(const char *, int, const char *, const char *),
log_close(void),
@@ -47,7 +43,6 @@ int job_runqueue(void),
get_string(char *, int, FILE *, char *),
load_env(char *, FILE *),
cron_pclose(FILE *, pid_t),
- glue_strings(char *, size_t, const char *, const char *, char),
allowed(const char *, const char *, const char *),
safe_p(const char *, const char *),
scan_atjobs(at_db *, struct timespec *);
@@ -55,7 +50,6 @@ int job_runqueue(void),
int strtot(const char *nptr, char **endptr, time_t *tp);
char *env_get(char *, char **),
- *arpadate(time_t *),
*first_word(char *, char *),
**env_init(void),
**env_copy(char **),
@@ -68,4 +62,3 @@ entry *load_entry(FILE *,
void (*)(const char *), struct passwd *, char **);
FILE *cron_popen(char *, char *, struct passwd *, pid_t *);
-
Index: usr.sbin/cron/globals.h
===================================================================
RCS file: /cvs/src/usr.sbin/cron/globals.h,v
retrieving revision 1.11
diff -u -p -u -r1.11 globals.h
--- usr.sbin/cron/globals.h 6 Oct 2015 14:58:37 -0000 1.11
+++ usr.sbin/cron/globals.h 3 Nov 2015 22:52:06 -0000
@@ -25,26 +25,5 @@
# define INIT(x)
#endif
-XTRN const char *MonthNames[]
-#ifdef MAIN_PROGRAM
- = {
- "Jan", "Feb", "Mar", "Apr", "May", "Jun",
- "Jul", "Aug", "Sep", "Oct", "Nov", "Dec",
- NULL
- }
-#endif
- ;
-
-XTRN const char *DowNames[]
-#ifdef MAIN_PROGRAM
- = {
- "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun",
- NULL
- }
-#endif
- ;
-
XTRN char *ProgramName INIT("amnesia");
XTRN int LineNumber INIT(0);
-XTRN time_t StartTime INIT(0);
-XTRN int NoFork INIT(0);
Index: usr.sbin/cron/pathnames.h
===================================================================
RCS file: /cvs/src/usr.sbin/cron/pathnames.h,v
retrieving revision 1.17
diff -u -p -u -r1.17 pathnames.h
--- usr.sbin/cron/pathnames.h 25 Oct 2015 21:36:55 -0000 1.17
+++ usr.sbin/cron/pathnames.h 3 Nov 2015 22:52:06 -0000
@@ -20,15 +20,13 @@
#ifndef _PATHNAMES_H_
#define _PATHNAMES_H_
-# include <paths.h>
+#include <paths.h>
-#ifndef CRONDIR
/* CRONDIR is where cron(8) and crontab(1) both chdir
* to; SPOOL_DIR, CRON_ALLOW, CRON_DENY, and LOG_FILE
* are all relative to this directory.
*/
#define CRONDIR "/var/cron"
-#endif
/* SPOOLDIR is where the crontabs live.
* This directory will have its modtime updated
@@ -73,30 +71,6 @@
/* what editor to use if no EDITOR or VISUAL
* environment variable specified.
*/
-#if defined(_PATH_VI)
-# define EDITOR _PATH_VI
-#else
-# define EDITOR "/usr/ucb/vi"
-#endif
-
-#ifndef _PATH_SENDMAIL
-# define _PATH_SENDMAIL "/usr/lib/sendmail"
-#endif
-
-#ifndef _PATH_BSHELL
-# define _PATH_BSHELL "/bin/sh"
-#endif
-
-#ifndef _PATH_DEFPATH
-# define _PATH_DEFPATH "/usr/bin:/bin"
-#endif
-
-#ifndef _PATH_TMP
-# define _PATH_TMP "/tmp/"
-#endif
-
-#ifndef _PATH_DEVNULL
-# define _PATH_DEVNULL "/dev/null"
-#endif
+#define EDITOR _PATH_VI
#endif /* _PATHNAMES_H_ */