Commit Graph

30 Commits

Author SHA1 Message Date
FRIGN
9144d51594 Check getline()-return-values properly
It's not useful when 0 is returned anyway, so be sure that we have a
string with length > 0, this also solves some indexing-gotchas like
"len - 1" and so on.
Also, add checked getline()'s whenever it has been forgotten and
clean up the error-messages.
2015-03-27 14:49:48 +01:00
FRIGN
4af8889396 Audit uniq(1)
Refactor the manpage and small style-changes in uniq.c.
Remove unnecessary "else", we catch argc > 2 earlier already.
2015-03-17 23:59:09 +01:00
Hiltjo Posthuma
78187474cf uniq: optimization: reuse the prevline buffer
don't strdup for each prevline, try to reuse the allocated buffer and if needed
increase it's size.
2015-03-08 14:50:46 +01:00
Hiltjo Posthuma
b2e73936bf uniq: dont use count format if empty 2015-03-07 14:04:04 +01:00
Hiltjo Posthuma
695940d50c uniq: style put main at bottom 2015-03-07 14:02:04 +01:00
Hiltjo Posthuma
4092196fdc uniq: fix argv check
uniq inputfile failed with "extra argument"
2015-03-07 13:29:12 +01:00
Quentin Rameau
7ddaf1d6fe uniq: corrected arg syntax in usage() 2015-02-19 14:57:09 +00:00
FRIGN
31572c8b0e Clean up #includes 2015-02-14 21:12:23 +01:00
Tai Chi Minh Ralph Eastwood
70694a318c uniq: add support for writing output files 2015-02-11 15:26:57 +00:00
sin
17dad35015 uniq: Fix typo in usage 2015-02-11 12:50:39 +00:00
sin
b2370171e6 uniq: Match usage with manpage 2015-02-11 12:21:31 +00:00
sin
5f06185b1b uniq: Fixup program usage and manpage
Remove -i as it is not required by POSIX.  We'll add it if we
hit scripts that require it.
2015-02-11 12:19:38 +00:00
sin
26bc079ecc uniq: Style fix 2015-02-11 12:02:33 +00:00
Tai Chi Minh Ralph Eastwood
bc2310376f uniq: add ascii implementation of -f and -s flags 2015-02-11 10:56:58 +00:00
Evan Gates
84b08427a1 remove agetline 2014-11-18 21:05:28 +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
7fc5856e64 Tweak NULL-pointer checks
Use !p and p when comparing pointers as opposed to explicit
checks against NULL.  This is generally easier to read.
2014-11-14 10:54:30 +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
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
sin
0c5b7b9155 Stop using EXIT_{SUCCESS,FAILURE} 2014-10-02 23:46:59 +01:00
Hiltjo Posthuma
fab4b384e7 use agetline instead of agets
also use agetline where fgets with a static buffer was used previously.

Signed-off-by: Hiltjo Posthuma <hiltjo@codemadness.org>
2014-06-01 18:03:10 +01:00
Hiltjo Posthuma
953ebf3573 code style
Signed-off-by: Hiltjo Posthuma <hiltjo@codemadness.org>
2014-06-01 18:02:30 +01:00
sin
cb005c150d Fix naming covention for uniq(1) 2014-01-20 10:49:28 +00: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
sin
83c2c3d1f5 Add 'not implemented' errors for unimplemented flags
These used to live in TODO but we got rid off them.  Make sure
we keep track of what we want to support by printing a message
when those flags are unimplemented.
2013-10-05 13:51:45 +01: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
Christoph Lohmann
52d39e35c2 The style inquisition on basename. 2013-03-05 21:35:55 +01:00
Robert Ransom
a16f603b20 uniq: Lobotomize for POSIX-subset compatibility
POSIX uniq(1) is required to write to its second argument,
if one is given.
The multiple-input feature I accidentally added might be useful,
but users and scripts who rely on it would be put at risk for data loss
if they ever run into a POSIX uniq(1).
2012-05-21 23:33:36 +00:00
Robert Ransom
85efaad43b uniq: Initial commit 2012-05-21 23:24:28 +00:00