diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2009-03-03 13:20:22 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2009-03-03 13:20:22 +0000 |
commit | 11a6f9b44f4a425b03e3a7a984e7b3e253e5f884 (patch) | |
tree | 6b27aba28cdfcab0d8dcd5013513edaa4104fb44 | |
parent | 7886275c982286e69fef12236d119ca39b831cec (diff) | |
download | busybox-w32-11a6f9b44f4a425b03e3a7a984e7b3e253e5f884.tar.gz busybox-w32-11a6f9b44f4a425b03e3a7a984e7b3e253e5f884.tar.bz2 busybox-w32-11a6f9b44f4a425b03e3a7a984e7b3e253e5f884.zip |
ls: do not follow links with -s (closes bug 33),
display unsigned data with %XXu, not %XXd.
-rw-r--r-- | coreutils/ls.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/coreutils/ls.c b/coreutils/ls.c index f4e71bc6a..8aa05507d 100644 --- a/coreutils/ls.c +++ b/coreutils/ls.c | |||
@@ -604,16 +604,16 @@ static int list_single(const struct dnode *dn) | |||
604 | for (i = 0; i <= 31; i++) { | 604 | for (i = 0; i <= 31; i++) { |
605 | switch (all_fmt & (1 << i)) { | 605 | switch (all_fmt & (1 << i)) { |
606 | case LIST_INO: | 606 | case LIST_INO: |
607 | column += printf("%7ld ", (long) dn->dstat.st_ino); | 607 | column += printf("%7lu ", (long) dn->dstat.st_ino); |
608 | break; | 608 | break; |
609 | case LIST_BLOCKS: | 609 | case LIST_BLOCKS: |
610 | column += printf("%4"OFF_FMT"d ", (off_t) dn->dstat.st_blocks >> 1); | 610 | column += printf("%4"OFF_FMT"u ", (off_t) dn->dstat.st_blocks >> 1); |
611 | break; | 611 | break; |
612 | case LIST_MODEBITS: | 612 | case LIST_MODEBITS: |
613 | column += printf("%-10s ", (char *) bb_mode_string(dn->dstat.st_mode)); | 613 | column += printf("%-10s ", (char *) bb_mode_string(dn->dstat.st_mode)); |
614 | break; | 614 | break; |
615 | case LIST_NLINKS: | 615 | case LIST_NLINKS: |
616 | column += printf("%4ld ", (long) dn->dstat.st_nlink); | 616 | column += printf("%4lu ", (long) dn->dstat.st_nlink); |
617 | break; | 617 | break; |
618 | case LIST_ID_NAME: | 618 | case LIST_ID_NAME: |
619 | #if ENABLE_FEATURE_LS_USERNAME | 619 | #if ENABLE_FEATURE_LS_USERNAME |
@@ -624,19 +624,19 @@ static int list_single(const struct dnode *dn) | |||
624 | break; | 624 | break; |
625 | #endif | 625 | #endif |
626 | case LIST_ID_NUMERIC: | 626 | case LIST_ID_NUMERIC: |
627 | column += printf("%-8d %-8d", dn->dstat.st_uid, dn->dstat.st_gid); | 627 | column += printf("%-8u %-8u", dn->dstat.st_uid, dn->dstat.st_gid); |
628 | break; | 628 | break; |
629 | case LIST_SIZE: | 629 | case LIST_SIZE: |
630 | case LIST_DEV: | 630 | case LIST_DEV: |
631 | if (S_ISBLK(dn->dstat.st_mode) || S_ISCHR(dn->dstat.st_mode)) { | 631 | if (S_ISBLK(dn->dstat.st_mode) || S_ISCHR(dn->dstat.st_mode)) { |
632 | column += printf("%4d, %3d ", (int) major(dn->dstat.st_rdev), | 632 | column += printf("%4u, %3u ", (int) major(dn->dstat.st_rdev), |
633 | (int) minor(dn->dstat.st_rdev)); | 633 | (int) minor(dn->dstat.st_rdev)); |
634 | } else { | 634 | } else { |
635 | if (all_fmt & LS_DISP_HR) { | 635 | if (all_fmt & LS_DISP_HR) { |
636 | column += printf("%9s ", | 636 | column += printf("%9s ", |
637 | make_human_readable_str(dn->dstat.st_size, 1, 0)); | 637 | make_human_readable_str(dn->dstat.st_size, 1, 0)); |
638 | } else { | 638 | } else { |
639 | column += printf("%9"OFF_FMT"d ", (off_t) dn->dstat.st_size); | 639 | column += printf("%9"OFF_FMT"u ", (off_t) dn->dstat.st_size); |
640 | } | 640 | } |
641 | } | 641 | } |
642 | break; | 642 | break; |
@@ -683,7 +683,7 @@ static int list_single(const struct dnode *dn) | |||
683 | errno = 0; | 683 | errno = 0; |
684 | #if ENABLE_FEATURE_LS_COLOR | 684 | #if ENABLE_FEATURE_LS_COLOR |
685 | if (show_color && !lstat(dn->fullname, &info)) { | 685 | if (show_color && !lstat(dn->fullname, &info)) { |
686 | printf("\033[%d;%dm", bgcolor(info.st_mode), | 686 | printf("\033[%u;%um", bgcolor(info.st_mode), |
687 | fgcolor(info.st_mode)); | 687 | fgcolor(info.st_mode)); |
688 | } | 688 | } |
689 | #endif | 689 | #endif |
@@ -710,7 +710,7 @@ static int list_single(const struct dnode *dn) | |||
710 | #if ENABLE_FEATURE_LS_COLOR | 710 | #if ENABLE_FEATURE_LS_COLOR |
711 | if (show_color) { | 711 | if (show_color) { |
712 | errno = 0; | 712 | errno = 0; |
713 | printf("\033[%d;%dm", bgcolor(info.st_mode), | 713 | printf("\033[%u;%um", bgcolor(info.st_mode), |
714 | fgcolor(info.st_mode)); | 714 | fgcolor(info.st_mode)); |
715 | } | 715 | } |
716 | #endif | 716 | #endif |
@@ -932,8 +932,8 @@ int ls_main(int argc UNUSED_PARAM, char **argv) | |||
932 | dn = NULL; | 932 | dn = NULL; |
933 | nfiles = 0; | 933 | nfiles = 0; |
934 | do { | 934 | do { |
935 | /* ls w/o -l follows links on command line */ | 935 | /* NB: follow links on command line unless -l or -s */ |
936 | cur = my_stat(*argv, *argv, !(all_fmt & STYLE_LONG)); | 936 | cur = my_stat(*argv, *argv, !(all_fmt & (STYLE_LONG|LIST_BLOCKS))); |
937 | argv++; | 937 | argv++; |
938 | if (!cur) | 938 | if (!cur) |
939 | continue; | 939 | continue; |