Subject: test(1) patches
To: None <current-users@sun-lamp.cs.berkeley.edu>
From: Dave Burgess <burgess@s069.infonet.net>
List: current-users
Date: 05/06/1994 20:10:32
Here are the patches that I put up once before as a uuencoded file.  
They are not uuencoded this time (so that it is easier for folks to
check them out I guess).

The only things that these patches do is allow you to compare file
dates.  They can be applied directly to the -current sources.

- - - - - - - - - - - - - Cut Here - - - - - - - - - - - - -

*** Makefile	Sat Apr  9 20:43:09 1994
--- ../newtest2/Makefile	Sat Apr  2 14:35:13 1994
***************
*** 8,14 ****
  MLINKS=	test.1 '[.1'
  
  # use this rule to if you update binary_ops, or unary_ops
! make_op: 
! 	sh ${.CURDIR}/mkops
! 
  .include <bsd.prog.mk>
--- 8,20 ----
  MLINKS=	test.1 '[.1'
  
  # use this rule to if you update binary_ops, or unary_ops
! #make_op: 
! #	sh ${.CURDIR}/mkops
! #
! #  IF YOU UPDATE binary_ops or unary_ops and have an obj directory link,
! #  you MUST run mkops yourself.  If you don't, the resulting output
! #  files will end up in obj.  While that isn't a problem (sine they get
! #  correctly compiled after that), this program will not run, since you
! #  don't have copies of *_ops in obj.
! #
  .include <bsd.prog.mk>
*** TEST.csh	Sat Apr  9 20:43:14 1994
--- ../newtest2/TEST.csh	Sat Apr  2 14:40:18 1994
***************
*** 1,6 ****
  #	@(#)TEST.csh	5.1 (Berkeley) 6/8/92
  
! alias t './test \!*; echo $status'
  #alias t 'test \!*; echo $status'
  
  echo 't -b /dev/ttyp2'
--- 1,6 ----
  #	@(#)TEST.csh	5.1 (Berkeley) 6/8/92
  
! alias t './obj/test \!*; echo $status'
  #alias t 'test \!*; echo $status'
  
  echo 't -b /dev/ttyp2'
***************
*** 35,40 ****
--- 35,45 ----
  echo 't -g /bin/ps'
  t -g /bin/ps
  
+ echo 't -h /sys'
+ t -h /sys
+ echo 't -h /usr/src'
+ t -h /usr/src
+ 
  echo 't -n ""'
  t -n ""
  echo 't -n "hello"'
***************
*** 135,137 ****
--- 140,172 ----
  t 700 -le 1000 -a -n "1" -a "20" = "20"
  echo 't ! \( 700 -le 1000 -a -n "1" -a "20" = "20" \)'
  t ! \( 700 -le 1000 -a -n "1" -a "20" = "20" \)
+ 
+ echo 't /etc/passwd -nt ./obj/test'
+ t /etc/passwd -nt ./obj/test
+ echo 't ! /etc/passwd -nt ./obj/test'
+ t ! /etc/passwd -nt ./obj/test
+ 
+ echo 't /etc/passwd -ot ./obj/test'
+ t /etc/passwd -ot ./obj/test
+ echo 't ! /etc/passwd -ot ./obj/test'
+ t ! /etc/passwd -ot ./obj/test
+ 
+ echo 't /etc/passwd -sa ./obj/test'
+ t /etc/passwd -sa ./obj/test
+ echo 't ! /etc/passwd -sa ./obj/test'
+ t ! /etc/passwd -sa ./obj/test
+ 
+ echo 't /etc/passwd -sa /etc/passwd'
+ t /etc/passwd -sa /etc/passwd
+ echo 't ! /etc/passwd -sa /etc/passwd'
+ t ! /etc/passwd -sa /etc/passwd
+ 
+ echo 't /etc -nt /etc/passwd  # Check Dir age vs. file'
+ t /etc -nt /etc/passwd
+ echo 't ! /etc -nt /etc/passwd'
+ t ! /etc -nt /etc/passwd
+ 
+ echo 't obj -nt /etc/passwd  # Check SymLink age vs. file'
+ t obj -nt /etc/passwd
+ echo 't ! obj -nt /etc/passwd'
+ t ! obj -nt /etc/passwd
*** binary_op	Sat Apr  9 20:43:18 1994
--- ../newtest2/binary_op	Sat Apr  2 14:35:14 1994
***************
*** 53,56 ****
  LT	 -lt	4    OP_INT
  LE	 -le	4    OP_INT
  GE	 -ge	4    OP_INT
! 
--- 53,58 ----
  LT	 -lt	4    OP_INT
  LE	 -le	4    OP_INT
  GE	 -ge	4    OP_INT
! NT	 -nt	4    OP_FILE
! OT	 -ot    4    OP_FILE
! SA	 -sa    4    OP_FILE
*** mkops	Sat Apr  9 20:43:23 1994
--- ../newtest2/mkops	Sat Apr  2 14:35:14 1994
***************
*** 71,80 ****
  };
  
  char *const andor_op[] = {'
! awk '/^[^#]/ && ($3 <= 2)	{printf "      \"%s\",\n", $2}' binary_op
  echo '      NULL
  };
- 
  const char op_priority[] = {'
  awk '/^[^#]/	{printf "      %s,\n", $3}' unary_op binary_op
  echo '};
--- 71,80 ----
  };
  
  char *const andor_op[] = {'
! awk '/^OR/	{printf "      \"%s\",\n", $2}' binary_op
! awk '/^AND/	{printf "      \"%s\",\n", $2}' binary_op
  echo '      NULL
  };
  const char op_priority[] = {'
  awk '/^[^#]/	{printf "      %s,\n", $3}' unary_op binary_op
  echo '};
*** operators.c	Sat Apr  9 20:43:26 1994
--- ../newtest2/operators.c	Sat Apr  2 14:38:26 1994
***************
*** 40,45 ****
--- 40,48 ----
        "-lt",
        "-le",
        "-ge",
+       "-nt",
+       "-ot",
+       "-sa",
        NULL
  };
  
***************
*** 50,56 ****
        "&",
        NULL
  };
- 
  const char op_priority[] = {
        3,
        12,
--- 53,58 ----
***************
*** 82,87 ****
--- 84,92 ----
        4,
        4,
        4,
+       4,
+       4,
+       4,
  };
  
  const char op_argflag[] = {
***************
*** 115,118 ****
--- 120,126 ----
        OP_INT,
        OP_INT,
        OP_INT,
+       OP_FILE,
+       OP_FILE,
+       OP_FILE,
  };
*** operators.h	Sat Apr  9 20:43:28 1994
--- ../newtest2/operators.h	Sat Apr  2 14:38:25 1994
***************
*** 28,33 ****
--- 28,36 ----
  #define LT 27
  #define LE 28
  #define GE 29
+ #define NT 30
+ #define OT 31
+ #define SA 32
  
  #define FIRST_BINARY_OP 18
  
*** test.1	Sat Apr  9 20:43:34 1994
--- ../newtest2/test.1	Sat Apr  2 14:35:29 1994
***************
*** 196,201 ****
--- 196,217 ----
  is algebraically less
  than or equal to the integer
  .Ar \&n\&2 .
+ .\" New stuff
+ .It Ar \&file\&1 Fl \&nt Ar \&file\&2
+ True if the file 
+ .Ar \&file\&1
+ is newer than
+ .Ar \&file\&2 .
+ .It Ar \&file\&1 Fl \&ot Ar \&file\&2
+ True if the file
+ .Ar \&file\&1
+ is older than
+ .Ar \&file\&2 .
+ .It Ar \&file\&1 Fl \&sa Ar \&file\&2
+ True if the file
+ .Ar \&file\&1
+ is the \&same \&age as
+ .Ar \&file\&2 .
  .El
  .Pp
  These primaries can be combined with the following operators:

------------------------------------------------------------------------------