xargs
Herb Gellis
herb at hpindda.HP.COM
Wed Feb 17 08:15:42 AEST 1988
Oy veh!
As the original author of xargs, I will respond ...
I wrote xargs about 10 (TEN) years ago when I worked at Bell Labs in
Piscataway NJ. At that time the Bourne Shell didn't exist yet. The original
shell was relatively primitive, and was being greatly enhanced (by John Mashey).
There were lots of other "primitive" aspects of UNIX, such as sizes of things
(max of 512 bytes for file name expansions on the command line... later
changed to 5120 byes), etc. etc. This latter aspect of max 512 byte file
name expansion was the major reason I wrote xargs in the first place, and
then added -i, etc. as new features seemed useful.
The funny (small) sizes are merely choices made at the time, some reflecting
"real world" or "convenient" sizes FOR THE TIME (long ago, and far away...).
There were other silly reasons for some things... By using simple I/O
(avoiding printf, e.g.) xargs was kept at under the "magic" size of 4K
and was able to load very quickly (magic back then before sizes in the
file system were revamped). Obviously sizes should have been changed
as UNIX changed around it, but I doubt very much that xargs was ever enhanced
(I left B.T.L. in 1981)...
I also wrote the man page from which you speak (and I agree it is an abortion,
but I couldn't stand looking at it anymore either) and obviously it has never
changed either (the same man page is in our HP-UX). Oh well. Sorry about
those core dumps... I've never seen any.
To attempt to answer your questions specifically (based on whatever
design decisions I think I remember making mucho years ago):
>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
Both, don't count them for -l and discard them as they don't contribute.
>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
No. This meant the line was continued to the next physical line
but was logically one line. (I realize that was a dumb way to do it,
should have used the \ escaped newline method)
>new-lines quoted by \ ? We are told that blanks and tabs are allowed
^^^^^^^^^^^^^
>in arguments, if quoted, but what about new-lines?
^^^^^^^^^^^^^^^^^^^^^
No on both counts.
> -- 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 5? Because I wrote it that way. Don't remember if it was a static
array, but this is purely arbitrary, and could be changed at will.
>-- why may constructed arguments grow to only 255 characters
That's how big the (static) buffer was.
>The XARGS(SD_CMD) section also says that "xargs will terminate if ...
>it receives a return code of -1 from ... command". This is bizarre,
Didn't seem unreasonable back in 1977 or thereabouts.
>So, is there a clear description of xargs anywhere?
No comment! (sorry)
Herb
. .
|=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-| "What will I be when I grow up?
| Herb Gellis | You are already grown up.
| {ucbvax,...}!hplabs!hpindda!herb | You mean this is as UP as I will get?..."
|=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-|
| | David Gerrold, "When HARLIE Was One"
--- ---
More information about the Comp.unix.questions
mailing list