xargs
Richard A. O'Keefe
ok at quintus.UUCP
Fri Feb 12 20:42:00 AEST 1988
Having had rather more core-dumps from xargs(1) {on lots of different
machines} than I really care for, I decided that it was time to write
my own. Deciding that the thing to do was to make it as exactly
compatible as I could, only working, I turned to the SVID to find out
just what xargs is supposed to do. I find the XARGS(SD_CMD) section
of the SVID remarkably obscure. For example, are empty lines to be
discarded in the sense that they aren't *counted* by the -l option,
or are they to be discarded only in the sense that they don't
contribute any arguments? {Don't suggest running the program; what I
want to know is what it is *supposed* to do.} If a line has a space
or tab before the new-line, is it still counted by -l? What about
new-lines quoted by \ ? We are told that blanks and tabs are allowed
in arguments, if quoted, but what about new-lines?
Then too, what is the significance of the magic numbers?
-- why will "-i" accept only five *arguments* containing replstr,
given that any one argument may contain any number of instances
of replstr? Would anything break if this limit were raised?
-- why may constructed arguments grow to only 255 characters
(apart from the fact that it crashes if you try a bigger number)?
The exec() family is happy with much longer arguments than that!
This is particularly painful in BSD systems, where a single
file-name can be 1023 characters long...
-- Why is the maximum total size of an argument list 470 characters?
See above comment on file names.
The XARGS(SD_CMD) section also says that "xargs will terminate if ...
it receives a return code of -1 from ... command". This is bizarre,
because elsewhere the SVID makes it clear that the exit status of a
command is ((W)>>8)&0377, where W is the result WAIT(BA_OS) gets.
Does the xargs section mean 255? Or 1? Or any non-zero value (which
would be consistent with everthing else)?
So, is there a clear description of xargs anywhere?
More information about the Comp.unix.questions
mailing list