[BusyBox] ls exit status patch

robotti at metconnect.com robotti at metconnect.com
Sun Oct 8 16:25:28 UTC 2000


This is for bb v0.47 so ls returns 
a exit status of 1 or 0.
 
--- ls.c.orig	Mon Sep 25 21:57:58 2000
+++ ls.c	Sun Oct  8 15:59:11 2000
@@ -173,6 +173,8 @@
 #define column_width    COLUMN_WIDTH
 #endif
 
+static int status; 
+
 static void newline(void)
 {
     if (column > 0) {
@@ -827,16 +829,21 @@
 			shellsort(dnf, dnfiles);
 #endif
 			showfiles(dnf, dnfiles);
+		status = 1;
 		}
 		if (dndirs > 0) {
 #ifdef BB_FEATURE_LS_SORTFILES
 			shellsort(dnd, dndirs);
 #endif
 			showdirs(dnd, dndirs);
+		status = 1;
 		}
 	}
 
-	return(0);
+	if (!status)
+	    return(1);
+
+	    return(0);
 
   print_usage_message:
 	usage(ls_usage);





More information about the busybox mailing list