I broke allbareconfig with half-finished cleanups I'd forgotten weren't done.
Got both to a decent stopping point. (There's a lot more cleanup to do on ls.c but now is not the time...)
This commit is contained in:
parent
8437ede6c2
commit
2b8a05a775
2 changed files with 19 additions and 26 deletions
|
@ -101,14 +101,10 @@ enum {
|
||||||
|
|
||||||
#define SORT_MASK (7U<<28)
|
#define SORT_MASK (7U<<28)
|
||||||
|
|
||||||
#ifdef CONFIG_FEATURE_LS_TIMESTAMPS
|
|
||||||
/* which of the three times will be used */
|
/* which of the three times will be used */
|
||||||
#define TIME_MOD 0
|
#define TIME_CHANGE ((1U<<23) * ENABLE_FEATURE_LS_TIMESTAMPS)
|
||||||
#define TIME_CHANGE (1U<<23)
|
#define TIME_ACCESS ((1U<<24) * ENABLE_FEATURE_LS_TIMESTAMPS)
|
||||||
#define TIME_ACCESS (1U<<24)
|
#define TIME_MASK ((3U<<23) * ENABLE_FEATURE_LS_TIMESTAMPS)
|
||||||
|
|
||||||
#define TIME_MASK (3U<<23)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef CONFIG_FEATURE_LS_FOLLOWLINKS
|
#ifdef CONFIG_FEATURE_LS_FOLLOWLINKS
|
||||||
#define FOLLOW_LINKS (1U<<25)
|
#define FOLLOW_LINKS (1U<<25)
|
||||||
|
@ -507,7 +503,7 @@ static void showdirs(struct dnode **dn, int ndirs, int first)
|
||||||
/* list all files at this level */
|
/* list all files at this level */
|
||||||
if (ENABLE_FEATURE_LS_SORTFILES) dnsort(subdnp, nfiles);
|
if (ENABLE_FEATURE_LS_SORTFILES) dnsort(subdnp, nfiles);
|
||||||
showfiles(subdnp, nfiles);
|
showfiles(subdnp, nfiles);
|
||||||
#ifdef CONFIG_FEATURE_LS_RECURSIVE
|
if (ENABLE_FEATURE_LS_RECURSIVE) {
|
||||||
if (all_fmt & DISP_RECURSIVE) {
|
if (all_fmt & DISP_RECURSIVE) {
|
||||||
/* recursive- list the sub-dirs */
|
/* recursive- list the sub-dirs */
|
||||||
dnd = splitdnarray(subdnp, nfiles, SPLIT_SUBDIR);
|
dnd = splitdnarray(subdnp, nfiles, SPLIT_SUBDIR);
|
||||||
|
@ -515,11 +511,13 @@ static void showdirs(struct dnode **dn, int ndirs, int first)
|
||||||
if (dndirs > 0) {
|
if (dndirs > 0) {
|
||||||
if (ENABLE_FEATURE_LS_SORTFILES) dnsort(dnd, dndirs);
|
if (ENABLE_FEATURE_LS_SORTFILES) dnsort(dnd, dndirs);
|
||||||
showdirs(dnd, dndirs, 0);
|
showdirs(dnd, dndirs, 0);
|
||||||
free(dnd); /* free the array of dnode pointers to the dirs */
|
/* free the array of dnode pointers to the dirs */
|
||||||
|
free(dnd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dfree(subdnp, nfiles); /* free the dnodes and the fullname mem */
|
/* free the dnodes and the fullname mem */
|
||||||
#endif
|
dfree(subdnp, nfiles);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -825,7 +823,6 @@ static const char ls_options[]="Cadil1gnsxAk" \
|
||||||
#define STYLE_MASK_TRIGGER STYLE_MASK
|
#define STYLE_MASK_TRIGGER STYLE_MASK
|
||||||
#define SORT_MASK_TRIGGER SORT_MASK
|
#define SORT_MASK_TRIGGER SORT_MASK
|
||||||
#define DISP_MASK_TRIGGER DISP_ROWS
|
#define DISP_MASK_TRIGGER DISP_ROWS
|
||||||
#define TIME_MASK_TRIGGER TIME_MASK
|
|
||||||
|
|
||||||
static const unsigned opt_flags[] = {
|
static const unsigned opt_flags[] = {
|
||||||
LIST_SHORT | STYLE_COLUMNS, /* C */
|
LIST_SHORT | STYLE_COLUMNS, /* C */
|
||||||
|
@ -904,7 +901,7 @@ int ls_main(int argc, char **argv)
|
||||||
char *color_opt;
|
char *color_opt;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
all_fmt = LIST_SHORT | (ENABLE_FEATURE_LS_TIMESTAMPS * TIME_MOD) |
|
all_fmt = LIST_SHORT |
|
||||||
(ENABLE_FEATURE_LS_SORTFILES * (SORT_NAME | SORT_ORDER_FORWARD));
|
(ENABLE_FEATURE_LS_SORTFILES * (SORT_NAME | SORT_ORDER_FORWARD));
|
||||||
|
|
||||||
#ifdef CONFIG_FEATURE_AUTOWIDTH
|
#ifdef CONFIG_FEATURE_AUTOWIDTH
|
||||||
|
@ -954,11 +951,9 @@ int ls_main(int argc, char **argv)
|
||||||
if (flags & DISP_MASK_TRIGGER) {
|
if (flags & DISP_MASK_TRIGGER) {
|
||||||
all_fmt &= ~DISP_MASK;
|
all_fmt &= ~DISP_MASK;
|
||||||
}
|
}
|
||||||
#ifdef CONFIG_FEATURE_LS_TIMESTAMPS
|
if (flags & TIME_MASK) {
|
||||||
if (flags & TIME_MASK_TRIGGER) {
|
|
||||||
all_fmt &= ~TIME_MASK;
|
all_fmt &= ~TIME_MASK;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
if (flags & LIST_CONTEXT) {
|
if (flags & LIST_CONTEXT) {
|
||||||
all_fmt |= STYLE_SINGLE;
|
all_fmt |= STYLE_SINGLE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,9 +28,7 @@
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
//#include "pwd_.h"
|
#include "shadow_.h"
|
||||||
//#include "grp_.h"
|
|
||||||
//#include "shadow_.h"
|
|
||||||
|
|
||||||
#ifndef _PATH_SHADOW
|
#ifndef _PATH_SHADOW
|
||||||
#define _PATH_SHADOW "/etc/shadow"
|
#define _PATH_SHADOW "/etc/shadow"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue