aboutsummaryrefslogtreecommitdiff
path: root/coreutils/ls.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* ls: fix support for long options when FEATURE_LS_COLOR is deselectedLaurent Bercot2017-05-261-6/+8
| | | | | | | | | | | Declaration of ls_longopts and initialization of applet_long_options were incorrectly guarded with ENABLE_FEATURE_LS_COLOR; that yielded a "ls: NO_OPT: \xff" error message when long options were selected and color support was not. This patch ensures long options are initialized separately from color support. Signed-off-by: Laurent Bercot <ska-dietlibc@skarnet.org> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ftpd/ls: show directories firstDenys Vlasenko2017-01-251-1/+6
| | | | | | | | | | Old TODO finally done function old new delta ls_main 548 568 +20 packed_usage 31116 31097 -19 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ls: convert DISP_DIRNAME to a bool variableDenys Vlasenko2017-01-231-9/+3
| | | | | | | function old new delta ls_main 553 548 -5 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ls: get rid of opt_flags[], handle -l1c through option_mask32Denys Vlasenko2017-01-231-67/+33
| | | | | | | | | | | | function old new delta display_single 885 888 +3 scan_and_display_dirs_recur 496 486 -10 opt_flags 11 - -11 ls_main 618 553 -65 ------------------------------------------------------------------------------ (add/remove: 0/1 grow/shrink: 1/2 up/down: 3/-86) Total: -83 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ls: handle -x through option_mask32, remove default -C from --helpDenys Vlasenko2017-01-231-8/+7
| | | | | | | function old new delta packed_usage 31024 31002 -22 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ls: handle -d and -R through option_mask32Denys Vlasenko2017-01-231-29/+17
| | | | | | | | | | | | | | | function old new delta scan_and_display_dirs_recur 545 550 +5 display_single 1039 1044 +5 append_char 67 68 +1 display_files 399 396 -3 ls_main 736 717 -19 opt_flags 68 11 -57 .rodata 168864 168784 -80 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 3/4 up/down: 11/-159) Total: -148 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ls: handle -p and -F through option_mask32Denys Vlasenko2017-01-231-18/+16
| | | | | | | | | | | | | function old new delta display_single 1039 1044 +5 append_char 67 68 +1 display_files 399 396 -3 scan_and_display_dirs_recur 545 541 -4 ls_main 736 722 -14 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/3 up/down: 6/-21) Total: -15 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ls: LIST_ID_NAME/ID_NUMERIC/LOPT/LONG are the same, merge as LONGDenys Vlasenko2017-01-231-43/+36
| | | | | | | | | | | | | Also, handle -n and --full-time using option_mask32 function old new delta scan_and_display_dirs_recur 548 545 -3 display_single 1053 1039 -14 ls_main 777 736 -41 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/3 up/down: 0/-58) Total: -58 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ls: make -Z output compatible with GNU coreutils 8.25Denys Vlasenko2017-01-231-19/+24
| | | | | | | | | | | | | | | | This also makes it clear that LIST_MODEBITS == LIST_LOPT function old new delta ls_main 752 777 +25 display_files 400 399 -1 display_single 1055 1053 -2 my_stat 320 317 -3 packed_usage 32311 32280 -31 .rodata 168895 168864 -31 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/5 up/down: 25/-68) Total: -43 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ls: LIST_NLINKS/SIZE/DATE_TIME/SYMLINK are always the same, merge as LIST_LOPTDenys Vlasenko2017-01-231-34/+30
| | | | | | | | | | | | | They are always set and cleared together function old new delta append_char 69 68 -1 display_single 910 908 -2 ls_main 677 664 -13 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/3 up/down: 0/-16) Total: -16 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ls: handle -s through option_mask32Denys Vlasenko2017-01-231-16/+16
| | | | | | | | | function old new delta scan_and_display_dirs_recur 493 494 +1 sort_and_display_files 424 423 -1 ls_main 682 677 -5 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ls: handle -i through option_mask32Denys Vlasenko2017-01-231-6/+5
| | | | | | | function old new delta sort_and_display_files 420 424 +4 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ls: handle -a and -A through option_mask32Denys Vlasenko2017-01-231-12/+10
| | | | | | | function old new delta ls_main 685 682 -3 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ls: handle all sort options through option_mask32Denys Vlasenko2017-01-231-71/+42
| | | | | | | | | | | | | | | function old new delta packed_usage 31007 31024 +17 my_stat 318 324 +6 sort_and_display_files 419 420 +1 print_name 216 217 +1 sortcmp 228 216 -12 opt_flags 96 64 -32 ls_main 732 685 -47 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 4/3 up/down: 25/-91) Total: -66 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ls: -1 should be ignored by -l (and options which imply -l)Denys Vlasenko2017-01-221-12/+12
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ls: more correct handling of -c, -uDenys Vlasenko2017-01-221-59/+50
| | | | | | | | | | | | | function old new delta my_stat 302 318 +16 packed_usage 30977 30969 -8 display_single 928 910 -18 sortcmp 258 228 -30 ls_main 776 732 -44 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/4 up/down: 16/-100) Total: -84 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ls: replace -e with --full-time, add --group-directories-first, delete -KDenys Vlasenko2017-01-221-56/+74
| | | | | | | | | | | | | | | | | -K and -e were non-standard function old new delta static.ls_longopts 9 47 +38 ls_main 748 776 +28 display_single 901 928 +27 sortcmp 254 258 +4 ls_options 32 31 -1 opt_flags 100 96 -4 packed_usage 31032 30977 -55 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 4/3 up/down: 97/-60) Total: 37 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Move FEATURE_AUTOWIDTH config option to two applets which use itDenys Vlasenko2017-01-111-11/+16
| | | | | | No code changes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Big cleanup in config help and descriptionDenys Vlasenko2017-01-101-6/+0
| | | | | | | | | | | | | Redundant help texts (one which only repeats the description) are deleted. Descriptions and help texts are trimmed. Some config options are moved, even across menus. No config option _names_ are changed. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Convert all coreutils/* applets to "new style" applet definitionsDenys Vlasenko2016-11-231-1/+69
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* *: add most of the required setup_common_bufsiz() callsDenys Vlasenko2016-04-211-0/+1
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* libbb: make bb_common_bufsiz1 1 kbyte, add capability to use bss tail for itDenys Vlasenko2016-04-211-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The config item is FEATURE_USE_BSS_TAIL. When it is off (default): function old new delta read_config 210 228 +18 doCommands 2279 2294 +15 ipneigh_list_or_flush 763 772 +9 ipaddr_list_or_flush 1256 1261 +5 display_process_list 1301 1306 +5 conspy_main 1378 1383 +5 do_lzo_compress 352 355 +3 do_lzo_decompress 565 567 +2 push 46 44 -2 inetd_main 2136 2134 -2 uevent_main 421 418 -3 addLines 97 92 -5 bb_common_bufsiz1 8193 1024 -7169 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 8/5 up/down: 62/-7181) Total: -7119 bytes text data bss dec hex filename 829850 4086 9080 843016 cdd08 busybox_old 829901 4086 1904 835891 cc133 busybox_unstripped FEATURE_USE_BSS_TAIL=y: read_config 210 228 +18 doCommands 2279 2294 +15 ipneigh_list_or_flush 763 772 +9 ipaddr_list_or_flush 1256 1261 +5 display_process_list 1301 1306 +5 conspy_main 1378 1383 +5 do_lzo_compress 352 355 +3 do_lzo_decompress 565 567 +2 inetd_main 2136 2134 -2 bb_common_bufsiz1 8193 - -8193 ------------------------------------------------------------------------------ (add/remove: 0/1 grow/shrink: 8/1 up/down: 62/-8195) Total: -8133 bytes text data bss dec hex filename 829850 4086 9080 843016 cdd08 busybox_old 829911 4086 880 834877 cbd3d busybox_unstripped FIXME: setup_common_bufsiz() calls are missing. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ls: fix columnar output. Closes 8731Denys Vlasenko2016-03-061-3/+3
| | | | | | | | | | | | In coreutils/ls.c, 1.19 introduced commit 2f7d9e8903029b1b5e51a15f9cb0dcb6ca17c3ac, removing the variable tabstops and hard coding the column separation to 2 characters, but was not done correctly. The column_width assumes a gap of 1 character, so the computed number of columns exceeds the terminal width when many small files are encountered. A minor problem but surprisingly annoying. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* libbb: factor out code which queries screen widthDenys Vlasenko2015-10-231-1/+1
| | | | | | | | | | | | | | | | function old new delta get_terminal_width - 17 +17 stty_main 1196 1197 +1 pstree_main 321 319 -2 ls_main 735 731 -4 watch_main 232 225 -7 bb_progress_update 714 706 -8 ps_main 555 543 -12 run_applet_and_exit 708 695 -13 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 1/6 up/down: 18/-46) Total: -28 byte Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ls: heed compiler warningDenys Vlasenko2015-02-231-1/+1
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ls: trivial code shrinkDenys Vlasenko2015-02-181-5/+5
| | | | | | | function old new delta display_single 914 893 -21 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ls: fix year 9999 bug :)Denys Vlasenko2015-02-161-5/+8
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ls: make "ls -s DIR" show total too. Clases 4946Denys Vlasenko2014-02-271-1/+1
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* whitespace fixes. no code changesDenys Vlasenko2013-01-141-2/+2
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* randomconfig fixesDenys Vlasenko2011-08-101-2/+2
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ls: fix HAVE_STRVERSCMP check; add check for older uclibc versionsDenys Vlasenko2011-06-211-1/+1
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Add HAVE_STRVERSCMP, guard the only usage of strverscmp with #ifdefDenys Vlasenko2011-06-211-0/+2
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ls: fix comment about -p (it's compatible now)Denys Vlasenko2011-06-131-4/+3
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ls: make -v and -X actually work as intendedDenys Vlasenko2011-06-131-7/+15
| | | | | | | | | | function old new delta strverscmp - 236 +236 sortcmp 186 254 +68 static.result_type - 60 +60 static.next_state 12 16 +4 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* *: remove "Options:" string from help textsDenys Vlasenko2011-06-051-1/+0
| | | | | | | function old new delta packed_usage 28706 28623 -83 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ls: code shrinkDenys Vlasenko2011-05-131-7/+11
| | | | | | | | | | | | function old new delta sort_and_display_files - 427 +427 scan_and_display_dirs_recur 497 488 -9 ls_main 765 735 -30 display_files 422 - -422 ------------------------------------------------------------------------------ (add/remove: 1/1 grow/shrink: 0/2 up/down: 427/-461) Total: -34 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ls: reorder and rename functions. No code changesDenys Vlasenko2011-05-131-238/+240
| | | | | | | | | | | | | | function old new delta display_single - 931 +931 scan_and_display_dirs_recur - 497 +497 display_files - 422 +422 showfiles 422 - -422 showdirs 497 - -497 list_single 931 - -931 ------------------------------------------------------------------------------ (add/remove: 3/3 grow/shrink: 0/0 up/down: 1850/-1850) Total: 0 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ls: reduce memory consumption and speed up (don't do redundant [l]stat)Denys Vlasenko2011-05-131-158/+210
| | | | | | | | | | | | function old new delta my_stat 110 278 +168 splitdnarray 120 118 -2 ls_main 769 765 -4 list_single 961 931 -30 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/3 up/down: 168/-36) Total: 132 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ls: avoid forward declaration. No code changesDenys Vlasenko2011-05-131-45/+43
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ls: code shrinkDenys Vlasenko2011-05-131-32/+21
| | | | | | | function old new delta list_single 990 961 -29 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ls: fix help text: -w N is optionalDenys Vlasenko2011-05-121-1/+1
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ls: fix -p help text, improve comments and define namesDenys Vlasenko2011-05-121-11/+11
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ls: better help text for -a and -ADenys Vlasenko2011-04-031-7/+7
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ls: fix handling of symlinks by option -1Denys Vlasenko2011-03-121-2/+4
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ls: widen -s (1k blocks) column from 4 to 6Denys Vlasenko2011-03-011-1/+2
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ls: -g implies -lDenys Vlasenko2011-02-281-5/+10
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ls: fix bits for -T, -w and --color; make -n imply -l; fix commentsDenys Vlasenko2011-02-281-25/+20
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ls: fix one-bit-off which caused -H to behave as -hDenys Vlasenko2011-02-271-1/+1
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ls: remove redundant constants LIST_FILENAME and LIST_SHORTJames Youngman2010-12-201-47/+44
| | | | | | | LIST_FILENAME is always true and LIST_SHORT affects nothing. Signed-off-by: James Youngman <jay@gnu.org> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ls: add support for -HDenys Vlasenko2010-12-191-73/+86
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>