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
Hartmut Brandt
3f18a493f4
Introduce VarCreate and VarDestroy functions and used them where
...
appropriate.
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-02-09 09:53:28 +00:00
Stefan Farfeleder
a3eb24c68b
Include missing headers.
2005-02-09 09:13:36 +00:00
Stefan Farfeleder
a4a3daa6f1
Avoid usage of implicit int.
2005-02-07 21:42:16 +00:00
Stefan Farfeleder
86601b3a10
Include <stdlib.h> for exit().
2005-02-07 21:41:26 +00:00
Stefan Farfeleder
65cc372082
Add a prototype for localupdate().
2005-02-07 21:40:24 +00:00
Hartmut Brandt
76749b8672
Remove an unneeded check.
2005-02-07 16:33:57 +00:00
Hartmut Brandt
9be6b372de
Introduce a typedef for variable value modifation functions and use it
...
where appropriate.
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-02-07 16:27:19 +00:00
Hartmut Brandt
b3c3341784
Make the intention of a loop clearer.
...
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-02-07 15:51:51 +00:00
Hartmut Brandt
46ca434737
Introduce Buf_StripNewLines() and use it where appropriate.
...
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-02-07 11:27:47 +00:00
Ruslan Ermilov
81a6a1f904
Fix bugs in the previous commit.
2005-02-07 08:44:34 +00:00
Hartmut Brandt
ae9eed1281
Invent a Buf_AppendRange function that appends a non-NUL-terminated string
...
given by a pointer to the start of the string and a pointer one behind
the end.
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-02-07 07:54:23 +00:00
Hartmut Brandt
d01d6678ad
Invent a Buf_Append function to append a NUL-terminated string
...
and use it thoughout the code.
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-02-07 07:49:16 +00:00
Xin LI
fd449ffe29
Revamp several Makefile nits:
...
- .PATH: is spelled ``.PATH: ''
- Don't forget to use DPADD so ``make checkdpadd'' is
not broken.
- LDADD should not come with + as it's empty in the
first place
Suggested by: ru
2005-02-07 05:45:38 +00:00
Xin LI
04def62430
Finish the import of nc(1) from OpenBSD. This includes:
...
- Bring IPsec support from the ports collection [1].
- Bring -o ("once only") option from the ports
collection [2].
- Adopt the Makefile framework into
usr.bin/nc/Makefile.
- Add a knob to control whether to build nc(1),
NO_NETCAT.
- Bump __FreeBSD_version so ports collection can
detect this change.
Original patchset are contributed to the ports collection by:
[1] nectar, [2] joerg.
Note: WARNS?=6 patchset spined off in this commit, in order not
to take too many files off the vendor branch.
2005-02-06 14:44:27 +00:00
Hartmut Brandt
2e0af0312e
Where the returned line length from Buf_GetAll is not used just pass
...
a NULL to the function. Delete the now unused local variables.
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-02-04 16:53:35 +00:00
Hartmut Brandt
f4dd241033
Rewrite of the buf code:
...
- convert Buf_AddByte from a macro to a function
- move #define's into the header file
- remove unused field in struct Buffer
- remove size fields - they can be easily computed
- inline Buf_OvAddByte
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-02-04 16:48:35 +00:00
Xin LI
76628ce773
Save last displayed file by having the "last" pointer global and save it
...
during we show the first file's tail. Instead of:
tarsier% tail -f 1 2
==> 1 <==
foo
bar
==> 2 <==
bar
foo
==> 2 <==
bar2
foo2
Now with this change, we have:
tarsier% tail -f 1 2
==> 1 <==
foo
bar
==> 2 <==
bar
foo
bar2
foo2
While I'm there, move a comment to where it should belong to. Also,
const'ify the "last" static because we will never need to change the
contents it points to.
MFC After: 1 week
2005-02-04 14:01:06 +00:00
Hartmut Brandt
b8900c134b
None of the users of Buf_Discard used it to get rid of only a part of
...
the buffer. So replace Buf_Discard by Buf_Clear which just gets rid
of the entire contents.
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-02-04 13:34:16 +00:00
Hartmut Brandt
8e1c246001
Inline the ADDWORD() macro in the two places where it is used. It just
...
obfuscates the code.
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-02-04 13:29:50 +00:00
Hartmut Brandt
c8bd426d66
Use _exit() instead of exit() when the exec() after a vfork() fails.
...
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-02-04 13:26:37 +00:00
Hartmut Brandt
8ffb687e64
Move PrintAddr() from util.c into suff.c - the only file where it is
...
actuall used, and make it static.
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-02-04 13:23:39 +00:00
Hartmut Brandt
ce8c7083f4
General whitespace cleanup: remove mixes of tabs and spaces, remove
...
space after function names, remove spaces on emtpy lines.
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-02-04 12:38:57 +00:00
Hartmut Brandt
435916b011
Minor cleanup: make brk_string to return argc only if the pointer to it
...
was non-NULL. This let's us eliminated an otherwise unused variable.
shellneeded can never return -1 so there is no need to check for it and
hence no need for a variable to hold the returned value.
Submitted by: Max Okumoto <okumoto@ucsd.edu> (partly)
2005-02-04 12:30:54 +00:00
Hartmut Brandt
acd5b69dd1
Further constification. Use a temporary hack (copying the input string)
...
until Var_Subst is fixed.
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-02-04 12:10:20 +00:00
Ceri Davies
fa5c581ccf
Quote example file names consistently, and fix a small grammatical nit.
2005-02-04 11:37:49 +00:00
Hartmut Brandt
8cfa18d178
Use an extra variable to assign to instead of missusing an input
...
parameter. This will help in constification.
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-02-04 08:31:42 +00:00
Hartmut Brandt
fec9b45897
Replace space, tab mixes by tabs.
...
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-02-04 08:15:11 +00:00
Hartmut Brandt
f6dc7bd983
Use tabs to move to the comments instead of wild mixes of tabs and spaces.
...
Submitted by: Max Okumoto <okumoto@ucsd.edu>
2005-02-04 08:11:58 +00:00
Hartmut Brandt
a9fe0a1150
Style: line up with tabulators.
2005-02-04 08:03:55 +00:00