[BusyBox-cvs] svn commit: trunk/busybox: archival coreutils debianutils include l etc...

vapier at busybox.net vapier at busybox.net
Wed May 11 00:39:05 UTC 2005


Author: vapier
Date: 2005-05-10 18:39:03 -0600 (Tue, 10 May 2005)
New Revision: 10289

Log:
change the hardcoded error constant (0x80000000UL) to a nice flexible define (BB_GETOPT_ERROR)

Modified:
   trunk/busybox/archival/ar.c
   trunk/busybox/archival/dpkg_deb.c
   trunk/busybox/archival/tar.c
   trunk/busybox/coreutils/cut.c
   trunk/busybox/coreutils/date.c
   trunk/busybox/coreutils/id.c
   trunk/busybox/coreutils/install.c
   trunk/busybox/debianutils/start_stop_daemon.c
   trunk/busybox/include/libbb.h
   trunk/busybox/libbb/getopt_ulflags.c
   trunk/busybox/util-linux/hwclock.c


Changeset:
Modified: trunk/busybox/archival/ar.c
===================================================================
--- trunk/busybox/archival/ar.c	2005-05-11 00:25:47 UTC (rev 10288)
+++ trunk/busybox/archival/ar.c	2005-05-11 00:39:03 UTC (rev 10289)
@@ -70,7 +70,7 @@
 	bb_opt_complementaly = "p~tx:t~px:x~pt";
 	opt = bb_getopt_ulflags(argc, argv, "ptxovcr");
 
-	if ((opt & 0x80000000UL) || (opt == 0) || (optind == argc)) {
+	if ((opt & BB_GETOPT_ERROR) || (opt == 0) || (optind == argc)) {
 		bb_show_usage();
 	}
 

Modified: trunk/busybox/archival/dpkg_deb.c
===================================================================
--- trunk/busybox/archival/dpkg_deb.c	2005-05-11 00:25:47 UTC (rev 10288)
+++ trunk/busybox/archival/dpkg_deb.c	2005-05-11 00:39:03 UTC (rev 10289)
@@ -88,7 +88,7 @@
 		argcount = 2;
 	}
 
-	if ((optind + argcount != argc) || (opt & 0x80000000UL)) {
+	if ((optind + argcount != argc) || (opt & BB_GETOPT_ERROR)) {
 		bb_show_usage();
 	}
 

Modified: trunk/busybox/archival/tar.c
===================================================================
--- trunk/busybox/archival/tar.c	2005-05-11 00:25:47 UTC (rev 10288)
+++ trunk/busybox/archival/tar.c	2005-05-11 00:39:03 UTC (rev 10289)
@@ -724,7 +724,7 @@
 				);
 
 	/* Check one and only one context option was given */
-	if(opt & 0x80000000UL) {
+	if(opt & BB_GETOPT_ERROR) {
 		bb_show_usage();
 	}
 #ifdef CONFIG_FEATURE_TAR_CREATE

Modified: trunk/busybox/coreutils/cut.c
===================================================================
--- trunk/busybox/coreutils/cut.c	2005-05-11 00:25:47 UTC (rev 10288)
+++ trunk/busybox/coreutils/cut.c	2005-05-11 00:39:03 UTC (rev 10289)
@@ -300,7 +300,7 @@
 	part = opt & (OPT_BYTE_FLGS|OPT_CHAR_FLGS|OPT_FIELDS_FLGS);
 	if(part == 0)
 		bb_error_msg_and_die("you must specify a list of bytes, characters, or fields");
-	if(opt & 0x80000000UL)
+	if(opt & BB_GETOPT_ERROR)
 		bb_error_msg_and_die("only one type of list may be specified");
 	parse_lists(sopt);
 	if((opt & (OPT_DELIM_FLGS))) {

Modified: trunk/busybox/coreutils/date.c
===================================================================
--- trunk/busybox/coreutils/date.c	2005-05-11 00:25:47 UTC (rev 10288)
+++ trunk/busybox/coreutils/date.c	2005-05-11 00:39:03 UTC (rev 10289)
@@ -166,7 +166,7 @@
 		bb_error_msg_and_die(bb_msg_memory_exhausted);
 	}
 	use_arg = opt & DATE_OPT_DATE;
-	if(opt & 0x80000000UL)
+	if(opt & BB_GETOPT_ERROR)
 		bb_show_usage();
 #ifdef CONFIG_FEATURE_DATE_ISOFMT
 	if(opt & DATE_OPT_TIMESPEC) {

Modified: trunk/busybox/coreutils/id.c
===================================================================
--- trunk/busybox/coreutils/id.c	2005-05-11 00:25:47 UTC (rev 10288)
+++ trunk/busybox/coreutils/id.c	2005-05-11 00:39:03 UTC (rev 10289)
@@ -64,7 +64,7 @@
 	bb_opt_complementaly = "u~g:g~u";
 	flags = bb_getopt_ulflags(argc, argv, "rnug");
 
-	if ((flags & 0x80000000UL)
+	if ((flags & BB_GETOPT_ERROR)
 	/* Don't allow -n -r -nr */
 	|| (flags <= 3 && flags > 0) 
 	/* Don't allow more than one username */

Modified: trunk/busybox/coreutils/install.c
===================================================================
--- trunk/busybox/coreutils/install.c	2005-05-11 00:25:47 UTC (rev 10288)
+++ trunk/busybox/coreutils/install.c	2005-05-11 00:39:03 UTC (rev 10289)
@@ -69,7 +69,7 @@
 	flags = bb_getopt_ulflags(argc, argv, "cdpsg:m:o:", &gid_str, &mode_str, &uid_str);	/* 'a' must be 2nd */
 
 	/* Check valid options were given */
-	if(flags & 0x80000000UL) {
+	if(flags & BB_GETOPT_ERROR) {
 		bb_show_usage();
 	}
 

Modified: trunk/busybox/debianutils/start_stop_daemon.c
===================================================================
--- trunk/busybox/debianutils/start_stop_daemon.c	2005-05-11 00:25:47 UTC (rev 10288)
+++ trunk/busybox/debianutils/start_stop_daemon.c	2005-05-11 00:39:03 UTC (rev 10289)
@@ -238,7 +238,7 @@
 			&startas, &cmdname, &signame, &userspec, &execname, &pidfile);
 
 	/* Check one and only one context option was given */
-	if ((opt & 0x80000000UL) || (opt & (SSD_CTX_STOP | SSD_CTX_START)) == 0) {
+	if ((opt & BB_GETOPT_ERROR) || (opt & (SSD_CTX_STOP | SSD_CTX_START)) == 0) {
 		bb_show_usage();
 	}
 

Modified: trunk/busybox/include/libbb.h
===================================================================
--- trunk/busybox/include/libbb.h	2005-05-11 00:25:47 UTC (rev 10288)
+++ trunk/busybox/include/libbb.h	2005-05-11 00:39:03 UTC (rev 10289)
@@ -151,6 +151,7 @@
 extern int   bb_fclose_nonstdin(FILE *f);
 extern void  bb_fflush_stdout_and_exit(int retval) __attribute__ ((noreturn));
 
+#define BB_GETOPT_ERROR 0x80000000UL
 extern const char *bb_opt_complementaly;
 extern const struct option *bb_applet_long_options;
 extern unsigned long bb_getopt_ulflags(int argc, char **argv, const char *applet_opts, ...);

Modified: trunk/busybox/libbb/getopt_ulflags.c
===================================================================
--- trunk/busybox/libbb/getopt_ulflags.c	2005-05-11 00:25:47 UTC (rev 10288)
+++ trunk/busybox/libbb/getopt_ulflags.c	2005-05-11 00:39:03 UTC (rev 10289)
@@ -155,10 +155,10 @@
            if specified together.  In this case you must set
            bb_opt_complementaly = "b~cf:c~bf:f~bc".  If two of the
            mutually exclusive options are found, bb_getopt_ulflags's
-           return value will have the error flag set (0x80000000UL) so
+           return value will have the error flag set (BB_GETOPT_ERROR) so
            that we can check for it:
 
-           if (flags & 0x80000000UL)
+           if (flags & BB_GETOPT_ERROR)
                    bb_show_usage();
 
    "*"     A star after a char in bb_opt_complementaly means that the
@@ -280,7 +280,7 @@
 				bb_show_usage ();
 		}
 		if(flags & on_off->incongruously)
-			flags |= 0x80000000UL;
+			flags |= BB_GETOPT_ERROR;
 		flags &= ~on_off->switch_off;
 		flags |= on_off->switch_on;
 		if(on_off->list_flg) {

Modified: trunk/busybox/util-linux/hwclock.c
===================================================================
--- trunk/busybox/util-linux/hwclock.c	2005-05-11 00:25:47 UTC (rev 10288)
+++ trunk/busybox/util-linux/hwclock.c	2005-05-11 00:39:03 UTC (rev 10289)
@@ -208,7 +208,7 @@
 	bb_opt_complementaly = "r~ws:w~rs:s~wr:l~u:u~l";
 	opt = bb_getopt_ulflags(argc, argv, "lursw");
 	/* Check only one mode was given */
-	if(opt & 0x80000000UL) {
+	if(opt & BB_GETOPT_ERROR) {
 		bb_show_usage();
 	}
 




More information about the busybox-cvs mailing list