Commit Graph

563 Commits

Author SHA1 Message Date
Wolfgang Corcoran-Mathe
7a6af2faba Fix typo breaking functionality in tail 2014-09-17 10:06:12 +01:00
sin
b712ef44ad Fix warning 'array subscript of type char' 2014-09-02 13:32:32 +01:00
Hiltjo Posthuma
0cbafaecb6 cp: print error to stderr and continue 2014-08-02 13:46:00 +01:00
sin
a9c9681f95 Fixup README
This is now consistent with ubase.  The advantage is that it can
be generated very easily with:

for i in $(./sbase-box); do echo $i; done
2014-07-26 15:46:33 +01:00
Hiltjo Posthuma
323c45edb7 cp: improvements
- improve copying block, char devices, fifo and sockets with -a.
- improve exit status code.
2014-07-21 16:44:26 +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
81bb8422a5 ln: allow with one argument
Signed-off-by: Hiltjo Posthuma <hiltjo@codemadness.org>
2014-07-21 16:44:06 +01:00
Hiltjo Posthuma
72b909df9c chown: update usage
Signed-off-by: Hiltjo Posthuma <hiltjo@codemadness.org>
2014-07-21 16:43:54 +01:00
Hiltjo Posthuma
ba8ca986a4 util/enmasse: fix double /
Signed-off-by: Hiltjo Posthuma <hiltjo@codemadness.org>
2014-07-21 16:43:42 +01:00
Hiltjo Posthuma
f67320ce93 cp: add -v, fix manpage info
Signed-off-by: Hiltjo Posthuma <hiltjo@codemadness.org>
2014-07-21 16:43:31 +01:00
sin
ac402965d5 Fix comment style and nuke stray whitespace 2014-07-16 20:43:29 +01:00
Adria Garriga
b3a63a60e4 Improved tr
- Added support for character ranges ( a-z )
- Added support for complementary charset ( -c ), only in delete mode
- Added support for octal escape sequences
- Unicode now only works when there are no octal escape sequences,
  otherwise behavior is not predictable at first sight.
- tr now supports null characters in the input
- Does not yet have support for character classes ( [:upper:] )
2014-07-16 20:40:54 +01:00
Hiltjo Posthuma
8b3a9c1971 cp: add -a, -d, -p 2014-07-10 11:23:21 +01:00
sin
8e8d8ff242 Only check errno if getpw*() fails 2014-07-09 15:09:11 +01:00
sin
7872986dd2 Add at(1) to TODO 2014-07-07 07:37:19 +01:00
Hiltjo Posthuma
7fdbdd0770 ls: add -1 for compatibility (ignore) 2014-07-05 16:26:27 +01:00
sin
5df631ac09 Use /dev/fd/0 as opposed to /dev/stdin 2014-07-04 23:14:26 +01:00
Willem van de Krol
f02f2190f0 fixed incorrect fday handling in dayofweek() function 2014-07-04 21:47:36 +01:00
Willem van de Krol
5721deb2c4 optimized isleap() function 2014-07-04 21:47:12 +01:00
sin
5dc02f757b Add support for '-' to cat
This chunk will need to be librarified at some point.
2014-07-04 16:52:27 +01:00
sin
a62eda512c Don't require two C-d to exit the loop 2014-07-04 16:52:17 +01:00
sin
f5ac08cc04 Only use /tmp if template is a file and not a path 2014-07-04 16:02:15 +01:00
sin
8eea7f74e9 A plain rm -f is valid and should not be considered an error 2014-07-04 14:55:45 +01:00
sin
75382abbf3 Add some error checking to util/recurse.c
Some more stylistic changes and simplification.
2014-06-30 16:05:51 +01:00
sin
df1b25a187 No need to include unistd.h in echo(1) 2014-06-25 21:27:53 +01:00
Hiltjo Posthuma
696cbdbb68 util.h, mode_t: sys/types.h defines mode_t
see: http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_stat.h.html

this removes the warning with gcc (but musl didn't have this warning).
2014-06-16 23:04:43 +01:00
FRIGN
8f7bc0db35 Refactor rmdir
Use arg.h- and pointer-iterator-idioms.
2014-06-10 11:14:32 +01:00
Tuukka Kataja
612e09af7e Implement -i flag for expand 2014-06-09 17:00:33 +01:00
Tuukka Kataja
6561567597 Fix expand when one of multiple files can't be opened
Currently when multiple files are specified and one of them can't be opened,
expand doesn't correctly skip over the missing file. This patch fixes that.
2014-06-09 17:00:23 +01:00
Tuukka Kataja
8b87d0098a Add unexpand(1) 2014-06-09 17:00:13 +01:00
Jakob Kramer
7f7e7dcbb9 cols: simplify filling with spaces
Use printf("%*s", n, "") instead of allocating
a string filled with spaces.
2014-06-05 11:19:34 +01:00
Jakob Kramer
2e1580ed2d remove unnecessary calls to realloc from tee 2014-06-03 23:46:17 +01:00
Jakob Kramer
7d1fd2621e add -t flag to sort 2014-06-02 13:35:59 +01:00
Hiltjo Posthuma
2ab2d2ee3b remove afgets
Signed-off-by: Hiltjo Posthuma <hiltjo@codemadness.org>
2014-06-01 18:03:20 +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
eac0f658cf check snprintf error aswell, handle as truncation error
Signed-off-by: Hiltjo Posthuma <hiltjo@codemadness.org>
2014-06-01 18:02:55 +01:00
Hiltjo Posthuma
953ebf3573 code style
Signed-off-by: Hiltjo Posthuma <hiltjo@codemadness.org>
2014-06-01 18:02:30 +01:00
Hiltjo Posthuma
97ca7c8b6d cut: improvements
- use agetline().
- code style.
- free allocated list.
- don't close stdin if "-" is given.
2014-06-01 18:02:13 +01:00
Hiltjo Posthuma
97fb4a1f9c grep: improvements
improvements:
- improve statuscode behaviour
  - don't exit if a file in a series fails. exit 2 if an error occured
    in a file series. don't exit if there is a read error (like: grep
     input file is a directory).
- use agetline instead of agets().

with the simple test: time seq 1 100000000 | grep 'a'
its 12 seconds (from 24 seconds) on my machine.

Signed-off-by: Hiltjo Posthuma <hiltjo@codemadness.org>
2014-06-01 18:02:01 +01:00
Hiltjo Posthuma
d12e953f18 add agetline, separate estrtod to util
Signed-off-by: Hiltjo Posthuma <hiltjo@codemadness.org>
2014-06-01 18:01:45 +01:00
Hiltjo Posthuma
daad071b31 cut, uudecode: free buf after use
Signed-off-by: Hiltjo Posthuma <hiltjo@codemadness.org>
2014-06-01 18:01:31 +01:00
Hiltjo Posthuma
2dbb694932 strlcat, strlcpy style
Signed-off-by: Hiltjo Posthuma <hiltjo@codemadness.org>
2014-06-01 18:01:19 +01:00
sin
07dd658f0d Use -std=c99 by default
Note, the code is largely c89 clean.  This is to avoid certain
warnings on some systems (OSX).
2014-05-31 17:56:34 +01:00
sin
69cde23703 Proper copyright header for strlcpy and strlcat 2014-05-28 11:15:59 +01:00
sin
4896bdf6de Revert "Make grep more memory-efficient"
This reverts commit d9a098ae6bc07188cbaefcd188e5911dec41815d.

Conflicts:
	grep.c

Hiltjo Posthuma <hiltjo@codemadness.org> said:

(Re)compiling the regex for each line doesn't make sense (imho) and
slows it down a lot.

A simple test:

time seq 1 100000000 | grep 'a'

sbase grep (before patch):
    0m22.21s real     0m0.00s user     0m0.00s system

sbase grep (after patch):
    2m16.28s real     0m0.00s user     0m0.00s system

coreutils grep:
    0m1.15s real     0m0.00s user     0m0.00s system

So the patch should be reverted I think.
2014-05-12 12:06:40 +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
sin
11eef783fe Declare error buffer at start of block 2014-05-12 00:40:29 +01:00
FRIGN
fb1bfe24bb Make grep more memory-efficient 2014-05-12 00:32:50 +01:00
FRIGN
8ea17b2a7d Switching to real name 2014-05-11 11:04:26 +01:00
Jakob Kramer
9366f48b1f sort: simplify linecmp, rename curr => tail 2014-05-06 18:01:44 +01:00