git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@15463 27425a3e-05d8-49a3-a47f-9c15f0e5edd8
This commit is contained in:
parent
ea65dbbe74
commit
1304481369
|
@ -30,9 +30,9 @@ static void *bufp = NULL;
|
||||||
|
|
||||||
static bool aflg = false;
|
static bool aflg = false;
|
||||||
static bool dflg = false;
|
static bool dflg = false;
|
||||||
|
static bool fflg = false;
|
||||||
static bool lflg = false;
|
static bool lflg = false;
|
||||||
static bool qflg = false;
|
static bool qflg = false;
|
||||||
static bool Uflg = false;
|
|
||||||
|
|
||||||
struct afile {
|
struct afile {
|
||||||
char ftype;
|
char ftype;
|
||||||
|
@ -47,9 +47,9 @@ static void usage(void) {
|
||||||
fprintf(stderr, "Options:" NEWLINE_STR);
|
fprintf(stderr, "Options:" NEWLINE_STR);
|
||||||
fprintf(stderr, " -a do not ignore entries starting with ." NEWLINE_STR);
|
fprintf(stderr, " -a do not ignore entries starting with ." NEWLINE_STR);
|
||||||
fprintf(stderr, " -d list directories themselves, not their contents" NEWLINE_STR);
|
fprintf(stderr, " -d list directories themselves, not their contents" NEWLINE_STR);
|
||||||
|
fprintf(stderr, " -f do not sort, enable -a, disable -l" NEWLINE_STR);
|
||||||
fprintf(stderr, " -l use a long listing format" NEWLINE_STR);
|
fprintf(stderr, " -l use a long listing format" NEWLINE_STR);
|
||||||
fprintf(stderr, " -q print ? instead of nongraphic characters" NEWLINE_STR);
|
fprintf(stderr, " -q print ? instead of nongraphic characters" NEWLINE_STR);
|
||||||
fprintf(stderr, " -U do not sort; list entries in directory order" NEWLINE_STR);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void freeall(void) {
|
static void freeall(void) {
|
||||||
|
@ -360,15 +360,15 @@ int main(int argc, char *argv[], char *envp[]) {
|
||||||
case 'd':
|
case 'd':
|
||||||
dflg = true;
|
dflg = true;
|
||||||
break;
|
break;
|
||||||
|
case 'f':
|
||||||
|
fflg = true;
|
||||||
|
break;
|
||||||
case 'l':
|
case 'l':
|
||||||
lflg = true;
|
lflg = true;
|
||||||
break;
|
break;
|
||||||
case 'q':
|
case 'q':
|
||||||
qflg = true;
|
qflg = true;
|
||||||
break;
|
break;
|
||||||
case 'U':
|
|
||||||
Uflg = true;
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
usage();
|
usage();
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -377,6 +377,14 @@ int main(int argc, char *argv[], char *envp[]) {
|
||||||
argv[0]++;
|
argv[0]++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* The "f" flag has side effects.*/
|
||||||
|
if (fflg) {
|
||||||
|
aflg = true;
|
||||||
|
lflg = false;
|
||||||
|
/*sflg = false;*/
|
||||||
|
/*tflg = false*/;
|
||||||
|
}
|
||||||
|
|
||||||
/* Case where no paths are specified.*/
|
/* Case where no paths are specified.*/
|
||||||
if (argc == 0) {
|
if (argc == 0) {
|
||||||
argc++;
|
argc++;
|
||||||
|
@ -402,7 +410,7 @@ int main(int argc, char *argv[], char *envp[]) {
|
||||||
fplast = fp;
|
fplast = fp;
|
||||||
|
|
||||||
/* Sorting the array, if not disabled.*/
|
/* Sorting the array, if not disabled.*/
|
||||||
if (!Uflg) {
|
if (!fflg) {
|
||||||
qsort(fp0, fplast - fp0, sizeof (struct afile), fcmp);
|
qsort(fp0, fplast - fp0, sizeof (struct afile), fcmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -412,7 +420,39 @@ int main(int argc, char *argv[], char *envp[]) {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* Entering directories. TODO */
|
/* Entering directories. TODO */
|
||||||
formatf(fp0, fplast);
|
if (fflg) {
|
||||||
|
fp = fp0;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
/* Skipping directories.*/
|
||||||
|
for (fp = fp0; fp < fplast && fp->ftype != 'd'; fp++) {
|
||||||
|
}
|
||||||
|
formatf(fp0, fp);
|
||||||
|
}
|
||||||
|
#if 0
|
||||||
|
|
||||||
|
if (fp < fplast) {
|
||||||
|
if (fp > fp0) {
|
||||||
|
printf("\n");
|
||||||
|
}
|
||||||
|
for (;;) {
|
||||||
|
formatd(fp->fname, argc > 1);
|
||||||
|
while (subdirs) {
|
||||||
|
struct subdirs *t;
|
||||||
|
|
||||||
|
t = subdirs;
|
||||||
|
subdirs = t->sd_next;
|
||||||
|
printf("\n");
|
||||||
|
formatd(t->sd_name, 1);
|
||||||
|
free((void *)t->sd_name);
|
||||||
|
free((void *)t);
|
||||||
|
}
|
||||||
|
if (++fp == fplast)
|
||||||
|
break;
|
||||||
|
printf("\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
freeall();
|
freeall();
|
||||||
|
|
Loading…
Reference in New Issue