Subject: Re: where is limfree defined?
To: None <bruce@zuhause.mn.org>
From: Mark W. Eichin <eichin@kitten.gen.ma.us>
List: current-users
Date: 01/24/1996 13:47:14
> So far, I haven't seen anyone suggest the following:
> grep '^limfree' `find /usr/src/sys -name '*.c' -print `
Because (1) it breaks on spaces in file names (2) it breaks on
MAXARGS, if your find returns "too many" files or "too long" a total
command line, it will either complain or silently truncate. (The word
"unfortunate" doesn't even begin to describe this *classic*
behaviour...)
My general invocation (when I don't already have a glimpse database or
TAGS file built) for this would be
find /usr/src/sys -name '*.c' -print | xargs grep -n ^limfree /dev/null
(ie. don't quote ^ because I don't use sh, and it hasn't meant "pipe"
in over a decate, -n because I'm running this from emacs as M-x grep,
so I can use c-x ' to actually go to the line, and /dev/null because
grep has this "feature" of not listing the filename if there was only
one filename on the command line...)
If I'm searching in a "suspicious" tree, ie. not a well formed source
tree like the above, I'll use -print0 and xargs -0, but usually I
forget :-)
Oh, and I won't do this on an ultrix system because the native xargs
breaks there. (Actually, I'll do it, it'll crash, and I'll give up and
try again on a real machine.)
The big problem with the xargs approach is that the command can't also
read from stdin -- which is a good argument for "find -xargs" (like
find -exec but able to combine arguments.)
Remember, most of the arguments against 'grep -R' (that is the
character used, *right*? :-) [except of course the portability one]
can be used against chmod, chown, and the whole idea that a command
takes multiple filenames on the command line [you've got for/foreach!]
ObHistory: Domain/OS had a "..." concept; the comos equivalent of
chown was called something else, but instead of chown -R user ~user
you used comchown ~user/... user, and the ... was handled (somehow) by
the "different" Domain/OS filesystem interfaces. Bonus points if this
makes it clear to you the difference between chown -R and find|xargs
chown; they *don't* do the same thing...
_Mark_ <eichin@kitten.gen.ma.us>
The Herd of Kittens