Commit Graph

1663 Commits

Author SHA1 Message Date
dwmalone
3c634774fa Remove double #include <sys/cdef.h> and __FBSDID.
PR:		40053
Submitted by:	Dan Lukes <dan@obluda.cz>
2002-07-01 10:46:39 +00:00
tjr
41d2a14ec1 Put documentation of the -m option's argument in its list tag in the
Description section for consistency with other manpages.
2002-06-30 06:50:16 +00:00
obrien
bc61fc95d8 Consistently use FBSDID 2002-06-30 05:25:07 +00:00
obrien
f6f518b207 Consistently use FBSDID 2002-06-30 05:15:05 +00:00
obrien
c84c569bd1 Consistently use __FBSDID 2002-06-30 05:13:54 +00:00
tjr
2ca2fb4fa3 Avoid truncating the pathname to UNIX Domain Sockets with snprintf(),
giving a more sensible warning when the (relatively meagre) sun_path
limit is exceeded.
2002-06-29 04:52:33 +00:00
tjr
c2f443c824 Check that snprintf() does not truncate the destination pathname when
linking into a directory.
2002-06-29 04:10:40 +00:00
sheldonh
8e1ca9d76c Document addition of RLIMIT_VMEM support, added in rev 1.26 of miscbltin.c. 2002-06-27 16:56:45 +00:00
dillon
8e4f3ae5f1 Add support for RLIMIT_VMEM. The #ifdef's were already there but getopt()
needed to be adjusted.
2002-06-26 00:29:53 +00:00
tjr
c239ae84e2 ln(1)'s symbolic link handling conforms to IEEE Std. 1003.1-2001, note
this in the Standards section.
2002-06-25 10:02:12 +00:00
tjr
18ad02fa6d Correctly mark up the final command line arguments with the Ar macro for
the last two synopsis forms.
2002-06-25 09:58:29 +00:00
keramida
a564153d5c Add a description of the restrictions that red(1) imposes to users,
and a warning that this "restricted mode" can be bypassed easily by
using symlinks, so that users don't depend too much on it.

PR:		docs/35940
Submitted by:	Gary W. Swearingen <swear@blarg.net>
Reviewed by:	jmallett
MFC after:	1 week
2002-06-24 22:06:47 +00:00
sobomax
8e683e45ef Don't try to decode old-style options if the argv[1] begins with `-' and the
second character represents some option taking an argument. This fixes
problem when ps(1) is invoked for examply as follows:

$ ps -Ufoobar1234

the above example results in option string being interpreted as
-U foobarp1234 - note extra `p'.

Reported by:	Vladimir Sotnikov <vovan@kyivstar.net>
MFC after:	2 weeks
2002-06-20 14:55:53 +00:00
jmallett
50fc04895e Bogusness may have happened using a variable assignment here before, but
proper parens mean that fd is always set by open(2) [in any part of C],
and so we can accurately check for it returning -1, without feeling like
we need to initialise fd to -1 in its declaration.

In other words, fix a stylistic/bogus nit.
2002-06-20 07:15:55 +00:00
jmallett
f49002f4f6 Use size_t consistently and complete some uncompleted code resulting in a
memory leak by assigning and freeing a variable appropriately as well as
keeping track of the amount of allocated ram properly.

MFC after:	1 month
2002-06-20 06:00:51 +00:00
jmallett
368a18f96b We have a place for extern declarations of global variables in ed.h, do not
use main() to do it locally.
2002-06-20 05:28:02 +00:00
jmallett
0c56b95c32 Remove two unused variables. 2002-06-20 05:21:43 +00:00
jmallett
2b674f32f6 Minor const cleanup.
Don't discard qualifiers we don't need to discard.
2002-06-20 05:20:50 +00:00
tjr
6b197bb764 Bring documentation on CDPATH and its effects on cd(1) back into sync with
reality (and POSIX): current directory isn't searched unless CDPATH has
a "." element or is unset.

PR:		38442
Submitted by:	oleg dashevskii <be9@be9.ru>
MFC after:	1 week
2002-06-19 12:04:22 +00:00
tjr
63d8853dda When trying to emulate a cross-device move operation with cp and rm, add
a "--" argument after the options so filenames with leading dashes are
handled correctly.

PR:		39318
Submitted by:	Serge van den Boom <svdb@stack.nl>
MFC after:	1 week
2002-06-16 04:06:58 +00:00
jmallett
f46221a82d Use an usage() rather than doing the fprintf inside option parsing. 2002-06-14 09:54:48 +00:00
tjr
041d0fbbd9 When -R is not specified, fail to copy the contents of dangling symlinks
instead of making a copy of the link itself (SUSv3)

Obtained from:	NetBSD
2002-06-13 15:48:36 +00:00
tjr
2f568aeb91 Print the "$" symbol on blank lines when the -s and -e options are used
together.

Obtained from:	OpenBSD (millert, Denis Afonin)
2002-06-13 14:05:26 +00:00
tjr
dea5473747 Remove bogus "-" operand from usage message. There is no restriction on
where it may be placed, it is treated the same as the file arguments.
2002-06-13 13:45:14 +00:00
tjr
0a94f3b05f Markup nits: use the Ar macro when describing the -signal_name and
-signal_number options, and for referring to the "pid" argument.
2002-06-13 08:46:01 +00:00
tjr
632d0deae4 Add examples and diagnostics sections 2002-06-13 08:40:01 +00:00
tjr
313635fc7e Support the "--" end of options marker, useful to disambiguate between
signal numbers and process groups (negative pid arguments), and
required by SUSv3.
2002-06-13 08:07:20 +00:00
tjr
08e98db385 Don't list shell builtins when the hash command is used (SUSv3) 2002-06-13 07:50:50 +00:00
jmallett
d40b17fd5d ps(1) appeared in v4
Submitted by:	grog
2002-06-10 22:48:51 +00:00
tjr
b9ecc7e16c Sort sections, use Ex macro in Diagnostics section, point out that the first
example only works with csh(1).
2002-06-10 09:33:15 +00:00
tjr
c41ca971a6 Add History section. sleep appeared in v4. 2002-06-10 09:07:22 +00:00
jmallett
dcf74a7fe1 Note early appearence of some commands. These actually appeared in PWB, but
it seems we don't have a macro for that yet, so list them in the first UNIX
release since then that we have a .At for: v7.
2002-06-10 05:03:20 +00:00
keramida
3eeaf63c36 Use socklen_t for the length of a socket structure instead of `int'.
Reviewed by:	mike
2002-06-09 04:18:45 +00:00
keramida
b309515be2 Replace <strings.h> with <string.h>. No functions from the former are
used in this file, and strlen() needs to be prototyped by the latter,
for this to compile without warnings.

Reviewed by:	mike
2002-06-09 04:15:40 +00:00
mike
d86e0bcc0c Check the return value of getcwd() to avoid printf()ing a NULL. Mark
usage() as __dead2 to avoid a GCC warning.

Spotted by:	keramida
2002-06-09 00:46:24 +00:00
jmallett
ef26e821fb Allow whitespace to act as a delimiter in the keywords list given to the -o,
again, but also allow it in the user-specified header, too.  This is far more
backwards compatible and SUSv3-happy than allowing only comma to seperate the
keywords list.

Submitted by:	tjr
2002-06-08 18:11:52 +00:00
bde
fa2a4fdbfc Fixed unsorting. 2002-06-08 06:49:15 +00:00
jmallett
93d0005574 Don't say that the list of formats can be space delimited, it no longer can be.
Mention that more than one -o will concatenate formats.

Submitted by:	Jun Kuriyama <kuriyama@imgsrc.co.jp>
2002-06-08 05:47:46 +00:00
jmallett
01f3abcecd Back out previous back out of previously correct code.
Double-plus-pointy-hat to:	jmallett
Submitted by:			bde
2002-06-07 01:14:05 +00:00
jmallett
865fcaca35 Remove tunables to hide warnings that no longer exist. 2002-06-07 00:01:00 +00:00
jmallett
95a388cd9a Cast to long to match format. Hidden by revision 1.18 of Makefile. 2002-06-07 00:00:29 +00:00
jmallett
d11731ff43 Use a global `now' variable for the current time, and initialise it at
startup, right after calling setlocale(3).
2002-06-06 21:21:25 +00:00
jmallett
becd81c4a9 Implement a SUSv3-ignorant but "time"-similar format for "etime", elapsed
run time (NOT cpu time).  cputime() and elapsed() both need to honour SUSv3
now.
2002-06-06 21:18:37 +00:00
jmallett
b00060629b sysctlbyname(3) returns -1 on failure, not any other value < 0. 2002-06-06 20:59:15 +00:00
jmallett
b9515c4b9c Support the SUSv3 `rgroup' format.
Clean up some local style bogons.
2002-06-06 20:42:16 +00:00
jmallett
7916563c61 Cast arg_max to size_t when comparing it (times 4, plus 1) against SIZE_MAX. I
was worried about truncation of arg_max by this cast, but if it gets truncated,
we know it'll obviously be greater than SIZE_MAX anyway.

Big pointy hat to:	jmallett
Submitted by:		keramida
2002-06-06 20:29:39 +00:00
jmallett
562b4c0250 SUSv3 conform on the "comm" and "args" formats, and make correct the "command"
format, since it's BSDlike, and "comm" is actually different.
2002-06-06 20:21:47 +00:00
jmallett
c22ab1edea Refer to the command format by its SUSv3 name (comm), and list command as an
alias.
2002-06-06 18:10:12 +00:00
jmallett
3afc0fe273 As per behaviour on SVR4 systems, to allow any desirable type of header in the
override, seperate by comma (',') only, rather than any type of whitespace
(the literal space character (' ') had already been removed from this list).

This allows things like:
miamivice# ps -opid='Process
> Identifier'
Process
Identifier
              1350
              1445
              1450

To work.
2002-06-06 18:04:46 +00:00
tjr
8b3a40cd3f Document the -f and -v options of the unset builtin. 2002-06-06 04:12:50 +00:00
tjr
70c6f806e0 Quote the output of the no-argument form of the `set' builtin for re-input
to the shell.
2002-06-06 04:02:50 +00:00
tjr
c74ee6d523 Add the SUSv3 -p ("portable") option to both the export and readonly
builtins. This makes export/readonly print lines in the form
"export name=value".
2002-06-06 03:57:22 +00:00
tjr
d658a1e5c7 Don't modify output that is to be quoted if it contains no IFS characters
or shell metacharacters.
2002-06-06 03:29:23 +00:00
jmallett
e24090eb3a Widen the scope of fmt.c::1.19 and consistently use errx(3) if malloc(3) [or
realloc(3)] happens to fail, everywhere in ps(1).

Discussed with:	bde, charnier (a while ago)

fmt_argv() can no longer return NULL, so don't bother checking.

Submitted by:	bde
2002-06-05 18:11:25 +00:00
jmallett
9b75b96530 Comma seperate format lists, since space is no longer up to the task.
Poked by:	David Wolfskill <david@catwhisker.org>
Pointy hat to:	jmallett
2002-06-05 17:31:44 +00:00
jmallett
c2f44f7a37 Support the 'comm' keyword, which is equivalent to our 'command', but
specified by SUSv3.
2002-06-05 02:05:24 +00:00
jmallett
399bb45a09 A space cannot be a header string seperator it appears given the SUSv3
description of ps(1), which uses them.  I question whether newline and tab
can be either, but I'm not touching them.  Yet.
2002-06-05 02:01:46 +00:00
jmallett
d6bbfbe40b To comply with SUSv3, duplicate the variable contents for each given format,
so that multiple -ovar=header lines do not overwrite eachother.

This means that ps -ouser=USERNAME -ouser=WHO would now possibly print:
USERNAME WHO
juli     juli

Whereas before it would be:
WHO WHO
juli juli
2002-06-05 01:58:36 +00:00
jmallett
6cb17fa895 Returning NULL here if malloc(3) fails is silly, at this point in the codepath
we have't malloc(3)'d nearly as much as we probably will, so errx(3) away,
instead of waiting for something to fail yet again later on.
2002-06-05 01:36:30 +00:00
jmallett
b34dd0148d Remove an XXX comment that seems to be a tiny bit no longer pertinent. This
function seems to do the right thing, and is not a "stub", and whoever "marc"
is, he's had plenty of time to do "the real one", so don't wait around for
him any longer.
2002-06-05 01:33:54 +00:00
jmallett
66d6aa72a5 Use of zero here meant many things, NULL, '\0' (NUL), and 0. Sort it out. 2002-06-05 01:32:21 +00:00
jmallett
4dd8bac65f Use a const char * where it is meant to be used. There's no reason to try
to discard the const qualifier here.
2002-06-05 01:02:13 +00:00
jmallett
3139a6b754 Duplicate the pointer to the string containing the header so it does not get
frobbed when/if the pointer it is actually a part of gets freed.
2002-06-05 01:01:20 +00:00
tjr
71a01dad7b Display job status correctly when a pipeline is suspended. 2002-06-04 15:26:00 +00:00
tjr
da1177ce1d Describe finished jobs as "Done", not "Exit" (SUSv3) 2002-06-04 14:40:33 +00:00
tjr
ec349498c5 Don't output state' and current' fields for processes that aren't
leaders in -l option to jobs(1).
2002-06-04 14:37:13 +00:00
tjr
ba4116c514 Missing prototypes from previous commit. 2002-06-04 13:13:54 +00:00
tjr
de63da4c55 Correct minor spacing problem in output of jobs -l for pipelines. 2002-06-04 13:01:51 +00:00
tjr
33d27dd210 Quote alias values in the output of the alias(1) builtin so they are
suitable for re-input to the shell (SUSv3)
2002-06-04 12:59:12 +00:00
tjr
b3775d9e40 Respect setting of the COLUMNS environment variable (SUSv3) 2002-06-04 10:20:10 +00:00
tjr
c6efb66343 Ignore empty COLUMNS environment variable. COLUMNS should take precedence
over TTY width found via ioctl() (SUSv3)
2002-06-04 10:11:29 +00:00
tjr
25b36dd1e7 Correct history (again): V3 had a kill command, only it was in section 8,
not 1.
2002-06-03 14:59:49 +00:00
tjr
22070ef719 Correct History: sync(8) appeared in V4. 2002-06-03 14:48:33 +00:00
tjr
910511d3ed Correct History section: kill(1) appeared in V4, not V6. 2002-06-03 14:45:20 +00:00
tjr
0930ee47eb Fix typo causing ``fc -e'' to not work correctly. getopt() sets optarg,
not shoptarg.
2002-06-02 08:34:09 +00:00
tjr
0a9f255d03 Adding an entry to the history with H_ENTER moves libedit's internal
history cursor. Reset the cursor after adding the entry to the history
when doing ``fc -s'' so the output is correct.
2002-06-02 08:27:04 +00:00
tjr
d3a1f7d912 Implement $PPID, the parent process ID of the shell. 2002-06-01 02:14:48 +00:00
tjr
fff7a36566 Support the remaining job ID formats required by SUSv3:
%+ (current job, same as %%),
%- (previous job),
%?str (job with "str" in its command name).
2002-06-01 01:51:42 +00:00
tjr
1f8bb8d729 Add -s (output PID's only) and -l (show PID's) options to the jobs(1)
builtin. Modify the output format to match what SUSv3 requires.
2002-05-31 14:04:23 +00:00
tjr
c828fbddc6 #if JOBS around a job control-related statement to allow compilation with
job control disabled.
2002-05-31 13:10:38 +00:00
tjr
5250eaebac Break the code to display status info for one job out from showjobs() into
showjob(), use it inside dowait() to display status info for consistency,
and in a format closer to what the standard requires.
2002-05-31 13:07:05 +00:00
tjr
952d847c40 Move job to front of most recently used job list when bg'd or fg'd. 2002-05-31 12:35:34 +00:00
tjr
7e9561b97a Instead of keeping just the jobid of the most recently bg'd or fg'd job,
keep a linked list of the jobs, most recently used first. This is required
to support the idea of `previous job', and to allow the jobs fg and bg
default to be correct according to POSIX.
2002-05-31 12:31:23 +00:00
ru
e57f94d9c9 mdoc(7) police: kill hard sentence breaks. 2002-05-30 14:10:44 +00:00
tjr
09ec516834 Reject options, handle "--" correctly in unlink(1). 2002-05-30 01:05:15 +00:00
tjr
a9256c24d5 Reject options, handle "--" end-of-options marker in link(1). 2002-05-30 00:57:38 +00:00
ru
7ff3239b45 mdoc(7) police: punctuation. 2002-05-29 18:52:02 +00:00
ru
76631b8618 mdoc(7) police: tidy up the markup a bit. 2002-05-29 15:38:59 +00:00
ru
9f5e5c2002 mdoc(7) police: markup nits. 2002-05-29 15:18:35 +00:00
ru
8604f56312 mdoc(7) police: markup nits. 2002-05-29 15:09:49 +00:00
ru
d8884723c1 mdoc(7) police: punctuation. 2002-05-29 15:06:24 +00:00
ru
c17d65090d mdoc(7) police: replace the XXX with the correct width. 2002-05-29 14:01:27 +00:00
marcel
58435e6cb7 Add uuidgen(2) and uuidgen(1).
The uuidgen command, by means of the uuidgen syscall, generates one
or more Universally Unique Identifiers compatible with OSF/DCE 1.1
version 1 UUIDs.

From the Perforce logs (change 11995):

Round of cleanups:
o  Give uuidgen() the correct prototype in syscalls.master
o  Define struct uuid according to DCE 1.1 in sys/uuid.h
o  Use struct uuid instead of uuid_t. The latter is defined
   in sys/uuid.h but should not be used in kernel land.
o  Add snprintf_uuid(), printf_uuid() and sbuf_printf_uuid()
   to kern_uuid.c for use in the kernel (currently geom_gpt.c).
o  Rename the non-standard struct uuid in kern/kern_uuid.c
   to struct uuid_private and give it a slightly better definition
   for better byte-order handling. See below.
o  In sys/gpt.h, fix the broken uuid definitions to match the now
   compliant struct uuid definition. See below.
o  In usr.bin/uuidgen/uuidgen.c catch up with struct uuid change.

A note about byte-order:
        The standard failed to provide a non-conflicting and
unambiguous definition for the binary representation. My initial
implementation always wrote the timestamp as a 64-bit little-endian
(2s-complement) integral. The clock sequence was always written
as a 16-bit big-endian (2s-complement) integral. After a good
nights sleep and couple of Pan Galactic Gargle Blasters (not
necessarily in that order :-) I reread the spec and came to the
conclusion that the time fields are always written in the native
by order, provided the the low, mid and hi chopping still occurs.
The spec mentions that you "might need to swap bytes if you talk
to a machine that has a different byte-order". The clock sequence
is always written in big-endian order (as is the IEEE 802 address)
because its division is resulting in bytes, making the ordering
unambiguous.
2002-05-28 06:16:08 +00:00
tjr
77288420b0 Note that the lutimes(2) and lchflags(2) syscalls also do not follow symlinks.
Remove incorrect examples.

PR:		25016
Submitted by:	Martin Kammerhofer, Joshua Goodall
2002-05-26 12:51:38 +00:00
tjr
4cc401e5ef Add lchmod(2) to the list of syscalls that do not follow symbolic links. 2002-05-26 12:12:36 +00:00
tjr
9ce8567e45 sh appeared in Version 1, not System V.1. 2002-05-25 12:18:27 +00:00
tjr
290ce9e466 Implement `set +o', which displays the currently set options in a format
suitable for re-input into the shell.
2002-05-25 12:11:58 +00:00
tjr
e6fbc84685 Bring back the cd -L and -P options from revision 1.24, but try harder not
to fail when the logical current directory no longer exists. Allow changes
to absolute paths when logical cwd is invalid, fall back to physical cd
if logical cd fails.
2002-05-22 05:15:53 +00:00
tjr
fff7331065 Temporarily back out revision 1.24; it seems to handle the case where the
current directory no longer exists incorrectly and breaks `make cleandir'.
2002-05-22 03:29:20 +00:00
tjr
bc86a28ef9 Add the SUSv3 -L and -P options to the cd and pwd builtin utilities. `Logical'
handling of .. is now the default.
2002-05-20 07:54:39 +00:00
jmallett
4205c9f55a Remove a small, annoying, nit I ran in to editing this file, a lone tab
on a line by itself.
2002-05-19 17:50:23 +00:00
tjr
b19972e699 Implement the -u (-o nounset) option, which gives an error message if
an unset variable is expanded.

Obtained from:	NetBSD (bjh21, christos)
2002-05-19 08:30:16 +00:00
tjr
b72e0fae17 Make the fg and bg commands give the output required by SUSv3.
fg outputs the name of the command, bg outputs the name of the command
and the job id.
2002-05-19 07:27:26 +00:00
tjr
ada2f900a3 Implement the -C (-o noclobber) option, which prevents existing regular
files from being overwritten by shell redirection.
2002-05-19 06:03:05 +00:00
tjr
18037eb7ab Add missing options required by SUSv3:
-m	List files across the page, separated by commas.
-p	Print a slash after directory names
-x	Same as -C but sort across the columns rather than down

Submitted by:	Kyle Martin <mkm@ieee.org>
2002-05-19 02:51:36 +00:00
iedowse
75e563ada2 Unconditionally update the maximum field width statistics when we
refetch the filesystem information in MNT_WAIT mode. This avoids
incorrect column alignment that sometimes occurs with NFS filesystems.

Submitted by:	Ian <freebsd@damnhippie.dyndns.org>
2002-05-18 21:10:40 +00:00
tjr
35d66bbcdb Back out part of previous commit: make -P the default again until I'm
convinced it's a good idea.
2002-05-18 13:52:07 +00:00
tjr
f0c2951e6b Make -L the default, allow both -L and -P to be specified (last one used
matters), fall back to -P mode if we can't get the logical directory.
2002-05-18 02:47:25 +00:00
ache
fbce3fb517 Optimize prev. commit code a bit 2002-05-17 12:24:19 +00:00
ache
c711b20bf2 Trailing slash fixes.
Fix the case:
        cp file nonexistent/
which create nonextstent as file while trailing slash clearly indicates
that nonexistent must be a directory.
Also fix the case:
	cp file1 file2/
which should produce error.
2002-05-17 11:52:48 +00:00
jmallett
3f70efa473 Remove local definition of _PATH_CP, and use <paths.h>, _PATH_CP is in the
CURRENT <paths.h>.
2002-05-17 11:38:48 +00:00
joe
40c0cc2b5f The sysctl has changed from 'kern.ps_showallprocs' to
'security.bsd.see_other_uids'.
2002-05-16 11:51:05 +00:00
trhodes
0c40c9d08e more file system > filesystem 2002-05-16 03:51:38 +00:00
trhodes
56036d2623 Consistancy check s/file system/filesystem/
Reviewed by:	brian
2002-05-16 01:57:20 +00:00
billf
8ce7d93d62 restore missing default case removed in ls.c:r1.57
add break statements to default cases where missing.

Submitted by:	bde
2002-05-15 18:53:56 +00:00
jmallett
3de05bf289 Make 'user' and 'group' const as to not discard the qualifier from the
functions we use to assign them.  Doesn't seem to be anything else that
relies on these being non-const.
2002-05-15 09:49:59 +00:00
jmallett
c0b64a6d1b Remove an empty default case to make this syntactically correct. Not there
is as good as blaknk.
2002-05-15 09:43:52 +00:00
phk
5e1cf3ad98 Remove the private code for reading UFS superblocks, this does not belong
in df(1) when we have multiple filesystem types, and the complications of
handling UFS2 pushes this over the edge.

Use the .../mount/extern.h to get prototypes of the functions we
borrow from there.  Constify things to match.  (why aren't these
functions in a lib anyway ?)

Make everything static and set WARNS?=5.

The way the "df diskdevice" thing works for unmounted diskdevices
is not very general.

Sponsored by: DARPA & NAI Labs.
2002-05-12 19:24:09 +00:00
jedgar
47acb76e7c Add semicolon to empty default case to silence warning. 2002-05-11 03:12:02 +00:00
wollman
a04093f9b6 EXPR_COMPAT should imply -e, since there is no way to specify it otherwise,
and -e reflects the historic behavior of FreeBSD's expr.
2002-05-11 03:08:12 +00:00
alfred
2864dba864 while i'm breaking stuff, use __dead2 instead of GCC specific __attribute__. 2002-05-11 01:25:54 +00:00
alfred
2f75a283e0 backout additional include of cdefs.h, it's not helping any. 2002-05-11 01:24:39 +00:00
alfred
83d76dffe1 include cdefs.h for __printf0like to silence warning. 2002-05-11 00:54:33 +00:00
jedgar
818f9c0a64 Add semicolon to empty default case to silence warning. 2002-05-11 00:45:01 +00:00
alfred
c4d4a5fa12 Add semicolon to empty default case to silence warning. 2002-05-11 00:21:00 +00:00
wollman
e11cb46ee8 The response to my POSIX interpretation request says that `expr'
is required to be oblivious to overflow and to use the data type `long'.
(Division by zero is undefined in ISO C so it's still OK to check for it
here.)  Add a new `-e' flag to get the old, more useful behavior.
2002-05-10 22:59:29 +00:00
obrien
88b6275cf8 Remove gCC'isms. 2002-05-10 01:48:15 +00:00
joe
36c976074e Replace /kernel with /boot/kernel/kernel.
PR:		docs/37757
Submitted by:	Hiten Pandya <hiten@uk.FreeBSD.org>
2002-05-09 11:47:42 +00:00
des
84dfbe4ad5 Use <paths.h> rather than "pathnames.h", and fix a couple of whitespace nits.
Sponsored by:	DARPA, NAI Labs
2002-05-08 00:47:01 +00:00
jmallett
0871762074 Check for possible overflow from sysconf _SC_ARG_MAX and error out in a
correct manner.  Revert my incorrect change to use err(3) for malloc(3)
failing.  Use a size_t variable to store the size of the argument buffer
we allocate, and remove silly casts as the result of having this around.
Modify the math in some of the paranoid checks for buffer overflow to
account for the fact we now are dealing with the actual size of the
buffer.  Remove the static qualifier for arg_max, and the bogus setting
of it to -1.

Include <limits.h> for the definitions we use to check for possible
overflows.

Submitted by:	bde
2002-05-05 04:42:50 +00:00
jmallett
896541a042 Don't cast incorrectly to malloc(3), and don't use errx(3) if malloc(3)
returns NULL, as malloc(3) sets errno.  Use err(3).
2002-05-02 05:46:37 +00:00
markm
09b63c5efb Reorder for style. 2002-04-28 13:54:45 +00:00
wollman
e46c2e6ba9 Provide an environment variabloe, EXPR_COMPAT, which disables option
parsing for compatibility with old implementations.
2002-04-22 21:23:09 +00:00
des
4d6b787d2d Usage style sweep: spell "usage" with a small 'u'.
Also change one case of blatant __progname abuse (several more remain)
This commit does not touch anything in src/{contrib,crypto,gnu}/.
2002-04-22 13:44:47 +00:00
charnier
0865462d56 Use `The .Nm utility' 2002-04-21 12:53:08 +00:00
charnier
487a22adbf Use `The .Nm utility' 2002-04-20 11:58:12 +00:00
mux
f446eb58b0 Add a reference to the kenv(2) manpage. 2002-04-18 18:49:41 +00:00
ru
8a3e2794af Replaced exists() tests with two equivalent defined().
LIBDIR is defined in bsd.own.mk but sys.mk no longer
includes bsd.own.mk as of revision 1.60.
2002-04-18 07:01:35 +00:00
mux
ef239236f8 Use the new functionalities provided by the kenv(2) syscall.
Reviewed by:	peter
2002-04-17 13:08:14 +00:00
charnier
79b89ed363 Use `The .Nm utility' 2002-04-16 20:08:06 +00:00
charnier
d219790077 ls(1) is utility not function 2002-04-16 20:03:54 +00:00
trhodes
ba4684c0e7 s/CMOS/hardware as talked about on cvs-committers.
Suggested by:   sheldonh
Approved by:	bde
MFC after:	1 day
2002-04-16 14:28:47 +00:00
trhodes
4afe0b0679 Little nit pick in date(1) manual page, tell users which clock date(1)
sets

PR:		35606
2002-04-15 18:05:14 +00:00
greid
5486a1c99e Stop a null pointer dereference in the builtin hash function.
PR:		36141
Approved by:	cracauer
MFC after:	1 week
2002-04-15 15:49:30 +00:00
jwd
a3fe1a7096 Document option to option dependancy. Fix typo.
MFC after:	1 week
2002-04-15 02:21:12 +00:00
charnier
64ab19a185 Do not return(f_returning_void());. Spell FALLTHROUGH to make it lint()able. 2002-04-12 20:23:51 +00:00
bmilekic
890c5794a5 Introduce NO_RCMNDS flag so as to not compile rsh, rlogin, and rcp on will,
and document in share/examples/etc/make.conf

Submitted by: Aleksandar Simic <asimic@dsl.pipex.com>
MFC after: 1 week
2002-04-09 18:25:44 +00:00
jedgar
f7f35bd6ba errx()/strerror() -> err() 2002-04-07 04:59:13 +00:00
keramida
9e46855391 Various mdoc fixes, including a change that corrects spacing as
described in PR docs/36461.

PR:		docs/36461
Noticed by:	Gary W. Swearingen <swear@blarg.net>
Submitted by:	ru
2002-03-31 20:49:37 +00:00
ache
0b9df2f267 Use intmax_t as quad_t replacement, like in expr 2002-03-28 16:30:42 +00:00
iedowse
87a3c1d190 Make the columns in the output of df(1) line up, even for very large
filesystems. We now keep track of the maximum width required for
every variable-width field instead of just the first one.

PR:		bin/15510
MFC after:	1 week
2002-03-26 20:32:37 +00:00
ru
f6da61bcc9 Install sys/security/lomac/*.h to /usr/include/security/lomac/.
Install sys/<arch>/include/pc/*.h to /usr/include/machine/pc/.

PR:		docs/29534

Install sys/netatm/*/*.h to /usr/include/netatm/*/.

Don't install compatibility symlinks for <machine/soundcard.h>
and <machine/joystick.h>.  Three years is enough to be aware of
the change, and these weren't visible in the SHARED=symlinks
case.

Back out include/Makefile,v 1.160 that was a null change anyway
due to the bug in the path, and we now don't want to install
these headers because they would otherwise be invisible in the
SHARED=symlinks case.

Don't install IPFILTER headers.  Userland utilities fetch them
directly, and they were not visible in the SHARED=symlinks case.

Resurrect SHARED=symlinks in Makefile.inc1.

PR:		bin/28002

Prodded by:	bde
MFC after:	2 weeks
2002-03-26 16:05:14 +00:00
markm
67e76f4ab3 Replace use of __progname with the functionally identical and more
acceptable getprogname(3).
2002-03-24 14:56:55 +00:00
wollman
7282a3b32e Disable -Werror when building -- the old version of gcc used on IA32 can't
deal with C99 formats.
2002-03-23 00:44:00 +00:00
wollman
d1fbde7cf6 Typo (if => of). 2002-03-22 20:49:29 +00:00
wollman
dc0ab81475 Add a word of caution about integer arithmetic range and overflow detection. 2002-03-22 20:46:59 +00:00
wollman
c1037fd271 Fix a few formatting brainos and make the formatting of the EXAMPLES
section somewhat clearer.
2002-03-22 20:38:44 +00:00
wollman
2e02d4aae7 Make expr POSIX-compliant, and fix some bugs. Specifically:
- expr must conform to the Utility Syntax Guidelines, so use
getopt() to eat the (non-existent) options.

- Use the Standard type intmax_t for arithmetic.

- If an argument cannot be *completely* converted to an integer, then
it is a string.

Additionally make some style cleanups near the modified lines.  This
utility is still not completely style-compliant.
2002-03-22 20:18:26 +00:00
obrien
785ec6a1f4 Update SCM ID. 2002-03-22 19:52:59 +00:00
obrien
8f7b828bab Note that -n is non-standard. 2002-03-22 19:52:48 +00:00
markm
09171e09d6 No need to cast; ().gr_gid is already the correct type. 2002-03-22 15:54:44 +00:00
obrien
6295b3bfe1 Add the -n option, which automatically answers "no" to the overwrite question. 2002-03-22 07:45:36 +00:00
imp
74d826c7a6 remove __P 2002-03-22 01:22:50 +00:00
ru
cebc449d30 mdoc(7) police: use precise width specifier. 2002-03-15 14:21:13 +00:00
rwatson
94342978a6 NAI DBA update. 2002-03-14 21:51:00 +00:00
markm
43cc55dd2f 1) Rev.1.35 of dd.c has a more serious regression. It backs out rev.1.31,
thus breaking systems with unpolluted <sys/stat.h>'s.

2) Back out an initialisation of a variable in BSS.

Reported by:	bde (1), many(2)
2002-03-07 14:00:33 +00:00
maxim
7d69422196 Log:
Remove eaccess(2) absence workaround. Add eaccess(2) checks for FILRD,
FILWR, FILEX and FILEXIST cases.

We cannot MFC this because there is no eaccess(2) in -stable yet.

PR:		bin/35076
Reviewed by:	ru
Approved by:	ru
2002-03-06 11:20:13 +00:00
imp
f0662fdefd Use ANSI-99 int names (uintXX_t) over traditional BSD int names
(u_intXX_t).
2002-03-05 05:28:49 +00:00
phantom
9124a610d0 Use NLSLINKS to setup symbolic links in NLS area 2002-03-04 12:29:21 +00:00
phantom
63f07ef33b This file is not used anymore 2002-03-04 11:10:17 +00:00
phantom
d12220dfdb Use bsd.nls.mk for building/installing NLS files
XXX: links handling simplify
2002-03-04 10:34:51 +00:00
alfred
fd4aa99c82 clarify code:
add comments.
don't get the length of each arg passed, only the last one.
check against == or != NULL rather than using a pointer value as
truth test.
2002-03-04 05:30:04 +00:00
dwhite
12798316b8 Update STANDARDS section on rm(1) to reflect current conformance.
PR:		35471
2002-03-02 05:10:11 +00:00
ache
4ac9e16668 Add (unsigned char) cast lost in WARNS=4 fixes which break 8bit locales
PR:		35421
2002-02-28 18:52:47 +00:00
sobomax
521f052069 Fix a bug introduced in rev.1.23 - for some reason mkdir("/", ...) system
call returns `EISDIR', not `EEXIST', so that be prepared for that. This should
fix number of ports, that often call `mkdir -p //usr/local/foobar'. This
is just a quick workaround, the real fix would be either to avoid calling
mkdir("/", ...) or fix VFS code to return consistent errno for this case.
2002-02-25 09:17:44 +00:00
bde
cf8ef037c8 #include <time.h> for the definition of time functions instead of
depending on namespace pollution 2 layers deep in <sys/stat.h>.

Removed unused includes.
2002-02-25 01:36:59 +00:00
bde
0a286122a7 Fixed unsorting. 2002-02-23 21:00:14 +00:00
bde
be1787bc6d Fixed some style bugs in revs 1.1 and 1.4. 2002-02-23 17:05:32 +00:00
markm
5b69d7da62 ANSIfy. 2002-02-22 23:31:57 +00:00
markm
2b941891db Fix warnings inspired by lint, a commercial lint and WARNS=4. 2002-02-22 21:24:14 +00:00
markm
3ce9528bfb Fix a boatload of warnings inspired by lint, a commercial lint
and WARNS=4.
2002-02-22 21:21:37 +00:00
markm
3b69d13d7c Warnings fixes. 2002-02-22 21:13:31 +00:00
markm
2e9a506a04 Fix warnings inspired by lint, a commercial lint and WARNS=4. 2002-02-22 21:11:03 +00:00
markm
02fae8d816 Partially fix (well, work around) warnings inspired by lint, a
commercial lint and WARNS=4.
2002-02-22 21:02:58 +00:00
markm
d2f778cddf Fix warnings inspired by lint, a commercial lint and WARNS=4. 2002-02-22 21:00:16 +00:00
markm
1fb3e88343 Warnings fixes inspired by lint, a commercial lint and WARNS=4. 2002-02-22 20:57:53 +00:00
markm
863c4cc748 Warning fix. Enter into the spirit of getopt(3) a bit more. 2002-02-22 20:55:04 +00:00
markm
7b7558d884 Fix warnings inspired by lint, a commercial lint and WARNS=4. 2002-02-22 20:51:00 +00:00
markm
f24931e332 Fix warnings inspired by lint, a commercial lint and WARNS=4 2002-02-22 20:45:09 +00:00
dillon
23fcffffc9 Revert wchan functionality. Add 'mwchan' to supply new duel mutex/msleep
functionality and make it the default.

With additional improvements by: Mark Peek <mp@FreeBSD.org>
2002-02-21 18:27:16 +00:00
jedgar
8cdc9fd108 Remove extraneous blank line 2002-02-19 02:36:35 +00:00
jedgar
8df81cb659 Use acl_dup() to duplicate an ACL instead of rolling our own 2002-02-19 02:36:15 +00:00
imp
60cc340d82 Fixed divots that I created when I moved prototypes of group_from_gid
and user_from_uid to grp.h and pwd.h.  Update the man pages.

Submitted by: David Malone
Pointy hat to: imp
2002-02-19 00:05:59 +00:00
imp
d4f0b8fef8 Remove now-obsolete __STDC__ ifdefs, remove redundant NULL definition and
include stdlib.h for NULL.
2002-02-18 06:08:23 +00:00
gshapiro
730b12a9a9 Update build infrastructure for sendmail 8.12. 2002-02-17 22:05:07 +00:00
dillon
77112edb7c When blocked on a mutex, display the mutex name via the wchan string field
so we can at least tell the difference between being blocked in Giant
and being blocked in some other mutex.
2002-02-16 20:10:00 +00:00
des
66be93a737 Document the 'M' state. 2002-02-16 18:47:22 +00:00
imp
f58558abb7 Move user_from_uid to pwd.h
Move group_from_gid to grp.h
Remove from stdlib.h
Make the prototypes match the code
Fix rm and mv to include new files.

NetBSD has these defined in those files, and others too that I've not
done.

Approved by: terminal room kabal
Reviewed by: jhb, phk
2002-02-14 01:59:47 +00:00
mp
5d2ae7a01f Install complete.tcsh and csh-mode.el into ${SHAREDIR}/examples/tcsh.
PR:		misc/34800 (from Steven Grady)
Submitted by:	phantom (patch)
MFC after:	3 days
2002-02-12 04:50:12 +00:00
mike
72a803ac5e Repo-copied src/bin/pwd/realpath.1' to src/bin/realpath/realpath.1',
as part of the move to seperate realpath(1) into its own directory.
2002-02-11 18:45:29 +00:00
mike
e9400873cc o Remove old code from pwd(1); realpath(1) is now in its own directory.
o Fix some unordered includes in pwd(1).
o Connect realpath(1) to the build.
2002-02-11 18:38:54 +00:00
mike
18a66da4bb Move the realpath(1) source into its own directory. Previously, it
shared sources with pwd(1).
2002-02-11 07:32:17 +00:00
mike
c9034a8d20 Use the getprogname(3) function instead of directly accessing
`__progname'.

Submitted by:	dd
2002-02-10 05:56:36 +00:00
markm
ae2558974f Remove leaf node WARNS?=2 (that mainly I added). This should
help the GCC3 transition and CURRENT in general.
2002-02-08 22:31:43 +00:00
green
b3206d8278 Correct a logic bug that snuck in and broke multiplication of off_ts. 2002-02-07 02:54:30 +00:00
zarzycki
98e34f92cb Fix the race between the stat() and the mkdir().
Reviewed by:	jkh
2002-02-05 21:55:12 +00:00
mike
9ee57bcb7f Add -L option (SUSv3) to pwd(1). Fix a bug, where realpath(1) would
complain about paths starting with `-', by not calling getopt(3).

Submitted by:	Tim J. Robbins <tim@robbins.dropbear.id.au>
Obtained from:	NetBSD (partially)
MFC after:	1 month
2002-02-04 07:26:21 +00:00
kris
a1a10418c8 Correct inadvertent style botches in previous commit. 2002-02-04 03:06:51 +00:00
kris
bb3058824a Lock down with WFORMAT=1 except those directories with unfixed warnings.
Tested on i386 and alpha.
2002-02-04 02:49:19 +00:00
kris
6ca02c8912 __printflike() should really be __printf0like() since verrx() can
accept a NULL format string.
2002-02-04 01:11:48 +00:00
kris
51396a4bd6 Add a __printflike() attribute to silence warning with FORMAT_AUDIT=1 2002-02-04 01:07:07 +00:00
markm
2973d46886 Use __FBSDID() and clean up the vendor tags. 2002-02-03 20:55:54 +00:00
markm
1084c0a6b2 WARNS=4 fixes, plus a healthy dose of fixes inspired by lint. 2002-02-03 19:11:32 +00:00
markm
aa05461c14 WARNS=4 fixes (incomplete, so set NO_WERROR), and lots of extra
cleanup courtesy of automatic checking (lint).
2002-02-03 14:43:04 +00:00
knu
396a7859f4 Work around a buffer overflow problem on argv that has been exposed
after making test(1) a sh(1) builtin; sh(1) coredumps when you run
something like this:

	sh -c 'test ! `true 1`'

The cause is that the test(1) code totally depends on the presence of
two extra cells at the end of argv that are filled with NULL's.  The
reason why the bug hasn't been exposed would be because the C startup
code kindly prepares argv with some extra zeroed cells for a program.

I know this is not the best fix, but since there are argv++'s without
boundary checks everywhere, I'd rather patch it up like this
(preparing a copy of argv with extra NULL's) for the moment.

MFC after:	3 days
2002-02-03 10:01:49 +00:00
jedgar
2547546bed Use a more correct method of copying entire ACLs (fixes
operation under Linux).
2002-02-03 02:37:43 +00:00
imp
e2889aca77 Fix unused variable. 2002-02-02 07:10:02 +00:00
imp
1733865f62 missed a few registers 2002-02-02 07:09:30 +00:00
imp
0496eb97bd Ooops, forgot to remove the registers here. 2002-02-02 07:07:59 +00:00
imp
c4d9fbc331 %.* takes an int, not a size_t. 2002-02-02 07:06:58 +00:00
imp
5ef5088ac4 o __P has been reoved
o Old-style K&R declarations have been converted to new C89 style
o register has been removed
o prototype for main() has been removed (gcc3 makes it an error)
o int main(int argc, char *argv[]) is the preferred main definition.
o Attempt to not break style(9) conformance for declarations more than
  they already are.
o Change
	int
	foo() {
	...
  to
	int
	foo(void)
	{
	...
2002-02-02 06:50:57 +00:00
imp
50014e3541 o __P has been reoved
o Old-style K&R declarations have been converted to new C89 style
o register has been removed
o prototype for main() has been removed (gcc3 makes it an error)
o int main(int argc, char *argv[]) is the preferred main definition.
o Attempt to not break style(9) conformance for declarations more than
  they already are.
2002-02-02 06:48:10 +00:00
imp
3fc8df52e3 o __P has been reoved
o Old-style K&R declarations have been converted to new C89 style
o register has been removed
o prototype for main() has been removed (gcc3 makes it an error)
o int main(int argc, char *argv[]) is the preferred main definition.
o Attempt to not break style(9) conformance for declarations more than
  they already are.
o gc some #ifdef sun ... #endif code

Approved by: arch@, new style(9)
2002-02-02 06:36:49 +00:00
imp
5203a0a465 o __P has been reoved
o Old-style K&R declarations have been converted to new C89 style
o register has been removed
o prototype for main() has been removed (gcc3 makes it an error)
o int main(int argc, char *argv[]) is the preferred main definition.
o Attempt to not break style(9) conformance for declarations more than
  they already are.

Approved by: arch@, new style(9)
2002-02-02 06:24:13 +00:00
imp
41e5cc1a95 Modernization effort for bin/c*:
o __P has been reoved
  o Old-style K&R declarations have been converted to new C89 style
  o register has been removed
  o prototype for main() has been removed (gcc3 makes it an error)
  o int main(int argc, char *argv[]) is the preferred main definition.
  o Attempt to not break style(9) conformance for declarations more than
    they already are.

  Approved by: arch@, new style(9)
2002-02-02 06:15:22 +00:00
imp
ef44ec93a7 Drag cat(1) kicking and screaming into the late 1980's:
o __P has been reoved
o Old-style K&R declarations have been converted to new C89 style
o register has been removed
o prototype for main() has been removed (gcc3 makes it an error)
o int main(int argc, char *argv[]) is the preferred main definition.
o Attempt to not break style(9) conformance for declarations more than
  they already are.

Approved by: arch@, new style(9)
2002-02-02 06:10:01 +00:00
sheldonh
84ced5c708 Refer to the original mode of the file, not the mode of the original
file.

PR:		docs/34224
Submitted by:	"Gary W. Swearingen" <swear@blarg.net>
2002-02-01 12:37:21 +00:00
ru
2137f05783 Remove a stray :' after v' in the getopt() call.
Submitted by:	bde
2002-01-28 13:43:22 +00:00
ru
8c5c420dd3 GC the -W option. kvm(3) doesn't read swap for almost 10 years.
PR:		docs/34134
Reviewed by:	bde, peter
MFC after:	1 month
2002-01-28 09:43:26 +00:00
green
db659d013d Commit general cleanups (separate get_num() and get_off_t() functions to
debogosify some of the command-line string-number conversions into
an unsigned and signed variant.)
2002-01-25 17:44:47 +00:00
mikeh
b216600a84 Prevent overflowing the buffer that stores the command arguments.
PR:		bin/19422
Not objected to by: -audit
MFC after:	3 weeks
2002-01-20 01:30:40 +00:00
sobomax
99ceec2679 Add missed includes.
Reviewed by:	md5
2002-01-15 12:23:52 +00:00
babkin
6f66434b4f The fix for >/dev/stdout, including Tor Egge's fix for the bug in the
original attempt of the fix. And yes, this time I've tried to build
world with it and it succeeded.

Submitted by:	Tor Egge
MFC after: 1 week
2002-01-13 14:37:40 +00:00
ru
108589a3f2 mdoc(7) police: tidy up. 2002-01-09 13:29:39 +00:00
peter
8b9a0acd48 Put the "mtxname" keyword in alphabetical order (t comes after s) so
that the keyword is recognized.
2002-01-05 12:19:51 +00:00
mckay
9ad6c9c9e7 Bruce thought some of the comments I added were not clear enough. This is
a combination of my words and his.  We will stop fiddling now. :-)
2002-01-01 06:14:26 +00:00
bde
997e80f81f Fixed style bug (unsorting of SRCS) in rev.1.15. 2001-12-29 12:05:30 +00:00
bde
3df6b14036 Fixed style bugs in revs. 1.6, 1.10 and 1.12. 2001-12-29 11:59:26 +00:00
bde
412b81cedf Fixed missing DPADD and disordered LDADD in rev.1.17
Fixed setting of WARNS in rev.1.16.  Options should normally be set using
using "?=", not using "=", so that the setting is easy to override on the
command line, and setting WARNS to 0 should not be an exception.
2001-12-29 11:51:27 +00:00
joe
42e2c5321a LSCOLOURS should be spelt LSCOLORS.
Submitted by:	Jordan DeLong <fracture@allusion.net
2001-12-29 10:13:43 +00:00
ben
8bd06e165d Remove part of a diff committed at the end of the file. 2001-12-29 00:51:23 +00:00
joe
e16986212d Force raw printing of non-printable characters via the -w option.
PR:		bin/28007
2001-12-29 00:22:29 +00:00
joe
4771d61303 Restore these files to shiny KNF. 2001-12-29 00:18:16 +00:00
joe
e208ef8e1a Convert some spaces into tabs that I missed first time around. 2001-12-28 21:55:23 +00:00
joe
d2121ec1c3 Revert most of rev 1.42, to restore KNF style.
Requested by:	bde
2001-12-28 21:47:33 +00:00
joe
dfee532b86 Add a new flag, -h which when combined with the -l option causes
file sizes to be displayed with unit suffixes; Byte, Kilobyte,
Megabyte, Gigabyte, Terabyte and Petabyte in order to reduce the
number of digits to three or less.

Submitted by:	nik
2001-12-28 20:50:12 +00:00
joe
4f254fdc50 Make it clearer what changed to a user using the old format of LSCOLORS. 2001-12-28 19:27:30 +00:00
joe
b4f7193e80 Mop up some warnings. 2001-12-28 19:26:06 +00:00
joe
22810faf4b Make the style more consistent throughout the file. 2001-12-28 18:43:32 +00:00
joe
731819d234 Use the default colour instead if a bad colour specification is given. 2001-12-28 18:20:23 +00:00