svn commit: trunk/busybox/miscutils

aldot at busybox.net aldot at busybox.net
Sat May 20 14:14:07 UTC 2006


Author: aldot
Date: 2006-05-20 07:14:05 -0700 (Sat, 20 May 2006)
New Revision: 15149

Log:
- silence warning about no return in function returning non-void
- put CONFIG_DEBUG_CROND_OPTION into config
no changes in size when debugging is disabled.


Modified:
   trunk/busybox/miscutils/Config.in
   trunk/busybox/miscutils/crond.c


Changeset:
Modified: trunk/busybox/miscutils/Config.in
===================================================================
--- trunk/busybox/miscutils/Config.in	2006-05-20 02:25:04 UTC (rev 15148)
+++ trunk/busybox/miscutils/Config.in	2006-05-20 14:14:05 UTC (rev 15149)
@@ -34,6 +34,13 @@
 	  Note that Busybox binary must be setuid root for this applet to
 	  work properly.
 
+config CONFIG_DEBUG_CROND_OPTION
+	bool "Support debug option -d"
+	depends on CONFIG_CROND
+	default n
+	help
+	  Support option -d to enter debug mode.
+
 config CONFIG_FEATURE_CROND_CALL_SENDMAIL
 	bool "Using /usr/sbin/sendmail?"
 	default n

Modified: trunk/busybox/miscutils/crond.c
===================================================================
--- trunk/busybox/miscutils/crond.c	2006-05-20 02:25:04 UTC (rev 15148)
+++ trunk/busybox/miscutils/crond.c	2006-05-20 14:14:05 UTC (rev 15149)
@@ -12,9 +12,6 @@
 
 #define VERSION "2.3.2"
 
-#undef FEATURE_DEBUG_OPT
-
-
 #include <stdio.h>
 #include <stdlib.h>
 #include <stdarg.h>
@@ -83,7 +80,7 @@
 
 #define DaemonUid 0
 
-#ifdef FEATURE_DEBUG_OPT
+#if ENABLE_DEBUG_CROND_OPTION
 static short DebugOpt;
 #endif
 
@@ -101,7 +98,7 @@
 
 static void RunJob(const char *user, CronLine * line);
 
-#ifdef CONFIG_FEATURE_CROND_CALL_SENDMAIL
+#if ENABLE_FEATURE_CROND_CALL_SENDMAIL
 static void EndJob(const char *user, CronLine * line);
 #else
 #define EndJob(user, line)  line->cl_Pid = 0
@@ -125,7 +122,7 @@
 	fmt = ctl + 1;
 	if (level >= LogLevel) {
 
-#ifdef FEATURE_DEBUG_OPT
+#if ENABLE_DEBUG_CROND_OPTION
 		if (DebugOpt) {
 			vfprintf(stderr, fmt, va);
 		} else
@@ -137,7 +134,7 @@
 			if (logfd >= 0) {
 				vdprintf(logfd, fmt, va);
 				close(logfd);
-#ifdef FEATURE_DEBUG_OPT
+#if ENABLE_DEBUG_CROND_OPTION
 			} else {
 				bb_perror_msg("Can't open log file");
 #endif
@@ -155,7 +152,7 @@
 	unsigned long opt;
 	char *lopt, *Lopt, *copt;
 
-#ifdef FEATURE_DEBUG_OPT
+#if ENABLE_DEBUG_CROND_OPTION
 	char *dopt;
 
 	bb_opt_complementally = "f-b:b-f:S-L:L-S:d-l";
@@ -165,11 +162,11 @@
 
 	opterr = 0;			/* disable getopt 'errors' message. */
 	opt = bb_getopt_ulflags(ac, av, "l:L:fbSc:"
-#ifdef FEATURE_DEBUG_OPT
+#if ENABLE_DEBUG_CROND_OPTION
 							"d:"
 #endif
 							, &lopt, &Lopt, &copt
-#ifdef FEATURE_DEBUG_OPT
+#if ENABLE_DEBUG_CROND_OPTION
 							, &dopt
 #endif
 		);
@@ -186,7 +183,7 @@
 			CDir = copt;
 		}
 	}
-#ifdef FEATURE_DEBUG_OPT
+#if ENABLE_DEBUG_CROND_OPTION
 	if (opt & 64) {
 		DebugOpt = atoi(dopt);
 		LogLevel = 0;
@@ -263,7 +260,7 @@
 				SynchronizeDir();
 			}
 			CheckUpdates();
-#ifdef FEATURE_DEBUG_OPT
+#if ENABLE_DEBUG_CROND_OPTION
 			if (DebugOpt)
 				crondlog("\005Wakeup dt=%d\n", dt);
 #endif
@@ -283,10 +280,10 @@
 			}
 		}
 	}
-	/* not reached */
+	bb_fflush_stdout_and_exit(EXIT_SUCCESS); /* not reached */
 }
 
-#if defined(FEATURE_DEBUG_OPT) || defined(CONFIG_FEATURE_CROND_CALL_SENDMAIL)
+#if ENABLE_DEBUG_CROND_OPTION || ENABLE_FEATURE_CROND_CALL_SENDMAIL
 /*
     write to temp file..
 */
@@ -341,7 +338,7 @@
 	if (LogFile == 0) {
 		openlog(bb_applet_name, LOG_CONS | LOG_PID, LOG_CRON);
 	}
-#ifdef FEATURE_DEBUG_OPT
+#if ENABLE_DEBUG_CROND_OPTION
 	else {				/* test logfile */
 		int logfd;
 
@@ -513,7 +510,7 @@
 	while (*ptr == ' ' || *ptr == '\t' || *ptr == '\n') {
 		++ptr;
 	}
-#ifdef FEATURE_DEBUG_OPT
+#if ENABLE_DEBUG_CROND_OPTION
 	if (DebugOpt) {
 		int i;
 
@@ -595,7 +592,7 @@
 					}
 					memset(&line, 0, sizeof(line));
 
-#ifdef FEATURE_DEBUG_OPT
+#if ENABLE_DEBUG_CROND_OPTION
 					if (DebugOpt) {
 						crondlog("\111User %s Entry %s\n", fileName, buf);
 					}
@@ -626,7 +623,7 @@
 					/* copy command */
 					(*pline)->cl_Shell = strdup(ptr);
 
-#ifdef FEATURE_DEBUG_OPT
+#if ENABLE_DEBUG_CROND_OPTION
 					if (DebugOpt) {
 						crondlog("\111    Command %s\n", ptr);
 					}
@@ -778,21 +775,21 @@
 			CronLine *line;
 
 			for (file = FileBase; file; file = file->cf_Next) {
-#ifdef FEATURE_DEBUG_OPT
+#if ENABLE_DEBUG_CROND_OPTION
 				if (DebugOpt)
 					crondlog("\005FILE %s:\n", file->cf_User);
 #endif
 				if (file->cf_Deleted)
 					continue;
 				for (line = file->cf_LineBase; line; line = line->cl_Next) {
-#ifdef FEATURE_DEBUG_OPT
+#if ENABLE_DEBUG_CROND_OPTION
 					if (DebugOpt)
 						crondlog("\005    LINE %s\n", line->cl_Shell);
 #endif
 					if (line->cl_Mins[tp->tm_min] && line->cl_Hrs[tp->tm_hour] &&
 						(line->cl_Days[tp->tm_mday] || line->cl_Dow[tp->tm_wday])
 						&& line->cl_Mons[tp->tm_mon]) {
-#ifdef FEATURE_DEBUG_OPT
+#if ENABLE_DEBUG_CROND_OPTION
 						if (DebugOpt) {
 							crondlog("\005    JobToDo: %d %s\n",
 								line->cl_Pid, line->cl_Shell);
@@ -881,7 +878,7 @@
 }
 
 
-#ifdef CONFIG_FEATURE_CROND_CALL_SENDMAIL
+#if ENABLE_FEATURE_CROND_CALL_SENDMAIL
 static void
 ForkJob(const char *user, CronLine * line, int mailFd,
 		const char *prog, const char *cmd, const char *arg, const char *mailf)
@@ -898,7 +895,7 @@
 		if (ChangeUser(user) < 0) {
 			exit(0);
 		}
-#ifdef FEATURE_DEBUG_OPT
+#if ENABLE_DEBUG_CROND_OPTION
 		if (DebugOpt) {
 			crondlog("\005Child Running %s\n", prog);
 		}
@@ -1030,7 +1027,7 @@
 		if (ChangeUser(user) < 0) {
 			exit(0);
 		}
-#ifdef FEATURE_DEBUG_OPT
+#if ENABLE_DEBUG_CROND_OPTION
 		if (DebugOpt) {
 			crondlog("\005Child Running %s\n", DEFAULT_SHELL);
 		}
@@ -1047,4 +1044,4 @@
 	}
 	line->cl_Pid = pid;
 }
-#endif							/* CONFIG_FEATURE_CROND_CALL_SENDMAIL */
+#endif /* ENABLE_FEATURE_CROND_CALL_SENDMAIL */




More information about the busybox-cvs mailing list