Commit Graph

1694 Commits

Author SHA1 Message Date
Tim J. Robbins
decb00f677 Second attempt at removing machdep.h and using ALIGN from <sys/param.h>.
The problem with the previous attempt, as noticed by Marcel, was that
stacknxt was being aligned to a pointer boundary instead of an
ALIGNBYTES + 1 boundary, which broke sparc64.
2003-02-17 03:51:44 +00:00
Tim J. Robbins
da5f5439a4 Temporarily back out machdep.h/ALIGN changes. It seems that on sparc64,
using the alignment from sys/param.h (16) instead of the alignment
from machdep.h (8) tickled a nasty bug in the memory allocator that I
haven't been able to track down yet.
2003-02-16 03:28:11 +00:00
Tim J. Robbins
457ae4f0d4 Use the ALIGN macro from <sys/param.h> instead of defining our own
incorrect version in machdep.h. Delete machdep.h.
2003-02-14 23:53:19 +00:00
Maxim Sobolev
6f15bc16ed Fix slight disorder that broke sorting. Put in bold warning about the
fact that in this case order matters.

Submitted by:	Peter Edwards <pmedwards@eircom.net>
2003-02-05 19:22:39 +00:00
Philippe Charnier
53a24b9359 Add FBSDID. 2003-02-05 13:23:46 +00:00
Philippe Charnier
eaed5652bf Display elapsed time (-o etime) using [[dd-]hh:]mm:ss, which according to
Solaris man page is the POSIX way.

Reviewed by:	jmallett
2003-02-05 13:18:17 +00:00
Philippe Charnier
e869e50704 Enclose sccsid according to style(9).
udp/timed -> timed/udp
2003-02-05 12:56:40 +00:00
Tom Rhodes
b63094f6ec Remove another unused doc Makefile. 2003-02-04 20:46:23 +00:00
Tom Rhodes
02b911053d Cross ref chflags(1).
Suggested by:	Craig Carey <research@ijs.co.nz) on -doc.
2003-02-04 20:38:51 +00:00
Tony Finch
1413f7de53 Improve the layout of the description of the various parameter expansion
modifiers. The paragraph that explains the difference between ${foo:-bar}
and ${foo-bar} etc. was not very visible.
2003-02-03 23:03:05 +00:00
Maxime Henrion
572417c7e4 Remove now unnecessary main() prototype. 2003-01-29 21:46:12 +00:00
Tim J. Robbins
c57bc2b10e Ensure that the TTY file descriptor is greater than or equal to 10 so that
it doesn't interfere with the user's redirections.

PR:		47136
MFC after:	1 week
2003-01-27 07:41:12 +00:00
Poul-Henning Kamp
cd967e322a Don't call DIOCWLABEL on disks, it is not implemented, and calling it
like this negated any practical value of the feature.
2003-01-26 11:13:40 +00:00
Tim J. Robbins
6da31df83b Make this compile with DEBUG defined now that WARNS=0 has been removed
from the Makefile:
- Print pointers with %p instead of %x.
- Include missing headers to get prototypes.

Noticed by:	benno
2003-01-21 10:06:04 +00:00
Chris Costello
d2e59e8d5d Reference maclabel(7).
Sponsored by:	DARPA, Network Associates Laboratories
2003-01-20 21:25:00 +00:00
David E. O'Brien
d8ac087563 kenv(1) has been repo copied from usr.bin to bin.
Sometimes we need kenv(1) in /etc/rc.diskless*.
2003-01-20 17:56:25 +00:00
Juli Mallett
78b1878a16 Per-variable\ entry headers, to allow the 'ps -otime -otime=FOO' or similar
case to do the right thing and affect exactly one column.  This is consistent
with GNU ps(1) in BSD mode, and POLA.
2003-01-19 00:31:16 +00:00
Juli Mallett
fde411d5a1 When inserting a non-user-specified (e.g. not via -o or -O) format, don't dupe
one that is already there.  This is consistent with GNU ps(1)'s BSD mode, and
POLA.

Reported by:	Andy Farkas <andyf@speednet.com.au>
Tested by:	Andy Farkas <andyf@speednet.com.au>
2003-01-19 00:22:34 +00:00
Juli Mallett
775bba9fd8 Refer to the process label as proclabel, as there is a function called label,
and that's what these locals were called before.
2003-01-18 03:31:30 +00:00
Johan Karlsson
de216a83c2 realpath(3) should use PATH_MAX instead of MAXPATHLEN according to POSIX.
This also reverts the PATH_MAX -> MAXPATHLEN part of
rev 1.3 of src/bin/realpath/realpath.c

Requested by:	imp
Reviewed by:	imp, bde
2003-01-15 21:22:55 +00:00
David E. O'Brien
2e79837f7b Make the "tarcp" example more direct. 2003-01-10 17:37:23 +00:00
Tim J. Robbins
9c92e72c7f Do not strip CTL* escapes from redirection filenames in exptilde(),
expari(), expbackq() and evalvar(). Similar to revision 1.39.
Patch from Tor Egge.

PR:		45349
MFC after:	2 weeks
2003-01-08 10:50:08 +00:00
Jens Schweikhardt
9d5abbddbf Correct typos, mostly s/ a / an / where appropriate. Some whitespace cleanup,
especially in troff files.
2003-01-01 18:49:04 +00:00
Jens Schweikhardt
d64ada501a Fix typos, mostly s/ an / a / where appropriate and a few s/an/and/
Add FreeBSD Id tag where missing.
2002-12-30 21:18:15 +00:00
Mike Barcroft
dc474219b6 Back out rev 1.44; getbsize(3)'s original interface has been restored.
Approved by:	markm
2002-12-30 18:10:37 +00:00
Robert Watson
8051fddedc Add "-h" arguments to getfacl and setfacl, which behave in a manner
similar to "-h" on chown, chmod, etc, causing the operation to occur
on a final symlink in the provided path, rather than its target.

Obtained from:	TrustedBSD Project
2002-12-30 15:36:29 +00:00
Tim J. Robbins
2c25061f18 Add the "wordexp" shell built-in command which will be used to implement
the POSIX wordexp() function.
2002-12-26 14:28:54 +00:00
Ruslan Ermilov
facc67676f mdoc(7) police: Deal with self-xrefs. 2002-12-24 13:41:48 +00:00
Ruslan Ermilov
463cfa804d Fixed the abuses of .Ql visible on stderr in troff mode.
PR:		docs/37176
2002-12-23 16:04:51 +00:00
Ruslan Ermilov
f5d1157fd1 mdoc(7) police: markup nit. 2002-12-23 15:21:38 +00:00
David Malone
f656dbec97 Use '\033' rather than '\e' as the latter is a gccism.
PR:             46015
Submitted by:   Jeroen Ruigrok van der Werven <asmodai@wxs.nl>
MFC after:      1 week
2002-12-22 21:35:14 +00:00
Tim J. Robbins
3fceb9fd5b pathconf() and acl_get_file() follow links so they cannot be used to
determine whether a symlink has an ACL. Instead, assume that symbolic
links don't have ACLs and don't bother checking. Avoids spurious
ENOENT warnings when listing directories containing broken symlinks
on filesystems with ACLs enabled.

Pointed out by:	rwatson, bde
2002-12-19 01:13:23 +00:00
Robert Watson
3c3f5f9cab Improve handling of symlink targets when listing MAC labels: don't
do the wrong thing when the symlink doesn't have a target, by
considering !f_label in the construction of ch_options.

Obtained from:	TrustedBSD Project
Sponsored by:	DARPA, Network Associates Laboratories
2002-12-18 21:05:15 +00:00
Johan Karlsson
894fd2da78 Remove undocumented behavior (return current work dir if no path
is given as argument) that is not present in 4-Stable.
It was introduced when realpath(1) was split out of pwd(1).
The removed behavior is provided by pwd(1).

Reviewed by:	mike
2002-12-18 11:50:28 +00:00
Johan Karlsson
9a26e46eb4 - use MAXPATHLEN per realpath(3)
- use the problematic part of the path, instead of the argument,
  when reporting an error.

Reviewed by:	mike
2002-12-18 10:20:40 +00:00
Tom Rhodes
304199ce19 The code uses trapsasync, however the manual page uses asynctraps. Fix the
manual page to reflect the code.

PR:		45820
Submitted by:	Marco Molteni <molter@tin.it>
Discussed with:	tjr
2002-12-17 20:27:48 +00:00
Tony Finch
162ae3ae7f Document trap EXIT and trap SIGNAME. 2002-12-17 17:31:44 +00:00
Tim J. Robbins
2e3684f843 When job control is disabled, never show the job id when reporting the
status of a background process that has terminated because of a signal.
2002-12-14 01:08:04 +00:00
Ruslan Ermilov
db8993ce9e Capitalize ASCII code names.
Approved by:	re
2002-12-05 08:50:00 +00:00
Ruslan Ermilov
e27480d64d mdoc(7) police:
Revert to using the .Tn POSIX and .Tn ANSI instead of \*[Px] and \*[Ai]
strings; using these strings is unsafe in troff mode, as they include a
change in a font size.

Approved by:	re
2002-11-26 17:55:41 +00:00
Ruslan Ermilov
2267d53b43 mdoc(7) police: In DESCRIPTION, list the options in pure alphabetical
order, as required by style(9).  Document the effect of the -f option
on exit status.  Fixed some spacing.

Submitted by:	bde
Approved by:	re
2002-11-25 14:18:42 +00:00
Ruslan Ermilov
1734e39a1a mdoc(7) police: markup fixes.
Approved by:	re
2002-11-25 13:52:57 +00:00
Ruslan Ermilov
98d13c7e51 mdoc(7) police: markup fixes.
Approved by:	re
2002-11-25 13:20:30 +00:00
Nate Lawson
e9a4552b14 Minimal take on previous commit -- remove getopt and printf. Static size
is reduced by 40k, dynamic by a few bytes.
Functional changes:
* "sleep -- arg" now returns usage() instead of ignoring the --
* "sleep -1" now returns immediately instead of returning usage()

Reviewed by:	jmallett
2002-11-14 01:14:35 +00:00
Nate Lawson
e021938408 Back out previous commit since there is controversy about changing so much
in sleep including duping strtol(3).  Code changes also increased
dynamic size of sleep(1).
2002-11-14 00:20:58 +00:00
Nate Lawson
174005b7f0 Remove getopt and strtol dependencies, reducing size of static exe.
Preserve older desired behavior, accept [+-]*[0-9]*\.[0-9]*
Remove a few unnecessary casts.

%ls -l /bin/sleep
-r-xr-xr-x  1 root  wheel  61332 Oct 28 05:16 /bin/sleep
%ls -l /usr/obj/usr/src/bin/sleep/sleep
-rwxr-xr-x  1 root  wheel  19124 Nov 13 12:12 /usr/obj/usr/src/bin/sleep/sleep

Submitted by:	Tim Kientzle <kientzle@acm.org>
2002-11-13 20:12:26 +00:00
Nate Lawson
ef3e71dac3 Put echo on a diet, removing unnecessary use of stdio and getopt.
Before...
-r-xr-xr-x  1 root  wheel  58636 Oct 28 05:16 /bin/echo
After...
-rwxr-xr-x  1 root  wheel  12824 Nov 12 17:39 /usr/obj/usr/src/bin/echo/echo

Submitted by:	Tim Kientzle <kientzle@acm.org>
2002-11-13 01:39:02 +00:00
Tim J. Robbins
e09fdabddf Use warn() instead of perror() or fprintf() where appropriate. 2002-11-06 01:18:12 +00:00
Tim J. Robbins
745d94fc5f Cross-reference setfacl(1). 2002-11-04 06:46:53 +00:00
Tim J. Robbins
4e65ab954d - Consistent use of warn() vs. perror().
- Gracefully handle the case where standard input is missing
  a newline at EOF.
- Exit with status 1 instead of -1 (really 255) on error.
- Add a Diagnostics section to the manual page documenting
  exit status.

Approved by:	rwatson
2002-11-03 23:22:34 +00:00
Tim J. Robbins
dd9aaeb0f7 Print a `+' character after the standard UNIX permission fields in long
listings if the file has an extended ACL (more than the required 3 entries).
This is what Solaris and IRIX do, and what the withdrawn POSIX.2c standard
required.

Reviewed by:	rwatson (an earlier version of the patch)
2002-11-03 07:29:08 +00:00
Thomas Moestl
297cf923e7 The hw.availpages sysctl has an unsigned long value now, fix the retrieval
to match that.
2002-11-01 23:26:20 +00:00
Marcel Moolenaar
9b2f268fb5 o Remove $Id$ from copyright; there's $FreeBSD$,
o  Remove static function uuid_print(); use uuid_to_string(3) in
   combination with printf(3) to achieve the same,
o  Remove unneeded includes,
o  Add a reference to uuid(3) to the manpage.
2002-11-01 06:20:14 +00:00
Tim J. Robbins
01e5f16641 Do not print a header line if it would be empty; required by 1003.1-2001. 2002-10-31 13:41:37 +00:00
Tim J. Robbins
0cda444bef Delete worthless comments. 2002-10-30 06:34:52 +00:00
Garrett Wollman
c9885518de Create a small library function, check_utility_compat(3), to determine
whether a named utility should behave in FreeBSD 4.x-compatible mode
or in a standard mode (default standard).  The configuration is done
malloc(3)-style, with either an environment variable or a symlink.

Update expr(1) to use this new interface.
2002-10-28 00:15:43 +00:00
Garrett Wollman
688dfe4533 Do not include <sys/syslimits.h> directly; it is not intended for general
consumption.
2002-10-27 17:44:33 +00:00
Robert Watson
4df6daba42 Attempt improved use of fts results: use the correct path to the
object to retrieve label information on, rather than directly
consuming the fts-provided paths (none of which are quite right).
This is based on the similar readlink() code, and may contain
the same bugs.

Obtained from:	TrustedBSD Project
Sponsored by:	DARPA, Network Associates Laboratories
2002-10-24 01:01:53 +00:00
Robert Watson
4d33b62edc Teach "ls -Z" to use the policy-agnostic MAC label interfaces rather
than the LOMAC-specific interfaces for listing MAC labels.  This permits
ls to view MAC labels in a manner similar to getfmac, when ls is used
with the -l argument.  Next generation LOMAC will use the MAC Framework
so should "just" work with this and other policies.  Not the prettiest
code in the world, but then, neither is ls(1).

Obtained from:	TrustedBSD Project
Sponsored by:	DARPA, Network Associates Laboratories
2002-10-24 00:07:30 +00:00
Robert Watson
2af538eb48 Use the MAC interface to list process MAC labels rather than using
the LOMAC-specific interface (which is being deprecated).  The
revised LOMAC using the MAC framework will export levels listable
using this mechanism.

Approved by:	re
Obtained from:	TrustedBSD Project
Sponsored by:	DARPA, Network Associates Laboratories
2002-10-24 00:00:57 +00:00
Mark Murray
0b66b1e8eb Fix for changed getbsize arg type. 2002-10-23 22:09:05 +00:00
Mark Murray
9d32ecfcdf Be consistent about declaring a function "static", and consistent
about the type of argv.
2002-10-23 10:23:38 +00:00
Mark Murray
ca2993fb41 Constify, staticify, rationalise types and fix other related warnings. 2002-10-23 10:20:01 +00:00
Mark Murray
099bda679e Constify to squash some warnings. 2002-10-23 10:15:44 +00:00
Mark Murray
4e3b1d65e6 Staticify for lint. 2002-10-18 14:48:48 +00:00
Mark Murray
ba8acd9de2 Constify and staticify for lint. 2002-10-18 14:45:00 +00:00
Tim J. Robbins
1656f85050 Print non-printing characters in directory names, as well as file names,
as `?' or `\ooo', depending on whether the -b or -B flags were used.

PR:		43995
MFC after:	1 month
2002-10-18 10:59:45 +00:00
Tim J. Robbins
728b72c237 Avoid accidentally making "-h" a synonym for "fc".
Obtained from:	NetBSD
2002-10-18 10:33:32 +00:00
Dima Dorfman
598420ee63 Output "human-readable" values with a non-0 precision where
appropriate.  Before this, a 2.9 GB file was misleadingly reported as
"2G".  This mostly brings unit_adjust() in line with what is in du(1).

Reviewed by:	jmallett
Approved by:	nik
2002-10-18 04:06:59 +00:00
Mark Murray
d8456c7ada Dekerberise. The corresponding userland stuff has been dekerberised
for ages, and no-one seems to have noticed. Viva PAM!
2002-10-16 16:10:46 +00:00
Tim J. Robbins
c121fd80b8 Do not strip CTL* escapes from redirection filenames in argstr(); they
are later stripped with rmescapes() in expandarg(). If the filename has
already been unescaped, doing it again in rmescapes() can walk off the
end of the string, leading to memory corruption and eventually SIGSEGV.

Noticed by:	kris
2002-10-08 11:22:49 +00:00
Tim J. Robbins
76900889fa Clean up use of <stdarg.h> macros: always call va_end after va_start,
reset with a call to va_start before each use of the va_list.

Obtained from:	NetBSD
2002-10-06 11:14:21 +00:00
Tim J. Robbins
e79f14fad9 Ensure all va_starts have a matching va_end.
Obtained from:	NetBSD
2002-10-06 09:23:58 +00:00
Philippe Charnier
7e61a4ae7b While removing a memory leak, rev 1.32 introduced a
free-memory-and-reuse-it-after. Correct both problems and
make rcp -r work again under /etc/malloc.conf -> AJ.
2002-10-06 09:09:27 +00:00
Tim J. Robbins
e7ed0f64bf /dev/sa0 is the default tape device, not /dev/rst0. 2002-10-06 07:56:27 +00:00
Tim J. Robbins
427748f7df Disallow empty condition parts of "if", "while" and "until" compound
commands. Commands like "if then ... fi" and "while do ... done" are no
longer accepted. Bodies of compound commands are still allowed to be
empty, because even though POSIX does not allow them, most shells do.
2002-10-06 06:35:51 +00:00
Tim J. Robbins
8b9f20c622 Use %jd in format string and cast argument to intmax_t instead of using
%qd to print struct stat.st_size. Remove WARNS=0 and WFORMAT=0 from
Makefile.

Tested on:	alpha, sparc64, i386
2002-10-06 03:50:06 +00:00
Tim J. Robbins
5b94264c20 Fix format string errors relating mainly to the use of %qu to print off_t's.
Instead use %ju and cast the argument.

WFORMAT=0 is still required in the Makefile because gcc warns about
some strftime() calls (I don't think this behaviour is useful.)

Tested on:	sparc64, alpha, i386
2002-10-06 03:20:27 +00:00
Bruce Evans
bb2d6f211d Oops, the previous version was a last minute test version with off_t
replaced by int instead of size_t.

Spotted by:	fanf
2002-10-03 17:19:36 +00:00
Bruce Evans
684370e703 Use a non-bogus type for representing the values of offsets in structs.
off_t is for offsets in files, and it is signed so it was no better
than the original type of int for avoiding warnings from broken lints,
except accidentally on machines like i386's where size_t is smaller
than off_t.
2002-10-03 15:00:07 +00:00
Tony Finch
35704b2f29 Fix some twelve hour clock braindamage. The range for hours is 0-23 not 1-12.
MFC After: 1 week
2002-10-03 14:11:29 +00:00
John Baldwin
0d6326492b Catch up to SMTX -> SLOCK changes. 2002-10-02 20:33:52 +00:00
Tim J. Robbins
54beeb39c2 Use %d in a printf() format string and cast the argument to int instead of
using %td when we know that the number is between 0 and 9; mksyntax is a
build tool and needs to work on -stable.
2002-10-02 09:57:54 +00:00
Tom Rhodes
0237755d1a Return the ``u'' 2002-10-01 20:32:59 +00:00
Tim J. Robbins
658a755b6a Back out experimental changes to fmtstr() that I didn't mean to include
in the previous commit.
2002-10-01 13:41:13 +00:00
Tim J. Robbins
7e73d40ee5 Replace a home-grown printf() clone with a fwopen() wrapper around
libc's vfprintf() that writes to a `struct output' instead of a file.
Inspired by NetBSD's similar changes (they used asprintf() instead).
2002-10-01 13:22:12 +00:00
Maxime Henrion
ca5434bae6 It is now safe to remove WARNS=0 and WFORMAT=0.
Tested on:	alpha, i386, sparc64
2002-10-01 12:12:45 +00:00
Tim J. Robbins
8c39572997 Restore "not found" error message when searching for (or executing)
a program fails because the file or a path component does not exist.

Suggested by:	bde
2002-10-01 11:48:18 +00:00
Maxime Henrion
0c1661b754 - Don't use quad_t when we really mean rlim_t.
- Cast rlim_t to intmax_t when printing it.

This should fix the last format errors in sh(1).

Tested on:	i386, sparc64
2002-10-01 11:44:38 +00:00
Tim J. Robbins
fce40e6ec6 Add back WARNS=0 and WFORMAT=0; gcc is finding nonexistent format string
errors with %qd formats.
2002-10-01 08:55:28 +00:00
Maxime Henrion
ec65e9977a Use the %t format modifier to print differences between
pointers.  This fixes two format warnings on 64 bits
archs which are fatal now that WFORMAT=0 has been removed.

It doesn't fully fix the sh(1) build on 64 bits platforms
though, there is still some quad_t issues that need to be
fixed.

Tested on:	i386, sparc64
2002-10-01 08:40:07 +00:00
Tim J. Robbins
b7f23f5be5 Remove WARNS=0 and WFORMAT=0. The shell compiles cleanly at WARNS=2
on at least i386. If there are warnings on other archs, I'd rather hear
about them than pretend they didn't exist.
2002-10-01 07:26:35 +00:00
Tim J. Robbins
c515abc535 Remove some kind of profiling support that required the 4.2BSD monitor()
function in libc.
2002-10-01 01:30:33 +00:00
Tim J. Robbins
b1a667509b Remove bits and pieces of support for atty, which was made obsolete by
adding history and vi/emacs-style line editing to the shell itself.
Atty was a user-mode terminal emulator (like screen and window) that did
line editing and history.
2002-10-01 00:54:14 +00:00
Tim J. Robbins
abe2dc6158 Callers of error() don't need to supply a program name prefix in the
error message. Stops ulimit giving error messages like "ulimit: ulimit: xyz".
2002-09-30 13:29:32 +00:00
Tim J. Robbins
f7a9b7fe3a Allow a left parenthesis before patterns in case blocks. POSIX requires
us to accept this, but I've never seen a script that uses it.
2002-09-30 13:25:00 +00:00
Tim J. Robbins
e00e16ad7f Allow empty case/esac statements; POSIX requires this, and recent versions
of autoconf are generating scripts that use this feature.

PR:		43275 35879
Submitted by:	Dan Nelson <dnelson@allantgroup.com>
2002-09-30 10:57:44 +00:00
Tim J. Robbins
9a7cafd9b8 Remove dead code which supported systems without O_APPEND, O_CREAT or SIGTSTP. 2002-09-29 12:38:25 +00:00
Tim J. Robbins
1c59560de9 Convert the remaining callers of errmsg() to use strerror(), and remove
errmsg() and its table of error messages.
2002-09-29 11:37:39 +00:00
Juli Mallett
f7f23e15f8 Mark the signo as __unused in a lazy signal handler. 2002-09-29 07:59:57 +00:00