diff options
author | Glenn L McGrath <bug1@ihug.co.nz> | 2004-03-06 09:12:55 +0000 |
---|---|---|
committer | Glenn L McGrath <bug1@ihug.co.nz> | 2004-03-06 09:12:55 +0000 |
commit | c4db0833a6c91dd3714bec1db076a80910af6e30 (patch) | |
tree | a85a239275938b42e39908bd9edb48b962348e99 | |
parent | a89bbfb257993ee6fddf4a15204e425d42d2ca2a (diff) | |
download | busybox-w32-c4db0833a6c91dd3714bec1db076a80910af6e30.tar.gz busybox-w32-c4db0833a6c91dd3714bec1db076a80910af6e30.tar.bz2 busybox-w32-c4db0833a6c91dd3714bec1db076a80910af6e30.zip |
Patch from Matt Kraai to fix debian bug number 231994.
There was an extra blank line preceding the first directory.
-rw-r--r-- | coreutils/ls.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/coreutils/ls.c b/coreutils/ls.c index 89e502115..46fe39d6c 100644 --- a/coreutils/ls.c +++ b/coreutils/ls.c | |||
@@ -532,7 +532,7 @@ static void showfiles(struct dnode **dn, int nfiles) | |||
532 | } | 532 | } |
533 | 533 | ||
534 | /*----------------------------------------------------------------------*/ | 534 | /*----------------------------------------------------------------------*/ |
535 | static void showdirs(struct dnode **dn, int ndirs) | 535 | static void showdirs(struct dnode **dn, int ndirs, int first) |
536 | { | 536 | { |
537 | int i, nfiles; | 537 | int i, nfiles; |
538 | struct dnode **subdnp; | 538 | struct dnode **subdnp; |
@@ -547,7 +547,10 @@ static void showdirs(struct dnode **dn, int ndirs) | |||
547 | 547 | ||
548 | for (i = 0; i < ndirs; i++) { | 548 | for (i = 0; i < ndirs; i++) { |
549 | if (all_fmt & (DISP_DIRNAME | DISP_RECURSIVE)) { | 549 | if (all_fmt & (DISP_DIRNAME | DISP_RECURSIVE)) { |
550 | printf("\n%s:\n", dn[i]->fullname); | 550 | if (!first) |
551 | printf("\n"); | ||
552 | first = 0; | ||
553 | printf("%s:\n", dn[i]->fullname); | ||
551 | } | 554 | } |
552 | subdnp = list_dir(dn[i]->fullname); | 555 | subdnp = list_dir(dn[i]->fullname); |
553 | nfiles = countfiles(subdnp); | 556 | nfiles = countfiles(subdnp); |
@@ -566,7 +569,7 @@ static void showdirs(struct dnode **dn, int ndirs) | |||
566 | #ifdef CONFIG_FEATURE_LS_SORTFILES | 569 | #ifdef CONFIG_FEATURE_LS_SORTFILES |
567 | shellsort(dnd, dndirs); | 570 | shellsort(dnd, dndirs); |
568 | #endif | 571 | #endif |
569 | showdirs(dnd, dndirs); | 572 | showdirs(dnd, dndirs, 0); |
570 | free(dnd); /* free the array of dnode pointers to the dirs */ | 573 | free(dnd); /* free the array of dnode pointers to the dirs */ |
571 | } | 574 | } |
572 | } | 575 | } |
@@ -1129,7 +1132,7 @@ extern int ls_main(int argc, char **argv) | |||
1129 | #ifdef CONFIG_FEATURE_LS_SORTFILES | 1132 | #ifdef CONFIG_FEATURE_LS_SORTFILES |
1130 | shellsort(dnd, dndirs); | 1133 | shellsort(dnd, dndirs); |
1131 | #endif | 1134 | #endif |
1132 | showdirs(dnd, dndirs); | 1135 | showdirs(dnd, dndirs, dnfiles == 0); |
1133 | } | 1136 | } |
1134 | } | 1137 | } |
1135 | return (status); | 1138 | return (status); |