Commit Graph

970 Commits

Author SHA1 Message Date
FRIGN 856c79e242 Make wording more consistent in head.1 and tail.1 2015-02-09 20:04:54 +01:00
FRIGN e31980915b Remove trailing newline 2015-02-09 19:03:25 +01:00
FRIGN 77fe242ded Amend STANDARDS section in tail.1 2015-02-09 19:02:39 +01:00
FRIGN 77d8a04dee Small tail(1) manpage fix 2015-02-09 19:01:35 +01:00
FRIGN 9292ae2e16 Small code cleanup in tail(1) 2015-02-09 18:46:47 +01:00
FRIGN 006c9739b3 Add c-flag to tail(1) and refactor manpage
and mark it as finished in README.
2015-02-09 18:38:41 +01:00
sin 989127e525 tail: Skip leading spaces in tail -n " +20" 2015-02-09 16:10:00 +00:00
sin fe3fc41838 tail: Fix tail -n -val to handle leading spaces
Previously 'tail -n "    -20" foo' was broken, now it works.
2015-02-09 16:05:55 +00:00
sin f802a544e7 tail: Handle tail -n -val properly 2015-02-09 15:52:31 +00:00
FRIGN a5cc60f2e0 Refactor tail(1) manpage and update README
It's not finished yet. We still need the c-flag.
2015-02-09 16:26:17 +01:00
sin c0d36e0064 Switch concat() to use fread() and fwrite()
We should never mix FILE I/O with raw I/O.  Going from raw I/O
to FILE I/O is fine but doing the opposite is extremely tricky and
only works under certain conditions (unbuffered stream + no call
to ungetc()).
2015-02-09 15:24:03 +00:00
sin 124cb7415a tail: Ignore anything other than FIFOs and regular files for -f 2015-02-09 15:03:35 +00:00
sin a25a57f6ac tail: Add rudimentary support to detect file truncation
We cannot in general detect that truncation happened.  At the moment
we use a heuristic to compare the file size before and after a write
happened.  If the new file size is smaller than the old, we correctly
handle truncation and dump the entire file to stdout.

If it so happened that the new size is larger or equal to the old size
after the file had been truncated without any reads in between, we will
assume the data was appended to the file.

There is no known way around this other than using inotify or kevent
which is outside the scope of sbase.
2015-02-09 14:47:35 +00:00
FRIGN ff7093f7b3 An additional size_t-fix in tail(1) 2015-02-09 15:47:08 +01:00
FRIGN 78f33ff069 Convert tail(1) to use size_t 2015-02-09 15:30:23 +01:00
sin 080a1ee833 No need to free the buffer for every call to getline()
It will realloc as necessary if the new line size exceeds the
capacity of the allocated buffer.
2015-02-09 14:11:06 +00:00
FRIGN 2a83c2c8be Add f-flag to tail(1) and refactor code 2015-02-09 15:06:17 +01:00
FRIGN 6b63fc2f2b 2014 -> 2015 in touch.1 2015-02-09 12:38:31 +01:00
sin 8f5d77d8c7 Do not rely on the underlying type of time_t in date(1) and touch(1)
Use LLONG_MAX unconditionally.  In practice this only causes trouble
with systems that are not 2038 ready.
2015-02-08 23:45:03 +00:00
FRIGN d6b3890af6 Add r-flag to touch(1), refactor manpage and code
and mark it as finished in README.
2015-02-09 00:41:57 +01:00
FRIGN 49ed53b46c Reformat README 2015-02-09 00:20:33 +01:00
FRIGN 1b4ba2b303 Remove wchar.h from unexpand(1)
not needed any more.
2015-02-09 00:20:02 +01:00
FRIGN 1004778757 Update TODO with current roadmap 2015-02-08 23:28:00 +01:00
FRIGN 5699d5fb64 Refactor tar(1) manpage
and mark it as finished in the README.
Specifically, add a small section on the compression flags, which
are basically an infected GNU limb which should be removed from
the face of the earth as soon as possible.
2015-02-08 23:16:27 +01:00
FRIGN 1df65f4af4 Refactor sponge(1) code and manpage
and mark it as finished in README.
2015-02-08 22:17:21 +01:00
FRIGN 8798b8a867 Add arg.h-handling to sync(1) and unlink(1) 2015-02-08 22:13:50 +01:00
FRIGN 3e7c549862 Refactor sync(1) code and manpage
and mark it as finished in README.
2015-02-08 22:08:14 +01:00
FRIGN e01469c9a2 Refactor unlink(1) code and manpage
Remove superfluous stdlib.h-include.
2015-02-08 21:59:59 +01:00
sin 6397952ab3 Nuke bogus newline 2015-02-08 20:28:18 +00:00
FRIGN 1513c2b766 Refactor unexpand(1) code and manpage, adding tablist support
as already seen for expand(1), only twice as complicated.
2015-02-08 21:24:22 +01:00
FRIGN 28b4b25076 Refactor uname(1) code and manpage
remove stdlib.h-include which was there for no reason and clear
up the manpage.
2015-02-07 22:15:56 +01:00
FRIGN 018d60c6bf Refactor tty(1) code and manpage 2015-02-07 22:00:28 +01:00
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