1 /* misc.c - Miscellaneous stuff for cron Author: Kees J. Bot
12 char *prog_name
; /* Name of this program. */
13 time_t now
; /* Cron's idea of the current time. */
14 time_t next
; /* Time to run the next job. */
16 size_t alloc_count
; /* # Of chunks of memory allocated. */
18 void *allocate(size_t len
)
19 /* Checked malloc(). Better not feed it length 0. */
23 if ((mem
= malloc(len
)) == nil
) {
24 log(LOG_ALERT
, "Out of memory, exiting\n");
31 void deallocate(void *mem
)
39 static enum logto logto
= SYSLOG
;
41 void selectlog(enum logto where
)
42 /* Select where logging output should go, syslog or stdout. */
47 void log(int level
, const char *fmt
, ...)
48 /* Like syslog(), but may go to stderr. */
54 #if __minix_vmd || !__minix
55 if (logto
== SYSLOG
) {
56 vsyslog(level
, fmt
, ap
);
60 fprintf(stderr
, "%s: ", prog_name
);
61 vfprintf(stderr
, fmt
, ap
);
67 * $PchId: misc.c,v 1.3 2000/07/17 19:01:57 philip Exp $