Lines 105-110
Link Here
|
105 |
/* flags */ |
105 |
/* flags */ |
106 |
int f_accesstime; /* use time of last access */ |
106 |
int f_accesstime; /* use time of last access */ |
107 |
int f_birthtime; /* use time of birth */ |
107 |
int f_birthtime; /* use time of birth */ |
|
|
108 |
static int f_dirfirstsort; /* put directories first */ |
109 |
static int f_dirlastsort; /* put directories last */ |
110 |
static int f_dirlistonly; /* list directories only */ |
111 |
static int f_dirlistnone; /* list non-directories only */ |
108 |
int f_flags; /* show flags associated with a file */ |
112 |
int f_flags; /* show flags associated with a file */ |
109 |
int f_humanval; /* show human-readable file sizes */ |
113 |
int f_humanval; /* show human-readable file sizes */ |
110 |
int f_inode; /* print inode */ |
114 |
int f_inode; /* print inode */ |
Lines 179-189
Link Here
|
179 |
|
183 |
|
180 |
fts_options = FTS_PHYSICAL; |
184 |
fts_options = FTS_PHYSICAL; |
181 |
while ((ch = getopt(argc, argv, |
185 |
while ((ch = getopt(argc, argv, |
182 |
"1ABCFGHILPRSTUWZabcdfghiklmnopqrstuwx")) != -1) { |
186 |
"1ABCDFGHILNPRSTUVWZabcdefghiklmnopqrstuvwxz")) != -1) { |
183 |
switch (ch) { |
187 |
switch (ch) { |
184 |
/* |
188 |
/* |
185 |
* The -1, -C, -x and -l options all override each other so |
189 |
* The -1, -C, -x and -l options all override each other, |
186 |
* shell aliasing works right. |
190 |
* as do also the -D and -Z options, and the -v and -z |
|
|
191 |
* options so shell aliasing works right. |
187 |
*/ |
192 |
*/ |
188 |
case '1': |
193 |
case '1': |
189 |
f_singlecol = 1; |
194 |
f_singlecol = 1; |
Lines 198-203
Link Here
|
198 |
case 'C': |
203 |
case 'C': |
199 |
f_sortacross = f_longform = f_singlecol = 0; |
204 |
f_sortacross = f_longform = f_singlecol = 0; |
200 |
break; |
205 |
break; |
|
|
206 |
case 'D': |
207 |
f_dirfirstsort = 1; |
208 |
f_dirlastsort = 0; |
209 |
break; |
210 |
case 'V': |
211 |
f_dirfirstsort = 0; |
212 |
f_dirlastsort = 1; |
213 |
break; |
214 |
case 'N': |
215 |
f_dirfirstsort = 0; |
216 |
f_dirlastsort = 0; |
217 |
break; |
218 |
case 'v': |
219 |
f_dirlistonly = 1; |
220 |
f_dirlistnone = 0; |
221 |
break; |
222 |
case 'z': |
223 |
f_dirlistonly = 0; |
224 |
f_dirlistnone = 1; |
225 |
break; |
226 |
case 'e': |
227 |
f_dirlistonly = 0; |
228 |
f_dirlistnone = 0; |
229 |
break; |
201 |
case 'l': |
230 |
case 'l': |
202 |
f_longform = 1; |
231 |
f_longform = 1; |
203 |
f_singlecol = 0; |
232 |
f_singlecol = 0; |
Lines 376-387
Link Here
|
376 |
#endif |
405 |
#endif |
377 |
|
406 |
|
378 |
/* |
407 |
/* |
379 |
* If not -F, -i, -l, -s, -S or -t options, don't require stat |
408 |
* If not -D, -V, -v, -z, -F, -i, -l, -s, -S or -t options, don't |
380 |
* information, unless in color mode in which case we do |
409 |
* require stat information, unless in color mode in which case |
381 |
* need this to determine which colors to display. |
410 |
* we do need this to determine which colors to display. |
382 |
*/ |
411 |
*/ |
383 |
if (!f_inode && !f_longform && !f_size && !f_timesort && |
412 |
if (!f_inode && !f_longform && !f_size && !f_timesort && |
384 |
!f_sizesort && !f_type |
413 |
!f_sizesort && !f_type && !f_dirfirstsort && !f_dirlastsort && |
|
|
414 |
!f_dirlistonly && !f_dirlistnone |
385 |
#ifdef COLORLS |
415 |
#ifdef COLORLS |
386 |
&& !f_color |
416 |
&& !f_color |
387 |
#endif |
417 |
#endif |
Lines 426-431
Link Here
|
426 |
sortfcn = revsizecmp; |
456 |
sortfcn = revsizecmp; |
427 |
else /* Use modification time. */ |
457 |
else /* Use modification time. */ |
428 |
sortfcn = revmodcmp; |
458 |
sortfcn = revmodcmp; |
|
|
459 |
if (f_dirfirstsort) { |
460 |
real_sortfcn = sortfcn; |
461 |
sortfcn = dirfcmp; |
462 |
} else if (f_dirlastsort) { |
463 |
real_sortfcn = sortfcn; |
464 |
sortfcn = revdirfcmp; |
465 |
} |
466 |
|
429 |
} else { |
467 |
} else { |
430 |
if (!f_timesort && !f_sizesort) |
468 |
if (!f_timesort && !f_sizesort) |
431 |
sortfcn = namecmp; |
469 |
sortfcn = namecmp; |
Lines 439-444
Link Here
|
439 |
sortfcn = sizecmp; |
477 |
sortfcn = sizecmp; |
440 |
else /* Use modification time. */ |
478 |
else /* Use modification time. */ |
441 |
sortfcn = modcmp; |
479 |
sortfcn = modcmp; |
|
|
480 |
if (f_dirfirstsort) { |
481 |
real_sortfcn = sortfcn; |
482 |
sortfcn = dirfcmp; |
483 |
} else if (f_dirlastsort) { |
484 |
real_sortfcn = sortfcn; |
485 |
sortfcn = revdirfcmp; |
486 |
} |
487 |
|
442 |
} |
488 |
} |
443 |
|
489 |
|
444 |
/* Select a print function. */ |
490 |
/* Select a print function. */ |
Lines 653-658
Link Here
|
653 |
cur->fts_number = NO_PRINT; |
699 |
cur->fts_number = NO_PRINT; |
654 |
rval = 1; |
700 |
rval = 1; |
655 |
continue; |
701 |
continue; |
|
|
702 |
} |
703 |
/* |
704 |
* Tell to print (only dirs|no dirs) if set |
705 |
*/ |
706 |
if (f_dirlistonly) { |
707 |
if (checkisdir(cur)) { |
708 |
cur->fts_number = NO_PRINT; |
709 |
continue; |
710 |
} |
711 |
} else if (f_dirlistnone) { |
712 |
if (! checkisdir(cur)) { |
713 |
cur->fts_number = NO_PRINT; |
714 |
continue; |
715 |
} |
656 |
} |
716 |
} |
657 |
/* |
717 |
/* |
658 |
* P is NULL if list is the argv list, to which different rules |
718 |
* P is NULL if list is the argv list, to which different rules |