Commit Graph

7797 Commits

Author SHA1 Message Date
Remko Lodder
4b61852d3d Add myself to the calendar.
MFC after: 	1 week
Approved by:	simon (mentor)
2005-04-10 19:03:48 +00:00
Stefan Farfeleder
6c97c3d1d3 Remove unused variables. 2005-04-09 14:31:41 +00:00
Murray Stokely
1717bcc6f4 Commodore Perry was not 4 years old when he sailed to Japan. Correct
birth year.
2005-04-08 09:50:30 +00:00
Joel Dahl
98d0a6938c Add myself (and decrease the average age).
Approved by:	brueffer (mentor)
2005-04-08 09:04:29 +00:00
Hartmut Brandt
2a30c95875 Move the code for parsing .for and .if statements to the place where the
other directives are handled.
2005-04-08 09:03:40 +00:00
Hartmut Brandt
a45b448277 When Parse_Error is called after the top-level Makefile is closed we
have no CURFILE anymore so we cannot print a file name or line number.

When ParseSkipLine() returns NULL (it does this when it has detected an
EOF in an .if block) try to pop the input stack and process the next line
2005-04-07 14:39:38 +00:00
Hartmut Brandt
a9c22e4739 Handle popping of the input stack in ParseReadLine() instead of
Parse_File(). Remove a comment and a piece of code comming from
ancient times when the if-directive read like #if and not .if.
Correctly analyze the first character of a line.
2005-04-07 11:29:39 +00:00
Hartmut Brandt
192ee26c2f Mostly stylistic changes: remove the noPLen field from the Shell
structure - it is just the strlen() of noPrint. Inline JobCondPassSig()
in the only function JobPassSig() using it. Fix the argument types
of JobPrintCommand(). Better parsing for the .SHELL target keywords.
2005-04-07 11:26:15 +00:00
Hartmut Brandt
506e445a6c There is not much sense in having an else after Punt() and _exit() which
never return. Also use pid_t for variables holding PIDs.
2005-04-05 12:33:54 +00:00
Hartmut Brandt
683f92e306 Put parantheses into 'if (foo && bar & flag)'. While they are not strictly
needed, they are useful for the human reader.
2005-04-05 08:14:40 +00:00
Hartmut Brandt
d265c4e11a Remove lots if irritating parantheses and fix two comments.
Checked by:	md5
2005-04-05 08:09:48 +00:00
Hartmut Brandt
e7e49de4e5 Remove the definition for STATIC and just use static. 2005-04-05 07:44:11 +00:00
Hartmut Brandt
2a2532d215 Remove unneccessary local prototypes. 2005-04-05 07:43:02 +00:00
Hartmut Brandt
d9e678f13f The static tfile is used only in one single function so move it into that
function.
2005-04-05 07:40:40 +00:00
Hartmut Brandt
29c6a883cd The tfile field of struct Job isn't used anymore since revision 1.22 so
remove it now.
2005-04-05 07:32:12 +00:00
Stefan Farfeleder
426494536e Include <string.h> and <strings.h> for various functions. 2005-04-04 21:19:48 +00:00
Pawel Jakub Dawidek
78dcb2aff0 If they ever tell my story,
let them say I lived in the time of Pope John Paul II,
one of the greatest man...

Je¶li kiedy¶ kto¶ opowie moj± historiê,
niech powie, ¿e ¿y³em w czasach Papie¿a Jana Paw³a II,
jednego z najwspanialszych ludzi, najwspanialszego Polaka...

			-- Pawe³ Jakub Dawidek, atheist
2005-04-03 09:46:06 +00:00
Warner Losh
550b53a99a Don't refer to devices that don't exist. 2005-04-03 05:19:45 +00:00
Seigo Tanimura
674b8a5cb4 Commemorate the bicentenary of Hans Christian Andersen's birth by
adding his birthday.
2005-04-02 09:27:13 +00:00
Tim J. Robbins
ef6c77648a Use rpmatch() instead of checking for responses that begin with 'y'
in queryuser(). This allows users to respond to -ok and -okdir
prompts with any affirmative reply defined by their current locale.
2005-04-02 07:44:12 +00:00
Hartmut Brandt
49ecabba2d Use a type-safe intrusive list to put jobs on the jobs or stoppedJobs list
instead of the generic Lst.
2005-04-01 16:24:25 +00:00
Hartmut Brandt
4d52cd1820 Remove a forward declaration that isn't needed anymore. 2005-04-01 16:23:48 +00:00
Hartmut Brandt
4bc60ea3fb Both struct Job and struct Shell are only used inside job.c so there is
no need to have them in a header file that is included by other modules.
Move them both into the c-file.
2005-04-01 13:35:35 +00:00
Hartmut Brandt
f54201efce Style: fix indentation. 2005-04-01 13:25:45 +00:00
Hartmut Brandt
a2e1fc0052 Style: fix indentation. 2005-04-01 13:06:05 +00:00
Hartmut Brandt
bfcf27787a Style: indentation. 2005-04-01 13:02:17 +00:00
Hartmut Brandt
ab9267be40 Style: Indentation. 2005-04-01 12:42:03 +00:00
Hartmut Brandt
c0489a0689 Style: fix indentation. 2005-04-01 12:31:15 +00:00
Hartmut Brandt
54348124ed Style: fix indentation. 2005-04-01 11:20:17 +00:00
Hartmut Brandt
5682c1009c Style: fix indentation. 2005-04-01 11:12:29 +00:00
Hartmut Brandt
901275d3b7 Style: fix indentation. 2005-04-01 10:53:43 +00:00
Colin Percival
d5a7659334 Note the passing of Cameron Grant <cg@FreeBSD.org>.
Approved by:	quiet1
2005-03-31 23:15:14 +00:00
Hartmut Brandt
c06ac233d7 Document the new -A flag for ignoring archive errors. 2005-03-31 11:40:53 +00:00
Hartmut Brandt
5e0a7a4450 Almost complete rewrite of the archive code (except for the Makefile parsing
part). Archive handling was broken at least since the move from BSD ar/ranlib
to GNU binutils because of the different archive format. This rewrite fixes
this by making make to carry around the defines for all formats (it supports)
so it can support all of them independent of the actually used one. The
supported formats are: traditional BSD (this seems to come from V7 at least,
short names only and __.SYMDEF), BSD4.4 (long names with #1/ and __.SYMDEF)
and SysV (extra name table and //). The only format not supported are broken
traditional archives where the member names are truncated to 15 characters.

Errors in the archive are not ignored anymore, but cause make to stop with
an error message. The command line option -A causes these errors to become
non-fatal. This is almost compatible with previous usage except for the
error message printed in any case.

Use a type-safe intrusive list for the archive cache.

Reviewed by:	Max Okumoto <okumoto@ucsd.edu> (without new error handling)
2005-03-31 11:35:56 +00:00
Hartmut Brandt
ae6bff540a Move the MAX macro to a util.h so it becomes usable in other modules.
Suggested by:	Max Okumoto <okumoto@ucsd.edu>
2005-03-31 11:12:45 +00:00
Hartmut Brandt
ba467ce430 Make the structure for handling the input stack local to the parse
module. The only module accessing it (the current line number) was the
condition module, so pass the current line number as a function argument.
Centralize the pushing of new input sources into one function
ParsePushInput() and rename the function handling the popping from ParseEOF()
to ParsePopInput(). Make the entire thing a little bit clearer, by holding
the current input source in the top element of the stack instead of
using extra variables for this. Use a type-safe intrusive list for the
input stack.
2005-03-30 15:18:58 +00:00
Hartmut Brandt
f43eb6f83b Fix a bug introduced in a previous commit: ParseModifier() consumes
characters so it is not safe to move around code from
before it to after it. This should fix problems with building the
documentation.

Patch:		7.170

Submitted by:	Max Okumoto <okumoto@ucsd.edu>
2005-03-30 15:14:22 +00:00
David E. O'Brien
a89017c846 Add directory hierarchy copying example. 2005-03-28 18:18:44 +00:00
David E. O'Brien
c0d08dc24d Note when 'stat' appeared in FreeBSD. 2005-03-28 04:02:45 +00:00
Alfred Perlstein
72aa911a29 When doing the initial open of the proc via procfs, complain if we are
unable to open the /proc/pid/mem file.  Otherwise doing a truss on
a nonexistant pid makes us return success even though no such process
exists.
2005-03-27 12:53:25 +00:00
Alfred Perlstein
5321ae8649 I've been working on this somewhat so I'm moving the
parts I'm touching to be as style(9) compliant as I can.
2005-03-27 12:47:04 +00:00
Hartmut Brandt
fe504834f3 Style: de-lispify by removing extra parantheses in conditional expressions. 2005-03-23 16:28:57 +00:00
Hartmut Brandt
1b0d28102e Style: make indentation 8 characters. 2005-03-23 16:14:41 +00:00
Hartmut Brandt
fb1dac11b4 Make paths an explicite datatype instead of using the generic Lst.
A Path is now a TAILQ of PathElements each of which just points to
a reference counted directory. Rename all functions dealing with Paths
from the Dir_ prefix to a Path_ prefix.
2005-03-23 12:56:15 +00:00
Hartmut Brandt
76a6d2363f Style: <space><tab> -> <tab> 2005-03-22 12:59:02 +00:00
Hartmut Brandt
cbb7c3931c Rename struct Path to struct Dir and move it into the C-file. It
is not used outside.
2005-03-22 12:54:46 +00:00
Hartmut Brandt
35167ece76 Remove debugging code that crept in in the last commit. 2005-03-22 12:52:00 +00:00
Hartmut Brandt
ad6ba6872a Remove Lst_Find() and Lst_FindFrom() now that they aren't needed anymore. 2005-03-22 12:40:24 +00:00
Hartmut Brandt
e4a90d00b4 Remove the last two instances of Lst_Find() calls. 2005-03-22 12:38:55 +00:00
Hartmut Brandt
144b68a7ef Use VarParse() inside var.c instead of Var_Parse().
Patch:		7.163

Submitted by:	Max Okumoto <okumoto@ucsd.edu>
2005-03-22 08:20:08 +00:00
Hartmut Brandt
6fd71d7a66 Unify callers to Var_Parse() with regard to variable names.
Patch:		7.162

Submitted by:	Max Okumoto <okumoto@ucsd.edu>
2005-03-22 08:18:15 +00:00
Hartmut Brandt
a4c193bbe2 Make some callers of VarFind using the same code structure.
Patch:		7.161

Submitted by:	Max Okumoto <okumoto@ucsd.edu>
2005-03-22 08:16:09 +00:00
Hartmut Brandt
29b59e2865 De-lispify some if()-expressions by removing extra parantheses.
Patch:		7.160
Requested by:	harti

Submitted by:	Max Okumoto <okumoto@ucsd.edu>
2005-03-22 08:12:16 +00:00
Hartmut Brandt
b6c44471ba Return a Buf object from VarGetPattern() instead of a char * and a size_t.
Store a Buf object in struct VarPattern instead of a char * and a length.

Patch:		7.158

Submitted by:	Max Okumoto <okumoto@ucsd.edu>
2005-03-22 08:09:43 +00:00
Hartmut Brandt
ce873d22d5 Use the struct VarPattern's lhs field instead of using an extra variable
to store the left expression of a C modificator.

Patch:		7.157

Submitted by:	Max Okumoto <okumoto@ucsd.edu>
2005-03-22 08:06:34 +00:00
Hartmut Brandt
6edf648505 Merge struct VarREPattern into struct VarPattern. This will help sorting
out common code.

Patch:		7.156

Submitted by:	Max Okumoto <okumoto@ucsd.edu>
2005-03-22 08:03:42 +00:00
Hartmut Brandt
b31a79d77e Sort prototypes.
Patch:		7.155

Submitted by:	Max Okumoto <okumoto@ucsd.edu>
2005-03-22 08:01:04 +00:00
Hartmut Brandt
d344c54aba Fix indentation.
Patch:		7.154 (partly)

Submitted by:	Max Okumoto <okumoto@ucsd.edu>
2005-03-22 08:00:02 +00:00
Hartmut Brandt
5af70720f4 Delete an extra empty line.
Patch:		7.153

Submitted by:	Max Okumoto <okumoto@ucsd.edu>
2005-03-22 07:57:18 +00:00
Hartmut Brandt
1ff3feb03d An automatic variable in a local scope is (conceptionally) destroyed with
the closing brace so it is unwise to keep a pointer to it. Make
the variable static to fix this.

Patch:		7.152

Submitted by:	Max Okumoto <okumoto@ucsd.edu>
2005-03-22 07:56:22 +00:00
Hartmut Brandt
4896df6314 Simplify buffer access by using Buf_Data() and Buf_Peel() where
appropriate.

Patch:		7.147-7.151

Submitted by:	Max Okumoto <okumoto@ucsd.edu>
2005-03-22 07:50:40 +00:00
Hartmut Brandt
9668c011e9 Two new functions: Buf_Data() returns a reference to the data in
the buffer and Buf_AppendBuf() appends a copy of one buffer to another
buffer.

Patch:		7.146,7.147

Submitted by:	Max Okumoto <okumoto@ucsd.edu>
2005-03-22 07:42:51 +00:00
Hartmut Brandt
cffe7fcdef Remove a temporary variable. Rename pattern to patt to be consistent.
Remove unreachable code for VAR_NOSUBST - it was never set.
Replace redundant code with calls to VarGetPattern().

Patch:		7.143-7.145

Submitted by:	Max Okumoto <okumoto@ucsd.edu>
2005-03-22 07:38:46 +00:00
Hartmut Brandt
1610cab61d Remove unneeded temporary variables in modifier_S() and modifier_C().
Change the parsing of the C modifier flags so that specifying both
'1' and 'g' gives an error.

Patch:		7.141,7.142

Submitted by:	Max Okumoto <okumoto@ucsd.edu>
2005-03-21 12:40:27 +00:00
Hartmut Brandt
090051a931 Remove comment about Var_Parse assuming that the first character
is always a '$'. This is not always correct, for example for
conditionals: .if defined(foobar).

Clean up some comments.

Move common code out of if-statements.

Patch:		7.140

Submitted by:	Max Okumoto <okumoto@ucsd.edu>
2005-03-21 12:32:41 +00:00
Hartmut Brandt
f244a9fb0a Split out SysV variable substitution into its own function.
Patch:		7.139

Submitted by:	Max Okumoto <okumoto@ucsd.edu>
2005-03-21 12:27:53 +00:00
Hartmut Brandt
a33399ac68 Rename freePtr to freeResult to make it more obvious about what
pointer we're talking.

Patch:		7.138

Submitted by:	Max Okumoto <okumoto@ucsd.edu>
2005-03-21 12:19:23 +00:00
Hartmut Brandt
6cb006aff1 Move some code from ParseModifier() into the calling function to
simplify things. Correct a number comments.

Patch:		7.137

Submitted by:	Max Okumoto <okumoto@ucsd.edu>
2005-03-21 12:17:44 +00:00
Hartmut Brandt
61cc000336 Cleanup the VAR_JUNK handling.
Patch:		7.136

Submitted by:	Max Okumoto <okumoto@ucsd.edu>
2005-03-21 12:15:06 +00:00
Hartmut Brandt
8f712e5034 Don't pass 'consumed' through all the parsing routines where it can be computed
by the caller. Don't pass 'endc' - it can be computed from 'startc'.
Remove unneccessary temporary variables. Remove constant if-expressions
and remove code before call Fatal() - there is no point to cleanup before
aborting.

Patch:		7.134,7.135

Submitted by:	Max Okumoto <okumoto@ucsd.edu>
2005-03-21 12:07:14 +00:00
Hartmut Brandt
b072d12283 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
Hartmut Brandt
13591063f0 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
Hartmut Brandt
0906b0904f 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
David Schultz
fd757c50f6 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
Hartmut Brandt
73c5a04dfa 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
Ian Dowse
2bcccc224c 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
Tim Kientzle
1ca479296c 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
Pawel Jakub Dawidek
d0cf19a161 Whitespace fixes. 2005-03-20 11:47:44 +00:00
Pawel Jakub Dawidek
0a5f326cd2 - 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
Pawel Jakub Dawidek
d054f5d7cd - 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
Pawel Jakub Dawidek
b94b78867e Sort options properly.
Reviewed by:	gad
MFC after:	3 days
2005-03-20 11:17:06 +00:00
Pawel Jakub Dawidek
46a4b46cd7 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
Pawel Jakub Dawidek
87a8221aeb 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
Pawel Jakub Dawidek
2b0a135497 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
Hartmut Brandt
cedc4e46c2 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
Hartmut Brandt
af0b17b173 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
Hartmut Brandt
2ae8b5b5f6 Style: fix indentation and <space><tab>.
Patch:		7.124

Submitted by:	Max Okumoto <okumoto@ucsd.edu>
2005-03-18 15:44:23 +00:00
Hartmut Brandt
e524dd1162 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
Hartmut Brandt
1753011e3f 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
Hartmut Brandt
6ea1a0dc21 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
Hartmut Brandt
2559e71404 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
Hartmut Brandt
7ea59d002e 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
Hartmut Brandt
0ce37001aa 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
Hartmut Brandt
0bcbcabd26 Replace Lst_ForEach by LST_FOREACH. 2005-03-16 16:02:09 +00:00
Hartmut Brandt
a238417909 Replace another bunch of Lst_ForEachs by LST_FOREACHs and simplify code. 2005-03-16 12:22:15 +00:00
Poul-Henning Kamp
99d432b90c Dike out another kvm indiscretion. 2005-03-16 10:24:16 +00:00
Hartmut Brandt
363fa56a62 Fix a comment. 2005-03-16 08:06:28 +00:00
Hartmut Brandt
0bcd542606 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
Hartmut Brandt
d2f389f5e4 Ups. Revert the last commits. These have been committed by accident. 2005-03-15 15:10:51 +00:00
Hartmut Brandt
d735bf8813 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
Hartmut Brandt
77f4b22417 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
Poul-Henning Kamp
dc2f8e798b Dike out unwarranted si_udev fondling. 2005-03-15 14:30:26 +00:00
Hartmut Brandt
49fe6e22fd 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
Hartmut Brandt
ca98b031fd 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
Hartmut Brandt
dd37002304 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
Hartmut Brandt
f321cf01e1 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
Hartmut Brandt
03ecd4b822 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
Hartmut Brandt
e0da09426f Move the creation of a Src structure into its own function. 2005-03-14 12:04:20 +00:00
Hartmut Brandt
b33cc19c5f 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
Hartmut Brandt
8cb809ea3f Convert a couple of other uses of Lst_ForEach to LST_FOREACH and
simplify code.
2005-03-14 08:29:58 +00:00
Tim Kientzle
fd51bae501 A handful of minor portability and style improvements. 2005-03-14 00:30:35 +00:00
Tim Kientzle
fbef37980b Style correction: one tab after #define. 2005-03-14 00:29:05 +00:00
Tim Kientzle
bab7b08353 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
Tim Kientzle
0c83e61cd1 Fix a compile warning, fix the build. 2005-03-13 21:36:15 +00:00
Tim Kientzle
6f55523db7 "make depend" with .y files is trickier than it looks. <sigh> 2005-03-13 19:55:53 +00:00
Tim Kientzle
3e41208d6e Brain-o. Missing quote. 2005-03-13 19:44:19 +00:00
Tim Kientzle
d14c1502f0 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 Davies
009cb1684c Remove an unused #define. md5's with and without this commit match.
Approved by:	murray (mentor)
2005-03-13 17:58:31 +00:00
Tim Kientzle
62a2ad1b03 Add --strip-components option, per bin/77666.
Thanks to: Sangwoo Shim
2005-03-13 04:12:30 +00:00
Stefan Farfeleder
595e532309 Use socklen_t where appropriate. 2005-03-11 14:17:12 +00:00
Hartmut Brandt
c2d34cc331 Simplify the print routines by using LST_FOREACH instead of Lst_ForEach
and inlining the small printing utility functions.
Create a function that can be used to produce printable representations
of flag words.
2005-03-11 13:24:08 +00:00
Hartmut Brandt
7985e10d29 Remove leading underscores from the pathname defines. All identifiers
with leading underscore followed by an uppercase letter are in the
implementation namespace.
2005-03-11 13:02:38 +00:00
Hartmut Brandt
2c9d008998 Remove the leading underscore from structure tags. All identifiers
with a leading underscore are in the implementation namespace.
2005-03-11 12:57:25 +00:00
Hartmut Brandt
941266174e Style: Fix indentation. 2005-03-11 12:40:55 +00:00
Hartmut Brandt
b13ac84d46 Call ParseFinishLine() also for the last line in a file. This
patch differs from the previous one in that it calls the function
only when a real file hits EOF. The bodies of .for loops are also
handled as files, but for these we don't want to end a dependency block
on the 'EOF' as in:

foo:
	do-this
.for ...
	do-something
.endfor
	do-more
2005-03-11 11:29:39 +00:00
Hartmut Brandt
520fec816c Back out the last commit. It turns out that this breaks more than
it fixes. This should fix the buildworld breakage.
2005-03-11 07:53:32 +00:00
Hartmut Brandt
da559dbfd0 Constify Var_Dump and simplify it by inlining VarPrintVar. 2005-03-10 15:38:01 +00:00
Hartmut Brandt
248cf569be Call ParseFinishLine() for the last line of a file too. 2005-03-10 15:30:09 +00:00
Hartmut Brandt
6dfe1d848e Reorganize Suff_EndTransform to be called only for nodes for
which it is needed (transforms).
2005-03-10 14:54:47 +00:00
Hartmut Brandt
8c87f5a0c7 Style: fix function style before working on it (mainly intendation). 2005-03-10 10:16:03 +00:00
Paul Saab
e891d82b56 Add limits on the number of elements in the sack scoreboard both
per-connection and globally. This eliminates potential DoS attacks
where SACK scoreboard elements tie up too much memory.

Submitted by:	Raja Mukerji (raja at moselle dot com).
Reviewed by:	Mohan Srinivasan (mohans at yahoo-inc dot com).
2005-03-09 23:14:10 +00:00
Roman Bogorodskiy
f7dc064cb6 Add myself.
Approved by:	krion (mentor)
2005-03-09 17:41:42 +00:00
Hartmut Brandt
a2e5fa0890 Implement a new macro LST_NEXT which is like Lst_Succ but doesn't check
for its argument to be non-NULL.
2005-03-09 16:53:31 +00:00
Hartmut Brandt
0d037244ba Split SuffExpandChildren into three functions: one that skips
variables and expands archive specifications, one that expands
wild cards and a driver that loops over the children list and
expands each child if necessary replacing it with it's expansions.
2005-03-09 16:51:43 +00:00
Stefan Farfeleder
3dc2fe25dc Fix dubious C code construct. 2005-03-09 11:57:32 +00:00
Hartmut Brandt
4ca8a80cb5 Var_Subst() cannot return NULL so there is no reason to check
for it.
2005-03-09 07:53:03 +00:00
Hartmut Brandt
0fdac3eed6 Style: fix indentation of SuffExpandChildren before working on it. 2005-03-08 16:30:32 +00:00
Hartmut Brandt
e390545124 Use Buf_Peel to get rid of a local variable. 2005-03-08 14:37:47 +00:00
Hartmut Brandt
d5247abc18 Use the Buf_Peel function to get to the string contained into a
buffer without using an extra local variable.
2005-03-08 14:33:58 +00:00
Hartmut Brandt
1a67f7b6d6 Remove useless local prototypes. 2005-03-08 14:30:18 +00:00
Hartmut Brandt
0c270d9eb0 Style: fix indentation. 2005-03-08 14:29:23 +00:00
Hartmut Brandt
7ca80f1cbc Use the new Buf_Peel function to simplify things.
Remove an unused struct definition.
2005-03-08 13:15:51 +00:00
Hartmut Brandt
3509f4d713 Create a new function Buf_Peel that returns the string from inside
a Buffer and frees the Buffer.
2005-03-08 13:15:18 +00:00
Giorgos Keramidas
336c393fc0 Use 12 columns for (int) values, 20 columns for (long) and align
headers properly (right justified for numbers, left justified for
everything else).

This fixes the alignment of the fields on i386, sparc64 and amd64
today but does not dynamically assign column widths or bear in mind
that some of the values may be 64-bit in the future.

Reviewed by:	alfred
2005-03-08 13:14:46 +00:00
Tony Finch
7dded4a50e Sync with upstream:
Allow the user to run unifdef without defining any symbols. This is
useful in conjunction with the -k flag.
Fix a bug in the -s handling code that would have caused out-of-bounds
array accesses.
Add a -n option to insert #line directives in the output.
Ignore comment markers inside string and character literals
(bug reported by Amos Shapira <amos.shapira@netregistry.com.au>).
More accurate copyright notices.
2005-03-08 12:52:00 +00:00
Hartmut Brandt
1753d0e6a4 Add a debugging function that prints a message and appends the
current strerror.
2005-03-08 07:47:14 +00:00
Hartmut Brandt
a0aea18e18 Mark functions that don't return as dead. 2005-03-08 07:45:50 +00:00
Hartmut Brandt
34d49b885f Finish constification of Var_Parse() and Var_Subst().
Patch:		0.18, 0.8, 7.110

Submitted by:	Max Okumoto <okumoto@ucsd.edu>
2005-03-08 07:43:57 +00:00
Hiten Pandya
9e1fb7fbad Document the '-i' option which allows the user to specify a ktr events
log file.
2005-03-08 06:58:56 +00:00
Hartmut Brandt
b37a89c4d4 Constify the callers of brk_string in this file.
Patch:		7.108

Submitted by:	Max Okumoto <okumoto@ucsd.edu>
2005-03-07 16:23:53 +00:00
Hartmut Brandt
f4d3f46b2e Style: fix indendation of VarModify().
Patch:		7.107

Submitted by:	Max Okumoto <okumoto@ucsd.edu>
2005-03-07 16:14:50 +00:00
Hartmut Brandt
3cc51195c4 Constify the input argument to brk_string.
Patch:		7.106

Submitted by:	Max Okumoto <okumoto@ucsd.edu>
2005-03-07 16:10:39 +00:00
Hartmut Brandt
c4487a484d Factor out the 'S' modifier into its own function. Move a variable
that is now used for both the 'M'/'N' branch and the 'S' branch of
the switch statement into a common scope.

Patch:		7.102-105
Submitted by:	Max Okumoto <okumoto@ucsd.edu>
2005-03-07 16:08:39 +00:00
Hartmut Brandt
ec3074aef1 Move the 'M' and 'N' modifiers into their own function.
Patch:		7.101

Submitted by:	Max Okumoto <okumoto@ucsd.edu>
2005-03-07 12:43:59 +00:00
Alfred Perlstein
9c6519b0a2 Change fix a bug where the length of data written by snprintf was
being mishandled by using accumulation (into an uninitialized
variable) instead of direct assignment.

Reviewed by: scottl
2005-03-03 17:20:36 +00:00
Hartmut Brandt
573d78add6 Style: remove unneeded parantheses in conditionals. 2005-03-03 11:34:04 +00:00
Hartmut Brandt
b6bda8ea9d Constify the code paths for the 'M' and 'N' modifiers.
Patch:		7.100

Submitted by:	Max Okumoto <okumoto@ucsd.edu>
2005-03-03 11:26:28 +00:00
Hartmut Brandt
179fc89109 Fix parsing of archives: in System V archive format the member names
is terminated with a slash. Although we are not System V, ar has
been configured to put that slash in. This format allows filenames
with trailing spaces.
2005-03-03 10:46:23 +00:00
Hartmut Brandt
5c78dee378 Fix parsing of archive specifications on the target side of
dependency lines.  It seems that nobody is actually is using
the archive-feature of make.
2005-03-03 10:09:39 +00:00
Hartmut Brandt
49f5e8346a Update the description comment of the function to reflect the
previous change.
2005-03-03 10:07:28 +00:00
Hartmut Brandt
d0330ee675 Transform VarParseLong() so that the lifetime and the constness of
variables gets clearer. Transform if() conditions to make the flow
clearer.

Patch:		7.93-99

Submitted by:	Max Okumoto <okumoto@ucsd.edu>
2005-03-03 07:25:04 +00:00
Xin LI
b2253a33dc If a user or group is not known, report the problem user/group, rather than
the first user/group. Caused huge fun in error messages from large script.
Old:	pgrep -u root,NoSuchUser,daemon	-> pgrep: unknown user `root'
Now:	pgrep -u root,NoSuchUser,daemon	-> pgrep: unknown user `NoSuchUser'

Obtained from:	NetBSD (rev. 1.8)
MFC After:	1 week (if re@ would have approved this)
2005-03-03 02:17:20 +00:00
Hartmut Brandt
bf7c33df9c Move the check for the error case (variable ends without a closing
paranthesis or brace) into the loop and don't leak the buffer in this
case. Remove the check for Var_Parse returning NULL - it can't.

Patch:		7.92

Submitted by:	Max Okumoto <okumoto@ucsd.edu>
2005-03-02 15:52:04 +00:00
Hartmut Brandt
b7beb62744 Fix indentation on a block of code.
Patch:		7.91

Submitted by:	Max Okumoto <okumoto@ucsd.edu>
2005-03-02 14:43:40 +00:00
Hartmut Brandt
09394f0073 Push the length computation down into VarParseShort().
Return always malloc()-ed strings from VarParseShort() to get
rid of warnings when returning string constants from a non-const char *
function.

Patch:		7.90

Submitted by:	Max Okumoto <okumoto@ucsd.edu>
2005-03-02 14:30:36 +00:00
Hartmut Brandt
c21044494f Convert a function call to Lst_ForEach with a macro call to LST_FOREACH. 2005-03-02 12:00:21 +00:00
Tom Rhodes
c71158d453 Wrap BSD r* commands in NO_RCMDS.
Change NO_RCMDNS to NO_RCMDS and do the switch in bsd.compat.mk.

Discussed with: ru, nectar
2005-03-02 11:53:22 +00:00
Jesus R. Camou
7cc4af3494 Add an entry for myself.
Approved by:	trhodes (mentor)
2005-03-02 09:08:17 +00:00
Hartmut Brandt
b93324d35e Use the LST_FOREACH macro instead of the Lst_ForEach function. This
saves function calls and reduces void casting.
2005-03-02 08:30:49 +00:00
Hartmut Brandt
41664cddcd Make sure the length variable is initialized to 0 before passing
it to Var_Parse().

Patch:		7.85

Submitted by:	Max Okumoto <okumoto@ucsd.edu>
2005-03-01 17:52:18 +00:00
Hartmut Brandt
f1c603af79 Split out ParseModifiers from VarParseLong.
Patch:		7.84
Submitted by:	Max Okumoto <okumoto@ucsd.edu>
2005-03-01 12:26:32 +00:00
Hartmut Brandt
73058038d5 VarParseLong: Create new else block for haveModifier. Move the call
to VarExpand down into the branches of the if as well as cleanup code.
Eliminate code that is now obviously dead.

Patch:		7.83

Submitted by:	Max Okumoto <okumoto@ucsd.edu>
2005-03-01 12:22:07 +00:00
Florent Thoumie
6313c7a1f2 Add myself to the calendar.
Feel free to send presents :)

Approved by:	pav (mentor)
2005-03-01 11:48:36 +00:00
Hartmut Brandt
aeadeefcdf Reverse a condition so that the else clause can be changed
to a fallthrough.

Patch:		7.82

Submitted by:	Max Okumoto <okumoto@ucsd.edu>
2005-03-01 07:58:18 +00:00
Hartmut Brandt
4866acd4de VarParseLong: Move the initialisation of dynamic up which saves
an else clause. Move the assignment to the lengthPtr down to
just before the return statements.

Patch:		7.81

Submitted by:	Max Okumoto <okumoto@ucsd.edu>
2005-02-28 17:23:17 +00:00
Hartmut Brandt
09fdd614d4 Buf_GetAll wants a pointer as its second argument, not a boolean -
replace FALSE by NULL.

Submitted by:	Max Okumoto <okumoto@ucsd.edu>
2005-02-28 17:05:26 +00:00
Hartmut Brandt
9944ed62ba Don't modify the input string in VarParseLong(). It is not
necessary to NUL-terminated it, because we know the lengths
from the pointers.

Patch:		7.80

Submitted by:	Max Okumoto <okumoto@ucsd.edu>
2005-02-28 15:01:37 +00:00
Simon Barner
bde229cc2c Add my birthday.
Approved by:	arved (mentor)
2005-02-27 21:34:08 +00:00
Ruslan Ermilov
edc431123e Make the format of LC_COLLATE files architecture independent. 2005-02-27 20:31:13 +00:00
Alexey Zelkin
cd147cba52 Fix two cut'n'paste'os which violated format of NLS catalogs 2005-02-27 19:42:48 +00:00
Ruslan Ermilov
4b25405336 Fix build on sparc64. 2005-02-27 19:37:51 +00:00
Alexey Zelkin
3e71d6fa8a Remove unused now stuff, also set WARNS to 8 2005-02-27 16:25:14 +00:00
Alexey Zelkin
5605146f8f Bring in NetBSD's improvements and cleanups to NLS subsystem, making
it type and endian clean.

Also following changes were done:

. Remove of outdated support for generating of include files for
  NLS catalogs being generated.
. Integrate my old code optimizations
. ANSI'fy prototypes
. Remove duplicate defines, and cleanup includes
. Remove first (unused) argument from error() function
. Const'ify (gencat now WARNS=8 clean)
. Convert corrupt() and nomem() functions to macros
. Add *temporary* note what '-new' command line argument is
  deprecated now (instead of exiting with error message)

WARNING: format of generated .cat files is changed!

XXX: re-add support for *updating* of .cat files, NetBSD has this
functionality disabled

Obtained from:	NetBSD (mostly)
2005-02-27 16:23:14 +00:00
Ruslan Ermilov
923d9b0109 Zero out the entire "struct __collate_st_chain_pri", or garbage
appears in LC_COLLATE files (due to alignment).  An alternative
would be to bump STR_LEN to 16.

(This is in preparation to make LC_COLLATE files architecture
independent.)
2005-02-27 14:05:38 +00:00
Garance A Drosehn
46793db95b MFC 1.22: Fix -0 vs -L/-I processing, mainly so that 'xargs -0 -I []' will
do something sensible (namely: treat then '\0' as the EOL character, when
deciding what "a line" is for -N).  Note that  -I implies -N.

MFC after:	3 days
2005-02-27 01:35:54 +00:00
Ruslan Ermilov
3fb3a43079 Make the format of LC_CTYPE files architecture independent by
introducing the disk formats for _RuneLocale and friends.

The disk formats do not have (useless) pointers and have 32-bit
quantities instead of rune_t and long.  (htonl(3) only works
with 32-bit quantities, so there's no loss).

Bootstrap mklocale(1) when necessary.  (Bootstrapping from 4.x
would be trivial (verified), but we no longer provide pre-5.3
source upgrades and this is the first commit to actually break
it.)
2005-02-26 21:47:54 +00:00
Hartmut Brandt
4ce3340f48 Major clean up and split the Var_Parse monster function into three
functions: one for the single letter variables, one for the others
and one that does the recursive expansion.

Patches:	7.68-7.79

Submitted by:	Max Okumoto <okumoto@ucsd.edu>
2005-02-26 08:54:40 +00:00
Tom Rhodes
a1b763cac1 Fix mismerge.
Noticed by:	tjr
2005-02-26 04:14:20 +00:00
Hartmut Brandt
179078e76d Change the return value of Var_Subst to return a Buffer instead
of a char *.

Patch:		7.49

Submitted by:	Max Okumoto <okumoto@ucsd.edu>
2005-02-25 13:16:56 +00:00
Sergey Matveychuk
88565cf2d1 Fix a typo in my last commit.
Reported by:	ceri
2005-02-24 18:17:41 +00:00
Sergey Matveychuk
524cfc25d0 Put my birthday into the pool.
Sorry guys, USSR idiosyncrasy.
2005-02-24 17:08:39 +00:00
Hartmut Brandt
d057118357 Var_Parse: Separate different error states by introducing an else block
after a return. Move assignments to {freePtr, dynamic, start} closer to the
return statements to clarify which variables are actually used for
communication between the losely coupled blocks of the code. Clear up
an if-expression to make common structures of the conditions clearer.
Use strchr instead of switch statements to check for a character beeing
a member of a set.

Patches:	7-62.2, 7-62.3, 7-64, 7-65.1, 7-65.2
Submitted by:	Max Okumoto <okumoto@ucsd.edu>
2005-02-24 16:05:45 +00:00
Hartmut Brandt
a65e9283c5 Push assignments to just before the returns from the function to
get it clearer what variables are actually needed.

Patches:	7.62.2, 7.62.3
Submitted by:	Max Okumoto <okumoto@ucsd.edu>
2005-02-24 10:35:39 +00:00
Hartmut Brandt
0cb1c98b7a Fix wording of a comment.
Submitted by:	Max Okumoto <okumoto@ucsd.edu>
2005-02-24 10:30:23 +00:00
Hartmut Brandt
9a2bfd7ef5 Replace the calls to Lst_ForEach with the new LST_FOREACH macro and
fix the prototype for Compat_RunCommand to take the actual argument
types instead of void *.
2005-02-24 10:23:31 +00:00
Tom Rhodes
c566c001e6 Add better mdoc(7) mark up, clean up wording, better describe the effects
of some arguments.

PR:				47705
Based on a patch submitted by:	Gary W. Swearingen <swear@attbi.com>
Glanced at by:			simon
2005-02-23 22:40:45 +00:00
Hartmut Brandt
592dcf0422 Use the LST_FOREACH macro instead of the Lst_ForEach function
and so get rid of the ForExec helper function by inlining it
into For_Run.
2005-02-23 14:03:18 +00:00
Hartmut Brandt
7175fefe00 Style: fix indent, use tabs instead of space+tab for aligning things.
Add a couple of comments.
2005-02-23 13:58:56 +00:00
Hartmut Brandt
09dd1bb9a1 Fix the indendation of some multi-line comments.
Noted by:	Max Okumoto <okumoto@ucsd.edu>
2005-02-23 10:20:58 +00:00
Ruslan Ermilov
6fe37d1365 Add endianness support to cap_mkdb(1), useful for cross builds. 2005-02-22 23:29:54 +00:00
Gleb Smirnoff
a97719482d Add CARP (Common Address Redundancy Protocol), which allows multiple
hosts to share an IP address, providing high availability and load
balancing.

Original work on CARP done by Michael Shalayeff, with many
additions by Marco Pfatschbacher and Ryan McBride.

FreeBSD port done solely by Max Laier.

Patch by:	mlaier
Obtained from:	OpenBSD (mickey, mcbride)
2005-02-22 13:04:05 +00:00
Hartmut Brandt
6a1865cdbb Fix the prototypes by addings some constness. This should have been
committed together with the commit to dir.c:1.48.
2005-02-22 08:17:05 +00:00
Hartmut Brandt
e4597ce6ea Use the new LST_FOREACH macro throughout the file and replace calls to
Lst_ForEach and Lst_Find.
2005-02-22 08:00:06 +00:00
Hartmut Brandt
36120d91e5 Invent the LST_FOREACH macro for looping through a list. In contrast
to the Lst_ForEach function this macro reduces the number of function
calls per invocation by N + 1 (where N is the number of list elements)
and increases code locality thereby increasing readability and
(maybe) performance.
2005-02-22 07:58:53 +00:00
Paul Saab
043da612df Fix an overflow when calculating the number of kilobytes from the
number of pages.

Obtained from:	Yahoo!
2005-02-21 14:35:00 +00:00
Hartmut Brandt
1d2a8153d3 Style: fix indendation to be 8 and use tabulators. Fix lines longer than
80 characters and slightly reorder functions to get rid of static
prototypes.
2005-02-21 13:36:22 +00:00
Hartmut Brandt
6abaece6ae Forgot to set *freePtr to FALSE in another place.
Submitted by:	Max Okumoto <okumoto@ucsd.edu>
2005-02-21 08:10:21 +00:00
Hartmut Brandt
436834581b Fix a bug in handling archive members: when a member was not found
when looking into an already hashed archive, the code tried to use
the name shortened to the maximum length allowed for the archive.
Unfortunately it passed a buffer of junk to the hashing routine when
the name actually wasn't too long. Theoretically this could lead to
a false positive.
2005-02-21 08:06:34 +00:00
Ruslan Ermilov
02172b19b8 Fixate the hash bucket size to 4K. We were using the default,
which is stat.st_blksize (i.e., PAGE_SIZE).

This change causes the .db files that were cross-compiled on
another platform to be identical to the natively built ones.

Tested on:	alpha->amd64 build
2005-02-19 23:59:49 +00:00
Hajimu UMEMOTO
1b92360adc simply ignore unknown address family.
MFC after:	1 week
2005-02-19 16:54:26 +00:00
Hajimu UMEMOTO
511912ad5c teach IPv6 to `systat -netstat'.
Tested by:	kuriyama
MFC after:	1 week
2005-02-19 15:10:19 +00:00
Garrett Wollman
456f9a140f Support correct programming environment name for amd64.
MFC after:	3 days
2005-02-18 21:53:05 +00:00
Tim Kientzle
b432e867aa Document the --null, --one-file-system, and -I options.
Clarify that -T can be used in 'x' mode as well as 'c' mode.
2005-02-18 19:19:45 +00:00
Hartmut Brandt
7f2e1af188 Push the assignments of some variables down into the sub-blocks where
it is actually needed. This makes clear in which subblocks the variables
are not needed and which can easier be split out.

Submitted by:	Max Okumoto <okumoto@ucsd.edu>
2005-02-18 15:32:06 +00:00
Hartmut Brandt
1aaa4432a5 Push down variables into local scope in Var_Parse to make their
liveness clear for splitting up this monster function.

Submitted by:	Max Okumoto <okumoto@ucsd.edu>
2005-02-18 07:33:43 +00:00
Herve Quiroz
f812d8f8c6 Add myself to the calendar 2005-02-17 16:38:56 +00:00
Hartmut Brandt
5fdd47f89b Whitespace cleanup: substitute mixed tabs and spaces by canonical
whitespace and line up some variable definitions.
2005-02-17 12:35:32 +00:00
Hartmut Brandt
b2a8c56e3a Move error case to begin of if-else chain. Do not needless initialize
startc, but only at the place where the initialisation is needed. Remove
a needless else.

Submitted by:	Max Okumoto <okumoto@ucsd.edu> (partly)
2005-02-17 12:31:53 +00:00
Hartmut Brandt
3ff4a47ba0 Fix two typos in comments.
Submitted by:	ru & Max Okumoto <okumoto@ucsd.edu>
2005-02-17 09:09:34 +00:00
Hartmut Brandt
768820f8c7 Sort out the error case that a single '$' was passed a little bit
earlier instead of mixing its handling with other cases.

Submitted by:	Max Okumoto <okumoto@ucsd.edu>
2005-02-17 09:01:19 +00:00
Hartmut Brandt
46f05faa3a Mostly stylistic issues: move a variable into local scope, make
condition positive and fix long lines.

Submitted by:	Max Okumoto <okumoto@ucsd.edu>
2005-02-16 17:20:09 +00:00
Hartmut Brandt
5e431bae8f Better version of the patch in 1.117: bring a variable into local scope
to prepare for function splitting and slightly reorganise the code
in anticipation of Var_Subst returning a Buffer.

Submitted by:	Max Okumoto <okumoto@ucsd.edu> (with slight changes)
2005-02-16 12:39:32 +00:00
Stefan Farfeleder
78e3eed071 Fix most cases where the address of an int is passed to a function expecting a
socklen_t * argument.
2005-02-14 17:42:58 +00:00
Ruslan Ermilov
36a142c455 Expand contractions. 2005-02-13 23:45:54 +00:00
Ruslan Ermilov
0227791b40 Expand *n't contractions. 2005-02-13 22:25:33 +00:00
Xin LI
41fe9ea15f New order after _netcat has been changed to _nc: sort the list.
Submitted by:	ru
Pointy hat to:	me
2005-02-13 13:42:20 +00:00
Hartmut Brandt
0d63385639 Back out the previous commit. There is an obvious bug in it.
Pointy hat to:	harti
2005-02-13 13:33:56 +00:00
Xin LI
a1635c6837 Spell the variable as underscore plus their possible value, to follow
the style nearby.

Submitted by:	ru
2005-02-13 10:11:21 +00:00
Xin LI
4457bf036b Forgotten to commit this file during the last commit. Connect nc(1)
to build.
2005-02-13 07:12:23 +00:00
Hartmut Brandt
157e401636 Stylistic fixes: push variable into a local context (this part is going
to be split out into a function soon). Also there is no need to write
back the colon that we have NUL-ed - the string is going to be freed
anyway.

Submitted by:	Max Okumoto <okumoto@ucsd.edu>
2005-02-11 17:03:18 +00:00
Hartmut Brandt
40fe2aa311 Convert several instances of negative logic to positive logic.
Submitted by:	Max Okumoto <okumoto@ucsd.edu>
2005-02-11 10:49:01 +00:00
Hartmut Brandt
26478079f7 Buffers are already NUL-terminated so there is no need to explicitely add
a NULL.

Submitted by:	Max Okumoto <okumoto@ucsd.edu>
2005-02-10 17:01:46 +00:00
Hartmut Brandt
ed293d7304 Mostly stylistic nits in preparation for splitting up Var_Parse:
use a more consistent style with regard to *str and str[0];
simplify code by introducing a temporary variable;
shift a break around and add braces where appropriate.

Submitted by:	Max Okumoto <okumoto@ucsd.edu>
2005-02-10 17:00:16 +00:00
Ruslan Ermilov
48baa77217 Fixed usage(). 2005-02-10 16:07:23 +00:00
Ruslan Ermilov
b7a311f2b8 Require at least one argument. 2005-02-10 16:04:22 +00:00
Hartmut Brandt
42e4f1252b Let the buffer just use the default size by specifying 0 as the size
instead of specifying the default size explicitely.

Submitted by:	Max Okumoto <okumoto@ucsd.edu>
2005-02-10 14:53:29 +00:00
Hartmut Brandt
c738c9b125 Mark the modification of the input string (which should really be const)
with a comment.

Submitted by:	Max Okumoto <okumoto@ucsd.edu>
2005-02-10 14:52:14 +00:00
Hartmut Brandt
302288aba2 Style nits:
Move some assignments nearer to where they actually used. Convert a loop
from a for() to a while() to make it clearer and add braces to the long
body of it. Split assignment from variable declaration.

Submitted by:	Max Okumoto <okumoto@ucsd.edu>
2005-02-10 14:50:34 +00:00
Hartmut Brandt
d2bda84a20 Describe a pre-condition of Var_Parse().
Submitted by:	Max Okumoto <okumoto@ucsd.edu>
2005-02-10 14:43:22 +00:00
Hartmut Brandt
f804a7b3b1 Remove a comment that's not actual anymore.
Submitted by:	Max Okumoto <okumoto@ucsd.edu>
2005-02-10 14:41:22 +00:00
Hartmut Brandt
5cb05d7962 Fix spacing by converting mixes of space and tab to tab. Also add a number
of empty lines in appropriate places.

Submitted by:	Max Okumoto <okumoto@ucsd.edu>
2005-02-10 14:39:05 +00:00
Hartmut Brandt
96089951e4 Initialise the status variable. W_SETTERMSIG uses its value.
Submitted by:	stefanf
2005-02-10 14:32:14 +00:00
Hartmut Brandt
51079b278c Lst_Append returns void, so the other case of the ? statement
should also be void.

Submitted by:	stefanf
2005-02-10 14:25:12 +00:00
Alfred Perlstein
ed5769e305 back out 1.7 changes, unneeded and possibly wrong. 2005-02-10 10:44:29 +00:00
Stefan Farfeleder
5bcb8532a8 Turn K&R functions into prototypes. 2005-02-10 09:13:20 +00:00
Stefan Farfeleder
4f83fd1962 Let the generated code include <string.h> instead of <memory.h>. 2005-02-10 08:12:38 +00:00
Hartmut Brandt
2890fef88d Use defines for character constants for open and closing braces and
parantheses. This helps editors to find its way through the horrible
mess of Var_Parse. Rewrite a for() loop into a while() to make it clearer.

Submitted by:	Max Okumoto <okumoto@ucsd.edu>
2005-02-09 18:44:09 +00:00
Ruslan Ermilov
6b806d21d1 Fixed the misplaced $FreeBSD$. 2005-02-09 18:07:17 +00:00
Hartmut Brandt
83307acd08 While working on constification temporarily disable -Werror. Things are too
twisted.
2005-02-09 13:22:02 +00:00
Hartmut Brandt
f2b48f62c6 Untangle VarFind and, while rewriting most of the function, fix the
intendation. (A large part of the function was already at intendation 8).
2005-02-09 13:13:59 +00:00