aboutsummaryrefslogtreecommitdiff
path: root/toys/posix/ls.c
AgeCommit message (Collapse)Author
2015-05-18Fix "ls -Z . toys" segfaulting, because preprocessing skipped.Rob Landley
strwidth() got called on ->extra which was NULL. Had some other bad effects ala "ls -sk file1 file2 file3" ignored the -k. This should fix that too.
2015-05-18Recent commit broke ls -R (test reversed), and "ls -R singledir" shouldRob Landley
show label: at the start (yes, even "ls -R" in an empty dir).
2015-05-18More ls -Z upgrading. Move TOYBOX_SELINUX and TOYBOX_SMACK support fromRob Landley
portability.h to new lib/lsm.h. Update ls.c to use it. Fix "ls . toys" (two directories when one is . or ..), which was filtering out the . as something we shouldn't recurse into even though it was explicitly listed on the command line. For some reason "ls -Z . toys" is still segfaulting though (but "ls -Z ." isn't), need to figure out why...
2015-05-13Fix bug (len[7] wasn't zeroed if -Z off, thus -C overestimated entry lengths),Rob Landley
and some cleanups while I was there.
2015-05-10Cleanups of dirtree_start() calls. (Don't need to feed in flag values, justRob Landley
symfollow true/false.)
2015-05-09Add DIRTREE_SHUTUP to disable dirtree warnings if file vanishes out fromRob Landley
under traversal. Pass through full flag set in dirtree_add_node(), add dirtree_start() wrapper to provide symlink-only behavior (avoiding a lot of DIRTREE_SYMFOLLOW*!!(logic) repeated in callers).
2015-05-04Implement SELinux ls -Z support.Elliott Hughes
This patch uses lgetfilecon rather than fgetfilecon because dirtree_parentfd always seems to return -1 in this function. If/when the SMACK code is fixed to work with dirtree_parentfd, I'll send a matching patch for SELinux. In the meantime, this works, and although ls -h is still on my to-do list, I think this patch is sufficient to let us replace toolbox ls with toybox ls.
2015-04-30More ls cleanups from squinting at Jose's most recent smack patch.Rob Landley
Behavior change in flags: allow -long to work together, and -l1 work like -l not -1. I didn't make ls -gCl remember the g, though. (Because -Cg and -gC take the last one: I'll preserve explicit state but not implicit state. And if -1Cl and -lC1 aren't going to behave the same, it wasn't consistent anyway.)
2015-04-30Wild guess at cleaning up smack support. Don't have a test environment yet.Rob Landley
2015-04-29ls: Add -Z (Smack) optionJan Cybulski
Option triggers printing security context, for smack that is file's access smack label. Change-Id: I9054d9bcfe4d149e8fbfa0831b6ab50165d2bd91 Signed-off-by: Jan Cybulski <j.cybulski@samsung.com> Signed-off-by: José Bollo <jose.bollo@open.eurogiciel.org>
2015-04-27Fix ls -s and -i indentation in -C and -x modes. (Spotted by Jan Cybulski.)Rob Landley
2015-03-01Patches from Elliott Hughes to fix various printf() format strings.Rob Landley
(Don't specify the space flag when it's the default behavior. The ifconfig stuff was actual bugs.)
2014-10-30Test for ls -d from Isaac Dunham, and he pointed out -F also disables ↵Rob Landley
symlink following.
2014-10-30Bug report from Isaac Dunham: ls -d shouldn't follow command line symlinks ↵Rob Landley
without -H or -L (just like ls -l).
2014-08-02Missed checking in dirtree_recurse() change (now needs specific ↵Rob Landley
DIRTREE_SYMFOLLOW value, not just true/false).
2014-07-20Don't go into an endless loop if we hit a bad utf8 sequence without -q.Rob Landley
2014-07-20Add utf8 support to ls -C.Rob Landley
Use wcwidth() instead of strlen(), and extend the -q substitution to also whiteout nonprintable characters that are nonparseable utf8 snippets.
2013-09-02Switch ls from utoa to sprintf.Rob Landley
2013-09-01Implement ls --color=auto, suggested by Rich Felker.Rob Landley
2013-08-01ls --color should depend on LS in menuconfig.Rob Landley
2013-07-01Make ls output major, minor for block devices.0.4.5Rob Landley
2013-06-30First pass at ls --colorRob Landley
2013-06-30Condense ls help text.Rob Landley
2013-06-30Fix another segfault in ls -C when terminal size is 0x0.Rob Landley
2013-06-02Stat cleanup.Rob Landley
lib: rename format_mode() to mode_to_string() (echoing string_to_mode), make it take a normal char * argument. stat: collapse big switch/case statements that only have one line each into if/else staircase (much fewer lines of code). Remove return type (other stat implementations print ? for unknown escapes, so do that here). Inline do_stat() and do_statfs(). Set default string in normal local variable "format". Remove unnecessary struct d. Restructure stat logic to "if (flagf && !statfs()) else if (!flagf && !stat()) else perror_msg();" Teach %N to add -> symlink. Judicious use of putchar() instead of xputc to let FILE * do its job collating output.
2013-04-22Add library function for the file permission formatting in ls and statFelix Janda
2012-12-26A screen width of 1 is possible (in some weird setups), and gives ls -C a ↵Rob Landley
division by zero error.
2012-12-06Have dirtree_add_node() set parent so error message can provide full path.Rob Landley
2012-12-01Minor whitespace tweak.Rob Landley
2012-11-26Squash "type punned pointer" nonsense with a bigger hammer. (Sheesh.)Rob Landley
2012-11-19Teach option parsing about [groups] of related options.Rob Landley
2012-11-15Make ls default to -C if no option specified and it's outputting to a tty.Rob Landley
2012-11-13Reindent to two spaces per level. Remove vi: directives that haven't worked ↵Rob Landley
right in years (ubuntu broke its' vim implementation). Remove trailing spaces. Add/remove blank lines. Re-wordwrap in places. Update documentation with new coding style. The actual code should be the same afterward, this is just cosmetic refactoring.
2012-10-08New build infrastructure to generate FLAG_ macros and TT alias, #define ↵Rob Landley
FOR_commandname before #including toys.h to trigger it. Rename DEFINE_GLOBALS() to just GLOBALS() (because I could never remember if it was DECLARE_GLOBALS). Convert existing commands to use new infrastructure, and replace optflag constants with FLAG_ macros where appropriate.
2012-09-06I screwed up ls in commit 580. Oops. Fix it.Rob Landley
2012-08-25Regularize command headers, update links to standards documents.Rob Landley
2012-08-25Move commands into "posix", "lsb", and "other" menus/directories.Rob Landley