Commit Graph

7579 Commits

Author SHA1 Message Date
harti
f3ce1067ac Change one occurence of 'delim' to the correct type. Delete another
occurence which actually holds always the same constant value.
Shorten the name pattern to patt.

Patch:		7.133

Submitted by:	Max Okumoto <okumoto@ucsd.edu>
2005-03-21 11:54:46 +00:00
harti
cc6fd34f2d Replace calls to Lst_Find with either appropriate LST_FOREACH macros
plus predicate inlining or a special purpose function with takes
and returns the correct types.
2005-03-21 11:44:57 +00:00
harti
59177829ff Reduce number of parameters passed between the parsing routines
by putting them into struct VarParser or computing them (consumed).
Change the loop termination condition in VarParseLong from endc to \0.

Patch:		7.128-7.132

Submitted by:	Max Okumoto <okumoto@ucsd.edu>
2005-03-21 11:43:02 +00:00
das
f5e55fd604 Support the L modifier for floating-point values as an extension.
When L is omitted, double precision is used, so printf(1) gives
reproducable results.  When L is specified, long double precision is
used, which may improve precision, depending on the machine.
2005-03-21 08:01:09 +00:00
harti
47633d30dc Reduce the number of explicit parameters passed to VarParse()
by passing them through struct VarParser.

Patch:		7.127

Submitted by:	Max Okumoto <okumoto@ucsd.edu>
2005-03-21 07:40:33 +00:00
iedowse
316bdea082 Don't skip the initialisation of tl->len when we hit an EOF immediately
after allocating a new buffer. This bug caused `tail -r < /dev/null'
to core dump when the `J' malloc option is set, and also affected
any other input that was an exact multiple of 128k.
2005-03-20 22:08:52 +00:00
kientzle
c74d7d94bd Deorbit gtar, step 1: Remove WITH_GTAR knob.
"tar" is now always a synonym for "bsdtar".
  People who need gtar can access it as "gtar."

Approved by:	No objections on arch@
2005-03-20 20:38:46 +00:00
pjd
1fbe41652e Whitespace fixes. 2005-03-20 11:47:44 +00:00
pjd
c7d05e490c - Introduce an '-o' option which allows to match oldest of the matching
processes.
  This option can be also found in Solaris and Linux.
- Use timercmp(9) macro for timeval comparsion.
- Include time.h directly, don't depend on stat.h doing it for us.

Reviewed by:	gad (first point)
MFC after:	3 days
2005-03-20 11:42:26 +00:00
pjd
a5414c9dd1 - Introduce '-S' option which allows to match system processes (pgrep only).
- Rename IS_KERNPROC() macro to PSKIP() and extend its functionality.
  Now it'll skip calling process and system processes when -S is not given.
  As a side effect it fixes '-n' option. Before it was always matching
  calling process (because of missing 'if (kp->ki_pid == mypid)' check)
  and after that, calling process was ignored.
- When '-l' option is given and there are no arguments, use p_comm as an
  arguments list (this is helpful for kernel threads matching).

Reviewed by:	gad
MFC after:	3 days
2005-03-20 11:30:26 +00:00
pjd
b616d49d9f Sort options properly.
Reviewed by:	gad
MFC after:	3 days
2005-03-20 11:17:06 +00:00
pjd
d88f375460 Add a -i option to ignore case in the process match.
Obtained from:	NetBSD
Reviewed by:	gad
MFC after:	3 days
2005-03-20 11:12:13 +00:00
pjd
3f98083e57 Add and document '-F' option which allows to use file where PID is stored
for matching.

Reviewed by:	gad
MFC after:	3 days
2005-03-20 11:03:11 +00:00
pjd
2b2f4d5e6e Add and document '-j' option which allows to match processes based on its
jail ID.

Reviewed by:	gad
MFC after:	3 days
2005-03-20 10:53:54 +00:00
harti
5b55d8aa02 Cleanup handling of colons in variable substitutions.
Patch:		7.126

Submitted by:	Max Okumoto <okumoto@ucsd.edu>
2005-03-18 16:52:46 +00:00
harti
4565898f62 Unfold parsing of single letter modifiers from multi-letter ones.
Patch:		7.125

Submitted by:	Max Okumoto <okumoto@ucsd.edu>
2005-03-18 15:51:04 +00:00
harti
821eec0009 Style: fix indentation and <space><tab>.
Patch:		7.124

Submitted by:	Max Okumoto <okumoto@ucsd.edu>
2005-03-18 15:44:23 +00:00
harti
efa8f52f88 Split out the 'S' modifier into its own function.
Patch:		7.122,7.123

Submitted by:	Max Okumoto <okumoto@ucsd.edu>
2005-03-18 15:37:31 +00:00
harti
f00fcf68ef Convert Var_Parse to a wrapper function.
Reduce the number of arguments passed between these functions by
creating a special-purpose struct.

Patch:		7.120,7.121

Submitted by:	Max Okumoto <okumoto@ucsd.edu>
2005-03-18 15:34:07 +00:00
harti
5b2a5b84de Replace Lst_Find calls with LST_FOREACH loops. This helps in
constification und simplifies the code because the one-liner
predicates can be inlined into the code.
2005-03-18 15:25:23 +00:00
harti
3cd2d2d0d5 Replace a bogus use of Lst_Find with explicite LST_FOREACH calls
and remove the unneeded second argument to ReadMakefile.
2005-03-18 15:23:49 +00:00
harti
3754e8fb58 Fix a bug in matching suffixes. Under certain circumstances the code
would access memory before the beginning of the string to match (the
suffix match starts at the end of both the string and the suffix and
proceedes to the begin until either the start of the suffix is hit
or the character does not match). This could lead to a memcpy copying
into random memory. Fix this by checking the length of the string to
match too and replacing the Lst_Find calls with LST_FOREACH loops
(last part by me).

Submitted by:	Matt Dillon <dillon@apollo.backplane.com> (in principle)
2005-03-18 15:16:09 +00:00
harti
3d5967d365 Now that there are no users of Lst_ForEach and Lst_ForEachFrom are left
delete these two macros and all the associated stuff.
2005-03-16 16:11:11 +00:00
harti
df4f9cb09a Replace Lst_ForEach by LST_FOREACH. 2005-03-16 16:02:09 +00:00
harti
cbbd172aea Replace another bunch of Lst_ForEachs by LST_FOREACHs and simplify code. 2005-03-16 12:22:15 +00:00
phk
3ff5706695 Dike out another kvm indiscretion. 2005-03-16 10:24:16 +00:00
harti
35b09a0244 Fix a comment. 2005-03-16 08:06:28 +00:00
harti
fe00d22104 Get rid of another bunch of Lst_ForEach in favour of LST_FOREACH and
simplify code accordingly.
2005-03-16 08:04:45 +00:00
harti
0ce269a189 Ups. Revert the last commits. These have been committed by accident. 2005-03-15 15:10:51 +00:00
harti
6fc3b6df1c modifier_M: instead of going through the string twice to compute the
size of the buffer we need, just allocate the possible maximum.

Patch:		7.117

Submitted by:	Max Okumoto <okumoto@ucsd.edu>
2005-03-15 15:05:14 +00:00
harti
7bd6f53de6 Style: Move a variable from a local scope up to the begin of the function.
Rename result variable so common code becomes more visible.
Rename freePtr to freeResult to make clear what pointer must be freed.

Patch:		7.116, 7.116a

Submitted by:	Max Okumoto <okumoto@ucsd.edu>
2005-03-15 14:52:10 +00:00
phk
2116975c84 Dike out unwarranted si_udev fondling. 2005-03-15 14:30:26 +00:00
harti
384241be9f Get rid of a number of Lst_ForEach calls in favour of LST_FOREACH
and simplify the printing functions.
2005-03-15 14:28:39 +00:00
harti
84812666f6 VarParseLong: move the detection of the modifier separator ':' into
the loop. Add a comment why the 'consumed' variable is updated.
Rename lengthPtr to consumed.

Patch:		7.115

Submitted by:	Max Okumoto <okumoto@ucsd.edu>
2005-03-15 14:27:29 +00:00
harti
db06c5de06 Yet another version of passing the last line to ParseFinishLine().
It turns out that some ports use the obscure feature of spreading
a dependency block across multiple include files. While this seems
bad style, allow it for now and call said function only at end of
all input to process the really last line of everything.
2005-03-15 14:25:24 +00:00
harti
6427cb7c26 Get rid of another Lst_ForEach in favour of LST_FOREACH. Get rid
of the now unused struct LstSrc and collapes two functions into one.
2005-03-14 17:04:58 +00:00
harti
e46b6260f7 ParseModifier(): rename rw_str to value and reindent cleanup section.
ParseRestModifier() and ParseRestEnd(): move advancement of ptr to remove
a confusing calculation.
VarParseLong(): cleanup calculation of consumed.

Patch:		7.114

Submitted by:	Max Okumoto <okumoto@ucsd.edu>
2005-03-14 17:03:34 +00:00
harti
6c1fea3e9f Move the creation of a Src structure into its own function. 2005-03-14 12:04:20 +00:00
harti
65a16da8cc Split off two function from VarParseLong to handle modifiers and the
actual variable lookup. Consistently rename lengthPtr to consumed.
Update a number of comments to match the code.

Patch:		7.111-113

Submitted by:	Max Okumoto <okumoto@ucsd.edu>
2005-03-14 12:03:30 +00:00
harti
dffc7fe63f Convert a couple of other uses of Lst_ForEach to LST_FOREACH and
simplify code.
2005-03-14 08:29:58 +00:00
kientzle
7f4dba0f0e A handful of minor portability and style improvements. 2005-03-14 00:30:35 +00:00
kientzle
c46a8c03ea Style correction: one tab after #define. 2005-03-14 00:29:05 +00:00
kientzle
b3cbed0960 Re-unbreak the distfile target.
Also, reduce the WARNS level to 5 since different build environments
end up using different Yacc skeletons.  The BSD one does not
predeclare yyparse, the FSF one does, so it's not really possible to
consistently enforce both -Wmissing-prototypes and -Wredundant-decls.
2005-03-13 23:49:53 +00:00
kientzle
2b38f44c2f Fix a compile warning, fix the build. 2005-03-13 21:36:15 +00:00
kientzle
4949e1d1ad "make depend" with .y files is trickier than it looks. <sigh> 2005-03-13 19:55:53 +00:00
kientzle
5d0c5f694a Brain-o. Missing quote. 2005-03-13 19:44:19 +00:00
kientzle
832a345376 Add --newer-ctime, --newer-mtime, --newer-ctime-than, and --newer-mtime-than
switches to support selecting files by time of modification.

Special thanks to: Steven M. Bellovin, Rich $alz, and Jim Berets,
	authors of the public-domain getdate.y date-parsing code.
2005-03-13 18:36:24 +00:00
ceri
14adec0b92 Remove an unused #define. md5's with and without this commit match.
Approved by:	murray (mentor)
2005-03-13 17:58:31 +00:00
kientzle
0eac7627b8 Add --strip-components option, per bin/77666.
Thanks to: Sangwoo Shim
2005-03-13 04:12:30 +00:00
stefanf
8655a91f58 Use socklen_t where appropriate. 2005-03-11 14:17:12 +00:00