Commit Graph

5312 Commits

Author SHA1 Message Date
Tim J. Robbins
759484bacd Use getopt() to reject any options and skip "--" arguments. 2002-05-29 13:14:51 +00:00
Dag-Erling Smørgrav
743ea2081c Make our child the leader of its own process group to avoid receiving
signals in its stead.  This fixes the dread "zsh exits upon ^C" bug.
2002-05-29 03:32:17 +00:00
Alfred Perlstein
16d8455dcc Assume __STDC__, remove non-__STDC__ code. 2002-05-28 19:23:47 +00:00
Tim J. Robbins
7c5b751452 Add a History section. comm(1) appeared in V4. 2002-05-28 09:35:30 +00:00
Tim J. Robbins
fc7f17b1fe No need to handle '-' explicitly in getopt() loop.
Obtained from:	NetBSD
2002-05-28 09:26:08 +00:00
Dag-Erling Smørgrav
a1bdb05cce Drive-by whitespace cleanup & add NAI copyright 2002-05-28 06:47:32 +00:00
Dag-Erling Smørgrav
c51edfb77d Drive-by whitespace cleanup. 2002-05-28 06:46:37 +00:00
Tim J. Robbins
1a94013869 Write "FROM" heading above the hostname column, like NetBSD and GNU do. 2002-05-28 06:36:46 +00:00
Marcel Moolenaar
52183d0145 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
Tim J. Robbins
776c387ac1 Hook newgrp(1) up to the build.
PR:		36190
2002-05-28 05:07:42 +00:00
Tim J. Robbins
29f48d6256 Add the newgrp(1) utility, which changes groups. This is required by
the POSIX.2 UPE.

PR:		36190
Reviewed by:	-standards, silence on -audit
2002-05-28 05:05:28 +00:00
Tim J. Robbins
66f9c15fcf The XCU issue 5 requirement of accepting the file operand intermingled
with options has been withdrawn in issue 6, to which nl(1) now conforms.
2002-05-27 06:53:54 +00:00
Tim J. Robbins
53e29ec5b4 style(9): use errx() where appropriate instead of fprintf() + exit(). 2002-05-27 06:46:29 +00:00
Tim J. Robbins
f1e20ff77e style(9): use err() instead of perror() + exit(). 2002-05-27 06:37:34 +00:00
Tim J. Robbins
3662a24058 Claim conformance to IEEE Std 1003.1-2001.
See also csplit(1).
2002-05-27 06:08:14 +00:00
Tim J. Robbins
3e4228c3be Allow "-" to be specified as an operand as well as an option.
SUSV3 requires something like "split -- -" to work. Document the "-" operand.
2002-05-27 05:27:10 +00:00
Tim J. Robbins
3f5869d0b0 Avoid overflowing `fname' if the file name prefix given on the command
line is too long.

Obtained from:	OpenBSD
2002-05-27 04:59:46 +00:00
Tim J. Robbins
880ff11350 Exit non-zero if the tags file cannot be opened. 2002-05-27 03:54:45 +00:00
Tim J. Robbins
594830fbc1 From NetBSD:
Revision 1.10 Sat Oct 14 17:41:55 2000 UTC by bjh21
    Don't core dump with an empty format string.  Fixes PR#11218.
    Patch supplied by Launey Thomas.

Obtained from:	NetBSD
2002-05-27 03:17:28 +00:00
Tim J. Robbins
f457179a13 Initialise the `positions' array correctly before use. 2002-05-27 02:01:25 +00:00
Tim J. Robbins
7d44cb6e1f Add Standards, Diagnostics and History sections. 2002-05-26 07:07:14 +00:00
Tim J. Robbins
456fc9e56f If a file operand cannot be processed, go on to process any remaining files
but exit non-zero.
2002-05-26 06:15:15 +00:00
Ruslan Ermilov
1c3fc710e2 Make it work for a different endianness binary.
(This version is still limited to ELF64.)

Reviewed by:	jake
2002-05-25 13:43:16 +00:00
Ruslan Ermilov
02c0301fa7 Move elf2aout to usr.sbin/.
Approved by:	jake
2002-05-25 13:29:47 +00:00
Tim J. Robbins
ba545bbb61 Sync usage message with manual page synopsis. 2002-05-25 11:37:10 +00:00
Tim J. Robbins
b8b53eef91 Bad numeric arguments or usernames should cause non-zero exit status. 2002-05-25 10:37:24 +00:00
Tim J. Robbins
d6c762af40 Determine exit status to use before writing diagnostic message; warn()
may change errno.
2002-05-25 03:32:23 +00:00
Tim J. Robbins
816dde7d05 Typo: use plural now that we have more than one option. 2002-05-25 03:08:21 +00:00
Tim J. Robbins
fb2582c006 If a file cannot be processed, try to process any remaining files
then exit non-zero.
2002-05-25 03:04:28 +00:00
Tom Rhodes
e223a77118 Add the word ``fields'' to the description, and change an instance from
fields to num in the SYNOPSIS

Noticed by:	keramida
2002-05-24 19:12:02 +00:00
Ruslan Ermilov
1737392273 Back out the ``run shell from $PATH'' change; this was an overkill
and is insecure.

Requested by:	bde
2002-05-24 15:51:27 +00:00
Tim J. Robbins
3af4dcb223 If a file argument cannot be processed, process the remaining ones
and exit non-zero (SUSv3)
2002-05-24 10:58:21 +00:00
Tim J. Robbins
204c78a163 When a file name of "-" is given, read from standard input (SUSv3) 2002-05-24 09:56:18 +00:00
Tim J. Robbins
a8522a9bb7 Allow byte/character positions >_POSIX2_LINE_MAX to be specified by
dynamically growing the `positions' array.
2002-05-24 09:11:18 +00:00
Tim J. Robbins
d42862594a Use fgetln(3) to handle lines of unlimited length instead of a
getc/putc loop.

Suggested by: dd
2002-05-24 08:56:49 +00:00
Tim J. Robbins
ce78cbf9e0 P1003.2 forbids imposing any limit on line lengths; read character by
character instead of manually buffering each line.
2002-05-24 07:05:10 +00:00
Tim J. Robbins
0968654cfd Exit with non-zero status if any files specified could not be opened
when -s option is given (SUSv3).
2002-05-24 06:17:29 +00:00
Tim J. Robbins
a6ea32c3c5 If processing of one file fails, try to process the remaining files and
exit non-zero instead of immediately exiting. The traditional BSD
behaviour is explicitly forbidden by P1003.2.
2002-05-24 06:03:12 +00:00
Tim J. Robbins
5069e2716c If processing of one file fails, try to process the remaining files and
exit non-zero instead of immediately exiting (SUSv3).
2002-05-24 06:00:47 +00:00
Tony Finch
5ac21f6976 Sync with upstream version:
* Ensure we work within the array bounds when parsing command-line options;
  * Replace h0h0getopt with getopt(3);
  * Use consistent whitespace style in the function declarations.

Revieweded by:	dwmalone (mentor)
2002-05-23 16:50:41 +00:00
Juli Mallett
a8ca0a178e Handle numeric keys by checking a "default" file. Handle number-less keys
by failing, since comparing up to the length of the key (0) against the
begin line for a key in the help file will always succeed, and print what
is wholly bogus output.
2002-05-23 14:58:22 +00:00
Juli Mallett
e0bd05dc2f Set the MAKEFILE variable to the value passed to ReadMakefile(), not the full
path to it.  Use the full path only for parsing it.
2002-05-23 12:01:54 +00:00
Juli Mallett
39346853df Make my style consistent.
Remove two includes.

Fix a typo (semicolon instead of period at EOL).
2002-05-23 03:03:44 +00:00
Juli Mallett
3549859680 Taking a leap of faith, tie the help command in to the build. 2002-05-22 23:15:58 +00:00
Juli Mallett
192f0a0c65 Add my PD implementation of the SCCS help command, which prints help from
files in the format used by SCCS, given a key.  It behaves exactly like the
``proper'' SCCS help command, from what testing I can do.
2002-05-22 23:14:17 +00:00
Juli Mallett
a0304d8026 Tie sccs(1) in to the build, as it now does one thing right: sccs what 2002-05-22 16:19:31 +00:00
Juli Mallett
fb22fc68e4 Remove mention of the GNU version of ptx, it is dead. 2002-05-22 16:18:14 +00:00
Juli Mallett
08f4375879 Add a usage().
Print usage() if right before executing the specified command, it comes to be
that *argv is NULL (i.e. a flag was specified without a command being given).
2002-05-22 16:09:52 +00:00
Juli Mallett
824ff2896d Remove #ifndef's on V6. 2002-05-22 16:01:50 +00:00
Juli Mallett
5e213af359 Put braces around the command table properly. 2002-05-22 15:59:27 +00:00
Juli Mallett
6bad09a23e Use what(1) here, in /usr/bin/what. It doesn't print error 26 correctly, but
neither does the pd sccs(1) implementation I have around, so there's no loss
for now.
2002-05-22 15:44:29 +00:00
Juli Mallett
8eccf3b248 str_concat() doesn't really take const arguments.
Submitted by:	bde
Pointy hat to:	jmallett
2002-05-22 15:34:00 +00:00
Ruslan Ermilov
ea98f295f7 Do not run shell from /bin, run it from $PATH.
Bump MAKE_VERSION to 5200205221.
2002-05-22 14:53:18 +00:00
Ruslan Ermilov
8e9bddc97b Added the MAKE_VERSION global that could be useful in determining
if a given make(1) is feature-compatible with a set of makefiles.

When merged, this will be used to replace the ugly upgrade_checks
hacks in src/Makefile.

Version has the RYYYYMMDDX format, where R is from RELENG_<R> and
X allows for 10 distinguishable changes per day.

Discussed with:	bde
2002-05-22 14:35:47 +00:00
Juli Mallett
e0f783d4f8 Format internal commands properly.
Kill a bit of trailing whitespace.

Fix a path format.

Submitted by:	mdoc(7) police (ru)
2002-05-22 14:17:16 +00:00
Juli Mallett
89d6ab227d Clean up the manual page by leaps and bounds in terms of formatting.
Ruslan's version took away the '.Nm' for some commands, but not others, so
I chose to go with leaving '.Nm'.

Submitted by:	ru
2002-05-22 13:59:52 +00:00
Juli Mallett
b77ce308c0 Make the guarded string functions take a const "from" addr, and make the
function that prints when a botched guarded string operation occurs take
two const arguments.

XXX Should we use strlcat/strlcpy instead and hope for the best?
2002-05-22 13:41:08 +00:00
Juli Mallett
aecf4d561b Remove register qualifier. 2002-05-22 12:32:54 +00:00
Juli Mallett
8a4f086026 Use function prototypes. 2002-05-22 12:31:40 +00:00
Juli Mallett
5fed7e7311 Clean up formatting. 2002-05-22 11:29:21 +00:00
Juli Mallett
27ffa61f2a Replace the evil that is __DECONST() with (void *). This is one of the least
evil things we can do involving the const qualifier and a pointer.

Submitted by:	bde, ru
2002-05-22 11:16:48 +00:00
Juli Mallett
d7853f431e Make sccs(1) compile cleanly by fixing syntax errors such as #endif followed
by a token, and by including headers to get prototypes for many things, and
also by spelling the type of structure readdir(3) returns as "dirent".
2002-05-22 11:10:03 +00:00
Ruslan Ermilov
f6ce5895a9 Unroff all forms of \f and \*, and the simplest form of \s.
Submitted by:	fenner, ru
Reviewed by:	ru, fenner
2002-05-22 11:08:41 +00:00
Juli Mallett
61252e89e7 Revive the SCCS front-end, sccs(1), back from the Attic, since it's something
SUS wants (they want the entire suite of SCCS commands, we don't have them,
but we *had* the frontend, so we can have it again, and now).

Add $FreeBSD$ where appropriate, don't revive PSD.doc/spell.ok.
2002-05-22 10:43:50 +00:00
Tim J. Robbins
b9f6304141 Build pathchk(1). 2002-05-22 10:32:24 +00:00
Tim J. Robbins
c78c4633a2 Add the pathchk utility, which checks pathnames for validity or
portability between POSIX systems.

Submitted by:	Chuck Rouillard (manpage, initial implementation)
2002-05-22 10:30:16 +00:00
Juli Mallett
21b8b7cb3c Make ReadMakefile() operate using the realpath(3) name for the file handed to
it, which means that relative paths will be expanded to absolute paths, and
filenames without a path will end up with their absolute path included as
well.  This aids tremendously in debugging a build using our make(1) with
multiple Makefile's, such as when there is a syntax error in a file in a
sub-directory as per <bsd.subdir.mk>.  Normally we'd end up with just
"Makefile" known about the Makefile in question, which means that an error
would be useless for someone trying to debug their build system, now we
end up with a complete real pathname for the Makefile.

So mostly this is useful in a debugging context, but possibly others too
(I haven't thought of them yet, but they probably are more useful if you
make Dir_FindFile use realpath(3), but that's another story).

Reviewed by:	-current
MFC after:	2 weeks
2002-05-21 20:24:46 +00:00
Tom Rhodes
69cc776cd6 Reword a small part of the uniq(1) manual page to help reduce word
duplication (ie: fields fields).

PR:		38161
Reviewed by:	keramida
MFC after:	3 days
2002-05-21 16:54:58 +00:00
Tim J. Robbins
4ef27b1a49 Mark argc as __unused to silence GCC. 2002-05-21 02:48:55 +00:00
Tim J. Robbins
743f138e8d Build the tabs(1) utility.
PR:		36126
2002-05-21 02:36:12 +00:00
Tim J. Robbins
890a73ed39 Add an implementation of the tabs(1) utility, as required by SUSv3.
PR:		36126
2002-05-21 02:33:25 +00:00
Ruslan Ermilov
0f91d7050c Style. 2002-05-20 16:42:15 +00:00
Ruslan Ermilov
b501b9b5c1 Bootstrap elf2aout(1) for sparc64; used to build sys/boot/sparc64/boot1. 2002-05-20 14:42:48 +00:00
Ruslan Ermilov
fa7e3ca68a Kill the stray #include line. 2002-05-20 08:05:58 +00:00
Ruslan Ermilov
8aa98dece2 s/u_int/u_int32_t/ 2002-05-20 07:56:40 +00:00
Dima Dorfman
a79a73ab1b Mark a warning as such. Without this, it isn't obvious whether
killall stopped after failing to kill one process or whether it kept
going.
2002-05-20 07:17:22 +00:00
Juli Mallett
d784a077e4 Fix a late-night buglet in MLINKS ordering.
Submitted by:	Szilveszter Adam <sziszi@bsd.hu>
2002-05-19 20:39:42 +00:00
Juli Mallett
28130e4305 Synch usage() and manpage for b64encode/b64decode.
Make uudecode's usage more like that of other programs.
2002-05-19 11:22:54 +00:00
Juli Mallett
09bf07df21 Add b64decode & b64encode as synonyms for uudecode and uuencode -m,
respectively, for convenience when encoding or decoding base64 files.

As requested by various users.
2002-05-19 11:17:17 +00:00
David E. O'Brien
c345c0dae5 elf2aout can be useful to have on all platforms 2002-05-18 18:25:58 +00:00
David E. O'Brien
6639a24d01 Don't build getconf if you don't have a full C++ installation. 2002-05-18 18:24:55 +00:00
Ruslan Ermilov
9f377ad834 Fix markup.
Give Wolfram a credit for writing the original version in Perl
like in killall(1).
2002-05-18 15:39:56 +00:00
Ruslan Ermilov
3e97608622 More whitespace fixes. 2002-05-18 15:15:30 +00:00
Mark Murray
ccde38c38d Remove Perl and TCL/TK bits, neither of which are in the base system
(anymore).
2002-05-18 14:27:17 +00:00
Ruslan Ermilov
93685bb81e Fixed spacing. 2002-05-18 14:17:53 +00:00
Ruslan Ermilov
02484f2b53 Look into machine specific subdirs. 2002-05-18 13:56:53 +00:00
Mark Murray
bf7bec3366 Add C rewrites of catman and makewhatis. These aren't quite as
the submitter supplied them, as I did some WARNS=n fixups (mostly
const-ification).

Submitted by:	John Rochester <john@jrochester.org>
2002-05-18 09:19:08 +00:00
David E. O'Brien
b3161ee9b5 WARNS 6 this. 2002-05-18 05:33:28 +00:00
David E. O'Brien
0b094b5426 Add a perl wrapper. mergmaster(8) is broken with out it.
Submitted by:	DES
2002-05-18 05:31:48 +00:00
Gordon Tetlow
d2b6bd664b Add my birthday to the list. Apparently, I share a birthday with dwhite.
Reviewed by:	jake
Approved by:	jake
2002-05-17 17:49:32 +00:00
Akinori MUSHA
005ba515dc Fix a tiny bug in shlib support of ldd(1); if dlopen(lib, RTLD_TRACE)
returns, exit gracefully with 0.

This fixes the behavior you see when you specify libc.so.  It occurs
because ldd(1) itself is linked with libc.so.

	$ ldd /usr/lib/libc.so
	/usr/lib/libc.so:
	ldd: /usr/lib/libc.so: (null)
	/usr/lib/libc.so: exit status 1

Reviewed by:	silence of audit@
2002-05-17 17:06:56 +00:00
Jake Burkholder
fa5fb2ec22 Get byte swapping primitives from sys/endian.h now that they are exported
to userland.  This makes elf2aout work as a cross tool.
2002-05-17 15:46:08 +00:00
Juli Mallett
4eb254c143 Group the output chunks differently, to try to match BSD/OS output. Switch
to using arithmatic to determine buffer sizes to encode into.

Diane Bruce pointed out to me that BSD/OS did MIME too, so I want to match
their output, too, since my decision of 8 output groups was wholly arbitrary.
2002-05-17 12:27:02 +00:00
Juli Mallett
621e56b613 Revert part of the previous revision. Changing exit() to return() in main()
is wrong, even though our C compiler doesn't understand that exit() eats
control of the program, and as such can sometimes complain that main() reaches
the bottom of its body without an explicit return().

Aside from that, the functional usefulness of changing it is effectively nil,
so back it out.

Submitted by:	mike
2002-05-17 11:16:49 +00:00
Tim J. Robbins
7139b25561 Make the output tidier when multiple integer formats are requested by
attempting to line up values into columns.

Obtained from:	NetBSD (idea)
2002-05-17 08:54:32 +00:00
Juli Mallett
be70f7d4da Simplify prerun() in the case where there are no arguments. Can't do -I or -J
substitution if `utility' is not specified and we're using the buildin echo;
It has no arguments for us to abuse.
2002-05-17 07:55:24 +00:00
Tim J. Robbins
cf021af20b Overhaul hexdump's od syntax code to handle the -s -A -j -N -t options that
SUSv3 requires and give od a proper manual page.

PR:		36783
2002-05-17 07:14:55 +00:00
Tim J. Robbins
1b50831dd6 Declare variables that were extern'd in multiple places in hexdump.h.
PR:		36783
2002-05-17 06:32:00 +00:00
Tim J. Robbins
828663767a Add support for printing long doubles.
PR:		36783
2002-05-17 06:12:25 +00:00
Tim J. Robbins
cf45dcc8e6 Print signed single-byte decimal integers correctly instead of implicitly
converting them to unsigned bytes.

PR:		36783
2002-05-17 05:43:00 +00:00