Commit Graph

1238 Commits

Author SHA1 Message Date
FRIGN
352eedff58 No need to check for stdin on fclose()
as we are not trying to read from it afterwards.
2015-02-07 21:42:41 +01:00
FRIGN
cb1b5d532b Handle stdin properly in cmp(1) and remove path comparison
Same paths are undefined behaviour, let's not endorse it.
2015-02-07 21:36:36 +01:00
FRIGN
d756dca999 Reuse 'n' in cmp(1)
Factors out one more local variable.
2015-02-07 21:13:54 +01:00
FRIGN
79e45395e5 Refactor cmp(1) code and manpage
The algorithm had some areas which had potential for improvement.
This should make cmp(1) faster.
There have been changes to behaviour as well:

1) If argv[0] and argv[1] are the same, cmp(1) returns Same.
2) POSIX specifies the format of the difference-message to be:
      "%s %s differ: char %d, line %d\n", file1, file2,
      <byte number>, <line number>
   However, as cmp(1) operates on bytes, not characters, I changed
   it to
      "%s %s differ: byte %d, line %d\n", file1, file2,
      <byte number>, <line number>
   This is one example where the standard just keeps the old format
   for backwards-compatibility. As this is harmful, this change
   makes sense in the sense of consistentcy (and because we take
   the difference of char and byte very seriously in sbase, as
   opposed to GNU coreutils).

The manpage has been annotated, reflecting the second change, and
sections shortened where possible.
Thus I marked cmp(1) as finished in README.
2015-02-07 21:05:33 +01:00
FRIGN
d5d686e9f6 tr : Revert 97c5986146
This was no typo.
2015-02-07 18:09:04 +01:00
sin
39802832af wc: Make output POSIX compliant 2015-02-06 19:46:45 +00:00
sin
0c8fe5d19b wc: Report exit status properly 2015-02-06 19:11:33 +00:00
Hiltjo Posthuma
3b4a366ffd xargs.1: dont justify text, remove " " 2015-02-06 15:43:46 +01:00
Hiltjo Posthuma
e57c3505cc cron.1: path macro for /etc/crontab 2015-02-06 15:43:23 +01:00
Hiltjo Posthuma
97c5986146 tr: small typo 2015-02-06 15:43:07 +01:00
Eon S. Jeon
6b93b14fba support llvm-ar
llvm-ar doesn't understand flags prefixed with dashes.
2015-02-03 10:08:26 +00:00
FRIGN
ff0347e391 Fix tr(1) behaviour in special cases and be stricter about stuff 2015-02-02 19:59:41 +01:00
FRIGN
f9d9672326 Fix segmentation fault in tr(1) with -dc and one set 2015-02-02 17:58:16 +01:00
Jakob Kramer
fdcfbba96c sort: minor manual page adjustments 2015-02-01 21:46:58 +01:00
Hiltjo Posthuma
96fc8383cd man pages: fix some typos 2015-02-01 21:28:17 +01:00
Hiltjo Posthuma
22f4e05b5b man pages: improve consistency 2015-02-01 20:52:28 +01:00
Hiltjo Posthuma
a986e4bbd5 basename: make usage line the same as the man page 2015-02-01 19:26:49 +01:00
Hiltjo Posthuma
d0d852dd42 sort.1: fix warning 2015-02-01 19:02:48 +01:00
Jakob Kramer
331b2729d5 sort manpage: fix key definition 2015-02-01 17:49:02 +00:00
sin
2f6ffc9ec9 No need to specify "rb" and "wb" in fopen, use "r" and "w" 2015-02-01 15:55:30 +00:00
Hiltjo Posthuma
66e1bbccf3 Makefile: stricter regex replace for sbase VERSION 2015-02-01 16:33:46 +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
sin
5552db75ba Don't call var "read" 2015-02-01 10:22:11 +00:00
FRIGN
22f40b5a03 Add explicit boundary to loop in readrune()
You never know what could happen. Better have a "blind" read than
a segmentation fault.
2015-02-01 04:20:02 +01:00
FRIGN
986a9de51a Add even stricter UTF-8-support to wc(1)
using readrune() and iswspace().
musl for instance doesn't differentiate between iswspace() and
isspace(), but when it does, the code will be ready.
It goes without saying that GNU coreutils don't use iswspace()[0].

[0]: http://git.savannah.gnu.org/gitweb/?p=coreutils.git;a=blob;f=src/wc.c
2015-02-01 04:06:06 +01:00
FRIGN
696bb992c3 Return number of bytes read even on a partial read
and set the rune to Runeerror for later checking (if desired).
2015-02-01 03:54:56 +01:00
FRIGN
f2e6af7350 Return number of bytes read in readrune()
Could be useful in some cases...
2015-02-01 03:43:54 +01:00
FRIGN
8ab096d2a4 Finish up wc(1)
Use size_t for all counts, fix the manpage and refactor the code.
Here's yet another place where GNU coreutils fail:

sbase:
$ echo "GNU/Turd sucks" | wc -cm
    15

coreutils:
$ echo "GNU/Turd sucks" | wc -cm
     15      15

Take a bloody guess which behaviour is correct[0].

[0]: http://pubs.opengroup.org/onlinepubs/009604499/utilities/wc.html
2015-02-01 03:01:11 +01:00
sin
d75cc2e556 POSIX doesn't specify yes(1) so mark it as such in README 2015-02-01 01:27:44 +00:00
sin
9b37332e1e yes: Minor style fix 2015-02-01 01:27:05 +00:00
FRIGN
0b5ab80b05 Fix potential modulo 0 2015-02-01 02:23:35 +01:00
FRIGN
f40608ef09 Finish up yes(1) by adding multiple string support 2015-02-01 02:13:47 +01:00
FRIGN
27b770c02c Adjust some limits to more flexibility for strtonum 2015-02-01 01:24:03 +01:00
FRIGN
5a20d0e9d7 Finish up cols(1) 2015-02-01 00:55:22 +01:00
FRIGN
7cdb24d085 Finish up setsid(1) 2015-02-01 00:47:32 +01:00
FRIGN
7faf732d0b Edit readlink.1 and document missing flags 2015-02-01 00:43:43 +01:00
FRIGN
a645f52843 Finish up printenv(1) 2015-02-01 00:23:38 +01:00
FRIGN
cd37dc4553 Fix grammar in mktemp(1) 2015-02-01 00:15:19 +01:00
FRIGN
93a0e759c9 Finish up mktemp(1) 2015-02-01 00:14:19 +01:00
FRIGN
01195fa7e5 Finish up hostname(1) 2015-02-01 00:03:03 +01:00
FRIGN
bcf264f9cd Finish up chroot(1) and md5sum(1) 2015-01-31 23:54:51 +01:00
Jakob Kramer
4769b47dd7 Use size_t for number of lines in linebuf
.nlines and .capacity are used as array indices and
should therefore be of type size_t.
2015-01-31 22:49:43 +00:00
sin
0934e7f6ed Add .Os sbase and sed replace to .Os sbase $(VERSION) in make install 2015-01-31 19:37:03 +00:00
Jakob Kramer
572ad27110 sort: support sorting decimal numbers correctly
sorry not to have used strtold from the beginning
2015-01-31 19:19:55 +00:00
Hiltjo Posthuma
0e01a2db9b ln: usage, just use %s 2015-01-31 15:23:59 +01:00
Hiltjo Posthuma
6579919fec grep: getline returns signed (ssize_t) 2015-01-31 15:19:42 +01:00
Hiltjo Posthuma
f769c2402f fix mandoc warnings
- sort references in SEE ALSO section to section number, name.
- cols.1: proper order of sections.
- wrap lines to max 79 column length.
2015-01-31 14:43:27 +01:00
Hiltjo Posthuma
4a920a5960 remove sbase-VERSION from man page, fix sponge.1 date 2015-01-31 14:20:02 +01:00
Hiltjo Posthuma
3253f2eec3 split.1: convert to mandoc
... and fix usage line, when -l or -b is specified the argument is required,
not optional.
2015-01-31 14:07:13 +01:00
Hiltjo Posthuma
67e374bcba tar.1: convert to mandoc
- simplify usage line.
- add new flags (-m, -j and -z).
- fix typos.
2015-01-31 14:05:23 +01:00