Commit Graph

48 Commits

Author SHA1 Message Date
Tai Chi Minh Ralph Eastwood
dacd523ec1 ls: add support for -R flag 2015-02-21 11:46:04 +00:00
sin
9c30fbf018 Add ls -A implementation
Thanks joshua@cubesolving.com!
2015-02-21 09:31:01 +00:00
Quentin Rameau
51b707e91e ls: add support for -p 2015-02-19 18:52:13 +00:00
sin
e635760742 Fix ls when -q is not set
Use strdup() unconditionally.
2015-02-18 16:48:07 +00:00
sin
d40333e702 Fix ls -q UTF-8 parsing
Thanks FRIGN for the input.
2015-02-18 16:43:18 +00:00
sin
2a3f82a5cd Implement -u support for ls(1) 2015-02-18 16:29:46 +00:00
sin
9bd094193d Simplify ls -q implementation 2015-02-18 15:55:57 +00:00
FRIGN
6b719faade Add q-flag to ls(1)
of course, UTF-8-aware. ;)
2015-02-17 18:59:01 +01:00
FRIGN
bec3c32dbd Refactor ls(1) 2015-02-16 19:20:06 +01:00
FRIGN
31572c8b0e Clean up #includes 2015-02-14 21:12:23 +01:00
sin
dc70eb7976 ls: Implement -c and update manpage
Update usage + README as well.  Apparently some of the options (
-H and -L) had already been implemented but not reflected in the
program usage line.
2015-01-20 16:50:37 +00:00
sin
bb59d2eb34 ls: No need to set errno to zero
Consider the following code:

pw = getpwuid(uid);
if (!pw) {
	if (errno)
		...
	else
		...
}

If the entry was not found then as per POSIX errno is not set
because that is not considered to be a failing condition.  errno
is only set if an internal error occurred.

If errno happened to be non-zero before the getpwuid() call
because of a previous error then we'll report a bogus error.

In this case, we have to set errno to zero before the call to
getpwuid().

However in ls(1) we only really care if the password entry was found
and we do not report any errors so setting errno to 0 is not necessary.
2014-12-22 11:28:20 +00:00
Hiltjo Posthuma
32651cb2da ls: getpwuid, getgrgid, use return code of NULL is an error, not errno 2014-12-22 11:28:20 +00:00
Michael Forney
573ef00c91 ls: Always leave room for the NULL byte in the link target
Otherwise, if the length of the link target is the same as BUFSIZ, we
will try to write past the end of buf.
2014-12-08 10:02:28 +00:00
Michael Forney
46ea55a258 ls: Handle symlinks to directories properly
Also, implement the -H and -L options.
2014-12-08 10:02:09 +00:00
FRIGN
1436518f9d Use < 0 instead of == -1 2014-11-19 20:09:29 +00:00
FRIGN
e17b9cdd0a Convert codebase to use emalloc.c utility-functions
This also definitely increases readability and makes OOM-conditions
more consistent.
2014-11-16 10:22:39 +00:00
FRIGN
ec8246bbc6 Un-boolify sbase
It actually makes the binaries smaller, the code easier to read
(gems like "val == true", "val == false" are gone) and actually
predictable in the sense of that we actually know what we're
working with (one bitwise operator was quite adventurous and
should now be fixed).

This is also more consistent with the other suckless projects
around which don't use boolean types.
2014-11-14 10:54:20 +00:00
FRIGN
7d2683ddf2 Sort includes and more cleanup and fixes in util/ 2014-11-14 10:54:10 +00:00
FRIGN
eee98ed3a4 Fix coding style
It was about damn time. Consistency is very important in such a
big codebase.
2014-11-13 18:08:43 +00:00
Hiltjo Posthuma
4d4e2608c1 ls: add -h flag
for util/human don't show "B" for bytes.
2014-10-19 12:54:19 +01:00
sin
0c5b7b9155 Stop using EXIT_{SUCCESS,FAILURE} 2014-10-02 23:46:59 +01:00
Hiltjo Posthuma
35959cd1c4 ls: improve default format
truncate username and group for better alignment for now. in the future
better tabular printing will be implemented.
2014-07-21 16:44:15 +01:00
Hiltjo Posthuma
7fdbdd0770 ls: add -1 for compatibility (ignore) 2014-07-05 16:26:27 +01:00
Hiltjo Posthuma
953ebf3573 code style
Signed-off-by: Hiltjo Posthuma <hiltjo@codemadness.org>
2014-06-01 18:02:30 +01:00
sin
e3c62682ff Don't bail out if the username/group name does not exist in ls(1) 2014-04-05 20:23:40 +01:00
Daniel Bainton
080db637f8 Add the -F flag to ls 2014-02-18 12:54:16 +00:00
Markus Wichmann
a55cc8c95e Make chmod and ls recognize sticky bit (S_ISVTX). 2013-10-20 10:41:32 +01:00
sin
b5a511dacf Exit with EXIT_SUCCESS/EXIT_FAILURE instead of 0 and 1
Fixed for consistency purposes.
2013-10-07 16:44:22 +01:00
Markus Teich
952fa19362 ls: rework implementation for reversing the sort order
Update the usage line as well.
2013-10-06 19:57:21 +01:00
Markus Teich
3a3cd24092 ls: add option to reverse the sort order
Now you can list directory contents ordered by mtime with the
latest file displayed last in the output.
2013-10-05 14:58:55 +01:00
sin
8c87c20054 Implement -i support for ls 2013-10-05 13:51:45 +01:00
sin
582511d57b Fix some warnings about strcpy() etc. on OpenBSD 2013-10-05 13:50:57 +01:00
David Galos
cd1526715f Opimizing tar, adding U flag 2013-07-18 15:14:53 -04:00
stateless
7216a53a7e Remove unnecessary exit(1) in usage()
Signed-off-by: Christoph Lohmann <20h@r-36.net>
2013-06-19 19:58:19 +02:00
Christoph Lohmann
4d38f60685 Eliminating the getopt disgrace. 2013-06-14 20:20:47 +02:00
anonymous
4192b13768 ls: allocate proper space for args 2012-01-19 00:04:04 +00:00
Connor Lane Smith
c2d89afa16 ls: sort argv 2011-06-16 01:13:46 +01:00
Connor Lane Smith
ff97891dad add fold 2011-06-08 21:30:33 +01:00
Connor Lane Smith
ad16c666dc ls: show symlinks 2011-06-04 12:40:05 +01:00
Connor Lane Smith
d90ced2047 consistent error check 2011-06-04 12:20:41 +01:00
Connor Lane Smith
3172b979dc pwd -LP 2011-05-28 15:37:42 +01:00
Connor Lane Smith
0a3a8c55e4 ls cleanup 2011-05-27 23:56:43 +01:00
Connor Lane Smith
0236550c77 no strdup 2011-05-26 06:39:12 +01:00
Connor Lane Smith
6c7f288bd8 separate dirs 2011-05-26 05:03:37 +01:00
Connor Lane Smith
217e9bce9c buf -> cwd 2011-05-26 04:17:06 +01:00
Connor Lane Smith
8be2afd2c3 cleanup ls 2011-05-26 04:12:49 +01:00
Connor Lane Smith
6ef3d9174b add ls; simpler pwd 2011-05-26 04:01:20 +01:00