Commit Graph

24 Commits

Author SHA1 Message Date
FRIGN 3725d501b3 Audit split(1)
1) Refactor manpage, add STANDARDS section.
2) Boolean-style-changes.
3) Update usage, reflecting num-idiom also changed in the manpage.
4) Refactor error messages.
5) Also fclose stdin.
6) Empty line before return.
2015-03-17 22:59:48 +01:00
FRIGN 93fd817536 Add estrlcat() and estrlcpy()
It has become a common idiom in sbase to check strlcat() and strlcpy()
using

if (strl{cat, cpy}(dst, src, siz) >= siz)
        eprintf("path too long\n");

However, this was not carried out consistently and to this very day,
some tools employed unchecked calls to these functions, effectively
allowing silent truncations to happen, which in turn may lead to
security issues.
To finally put an end to this, the e*-functions detect truncation
automatically and the caller can lean back and enjoy coding without
trouble. :)
2015-03-17 11:24:49 +01:00
Hiltjo Posthuma 0c17cd0fb3 staticize some functions 2015-03-07 13:33:39 +01:00
FRIGN 31572c8b0e Clean up #includes 2015-02-14 21:12:23 +01:00
Hiltjo Posthuma 949f930280 split: fixes
- -b argument required, don't allow -b <= 0.
- -l argument required, don't allow -l <= 0.
- usage() and argument parsing: sort flags.
- don't write 0 size file, get rid of goto reproducable with:
  printf 'a' | split -b 1.
- close FILE *in if != stdin.
- mark split as finished in README.
- codestyle fixes.
2015-02-01 16:30:12 +01:00
FRIGN 27b770c02c Adjust some limits to more flexibility for strtonum 2015-02-01 01:24:03 +01:00
FRIGN fd562481f3 Convert estrto{l, ul} to estrtonum
Enough with this insanity!
2015-01-30 16:52:44 +01:00
FRIGN 1436518f9d Use < 0 instead of == -1 2014-11-19 20:09:29 +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 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
sin 0c5b7b9155 Stop using EXIT_{SUCCESS,FAILURE} 2014-10-02 23:46:59 +01:00
sin b712ef44ad Fix warning 'array subscript of type char' 2014-09-02 13:32:32 +01:00
Hiltjo Posthuma 5b3a0a9382 build warnings: initialise values...
... to make fix gcc warnings with -Wall.

Signed-off-by: Hiltjo Posthuma <hiltjo@codemadness.org>
2014-05-12 12:06:14 +01:00
dwts 575b38391c keep usage definition above main 2014-04-22 13:46:33 +01:00
sin 02d91696b4 Fix char **argv to char *argv[] 2014-04-18 11:54:44 +01:00
Hiltjo Posthuma bd9a81951f split: dont use table lookup for size
Signed-off-by: Hiltjo Posthuma <hiltjo@codemadness.org>
2014-04-01 16:20:52 +01:00
Hiltjo Posthuma f7403ce6c6 style: whitespace fixes
Signed-off-by: Hiltjo Posthuma <hiltjo@codemadness.org>
2014-04-01 16:20:43 +01:00
sin a6ef67cd3d Use strlcpy() 2014-03-23 18:33:45 +00:00
sin b1b225c9ee No need to print the name of the program
The name is printed automatically.  Add some missing newlines
as well.
2014-01-30 14:55:18 +00:00
sin 5b5f062184 Add license file details at top of files 2013-10-07 17:03:34 +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
David Galos 9f8deb4b23 Tar compiles on BSD, thanks Roberto E. Vargas Caballero. Also remove tons of trailing whitespace. 2013-07-20 01:27:42 -04:00
Christoph Lohmann 9df408f8c6 Adding who, chroot, env and split.
Thanks "Galos, David" <galosd83@students.rowan.edu>!
2013-06-14 18:55:25 +02:00