From 7138c068a963e26ee1fe5213dc6f4d788876854c Mon Sep 17 00:00:00 2001 From: thib Date: Tue, 12 Sep 2000 19:52:34 +0000 Subject: [PATCH] support of autoconf --- fcron.c | 42 ++++++++++++++++++++++++++---------------- fcron.h | 22 +++++++++++++++++++++- fcrontab.c | 12 +++++++++--- global.h | 41 ++++++++++++++++++++++++++++++++++++++--- 4 files changed, 94 insertions(+), 23 deletions(-) diff --git a/fcron.c b/fcron.c index d829614..0ca70a6 100644 --- a/fcron.c +++ b/fcron.c @@ -21,27 +21,37 @@ * `LICENSE' that comes with the fcron source distribution. */ - /* $Id: fcron.c,v 1.25 2000-09-03 13:15:46 thib Exp $ */ + /* $Id: fcron.c,v 1.26 2000-09-12 19:52:34 thib Exp $ */ #include "fcron.h" -char rcs_info[] = "$Id: fcron.c,v 1.25 2000-09-03 13:15:46 thib Exp $"; +char rcs_info[] = "$Id: fcron.c,v 1.26 2000-09-12 19:52:34 thib Exp $"; void main_loop(void); void check_signal(void); void info(void); void usage(void); -void sighup_handler(int x); -void sigterm_handler(int x); -void sigchild_handler(int x); -void sigusr1_handler(int x); +RETSIGTYPE sighup_handler(int x); +RETSIGTYPE sigterm_handler(int x); +RETSIGTYPE sigchild_handler(int x); +RETSIGTYPE sigusr1_handler(int x); int parseopt(int argc, char *argv[]); void get_lock(void); /* command line options */ -char debug_opt = DEBUG; /* set to 1 if we are in debug mode */ -char foreground = FOREGROUND; /* set to 1 when we are on foreground, else 0 */ +#ifdef DEBUG +char debug_opt = 1; /* set to 1 if we are in debug mode */ +#else +char debug_opt = 0; /* set to 1 if we are in debug mode */ +#endif + +#ifdef FOREGROUND +char foreground = 1; /* set to 1 when we are on foreground, else 0 */ +#else +char foreground = 0; /* set to 1 when we are on foreground, else 0 */ +#endif + char *cdir = FCRONTABS; /* the dir where are stored users' fcrontabs */ /* process identity */ @@ -262,7 +272,7 @@ parseopt(int argc, char *argv[]) } -void +RETSIGTYPE sigterm_handler(int x) /* exit safely */ { @@ -271,7 +281,7 @@ sigterm_handler(int x) xexit(EXIT_OK); } -void +RETSIGTYPE sighup_handler(int x) /* update configuration */ { @@ -289,7 +299,7 @@ sighup_handler(int x) sig_conf = 1; } -void +RETSIGTYPE sigchild_handler(int x) /* call wait_chld() to take care of finished jobs */ { @@ -306,7 +316,7 @@ sigchild_handler(int x) } -void +RETSIGTYPE sigusr1_handler(int x) /* reload all configurations */ { @@ -405,12 +415,12 @@ main(int argc, char **argv) explain("%s[%d] " VERSION " started", prog_name, daemon_pid); - (void)signal(SIGTERM, sigterm_handler); - (void)signal(SIGHUP, sighup_handler); + signal(SIGTERM, sigterm_handler); + signal(SIGHUP, sighup_handler); siginterrupt(SIGHUP, 0); - (void)signal(SIGCHLD, sigchild_handler); + signal(SIGCHLD, sigchild_handler); siginterrupt(SIGCHLD, 0); - (void)signal(SIGUSR1, sigusr1_handler); + signal(SIGUSR1, sigusr1_handler); siginterrupt(SIGUSR1, 0); diff --git a/fcron.h b/fcron.h index 9234617..0e1638d 100644 --- a/fcron.h +++ b/fcron.h @@ -21,18 +21,38 @@ * `LICENSE' that comes with the fcron source distribution. */ - /* $Id: fcron.h,v 1.10 2000-08-28 17:59:15 thib Exp $ */ + /* $Id: fcron.h,v 1.11 2000-09-12 19:52:50 thib Exp $ */ #ifndef __FCRONH__ #define __FCRONH__ #include "global.h" +#ifdef HAVE_DIRENT_H #include +#elif HAVE_SYS_DIRENT_H +#include +#elif HAVE_SYS_DIR_H +#include +#endif + +#ifdef HAVE_FCNTL_H #include +#endif + #include + +#ifdef HAVE_SYS_IOCTL_H #include +#endif + +#ifdef HAVE_SYS_TIME_H #include +#endif + +#ifndef HAVE_GETLOADAVG +#include "getloadavg.h" +#endif /* global variables */ diff --git a/fcrontab.c b/fcrontab.c index d0e4ea4..5371e6c 100644 --- a/fcrontab.c +++ b/fcrontab.c @@ -22,7 +22,7 @@ * `LICENSE' that comes with the fcron source distribution. */ - /* $Id: fcrontab.c,v 1.13 2000-09-05 19:52:33 thib Exp $ */ + /* $Id: fcrontab.c,v 1.14 2000-09-12 19:53:03 thib Exp $ */ /* * The goal of this program is simple : giving a user interface to fcron @@ -42,7 +42,7 @@ #include "fcrontab.h" -char rcs_info[] = "$Id: fcrontab.c,v 1.13 2000-09-05 19:52:33 thib Exp $"; +char rcs_info[] = "$Id: fcrontab.c,v 1.14 2000-09-12 19:53:03 thib Exp $"; void info(void); void usage(void); @@ -57,7 +57,13 @@ char edit_opt = 0; char reinstall_opt = 0; char ignore_prev = 0; int file_opt = 0; -char debug_opt = DEBUG; + +#ifdef DEBUG +char debug_opt = 1; /* set to 1 if we are in debug mode */ +#else +char debug_opt = 0; /* set to 1 if we are in debug mode */ +#endif + char *user = NULL; uid_t uid = 0 ; char *cdir = FCRONTABS; diff --git a/global.h b/global.h index 162a96d..b5b3263 100644 --- a/global.h +++ b/global.h @@ -21,7 +21,7 @@ * `LICENSE' that comes with the fcron source distribution. */ - /* $Id: global.h,v 1.18 2000-08-30 09:09:07 thib Exp $ */ + /* $Id: global.h,v 1.19 2000-09-12 19:53:10 thib Exp $ */ /* @@ -32,27 +32,62 @@ #ifndef __GLOBALH__ #define __GLOBALH__ +/* config.h must be included before every other includes */ +#include "config.h" + + #include + +#ifdef HAVE_ERRNO_H #include -#ifdef __linux__ +#endif + +#ifdef HAVE_GETOPT_H #include #endif + #include #include + +#ifdef HAVE_STDARG_H #include +#endif + #include #include #include + +#ifdef HAVE_SYS_FILE_H #include +#endif + #include #include + +#ifdef HAVE_SYS_WAIT_H #include +#endif + +#ifdef HAVE_SYSLOG_H #include +#endif + +#ifdef TIME_WITH_SYS_TIME #include +#elif HAVE_SYS_TIME_H +#include +#endif + +#ifdef HAVE_UNISTD_H #include +#endif + +#ifdef HAVE_FCNTL_H #include +#elif HAVE_SYS_FCNTL_H +#include +#endif -#include "config.h" #include "bitstring.h" #include "option.h" -- 2.40.0