Commit Graph

7706 Commits

Author SHA1 Message Date
Hartmut Brandt
87c7b797f0 Get rid of global variables for argument vectors produced by brk_string()
introduce a struct that holds all the information about an argument
vector and pass that around.

Author:		Max Okumoto <okumoto@ucsd.edu>
Obtained from:	DragonFlyBSD
2005-05-18 14:50:35 +00:00
Giorgos Keramidas
58ea49c98e (1) Revert unnecessary indentation changes I committed as part of the
last version and (2) remove a disabled debugging fprintf() that I
accidentally committed here.

Noticed by:	simon (2)
2005-05-18 13:42:51 +00:00
Giorgos Keramidas
bbf750fbff Merge the CPU and WCPU columns in a single %6.2f column, add a new 'C'
command that toggles between the two and update the ORDER_PCTCPU()
macro to sort correctly by the visible "cpu" value.

This saves 6 more columns in 80-column terminals, making things a lot
better for the COMMAND column.

Tested on:	i386, sparc64 (panther), amd64 (sledge)
Approved by:	davidxu (in principle)
2005-05-18 13:30:08 +00:00
Hartmut Brandt
485aef42c9 Get rid of the ReturnStatus obscuration that was anyway used only
in two places. While here don't bother returning anything from
Lst_Replace - nobody ever checks the return code.

Suggested by:	jmallet
2005-05-18 06:50:39 +00:00
Alexander Kabaev
39be1552ee Unbreak r1.11 by delhij. Blind change from unsigned to signed char
pointer causes problems with sign extension and leads to compress(1)
dumping core on any non-trivial incoming data.
2005-05-18 05:24:08 +00:00
Ruslan Ermilov
f9fe4d605f Add temporary patches to make one-true-awk respect locale's collating order
in [a-z] bracket expressions, until a more complete fix (like handing BREs)
is ready.

Prodded by:	ache
OK'ed by:	tjr
2005-05-17 14:54:33 +00:00
Ruslan Ermilov
7f5103e510 Correct the script name to be "zless.sh". This avoids an extra cp/chmod
(from the sys.mk rule) while still installing it under the "zless" name.
2005-05-17 11:41:01 +00:00
Dag-Erling Smørgrav
2430592ce1 Add a zless script which invokes less using the lesspipe script. This is
similar to the zmore script that comes with gzip (and in fact, in most
Linux distros, zless is a symlink to that very same zmore script) but has
the advantage that you get the correct file name on the less status line,
and can use :n and :p to navigate back and forth between multiple files.

MFC after:	1 week
2005-05-17 11:14:11 +00:00
Dag-Erling Smørgrav
40d28fe140 Handle presumably uncompressed files with cat; exec the handlers.
MFC after:	1 week
2005-05-17 11:08:11 +00:00
David E. O'Brien
c413702af3 Hardcode username to 8 characters. This makes top(1) output sane when
there are users on the system (even if not running a single process)
with a login > 8 chars.
I'm not all that happy limiting the username width like this, but it
restores sanity to top(1) output.

Discussed with:	keramida
2005-05-16 18:17:38 +00:00
Ruslan Ermilov
228f8c4f8b Make <runefile.h> internal to libc.
Suggested by:	phantom
2005-05-16 09:32:41 +00:00
Marcel Moolenaar
77a77c66d1 o Add option -n. The -n option takes a count and breaks the line
after that many values have been printed. The line length is not
   considered anymore.
o  Add option -x. The -x option will cause the byte values to be
   printed in hexadecimal instead of decimal.
o  Bump WARNS to 6.
o  Update the manpage accordingly.
2005-05-15 06:26:59 +00:00
Marcel Moolenaar
ac97b33fc7 Reindent and improve style(9) comformance. 2005-05-15 01:07:36 +00:00
Hajimu UMEMOTO
4f10131848 NI_WITHSCOPEID cleanup. Neither RFC 2553 nor RFC 3493 defines
NI_WITHSCOPEID, and our getaddrinfo(3) does nothing special
for it, now.
2005-05-13 16:31:11 +00:00
Hartmut Brandt
80f4b4290c Use the print_flags function to print the OP_ flags of a target.
Give the function one more argument to decide whether it should
print the flags like a C-expression or just space-delimited.
2005-05-13 13:47:41 +00:00
Hartmut Brandt
3814743160 Move the Boolean and ReturnStatus stuff from sprite.h to util.h and
get rid of sprite.h.

Obtained from:	DragonFlyBSD
2005-05-13 08:53:00 +00:00
Hartmut Brandt
5a7a21e591 Make Shell_Init() static - it's only used here.
Make sure we don't end up with shellPath beeing non-zero, but shellName
beeing zero in the error case - back out cleanly from the error.
When executing a command for macro assignment in Cmd_Exec() stuff the
path of the shell into argv[0], not the name. This makes no difference
from the functionality point of view, but allows the regression tests to
determine whether make executes the correct shell.
2005-05-13 06:31:45 +00:00
Juli Mallett
36f45138fb Add a flag (-q) which prints no header for the file and which doesn't indent the
match text; it also doesn't warn() for files which can't be opened.  Remove
global variables.  Use bool.  fopen(3) the files instead of freopen(3)ing stdin.
2005-05-12 18:57:37 +00:00
Juli Mallett
3b7d275a3d Include <err.h>. On my system CVS Make(1) has an implicit declaration of
warnc(3) without it.
2005-05-12 16:40:16 +00:00
Hartmut Brandt
fda7e43bda Still too early to bump WARNS - there are still warnings on 64bit
architectures.
2005-05-12 15:58:25 +00:00
Hartmut Brandt
2c050ec33f Make sure machine is initialize before use. Also make two pointers const
to get rid of the last two const warnings.
2005-05-12 15:54:52 +00:00
Hartmut Brandt
fac1e7a589 Get rid of the warning about vfork() clobbering variables.
Submitted by:	Max Okumoto <okumoto@ucsd.edu> (7.246)
2005-05-12 15:54:17 +00:00
Hartmut Brandt
616b319ded Do mktemp() by hand to get rid of the mktemp() warning and the
possible associated security hole.

Submitted by:	Max Okumoto <okumoto@ucsd.edu> (7.245)
2005-05-12 15:45:14 +00:00
Hartmut Brandt
6bf2b616ac Use a variable initialized to a string instead of the string directly
to get rid of a const warning.

Submitted by:	Max Okumoto <okumoto@ucsd.edu> (7.244)
2005-05-12 15:41:02 +00:00
Hartmut Brandt
375209dd24 Move code in CondToken() and get rid of a goto.
Submitted by:	Max Okumoto <okumoto@ucsd.edu> (7.243)
2005-05-12 15:38:11 +00:00
Hartmut Brandt
8de86ef91d Remove a useless else and un-indent the following code. 2005-05-12 15:35:33 +00:00
Hartmut Brandt
a604bcc55d Revert the previous accidential commit. 2005-05-12 15:20:50 +00:00
Hartmut Brandt
46180c9f74 Cleanup SuffFindArchDeps() to get rid of two const-warnings.
Submitted by:	Max Okumoto <okumoto@ucsd.edu> (7.240)
2005-05-12 15:20:03 +00:00
Hartmut Brandt
7ea02fbf54 The first element of the vector built by brk_string() is never
used so there is no need to stuff the value of .MAKE into it,
which btw isn't set for quite a while already.

Submitted by:	Max Okumoto <okumoto@ucsd.edu> (7.239)
2005-05-12 15:10:45 +00:00
Hartmut Brandt
059649b9ce Cleanup. Move initialisation of file and program global variables
to top of main() and sort them. Make chdir_verify_path() static - it
is used only here.

Submitted by:	Max Okumoto <okumoto@ucsd.edu> (7.238)
2005-05-12 15:04:14 +00:00
Hartmut Brandt
1185781977 Replace a lot of Var_Set(..., VAR_GLOBAL) by Var_SetGlobal().
Submitted by:	Max Okumoto <okumoto@ucsd.edu> (7.237)
2005-05-12 14:47:22 +00:00
Hartmut Brandt
7007abaf14 Cleanup main(). Move catching SIGCHLD into job.c. Move unsetenv("ENV")
into job.c. Move retrieving of environment nearer to the place where it
is actually used and invert the preprocessor conditionals to use
positive logic.

Submitted by:	Max Okumoto <okumoto@ucsd.edu> (7.236)
2005-05-12 14:43:32 +00:00
Hartmut Brandt
54a923046f Reshuffle functions to get rid of prototypes.
Submitted by:	Max Okumoto <okumoto@ucsd.edu> (7.235)
2005-05-12 14:35:01 +00:00
Hartmut Brandt
3db87a68e0 Compat_RunCommand is used only in job.c so make it static there.
Submitted by:	Max Okumoto <okumoto@ucsd.edu> (7.234)
2005-05-12 14:33:24 +00:00
Hartmut Brandt
7594df85cf Move variable printing from main.c to var.c
Submitted by:	Max Okumoto <okumoto@ucsd.edu> (7.233)
2005-05-12 14:31:42 +00:00
Hartmut Brandt
8b8eb9e2ab Fix the fix for bin/72510 applied in job.c:1.70. Actually there have
been two maxJobs variables: one static in job.c and one global used in
main.c and parse.c. Makeing one global out of these was the wrong way
to fix the problem. Instead rename the global one to jobLimit and keep
maxJobs static in job.c.

Suggested by:	rwatson
PR:		bin/72510
2005-05-12 14:16:44 +00:00
Hartmut Brandt
0ec9b6feef Move some global variables to the correct files.
Submitted by:	Max Okumoto <okumoto@ucsd.edu> (7.232)
2005-05-12 11:58:39 +00:00
Hartmut Brandt
e30f38a08e Untwist the convoluted if() expressions in JobFinish(). They
could benefit from even more untwisting.

Submitted by:	Max Okumoto <okumoto@ucsd.edu> (7.23[01])
2005-05-12 11:47:17 +00:00
Hartmut Brandt
d8549718a9 Move some comments around to where they belong and remove some unneccessary
gcc magic.

Submitted by:	Max Okumoto <okumoto@ucsd.edu> (7.229)
2005-05-12 11:16:04 +00:00
Hartmut Brandt
f7a01b8dcc Convert Compat_RunCommand() to use ProcWait(). This also gives Cmd_Exec()
the potential to handle interrupts which it doesn't currently.

Submitted by:	Max Okumoto <okumoto@ucsd.edu> (7.228)
2005-05-12 11:09:45 +00:00
Hartmut Brandt
32b5d9451b Make a function ProcWait() that waits for the given process.
Submitted by:	Max Okumoto <okumoto@ucsd.edu> (7.227)
2005-05-12 10:55:37 +00:00
Hartmut Brandt
4eb51779c8 Overhaul the fork(), exec() code. Put all the common handling that
takes place in the child process in a function ProcExec(). Make sure,
that the child does not call malloc() or other potential dangerous
functions (there are still calls to Punt() in the error case that
should go away). Allocate the argv string via malloc to overcome
the non-constness bug of the execvp prototype. Change the handling of
shell meta-characters and move the builtin list near the list of shell
builtins. Both of these lists should actuall be configurable by the .SHELL
target since they depend on the shell used.

Patch:		7.21[2-9], 7.22[0-46]
Submitted by:	Max Okumoto <okumoto@ucsd.edu>
2005-05-12 10:40:57 +00:00
Max Khon
5cf3bf70f7 - check for geom_uzip module presence using kldstat -m.
kldstat -m finds geom_uzip module even if it is compiled in statically.
- create output file with x bit set.
- build mkuzip on all architectures (verified with "make universe").
- fix typo in info message.
2005-05-11 17:02:38 +00:00
Juli Mallett
e8b92d55b6 Spell 1 as SHUT_WR in argument to shutdown(2). 2005-05-11 02:49:03 +00:00
Hartmut Brandt
4aa6beaf60 Move the definitions of the OP_* constants from make.h into GNode.h
where they actually belong to. Move the definitions of the strings
for special macros like "$*" from make.h to parse.h - they're used
only in the parser.

Submitted by:	Max Okumoto <okumoto@ucsd.edu> (7.211)
2005-05-10 14:27:04 +00:00
Hartmut Brandt
824060d705 Path_Expand() expects its first argument to be writeable so put the
default system directory into a writeable character array before passing
it to Path_Expand().

Submitted by:	Max Okumoto <okumoto@ucsd.edu> (7.210)
2005-05-10 14:23:31 +00:00
Hartmut Brandt
e8b4c1591a Move declarations of variables belonging to the variable module
from globals.h into var.h.

Submitted by:	Max Okumoto <okumoto@ucsd.edu> (7.209)
2005-05-10 14:16:40 +00:00
Hartmut Brandt
413c6d2540 Style: remove spaces before tabs.
Patch:	7.207
Submitted by:	Max Okumoto <okumoto@ucsd.edu>
2005-05-10 14:13:20 +00:00
Hartmut Brandt
a139b7bac1 Move the remaining two prototypes from nonints.h to make.h and
remove nonints.h.

Patch:	7.204
Submitted by:	Max Okumoto <okumoto@ucsd.edu>
2005-05-10 14:10:44 +00:00
Hartmut Brandt
9a910e11d1 Make shellPath and shellName static - they're used in job.c only.
Move definition of parsing error levels from make.h into parse.h.

Patches:	7.202,7.203
Submitted by:	Max Okumoto <okumoto@ucsd.edu>
2005-05-10 14:06:19 +00:00