diff options
author | andersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2001-10-24 05:00:29 +0000 |
---|---|---|
committer | andersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2001-10-24 05:00:29 +0000 |
commit | 1e2799601614452a40df7862e6ca180ecb08c04d (patch) | |
tree | 153a573095afac8d8d0ea857759ecabd77fb28b7 /coreutils/ls.c | |
parent | 47f91d1f7fc06cf27e2a6c3c2ada99226ba50cb9 (diff) | |
download | busybox-w32-1e2799601614452a40df7862e6ca180ecb08c04d.tar.gz busybox-w32-1e2799601614452a40df7862e6ca180ecb08c04d.tar.bz2 busybox-w32-1e2799601614452a40df7862e6ca180ecb08c04d.zip |
Major rework of the directory structure and the entire build system.
-Erik
git-svn-id: svn://busybox.net/trunk/busybox@3561 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'coreutils/ls.c')
-rw-r--r-- | coreutils/ls.c | 116 |
1 files changed, 58 insertions, 58 deletions
diff --git a/coreutils/ls.c b/coreutils/ls.c index 8d0282dfe..672a3bb3c 100644 --- a/coreutils/ls.c +++ b/coreutils/ls.c | |||
@@ -65,7 +65,7 @@ enum { | |||
65 | #include <sys/ioctl.h> | 65 | #include <sys/ioctl.h> |
66 | #include "busybox.h" | 66 | #include "busybox.h" |
67 | 67 | ||
68 | #ifdef BB_FEATURE_LS_TIMESTAMPS | 68 | #ifdef CONFIG_FEATURE_LS_TIMESTAMPS |
69 | #include <time.h> | 69 | #include <time.h> |
70 | #endif | 70 | #endif |
71 | 71 | ||
@@ -108,7 +108,7 @@ STYLE_COLUMNS = 3 /* fill columns */ | |||
108 | #define DISP_RECURSIVE (1<<4) /* show directory and everything below it */ | 108 | #define DISP_RECURSIVE (1<<4) /* show directory and everything below it */ |
109 | #define DISP_ROWS (1<<5) /* print across rows */ | 109 | #define DISP_ROWS (1<<5) /* print across rows */ |
110 | 110 | ||
111 | #ifdef BB_FEATURE_LS_SORTFILES | 111 | #ifdef CONFIG_FEATURE_LS_SORTFILES |
112 | /* how will the files be sorted */ | 112 | /* how will the files be sorted */ |
113 | static const int SORT_FORWARD = 0; /* sort in reverse order */ | 113 | static const int SORT_FORWARD = 0; /* sort in reverse order */ |
114 | static const int SORT_REVERSE = 1; /* sort in reverse order */ | 114 | static const int SORT_REVERSE = 1; /* sort in reverse order */ |
@@ -122,7 +122,7 @@ static const int SORT_EXT = 8; /* sort by file name extension */ | |||
122 | static const int SORT_DIR = 9; /* sort by file or directory */ | 122 | static const int SORT_DIR = 9; /* sort by file or directory */ |
123 | #endif | 123 | #endif |
124 | 124 | ||
125 | #ifdef BB_FEATURE_LS_TIMESTAMPS | 125 | #ifdef CONFIG_FEATURE_LS_TIMESTAMPS |
126 | /* which of the three times will be used */ | 126 | /* which of the three times will be used */ |
127 | static const int TIME_MOD = 0; | 127 | static const int TIME_MOD = 0; |
128 | static const int TIME_CHANGE = 1; | 128 | static const int TIME_CHANGE = 1; |
@@ -142,7 +142,7 @@ static const int SPLIT_SUBDIR = 2; | |||
142 | 142 | ||
143 | #define TYPEINDEX(mode) (((mode) >> 12) & 0x0f) | 143 | #define TYPEINDEX(mode) (((mode) >> 12) & 0x0f) |
144 | #define TYPECHAR(mode) ("0pcCd?bB-?l?s???" [TYPEINDEX(mode)]) | 144 | #define TYPECHAR(mode) ("0pcCd?bB-?l?s???" [TYPEINDEX(mode)]) |
145 | #ifdef BB_FEATURE_LS_FILETYPES | 145 | #ifdef CONFIG_FEATURE_LS_FILETYPES |
146 | #define APPCHAR(mode) ("\0|\0\0/\0\0\0\0\0@\0=\0\0\0" [TYPEINDEX(mode)]) | 146 | #define APPCHAR(mode) ("\0|\0\0/\0\0\0\0\0@\0=\0\0\0" [TYPEINDEX(mode)]) |
147 | #endif | 147 | #endif |
148 | 148 | ||
@@ -164,19 +164,19 @@ static int list_single(struct dnode *); | |||
164 | static unsigned int disp_opts; | 164 | static unsigned int disp_opts; |
165 | static unsigned int style_fmt; | 165 | static unsigned int style_fmt; |
166 | static unsigned int list_fmt; | 166 | static unsigned int list_fmt; |
167 | #ifdef BB_FEATURE_LS_SORTFILES | 167 | #ifdef CONFIG_FEATURE_LS_SORTFILES |
168 | static unsigned int sort_opts; | 168 | static unsigned int sort_opts; |
169 | static unsigned int sort_order; | 169 | static unsigned int sort_order; |
170 | #endif | 170 | #endif |
171 | #ifdef BB_FEATURE_LS_TIMESTAMPS | 171 | #ifdef CONFIG_FEATURE_LS_TIMESTAMPS |
172 | static unsigned int time_fmt; | 172 | static unsigned int time_fmt; |
173 | #endif | 173 | #endif |
174 | #ifdef BB_FEATURE_LS_FOLLOWLINKS | 174 | #ifdef CONFIG_FEATURE_LS_FOLLOWLINKS |
175 | static unsigned int follow_links=FALSE; | 175 | static unsigned int follow_links=FALSE; |
176 | #endif | 176 | #endif |
177 | 177 | ||
178 | static unsigned short column = 0; | 178 | static unsigned short column = 0; |
179 | #ifdef BB_FEATURE_AUTOWIDTH | 179 | #ifdef CONFIG_FEATURE_AUTOWIDTH |
180 | static unsigned short terminal_width = TERMINAL_WIDTH; | 180 | static unsigned short terminal_width = TERMINAL_WIDTH; |
181 | static unsigned short column_width = COLUMN_WIDTH; | 181 | static unsigned short column_width = COLUMN_WIDTH; |
182 | static unsigned short tabstops = COLUMN_GAP; | 182 | static unsigned short tabstops = COLUMN_GAP; |
@@ -186,13 +186,13 @@ static unsigned short column_width = COLUMN_WIDTH; | |||
186 | 186 | ||
187 | static int status = EXIT_SUCCESS; | 187 | static int status = EXIT_SUCCESS; |
188 | 188 | ||
189 | #ifdef BB_FEATURE_HUMAN_READABLE | 189 | #ifdef CONFIG_FEATURE_HUMAN_READABLE |
190 | static unsigned long ls_disp_hr = 0; | 190 | static unsigned long ls_disp_hr = 0; |
191 | #endif | 191 | #endif |
192 | 192 | ||
193 | static int my_stat(struct dnode *cur) | 193 | static int my_stat(struct dnode *cur) |
194 | { | 194 | { |
195 | #ifdef BB_FEATURE_LS_FOLLOWLINKS | 195 | #ifdef CONFIG_FEATURE_LS_FOLLOWLINKS |
196 | if (follow_links == TRUE) { | 196 | if (follow_links == TRUE) { |
197 | if (stat(cur->fullname, &cur->dstat)) { | 197 | if (stat(cur->fullname, &cur->dstat)) { |
198 | perror_msg("%s", cur->fullname); | 198 | perror_msg("%s", cur->fullname); |
@@ -222,7 +222,7 @@ static void newline(void) | |||
222 | } | 222 | } |
223 | 223 | ||
224 | /*----------------------------------------------------------------------*/ | 224 | /*----------------------------------------------------------------------*/ |
225 | #ifdef BB_FEATURE_LS_FILETYPES | 225 | #ifdef CONFIG_FEATURE_LS_FILETYPES |
226 | static char append_char(mode_t mode) | 226 | static char append_char(mode_t mode) |
227 | { | 227 | { |
228 | if ( !(list_fmt & LIST_FILETYPE)) | 228 | if ( !(list_fmt & LIST_FILETYPE)) |
@@ -304,7 +304,7 @@ static struct dnode **dnalloc(int num) | |||
304 | return(p); | 304 | return(p); |
305 | } | 305 | } |
306 | 306 | ||
307 | #ifdef BB_FEATURE_LS_RECURSIVE | 307 | #ifdef CONFIG_FEATURE_LS_RECURSIVE |
308 | static void dfree(struct dnode **dnp) | 308 | static void dfree(struct dnode **dnp) |
309 | { | 309 | { |
310 | struct dnode *cur, *next; | 310 | struct dnode *cur, *next; |
@@ -361,7 +361,7 @@ static struct dnode **splitdnarray(struct dnode **dn, int nfiles, int which) | |||
361 | } | 361 | } |
362 | 362 | ||
363 | /*----------------------------------------------------------------------*/ | 363 | /*----------------------------------------------------------------------*/ |
364 | #ifdef BB_FEATURE_LS_SORTFILES | 364 | #ifdef CONFIG_FEATURE_LS_SORTFILES |
365 | static int sortcmp(struct dnode *d1, struct dnode *d2) | 365 | static int sortcmp(struct dnode *d1, struct dnode *d2) |
366 | { | 366 | { |
367 | int cmp, dif; | 367 | int cmp, dif; |
@@ -426,13 +426,13 @@ static void shellsort(struct dnode **dn, int size) | |||
426 | static void showfiles(struct dnode **dn, int nfiles) | 426 | static void showfiles(struct dnode **dn, int nfiles) |
427 | { | 427 | { |
428 | int i, ncols, nrows, row, nc; | 428 | int i, ncols, nrows, row, nc; |
429 | #ifdef BB_FEATURE_AUTOWIDTH | 429 | #ifdef CONFIG_FEATURE_AUTOWIDTH |
430 | int len; | 430 | int len; |
431 | #endif | 431 | #endif |
432 | 432 | ||
433 | if(dn==NULL || nfiles < 1) return; | 433 | if(dn==NULL || nfiles < 1) return; |
434 | 434 | ||
435 | #ifdef BB_FEATURE_AUTOWIDTH | 435 | #ifdef CONFIG_FEATURE_AUTOWIDTH |
436 | /* find the longest file name- use that as the column width */ | 436 | /* find the longest file name- use that as the column width */ |
437 | column_width= 0; | 437 | column_width= 0; |
438 | for (i=0; i<nfiles; i++) { | 438 | for (i=0; i<nfiles; i++) { |
@@ -488,7 +488,7 @@ static void showdirs(struct dnode **dn, int ndirs) | |||
488 | { | 488 | { |
489 | int i, nfiles; | 489 | int i, nfiles; |
490 | struct dnode **subdnp; | 490 | struct dnode **subdnp; |
491 | #ifdef BB_FEATURE_LS_RECURSIVE | 491 | #ifdef CONFIG_FEATURE_LS_RECURSIVE |
492 | int dndirs; | 492 | int dndirs; |
493 | struct dnode **dnd; | 493 | struct dnode **dnd; |
494 | #endif | 494 | #endif |
@@ -503,17 +503,17 @@ static void showdirs(struct dnode **dn, int ndirs) | |||
503 | nfiles= countfiles(subdnp); | 503 | nfiles= countfiles(subdnp); |
504 | if (nfiles > 0) { | 504 | if (nfiles > 0) { |
505 | /* list all files at this level */ | 505 | /* list all files at this level */ |
506 | #ifdef BB_FEATURE_LS_SORTFILES | 506 | #ifdef CONFIG_FEATURE_LS_SORTFILES |
507 | shellsort(subdnp, nfiles); | 507 | shellsort(subdnp, nfiles); |
508 | #endif | 508 | #endif |
509 | showfiles(subdnp, nfiles); | 509 | showfiles(subdnp, nfiles); |
510 | #ifdef BB_FEATURE_LS_RECURSIVE | 510 | #ifdef CONFIG_FEATURE_LS_RECURSIVE |
511 | if (disp_opts & DISP_RECURSIVE) { | 511 | if (disp_opts & DISP_RECURSIVE) { |
512 | /* recursive- list the sub-dirs */ | 512 | /* recursive- list the sub-dirs */ |
513 | dnd= splitdnarray(subdnp, nfiles, SPLIT_SUBDIR); | 513 | dnd= splitdnarray(subdnp, nfiles, SPLIT_SUBDIR); |
514 | dndirs= countsubdirs(subdnp, nfiles); | 514 | dndirs= countsubdirs(subdnp, nfiles); |
515 | if (dndirs > 0) { | 515 | if (dndirs > 0) { |
516 | #ifdef BB_FEATURE_LS_SORTFILES | 516 | #ifdef CONFIG_FEATURE_LS_SORTFILES |
517 | shellsort(dnd, dndirs); | 517 | shellsort(dnd, dndirs); |
518 | #endif | 518 | #endif |
519 | showdirs(dnd, dndirs); | 519 | showdirs(dnd, dndirs); |
@@ -582,26 +582,26 @@ static int list_single(struct dnode *dn) | |||
582 | { | 582 | { |
583 | int i; | 583 | int i; |
584 | char scratch[BUFSIZ + 1]; | 584 | char scratch[BUFSIZ + 1]; |
585 | #ifdef BB_FEATURE_LS_TIMESTAMPS | 585 | #ifdef CONFIG_FEATURE_LS_TIMESTAMPS |
586 | char *filetime; | 586 | char *filetime; |
587 | time_t ttime, age; | 587 | time_t ttime, age; |
588 | #endif | 588 | #endif |
589 | #if defined (BB_FEATURE_LS_FILETYPES) | 589 | #if defined (CONFIG_FEATURE_LS_FILETYPES) |
590 | struct stat info; | 590 | struct stat info; |
591 | #endif | 591 | #endif |
592 | #ifdef BB_FEATURE_LS_FILETYPES | 592 | #ifdef CONFIG_FEATURE_LS_FILETYPES |
593 | char append; | 593 | char append; |
594 | #endif | 594 | #endif |
595 | 595 | ||
596 | if (dn==NULL || dn->fullname==NULL) return(0); | 596 | if (dn==NULL || dn->fullname==NULL) return(0); |
597 | 597 | ||
598 | #ifdef BB_FEATURE_LS_TIMESTAMPS | 598 | #ifdef CONFIG_FEATURE_LS_TIMESTAMPS |
599 | ttime= dn->dstat.st_mtime; /* the default time */ | 599 | ttime= dn->dstat.st_mtime; /* the default time */ |
600 | if (time_fmt & TIME_ACCESS) ttime= dn->dstat.st_atime; | 600 | if (time_fmt & TIME_ACCESS) ttime= dn->dstat.st_atime; |
601 | if (time_fmt & TIME_CHANGE) ttime= dn->dstat.st_ctime; | 601 | if (time_fmt & TIME_CHANGE) ttime= dn->dstat.st_ctime; |
602 | filetime= ctime(&ttime); | 602 | filetime= ctime(&ttime); |
603 | #endif | 603 | #endif |
604 | #ifdef BB_FEATURE_LS_FILETYPES | 604 | #ifdef CONFIG_FEATURE_LS_FILETYPES |
605 | append = append_char(dn->dstat.st_mode); | 605 | append = append_char(dn->dstat.st_mode); |
606 | #endif | 606 | #endif |
607 | 607 | ||
@@ -612,7 +612,7 @@ static int list_single(struct dnode *dn) | |||
612 | column += 8; | 612 | column += 8; |
613 | break; | 613 | break; |
614 | case LIST_BLOCKS: | 614 | case LIST_BLOCKS: |
615 | #ifdef BB_FEATURE_HUMAN_READABLE | 615 | #ifdef CONFIG_FEATURE_HUMAN_READABLE |
616 | fprintf(stdout, "%6s ", make_human_readable_str(dn->dstat.st_blocks>>1, | 616 | fprintf(stdout, "%6s ", make_human_readable_str(dn->dstat.st_blocks>>1, |
617 | KILOBYTE, (ls_disp_hr==TRUE)? 0: KILOBYTE)); | 617 | KILOBYTE, (ls_disp_hr==TRUE)? 0: KILOBYTE)); |
618 | #else | 618 | #else |
@@ -633,7 +633,7 @@ static int list_single(struct dnode *dn) | |||
633 | column += 10; | 633 | column += 10; |
634 | break; | 634 | break; |
635 | case LIST_ID_NAME: | 635 | case LIST_ID_NAME: |
636 | #ifdef BB_FEATURE_LS_USERNAME | 636 | #ifdef CONFIG_FEATURE_LS_USERNAME |
637 | my_getpwuid(scratch, dn->dstat.st_uid); | 637 | my_getpwuid(scratch, dn->dstat.st_uid); |
638 | printf("%-8.8s ", scratch); | 638 | printf("%-8.8s ", scratch); |
639 | my_getgrgid(scratch, dn->dstat.st_gid); | 639 | my_getgrgid(scratch, dn->dstat.st_gid); |
@@ -650,7 +650,7 @@ static int list_single(struct dnode *dn) | |||
650 | if (S_ISBLK(dn->dstat.st_mode) || S_ISCHR(dn->dstat.st_mode)) { | 650 | if (S_ISBLK(dn->dstat.st_mode) || S_ISCHR(dn->dstat.st_mode)) { |
651 | printf("%4d, %3d ", (int)MAJOR(dn->dstat.st_rdev), (int)MINOR(dn->dstat.st_rdev)); | 651 | printf("%4d, %3d ", (int)MAJOR(dn->dstat.st_rdev), (int)MINOR(dn->dstat.st_rdev)); |
652 | } else { | 652 | } else { |
653 | #ifdef BB_FEATURE_HUMAN_READABLE | 653 | #ifdef CONFIG_FEATURE_HUMAN_READABLE |
654 | if (ls_disp_hr==TRUE) { | 654 | if (ls_disp_hr==TRUE) { |
655 | fprintf(stdout, "%8s ", make_human_readable_str(dn->dstat.st_size, 1, 0)); | 655 | fprintf(stdout, "%8s ", make_human_readable_str(dn->dstat.st_size, 1, 0)); |
656 | } else | 656 | } else |
@@ -665,7 +665,7 @@ static int list_single(struct dnode *dn) | |||
665 | } | 665 | } |
666 | column += 10; | 666 | column += 10; |
667 | break; | 667 | break; |
668 | #ifdef BB_FEATURE_LS_TIMESTAMPS | 668 | #ifdef CONFIG_FEATURE_LS_TIMESTAMPS |
669 | case LIST_FULLTIME: | 669 | case LIST_FULLTIME: |
670 | case LIST_DATE_TIME: | 670 | case LIST_DATE_TIME: |
671 | if (list_fmt & LIST_FULLTIME) { | 671 | if (list_fmt & LIST_FULLTIME) { |
@@ -693,7 +693,7 @@ static int list_single(struct dnode *dn) | |||
693 | char *lpath = xreadlink(dn->fullname); | 693 | char *lpath = xreadlink(dn->fullname); |
694 | if (lpath) { | 694 | if (lpath) { |
695 | printf(" -> %s", lpath); | 695 | printf(" -> %s", lpath); |
696 | #ifdef BB_FEATURE_LS_FILETYPES | 696 | #ifdef CONFIG_FEATURE_LS_FILETYPES |
697 | if (!stat(dn->fullname, &info)) { | 697 | if (!stat(dn->fullname, &info)) { |
698 | append = append_char(info.st_mode); | 698 | append = append_char(info.st_mode); |
699 | } | 699 | } |
@@ -703,7 +703,7 @@ static int list_single(struct dnode *dn) | |||
703 | } | 703 | } |
704 | } | 704 | } |
705 | break; | 705 | break; |
706 | #ifdef BB_FEATURE_LS_FILETYPES | 706 | #ifdef CONFIG_FEATURE_LS_FILETYPES |
707 | case LIST_FILETYPE: | 707 | case LIST_FILETYPE: |
708 | if (append != '\0') { | 708 | if (append != '\0') { |
709 | printf("%1c", append); | 709 | printf("%1c", append); |
@@ -727,21 +727,21 @@ extern int ls_main(int argc, char **argv) | |||
727 | int opt; | 727 | int opt; |
728 | int oi, ac; | 728 | int oi, ac; |
729 | char **av; | 729 | char **av; |
730 | #ifdef BB_FEATURE_AUTOWIDTH | 730 | #ifdef CONFIG_FEATURE_AUTOWIDTH |
731 | struct winsize win = { 0, 0, 0, 0 }; | 731 | struct winsize win = { 0, 0, 0, 0 }; |
732 | #endif | 732 | #endif |
733 | 733 | ||
734 | disp_opts= DISP_NORMAL; | 734 | disp_opts= DISP_NORMAL; |
735 | style_fmt= STYLE_AUTO; | 735 | style_fmt= STYLE_AUTO; |
736 | list_fmt= LIST_SHORT; | 736 | list_fmt= LIST_SHORT; |
737 | #ifdef BB_FEATURE_LS_SORTFILES | 737 | #ifdef CONFIG_FEATURE_LS_SORTFILES |
738 | sort_opts= SORT_NAME; | 738 | sort_opts= SORT_NAME; |
739 | sort_order= SORT_FORWARD; | 739 | sort_order= SORT_FORWARD; |
740 | #endif | 740 | #endif |
741 | #ifdef BB_FEATURE_LS_TIMESTAMPS | 741 | #ifdef CONFIG_FEATURE_LS_TIMESTAMPS |
742 | time_fmt= TIME_MOD; | 742 | time_fmt= TIME_MOD; |
743 | #endif | 743 | #endif |
744 | #ifdef BB_FEATURE_AUTOWIDTH | 744 | #ifdef CONFIG_FEATURE_AUTOWIDTH |
745 | ioctl(fileno(stdout), TIOCGWINSZ, &win); | 745 | ioctl(fileno(stdout), TIOCGWINSZ, &win); |
746 | if (win.ws_row > 4) | 746 | if (win.ws_row > 4) |
747 | column_width = win.ws_row - 2; | 747 | column_width = win.ws_row - 2; |
@@ -752,25 +752,25 @@ extern int ls_main(int argc, char **argv) | |||
752 | 752 | ||
753 | /* process options */ | 753 | /* process options */ |
754 | while ((opt = getopt(argc, argv, "1AaCdgilnsx" | 754 | while ((opt = getopt(argc, argv, "1AaCdgilnsx" |
755 | #ifdef BB_FEATURE_AUTOWIDTH | 755 | #ifdef CONFIG_FEATURE_AUTOWIDTH |
756 | "T:w:" | 756 | "T:w:" |
757 | #endif | 757 | #endif |
758 | #ifdef BB_FEATURE_LS_FILETYPES | 758 | #ifdef CONFIG_FEATURE_LS_FILETYPES |
759 | "Fp" | 759 | "Fp" |
760 | #endif | 760 | #endif |
761 | #ifdef BB_FEATURE_LS_RECURSIVE | 761 | #ifdef CONFIG_FEATURE_LS_RECURSIVE |
762 | "R" | 762 | "R" |
763 | #endif | 763 | #endif |
764 | #ifdef BB_FEATURE_LS_SORTFILES | 764 | #ifdef CONFIG_FEATURE_LS_SORTFILES |
765 | "rSvX" | 765 | "rSvX" |
766 | #endif | 766 | #endif |
767 | #ifdef BB_FEATURE_LS_TIMESTAMPS | 767 | #ifdef CONFIG_FEATURE_LS_TIMESTAMPS |
768 | "cetu" | 768 | "cetu" |
769 | #endif | 769 | #endif |
770 | #ifdef BB_FEATURE_LS_FOLLOWLINKS | 770 | #ifdef CONFIG_FEATURE_LS_FOLLOWLINKS |
771 | "L" | 771 | "L" |
772 | #endif | 772 | #endif |
773 | #ifdef BB_FEATURE_HUMAN_READABLE | 773 | #ifdef CONFIG_FEATURE_HUMAN_READABLE |
774 | "h" | 774 | "h" |
775 | #endif | 775 | #endif |
776 | "k")) > 0) { | 776 | "k")) > 0) { |
@@ -785,54 +785,54 @@ extern int ls_main(int argc, char **argv) | |||
785 | case 'l': | 785 | case 'l': |
786 | style_fmt = STYLE_LONG; | 786 | style_fmt = STYLE_LONG; |
787 | list_fmt |= LIST_LONG; | 787 | list_fmt |= LIST_LONG; |
788 | #ifdef BB_FEATURE_HUMAN_READABLE | 788 | #ifdef CONFIG_FEATURE_HUMAN_READABLE |
789 | ls_disp_hr = FALSE; | 789 | ls_disp_hr = FALSE; |
790 | #endif | 790 | #endif |
791 | break; | 791 | break; |
792 | case 'n': list_fmt |= LIST_ID_NUMERIC; break; | 792 | case 'n': list_fmt |= LIST_ID_NUMERIC; break; |
793 | case 's': list_fmt |= LIST_BLOCKS; break; | 793 | case 's': list_fmt |= LIST_BLOCKS; break; |
794 | case 'x': disp_opts = DISP_ROWS; break; | 794 | case 'x': disp_opts = DISP_ROWS; break; |
795 | #ifdef BB_FEATURE_LS_FILETYPES | 795 | #ifdef CONFIG_FEATURE_LS_FILETYPES |
796 | case 'F': list_fmt |= LIST_FILETYPE | LIST_EXEC; break; | 796 | case 'F': list_fmt |= LIST_FILETYPE | LIST_EXEC; break; |
797 | case 'p': list_fmt |= LIST_FILETYPE; break; | 797 | case 'p': list_fmt |= LIST_FILETYPE; break; |
798 | #endif | 798 | #endif |
799 | #ifdef BB_FEATURE_LS_RECURSIVE | 799 | #ifdef CONFIG_FEATURE_LS_RECURSIVE |
800 | case 'R': disp_opts |= DISP_RECURSIVE; break; | 800 | case 'R': disp_opts |= DISP_RECURSIVE; break; |
801 | #endif | 801 | #endif |
802 | #ifdef BB_FEATURE_LS_SORTFILES | 802 | #ifdef CONFIG_FEATURE_LS_SORTFILES |
803 | case 'r': sort_order |= SORT_REVERSE; break; | 803 | case 'r': sort_order |= SORT_REVERSE; break; |
804 | case 'S': sort_opts= SORT_SIZE; break; | 804 | case 'S': sort_opts= SORT_SIZE; break; |
805 | case 'v': sort_opts= SORT_VERSION; break; | 805 | case 'v': sort_opts= SORT_VERSION; break; |
806 | case 'X': sort_opts= SORT_EXT; break; | 806 | case 'X': sort_opts= SORT_EXT; break; |
807 | #endif | 807 | #endif |
808 | #ifdef BB_FEATURE_LS_TIMESTAMPS | 808 | #ifdef CONFIG_FEATURE_LS_TIMESTAMPS |
809 | case 'e': list_fmt |= LIST_FULLTIME; break; | 809 | case 'e': list_fmt |= LIST_FULLTIME; break; |
810 | case 'c': | 810 | case 'c': |
811 | time_fmt = TIME_CHANGE; | 811 | time_fmt = TIME_CHANGE; |
812 | #ifdef BB_FEATURE_LS_SORTFILES | 812 | #ifdef CONFIG_FEATURE_LS_SORTFILES |
813 | sort_opts= SORT_CTIME; | 813 | sort_opts= SORT_CTIME; |
814 | #endif | 814 | #endif |
815 | break; | 815 | break; |
816 | case 'u': | 816 | case 'u': |
817 | time_fmt = TIME_ACCESS; | 817 | time_fmt = TIME_ACCESS; |
818 | #ifdef BB_FEATURE_LS_SORTFILES | 818 | #ifdef CONFIG_FEATURE_LS_SORTFILES |
819 | sort_opts= SORT_ATIME; | 819 | sort_opts= SORT_ATIME; |
820 | #endif | 820 | #endif |
821 | break; | 821 | break; |
822 | case 't': | 822 | case 't': |
823 | #ifdef BB_FEATURE_LS_SORTFILES | 823 | #ifdef CONFIG_FEATURE_LS_SORTFILES |
824 | sort_opts= SORT_MTIME; | 824 | sort_opts= SORT_MTIME; |
825 | #endif | 825 | #endif |
826 | break; | 826 | break; |
827 | #endif | 827 | #endif |
828 | #ifdef BB_FEATURE_LS_FOLLOWLINKS | 828 | #ifdef CONFIG_FEATURE_LS_FOLLOWLINKS |
829 | case 'L': follow_links= TRUE; break; | 829 | case 'L': follow_links= TRUE; break; |
830 | #endif | 830 | #endif |
831 | #ifdef BB_FEATURE_AUTOWIDTH | 831 | #ifdef CONFIG_FEATURE_AUTOWIDTH |
832 | case 'T': tabstops= atoi(optarg); break; | 832 | case 'T': tabstops= atoi(optarg); break; |
833 | case 'w': terminal_width= atoi(optarg); break; | 833 | case 'w': terminal_width= atoi(optarg); break; |
834 | #endif | 834 | #endif |
835 | #ifdef BB_FEATURE_HUMAN_READABLE | 835 | #ifdef CONFIG_FEATURE_HUMAN_READABLE |
836 | case 'h': ls_disp_hr = TRUE; break; | 836 | case 'h': ls_disp_hr = TRUE; break; |
837 | #endif | 837 | #endif |
838 | case 'k': break; | 838 | case 'k': break; |
@@ -842,17 +842,17 @@ extern int ls_main(int argc, char **argv) | |||
842 | } | 842 | } |
843 | 843 | ||
844 | /* sort out which command line options take precedence */ | 844 | /* sort out which command line options take precedence */ |
845 | #ifdef BB_FEATURE_LS_RECURSIVE | 845 | #ifdef CONFIG_FEATURE_LS_RECURSIVE |
846 | if (disp_opts & DISP_NOLIST) | 846 | if (disp_opts & DISP_NOLIST) |
847 | disp_opts &= ~DISP_RECURSIVE; /* no recurse if listing only dir */ | 847 | disp_opts &= ~DISP_RECURSIVE; /* no recurse if listing only dir */ |
848 | #endif | 848 | #endif |
849 | #if defined (BB_FEATURE_LS_TIMESTAMPS) && defined (BB_FEATURE_LS_SORTFILES) | 849 | #if defined (CONFIG_FEATURE_LS_TIMESTAMPS) && defined (CONFIG_FEATURE_LS_SORTFILES) |
850 | if (time_fmt & TIME_CHANGE) sort_opts= SORT_CTIME; | 850 | if (time_fmt & TIME_CHANGE) sort_opts= SORT_CTIME; |
851 | if (time_fmt & TIME_ACCESS) sort_opts= SORT_ATIME; | 851 | if (time_fmt & TIME_ACCESS) sort_opts= SORT_ATIME; |
852 | #endif | 852 | #endif |
853 | if (style_fmt != STYLE_LONG) | 853 | if (style_fmt != STYLE_LONG) |
854 | list_fmt &= ~LIST_ID_NUMERIC; /* numeric uid only for long list */ | 854 | list_fmt &= ~LIST_ID_NUMERIC; /* numeric uid only for long list */ |
855 | #ifdef BB_FEATURE_LS_USERNAME | 855 | #ifdef CONFIG_FEATURE_LS_USERNAME |
856 | if (style_fmt == STYLE_LONG && (list_fmt & LIST_ID_NUMERIC)) | 856 | if (style_fmt == STYLE_LONG && (list_fmt & LIST_ID_NUMERIC)) |
857 | list_fmt &= ~LIST_ID_NAME; /* don't list names if numeric uid */ | 857 | list_fmt &= ~LIST_ID_NAME; /* don't list names if numeric uid */ |
858 | #endif | 858 | #endif |
@@ -908,7 +908,7 @@ extern int ls_main(int argc, char **argv) | |||
908 | 908 | ||
909 | 909 | ||
910 | if (disp_opts & DISP_NOLIST) { | 910 | if (disp_opts & DISP_NOLIST) { |
911 | #ifdef BB_FEATURE_LS_SORTFILES | 911 | #ifdef CONFIG_FEATURE_LS_SORTFILES |
912 | shellsort(dnp, nfiles); | 912 | shellsort(dnp, nfiles); |
913 | #endif | 913 | #endif |
914 | if (nfiles > 0) showfiles(dnp, nfiles); | 914 | if (nfiles > 0) showfiles(dnp, nfiles); |
@@ -918,13 +918,13 @@ extern int ls_main(int argc, char **argv) | |||
918 | dndirs= countdirs(dnp, nfiles); | 918 | dndirs= countdirs(dnp, nfiles); |
919 | dnfiles= nfiles - dndirs; | 919 | dnfiles= nfiles - dndirs; |
920 | if (dnfiles > 0) { | 920 | if (dnfiles > 0) { |
921 | #ifdef BB_FEATURE_LS_SORTFILES | 921 | #ifdef CONFIG_FEATURE_LS_SORTFILES |
922 | shellsort(dnf, dnfiles); | 922 | shellsort(dnf, dnfiles); |
923 | #endif | 923 | #endif |
924 | showfiles(dnf, dnfiles); | 924 | showfiles(dnf, dnfiles); |
925 | } | 925 | } |
926 | if (dndirs > 0) { | 926 | if (dndirs > 0) { |
927 | #ifdef BB_FEATURE_LS_SORTFILES | 927 | #ifdef CONFIG_FEATURE_LS_SORTFILES |
928 | shellsort(dnd, dndirs); | 928 | shellsort(dnd, dndirs); |
929 | #endif | 929 | #endif |
930 | showdirs(dnd, dndirs); | 930 | showdirs(dnd, dndirs); |