[BusyBox-cvs] busybox/coreutils ls.c,1.104,1.105

Glenn McGrath bug1 at busybox.net
Sat Mar 6 09:12:57 UTC 2004


Update of /var/cvs/busybox/coreutils
In directory nail:/tmp/cvs-serv2509/coreutils

Modified Files:
	ls.c 
Log Message:
Patch from Matt Kraai to fix debian bug number 231994.
There was an extra blank line preceding the first directory.


Index: ls.c
===================================================================
RCS file: /var/cvs/busybox/coreutils/ls.c,v
retrieving revision 1.104
retrieving revision 1.105
diff -u -d -r1.104 -r1.105
--- a/ls.c	5 Feb 2004 13:52:03 -0000	1.104
+++ b/ls.c	6 Mar 2004 09:12:55 -0000	1.105
@@ -532,7 +532,7 @@
 }
 
 /*----------------------------------------------------------------------*/
-static void showdirs(struct dnode **dn, int ndirs)
+static void showdirs(struct dnode **dn, int ndirs, int first)
 {
 	int i, nfiles;
 	struct dnode **subdnp;
@@ -547,7 +547,10 @@
 
 	for (i = 0; i < ndirs; i++) {
 		if (all_fmt & (DISP_DIRNAME | DISP_RECURSIVE)) {
-			printf("\n%s:\n", dn[i]->fullname);
+			if (!first)
+				printf("\n");
+			first = 0;
+			printf("%s:\n", dn[i]->fullname);
 		}
 		subdnp = list_dir(dn[i]->fullname);
 		nfiles = countfiles(subdnp);
@@ -566,7 +569,7 @@
 #ifdef CONFIG_FEATURE_LS_SORTFILES
 					shellsort(dnd, dndirs);
 #endif
-					showdirs(dnd, dndirs);
+					showdirs(dnd, dndirs, 0);
 					free(dnd);	/* free the array of dnode pointers to the dirs */
 				}
 			}
@@ -1129,7 +1132,7 @@
 #ifdef CONFIG_FEATURE_LS_SORTFILES
 			shellsort(dnd, dndirs);
 #endif
-			showdirs(dnd, dndirs);
+			showdirs(dnd, dndirs, dnfiles == 0);
 		}
 	}
 	return (status);




More information about the busybox-cvs mailing list