Commit Graph

799 Commits

Author SHA1 Message Date
sin
c83aef2cda Use preprocessor conditionals to check if makedev() is present
makedev() is not portable and is typically implemented as a
macro.  If it exists use it, otherwise silently ignore character
and block devices.
2014-01-28 17:22:48 +00:00
sin
203b52c38a Use getpriority()/setpriority() instead of deprecated nice()
This is now similar to how renice(1) is implemented.
2014-01-28 17:20:20 +00:00
sin
43057f3a39 Remove mknod(1) from sbase
mknod(1) is not POSIX and it is not portable so it should be
in ubase instead of sbase.
2014-01-28 16:53:53 +00:00
sin
7028920ff4 Rename saved_errno' to savederrno' 2014-01-27 15:18:42 +00:00
sin
6a18e77962 Ensure we return a proper error value in setsid(1) 2014-01-27 15:18:30 +00:00
sin
a0fbe3278a Add Markus Teich to LICENSE 2014-01-25 22:53:14 +00:00
sin
eef1cef1d1 Add more people to LICENSE
Hopefully, I've not missed anyone.
2014-01-25 22:50:54 +00:00
sin
e31b8b76ee Add Silvan Jegen to LICENSE 2014-01-25 22:45:28 +00:00
sin
e9a4af87bd Staticise functions in tr(1) 2014-01-25 22:07:40 +00:00
sin
db2c54bee6 oops that should have been enprintf() 2014-01-24 16:46:56 +00:00
sin
b58951b4f0 snprintf() returns the # of chars printed *excluding* '\0' 2014-01-24 16:23:13 +00:00
sin
30620afb6c Check return value of snprintf in mktemp(1) 2014-01-24 16:19:46 +00:00
sin
5be9c21ce4 Use xrealpath() in du(1) 2014-01-23 21:17:24 +00:00
sin
3ef662c988 Check snprintf() return value 2014-01-23 21:17:08 +00:00
sin
cc2d762798 Use the width of the output device by default in mc(1)
If that fails, fallback to 65 characters as before.  If the -c
option is specified then just use that.
2014-01-21 11:23:16 +00:00
sin
fe6144793f Check mmap() return value and unmap at the end 2014-01-20 11:28:21 +00:00
Silvan Jegen
38f429a3d2 Add the tr program including man page 2014-01-20 11:22:28 +00:00
sin
cb005c150d Fix naming covention for uniq(1) 2014-01-20 10:49:28 +00:00
sin
13128a7aa0 Remove dead debug code 2014-01-18 11:50:51 +00:00
sin
7969fcd2c2 No need to dynamically allocate *cmd[] 2014-01-16 11:53:13 +00:00
sin
1bc2296bac Double NARGS
I just ran a simple one-liner[1] to find the average filepath
length on my system (absolute paths) and that came up with a value
~90 characters.  Assume this is out by a factor of two, we still
have potentially 5000 more arguments that we can put into the buffer.

Surely one might run xargs(1) on something that is not a filename.
We just choose to accomodate the common use-case as much as possible.

[1] find / 2>/dev/null | awk '{print length($0)}' \
	| awk '{a+=$1}END{print "average filepath length: ",a/NR}'
2014-01-16 11:01:10 +00:00
sin
b744ad5216 If there's no newline we don't count the last word - fix it 2014-01-10 22:52:00 +00:00
sin
fbd786d22a Correctly handle leftover input
We cannot rely on ungetc() pushing back more than 1 character
reliably on all systems, so just note if we have leftover input and
process it in the next run.
2014-01-08 20:49:52 +00:00
sin
1963a7cfb3 Group related declaration 2014-01-08 20:49:39 +00:00
sin
602fd49b53 Allocate the arg buffer in once place 2014-01-08 20:35:25 +00:00
sin
2d64fa9483 Rename runcmd() to spawn() 2014-01-08 20:35:19 +00:00
sin
574e3d48ed No need to check for a positive `argbpos'
No need to deinput a separator.
2014-01-08 20:35:12 +00:00
sin
cec487585c Rename pusharg() to deinputstr() 2014-01-08 20:35:05 +00:00
sin
e96144118e Error out if a single argument cannot fit into the argument space 2014-01-08 20:34:56 +00:00
sin
e585133012 Rename fillbuf() to fillargbuf() 2014-01-07 14:58:02 +00:00
sin
20c0a0b1e7 Factor out waiting for children into a separate function 2014-01-07 14:52:29 +00:00
sin
e27c55aec3 Implement -E eofstr for xargs(1) 2014-01-07 12:03:50 +00:00
sin
7a5369ae04 Update xargs(1) manpage to mention the possible exit codes 2014-01-07 12:03:37 +00:00
sin
59222b9193 Exit with error code 123 if one or more invocations of cmd failed 2014-01-06 18:53:30 +00:00
sin
3aec0ac2a4 Use a return value to signal an invalid backslash
Just for consistency with the rest of the code.
2014-01-06 18:22:00 +00:00
sin
bb4d7a0e7e Don't allow backslash at EOF 2014-01-06 18:17:44 +00:00
sin
0511ecfd84 If eatspace() encounters EOF don't try to read again from stdin 2014-01-06 18:13:27 +00:00
sin
ef57a609ca Exit with error 125 if the process is killed by a signal 2014-01-06 18:05:52 +00:00
sin
2dc105ebbc Use saved errno in case weprintf() fails internally 2014-01-04 14:07:34 +00:00
sin
567869a8fe Check the exit status and return it from the parent process 2014-01-04 14:02:40 +00:00
sin
7ec616e1e5 Exit with proper error codes
We still have a few error codes to do, namely when the process
is killed or stopped by a signal or when one or more invocations
of the command returned a nonzero exit status.
2014-01-04 13:53:59 +00:00
sin
9a1c5783c1 Remove mktemp(1) from TODO
We already have mktemp(1) implemented.
2014-01-04 13:41:47 +00:00
sin
18f9f3e141 Remove xargs(1) from TODO
We already have a barebones version.
2014-01-04 13:40:42 +00:00
sin
4bdf9a9658 Add initial version of xargs(1) 2014-01-04 00:04:05 +00:00
sin
71cbd12ede Revert "Fix relocation error on OpenBSD (amd64) when compiling with pcc"
This reverts commit 06d43e4832.

Let's stick to the most basic and common options for the default
case.
2013-12-21 13:39:29 +00:00
sin
1851c02a95 Show usage instead of exiting silently on an invalid option 2013-12-12 13:30:25 +00:00
sin
aff51008ea Add -R as a synonym to -r for cp(1)
List the available options in the usage line as well.
2013-12-12 13:30:17 +00:00
sin
7f6d5653c6 Add -R as a synonym to -r for rm(1)
Some scripts require this.
2013-12-12 13:15:47 +00:00
sin
544857623b Add -n support to sort(1) 2013-12-12 13:10:59 +00:00
sin
0b6b84886c Add newline at end of file 2013-12-04 17:42:33 +00:00