}
/*----------------------------------------------------------------------*/
-static void showdirs(struct dnode **dn, int ndirs)
+static void showdirs(struct dnode **dn, int ndirs, int first)
{
int i, nfiles;
struct dnode **subdnp;
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);
#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 */
}
}
#ifdef CONFIG_FEATURE_LS_SORTFILES
shellsort(dnd, dndirs);
#endif
- showdirs(dnd, dndirs);
+ showdirs(dnd, dndirs, dnfiles == 0);
}
}
return (status);