Commit Graph

41 Commits

Author SHA1 Message Date
sevan 51fe790c4c Drop main() prototype. 2016-09-05 01:00:07 +00:00
uebayasi 02829a8ca7 test(1): Compare timestamp in nsec scale in -nt/-ot. 2013-05-04 06:26:44 +00:00
joerg 66dd2755f5 Add __printflike attribution to use vprintf and friends with an argument
as format string.
2012-03-15 02:02:20 +00:00
joerg 5bb1ddccc2 Use __dead 2011-08-29 14:51:17 +00:00
christos 2e63684c48 bin/39446: Aleksey Cheusov: always produce errors on empty numbers. 2008-09-10 19:00:51 +00:00
christos afd857d440 make getn return long long to support large numbers on all archs. 2008-06-20 23:29:36 +00:00
christos 9655f5c24c PR/38755: murray armfield: /bin posix programs missing setprogname and/or
setlocale
2008-05-26 14:21:08 +00:00
perry 8b0f9554ff convert __attribute__s to applicable cdefs.h macros 2007-12-15 19:44:37 +00:00
christos 3c769789fa PR/36534: Greg A. Woods: test(1) doesn't do -r and -w quite right
Use stat(2) instead of access(2) per POSIX.
2007-06-24 18:54:58 +00:00
christos 35d9d3fddf Make sure we don't run over the end of the argument array while scanning
for input. This can happen if we have a unary not without an argument. When
we scan for the argument, we are already at the NULL element of the argument
array. Then when we scan ahead for a -a or -o, we end up testing the next
element after the NULL.
2007-05-24 18:47:08 +00:00
christos 06519c05da PR/36092: B K: algorithmic inefficiency in bin/test/test.c:t_lex
test(1) scans for "operators" linearly in an array using strcmp() to
find a match. Since the list of "operators" is fixed, split them
into one and two character ones, and ones that start with a `-' and
ones they don't. This way we can optimize the compare function to
just check for one or two characters. Sort and use bsearch(3). We
could have used a single sorted array and bsearch(3), to save some
complexity, but I decided to be a bit fancier.
2007-03-28 01:47:25 +00:00
hubertf 7eef11b485 Revert previous (==) - not worth the trouble. 2006-09-24 13:24:08 +00:00
hubertf f9278bfbec Allow '==' as synonym to '=', just like our ksh and bash do.
This also affects the sh(1) builtin test command.
2006-09-22 22:15:24 +00:00
christos 8c4dec8fa5 don't call get/set progname when we are a shell built-in. 2006-08-04 19:07:55 +00:00
christos c338573fdf use getprogname() instead of argv[0], because some programs that execv, pass
the full path in argv[0] instead of just the basename. In reality, those
programs should be fixed (hello gdb for example).
2006-08-04 14:38:58 +00:00
simonb dec70f4a29 KNF, use NULL instead of (type *)0. 2005-02-10 06:56:55 +00:00
wiz 10610e5a31 __STDC__ is always defined on NetBSD. 2002-05-25 23:12:16 +00:00
wiz d3d81c4e84 Some KNF fixes by Petri Koistinen and me. 2001-09-16 19:03:26 +00:00
wiz 8cfb973b8e ANSIfy and slight KNF. Mostly #13594 by Petri Koistinen. 2001-07-30 10:17:41 +00:00
christos e2e5d7bd40 - Enable test to be a shell builtin
- KNF
- Fix bug where test without arguments could access invalid memory
2000-04-09 23:24:59 +00:00
kleink e80c883c9d Operator precedence consistency; from "Andrew_L. Moore" <alm@SlewSys.Org>
in PR bin/7015.
1999-04-05 09:48:38 +00:00
christos 9908eacfd6 char -> unsigned char 1998-11-04 20:12:12 +00:00
mycroft ee9e50eacb Be more retentive about use of NOTREACHED and noreturn. 1998-07-28 11:41:40 +00:00
mycroft 15de1c9fd2 Use S_IS*(), not S_IF*. 1997-10-19 17:54:18 +00:00
christos e028842ec8 Fix compiler warnings.
Add WARNS=1
1997-07-20 21:28:26 +00:00
tls 3e254367af kill use of register 1997-01-09 16:44:06 +00:00
cgd a86f3aeda3 clean up Id's, and such. reorganize man page slight to match lite's org. 1995-03-21 07:03:50 +00:00
cgd 2c405cf3ed from jtc: insure that 3 and 4 argument special cases work properly. 1994-07-07 19:08:11 +00:00
jtc 008c3a98a0 Replaced test with simpler, more feature rich, version derived from pdksh. 1994-06-30 05:12:29 +00:00
jtc 9659258f38 Removed code that checked if arg was a unary operator when test is called
with only one argument.  It's not a syntax error --- it's a special case.
1994-06-29 22:10:16 +00:00
cgd e54bc987b5 fix syntax error when only have one arg. from Jarle Greipsland 1994-04-10 05:37:11 +00:00
cgd cc288c2f3b add support for 'test -h' a la SunOS 1994-02-19 06:28:59 +00:00
cgd 74427b6539 fix from Andrew Moore <alm@netcom.com> to fix test's handling of
(non-negated) "-a" and "-o".
1993-10-26 01:11:28 +00:00
mycroft 3030415fcf From alm:
Added and/or operator test to POSIX special case processing, so now:
$ test ! "abc" -o "abc"
evaluates to true.

The correct fix is probably to yank the superfluous special case code, but
I don't have time to verify the correctness of the result.
1993-09-23 22:49:40 +00:00
mycroft 831bfe48bd Put back RCS identifier. 1993-09-23 22:47:45 +00:00
alm 22e4414792 test "0 " -eq 0 now evaluates to true.
It also does range checking.  These override J.T.'s patches.
1993-09-15 04:35:53 +00:00
jtc f77a141a60 Ignore leading whitespace and handle `-' and `+' for operands of integer
comparisions.
1993-09-08 00:46:55 +00:00
alm 4eb2169336 /bin/test " 5" -eq 5 now evaluates to true, rather than return an error.
/bin/test "5 a" -eq 5 still correclty returns an error.
1993-09-08 00:10:06 +00:00
mycroft 8542364e07 Add RCS identifiers. 1993-08-01 18:49:50 +00:00
cgd 670dcac163 get the [ ! "" ] case right. 1993-06-15 06:22:41 +00:00
glass e5ac8e1e2a new 'test' from ftp.uu.net:/systems/unix/bsd-sources, got rid of GNU thing 1993-04-26 23:30:42 +00:00