Commit Graph

61 Commits

Author SHA1 Message Date
Alfred Perlstein
033be9ae81 while i'm breaking stuff, use __dead2 instead of GCC specific __attribute__. 2002-05-11 01:25:54 +00:00
Alfred Perlstein
46d560550a backout additional include of cdefs.h, it's not helping any. 2002-05-11 01:24:39 +00:00
Alfred Perlstein
dfe7e2f8ff include cdefs.h for __printf0like to silence warning. 2002-05-11 00:54:33 +00:00
Andrey A. Chernov
82ea3997c1 Use intmax_t as quad_t replacement, like in expr 2002-03-28 16:30:42 +00:00
Maxim Konovalov
89a3a364c2 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
Kris Kennaway
f4c1428318 __printflike() should really be __printf0like() since verrx() can
accept a NULL format string.
2002-02-04 01:11:48 +00:00
Kris Kennaway
7cbc81e6a1 Add a __printflike() attribute to silence warning with FORMAT_AUDIT=1 2002-02-04 01:07:07 +00:00
Akinori MUSHA
5c08c7d35d 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
Warner Losh
5134c3f799 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
Andrey A. Chernov
4cc31e55f5 strtoq -> strtoll (strtoq is deprecated) 2001-12-25 08:10:34 +00:00
Andrey A. Chernov
3d09cebfce 1) Localize (LC_CTYPE)
2) Catch "" to 0 conversion for OSes that not catch it in strto*()
   (f.e. -stable). It is needed because POSIX agrees with both variants.
2001-12-17 23:14:14 +00:00
Andrey A. Chernov
9ea42c8e34 POSIX strto*() functions MAY return EINVAL, so don't assume that only one
errno from them allowed and it is always ERANGE
2001-12-14 23:20:54 +00:00
David E. O'Brien
a748290789 Default to WARNS=2. Binary builds that cannot handle this must explicitly
set WARNS=0.

Reviewed by:	mike
2001-12-04 01:57:47 +00:00
Akinori MUSHA
bd90b9c76e Fix style bugs I found, and add a comment. 2001-11-19 20:39:24 +00:00
Akinori MUSHA
25e04004ff Oops sorry, forgot to add a #include. 2001-11-19 20:15:10 +00:00
Akinori MUSHA
d919a882fd - Do not reference argv[1] if no argument is given.
Reported by:	brian

- Call error() instead of errx() if compiled as sh(1) builtin.
2001-11-19 19:57:45 +00:00
Akinori MUSHA
d90c5c4ab4 Make test(1) a builtin command of our sh(1) for efficiency. The
binary size increase is 3,784 bytes (about 0.6%).

I don't drop the printf builtin while I'm here because some /etc/rc.*
scripts seem to use it before mounting /usr where printf(1) resides.

Reviewed by:	arch (sheldonh)
Inspired by:	NetBSD, ksh
Clued by:	ume (on how the printf builtin is used)
2001-11-17 19:10:11 +00:00
Dima Dorfman
46c128b5a5 The file_descriptor argument to -t isn't optional, so don't mark it up so. 2001-08-31 15:38:53 +00:00
Ruslan Ermilov
c4d9468ea0 mdoc(7) police:
Avoid using parenthesis enclosure macros (.Pq and .Po/.Pc) with plain text.
Not only this slows down the mdoc(7) processing significantly, but it also
has an undesired (in this case) effect of disabling hyphenation within the
entire enclosed block.
2001-08-07 15:48:51 +00:00
Dima Dorfman
7ebcc426ef Remove whitespace at EOL. 2001-07-15 07:53:42 +00:00
Dima Dorfman
982f5d88ff WARNS= -> WARNS?=
Submitted by:	Mike Barcroft <mike@q9media.com>
2001-06-22 21:38:30 +00:00
Kris Kennaway
6dca651581 Silence WARNS=2 and BDECFLAGS on alpha and i386
MFC After:	1 week
2001-05-20 05:33:53 +00:00
Ruslan Ermilov
be8b149795 mdoc(7) police: use the new features of the Nm macro. 2000-11-20 11:39:41 +00:00
Ruslan Ermilov
238fe5f74d mdoc(7) police: now that Nm macro accepts punctuation characters
as argument, unbreak this page by escaping the `[' character.

Noticed by:	sheldonh
2000-11-18 14:44:30 +00:00
Stefan Eßer
de96f24080 Add support for 64bit integer comparisons. 2000-07-10 21:29:28 +00:00
Kris Kennaway
97ccc6c7ab Remove test for block device. 2000-05-07 08:56:21 +00:00
Sheldon Hearn
bef84d6bc0 Remove single-space hard sentence breaks. These degrade the quality
of the typeset output, tend to make diffs harder to read and provide
bad examples for new-comers to mdoc.
2000-03-01 10:43:09 +00:00
Sheldon Hearn
9abf30435b Take into account the fact that "[" may be called with a path,
for example "/bin/[".

Reported by:	Vlad Skvortsov <vss@ulstu.ru>
Reported by:	Peter Jeremy <peter.jeremy@alcatel.com.au>
Message-Id:	99Dec27.111307est.40321@border.alcanet.com.au
1999-12-28 09:34:57 +00:00
Peter Wemm
2a4562393f $Id$ -> $FreeBSD$ 1999-08-27 23:15:48 +00:00
Brian Feldman
2a6d85a9cb Make the comments nice, short-but-sweet XXX format.
Submitted by:	sheldonh
1999-08-24 06:10:14 +00:00
Brian Feldman
0337663160 Make a comment I added a bit nicer. 1999-08-22 22:32:41 +00:00
Brian Feldman
d2fed466ac Finally: fix test -x as completely as possible.
Reviewed by: bde
Reworked by: bde
1999-08-20 16:19:26 +00:00
Brian Feldman
eb5e5558e9 The new test(1) did not use access() correctly. I don't know why, since
supposedly it's ksh-derived, and it's not broken in pdksh. I've added
a test for test running as root: if testing for -x, the file must be
mode & 0111 to get "success", rather than just existant.

Reviewed by:	chris
1999-08-18 00:18:52 +00:00
Sheldon Hearn
717a08b6e5 Replace our test(1) with NetBSD's pdksh-derived version. The code is
significantly easier to read and extend and offers a few new tests.
A few style changes taken from style(9) and OpenBSD, as well as
whitespace cleanups.

This change was discussed on freebsd-committers and freebsd-hackers
and met with approval from at least des, eivind and brian.

PR:	13091
Obtained from:	NetBSD
1999-08-16 09:44:09 +00:00
Chris Costello
bf6271821f Minor style fix - change 'if(!*v)' to 'if (!*v)' 1999-08-14 05:38:04 +00:00
Kris Kennaway
46be34b902 Various spelling/formatting changes.
Submitted by: Philippe Charnier <charnier@xp11.frmug.org>
1999-05-08 10:22:15 +00:00
Joseph Koshy
e5bf7bf46c Add cross-references to test(1) and expr(1) respectively.
PR: 		docs/9111
Submitted by:	Josh Gilliam <josh@quick.net>
1998-12-18 03:16:47 +00:00
Martin Cracauer
23f8fb3d1e Add -S flag to test for sockets.
PR:		bin/7507
Reviewed by:	I tested the patch
Submitted by:	Stefan `Sec` Zehl sec@42.org
1998-09-07 16:59:05 +00:00
Philippe Charnier
9ba8bd6557 Correct use of .Nm. Add rcsid. 1998-05-18 06:51:59 +00:00
Eivind Eklund
007d33500e Remove simultaneous include of <sys/param.h> and <sys/types.h>.
Reorder includes to be alphabetical some places since I already was in
here.
1997-12-10 22:18:54 +00:00
Philippe Charnier
c263cc2165 Typo fix. 1997-06-02 06:40:08 +00:00
Peter Wemm
b97fa2ef50 Revert $FreeBSD$ to $Id$ 1997-02-22 14:13:04 +00:00
Jordan K. Hubbard
1130b656e5 Make the long-awaited change from $Id$ to $FreeBSD$
This will make a number of things easier in the future, as well as (finally!)
avoiding the Id-smashing problem which has plagued developers for so long.

Boy, I'm glad we're not using sup anymore.  This update would have been
insane otherwise.
1997-01-14 07:20:47 +00:00
Wolfram Schneider
110ce42895 add some string examples, eg. test "" -o "" 1996-12-28 13:31:29 +00:00
Steve Price
9d633f68d7 Fix handling of -o and -a operators in the 3 argument case.
Submitted by: Tom Rush <tarush@mindspring.com>
1996-12-25 00:08:10 +00:00
Steve Price
4507dafda4 -Wall cleaning. 1996-12-14 06:16:51 +00:00
Wolfram Schneider
5a80fb277e sync copyright with /usr/share/examples/etc/bsd-style-copyright 1996-08-27 20:04:45 +00:00
Wolfram Schneider
0d917e0587 Add a better TEST script. I was surprised how much can be wrong
with program test(1) or builtin test(1).
1996-06-19 00:44:44 +00:00
Joerg Wunsch
9074ba2eea err() --> errx() for non-errno related failures. 1996-03-11 11:01:03 +00:00
Andrey A. Chernov
25c3d35121 Fix -h option:
sense symlink even it is unresolved
1995-10-28 11:54:42 +00:00