[BusyBox] forgotten patch

Matt Kraai kraai at alumni.carnegiemellon.edu
Wed Jan 24 21:48:27 UTC 2001


Howdy,

Of course, you can probably do a better job of commenting if you
can actually figure out what I did.  Argh.

Matt
-------------- next part --------------
Index: busybox.c
===================================================================
RCS file: /var/cvs/busybox/busybox.c,v
retrieving revision 1.116
diff -u -r1.116 busybox.c
--- busybox.c	2000/12/18 03:57:16	1.116
+++ busybox.c	2001/01/24 21:35:51
@@ -89,38 +89,7 @@
 {
 	struct BB_applet search_applet, *applet;
 	const char				*s;
-	applet_name = "busybox";
 
-#ifdef BB_FEATURE_INSTALLER	
-	/* 
-	 * This style of argument parsing doesn't scale well 
-	 * in the event that busybox starts wanting more --options.
-	 * If someone has a cleaner approach, by all means implement it.
-	 */
-	if (argc > 1 && (strcmp(argv[1], "--install") == 0)) {
-		int use_symbolic_links = 0;
-		int rc = 0;
-		char *busybox;
-
-		/* to use symlinks, or not to use symlinks... */
-		if (argc > 2) {
-			if ((strcmp(argv[2], "-s") == 0)) { 
-				use_symbolic_links = 1; 
-			}
-		}
-
-		/* link */
-		busybox = busybox_fullpath();
-		if (busybox) {
-			install_links(busybox, use_symbolic_links);
-			free(busybox);
-		} else {
-			rc = 1;
-		}
-		return rc;
-	}
-#endif /* BB_FEATURE_INSTALLER */
-
 	for (s = applet_name = argv[0]; *s != '\0';) {
 		if (*s++ == '/')
 			applet_name = s;
@@ -144,13 +113,43 @@
 		exit((*(applet->main)) (argc, argv));
 	}
 
-	return(busybox_main(argc, argv));
+	error_msg_and_die("applet not found\n");
 }
 
 
 int busybox_main(int argc, char **argv)
 {
 	int col = 0, len, i;
+
+#ifdef BB_FEATURE_INSTALLER	
+	/* 
+	 * This style of argument parsing doesn't scale well 
+	 * in the event that busybox starts wanting more --options.
+	 * If someone has a cleaner approach, by all means implement it.
+	 */
+	if (argc > 1 && (strcmp(argv[1], "--install") == 0)) {
+		int use_symbolic_links = 0;
+		int rc = 0;
+		char *busybox;
+
+		/* to use symlinks, or not to use symlinks... */
+		if (argc > 2) {
+			if ((strcmp(argv[2], "-s") == 0)) { 
+				use_symbolic_links = 1; 
+			}
+		}
+
+		/* link */
+		busybox = busybox_fullpath();
+		if (busybox) {
+			install_links(busybox, use_symbolic_links);
+			free(busybox);
+		} else {
+			rc = 1;
+		}
+		return rc;
+	}
+#endif /* BB_FEATURE_INSTALLER */
 
 	argc--;
 


More information about the busybox mailing list