These are the changes I had to make to get time to run under Linux
0.99pl9.  Most of them are just to get types to match, but a couple
are to use the native wait3.  The default configure doesn't recognize
it because it doesn't fill in all of rusage, but it does fill in some
of it.  The other big change is an decimal place problem that was
fixed in the last version of Linux time.  I don't know if the change
has made it into the next version, but it's not in the version
currently on prep.ai.mit.edu.
---
Rob Malouf
malouf@csli.stanford.edu

==============================================================================

diff -cr time-1.4/configure time-linux/configure
*** time-1.4/configure	Thu Oct 22 17:44:39 1992
--- time-linux/configure	Thu Jun 10 23:21:57 1993
***************
*** 302,307 ****
--- 302,310 ----
  #include <sys/types.h>
  #include <sys/time.h>
  #include <sys/resource.h>
+ #ifdef linux
+ #include <sys/wait.h>
+ #endif
  #include <stdio.h>
  /* HP-UX has wait3 but does not fill in rusage.  */
  main() {
***************
*** 315,321 ****
--- 318,328 ----
    case -1: _exit(0); /* What can we do?  */
    default: /* Parent.  */
      wait3(&i, 0, &r);
+ #ifndef linux
      exit(r.ru_nvcsw == 0);
+ #else
+     exit(r.ru_minflt == 0);
+ #endif
    }
  }
  EOF
diff -cr time-1.4/time.c time-linux/time.c
*** time-1.4/time.c	Wed Oct 28 11:21:05 1992
--- time-linux/time.c	Thu Jun 10 23:47:41 1993
***************
*** 35,40 ****
--- 35,43 ----
  #include <signal.h>
  #include <errno.h>
  #include <getopt.h>
+ #ifdef linux
+ #include <sys/wait.h>
+ #endif
  
  #ifdef HAVE_SYS_TIME_H
  #include <sys/time.h>
***************
*** 96,102 ****
  #endif
  
  #include "getpagesize.h"
! #ifndef getpagesize
  int getpagesize P_((void));
  #endif
  
--- 99,105 ----
  #endif
  
  #include "getpagesize.h"
! #if !defined(getpagesize) && !defined(linux)
  int getpagesize P_((void));
  #endif
  
***************
*** 388,398 ****
  	      fprintf (fp, "%ld", rup->ru_minflt);
  	      break;
  	    case 'S':		/* System time.  */
! 	      fprintf (fp, "%ld.%ld",
  		       rup->ru_stime.tv_sec, rup->ru_stime.tv_usec / 10000);
  	      break;
  	    case 'U':		/* User time.  */
! 	      fprintf (fp, "%ld.%ld",
  		       rup->ru_utime.tv_sec, rup->ru_utime.tv_usec / 10000);
  	      break;
  	    case 'W':		/* Times swapped out.  */
--- 391,401 ----
  	      fprintf (fp, "%ld", rup->ru_minflt);
  	      break;
  	    case 'S':		/* System time.  */
! 	      fprintf (fp, "%ld.%02ld",
  		       rup->ru_stime.tv_sec, rup->ru_stime.tv_usec / 10000);
  	      break;
  	    case 'U':		/* User time.  */
! 	      fprintf (fp, "%ld.%02ld",
  		       rup->ru_utime.tv_sec, rup->ru_utime.tv_usec / 10000);
  	      break;
  	    case 'W':		/* Times swapped out.  */
***************
*** 409,415 ****
  	      fprintf (fp, "%ld", rup->ru_nivcsw);
  	      break;
  	    case 'e':		/* Elapsed real time in seconds.  */
! 	      fprintf (fp, "%ld.%ld", tv->tv_sec, tv->tv_usec / 10000);
  	      break;
  	    case 'k':		/* Signals delivered.  */
  	      fprintf (fp, "%ld", rup->ru_nsignals);
--- 412,418 ----
  	      fprintf (fp, "%ld", rup->ru_nivcsw);
  	      break;
  	    case 'e':		/* Elapsed real time in seconds.  */
! 	      fprintf (fp, "%ld.%02ld", tv->tv_sec, tv->tv_usec / 10000);
  	      break;
  	    case 'k':		/* Signals delivered.  */
  	      fprintf (fp, "%ld", rup->ru_nsignals);
***************
*** 612,618 ****
--- 615,625 ----
       struct rusage *ruse;
       struct timeval *finish;
       int *exitcode;
+ #ifndef linux
       char const *const cmd[];
+ #else
+      char *const cmd[];
+ #endif
  {
  #ifdef HAVE_SYS_RESOURCE_H
    union wait status;		/* Exit status of child. */
***************
*** 633,639 ****
--- 640,650 ----
      error (1, errno, "cannot fork");
    else if (pid == 0)
      {				/* If child. */
+ #ifndef linux
        execvp (cmd[0], (const char **) cmd);
+ #else
+       execvp (cmd[0], cmd);
+ #endif
        error (0, errno, "cannot run %s", cmd[0]);
        _exit (errno == ENOENT ? 127 : 126);
      }
***************
*** 668,674 ****
--- 679,689 ----
    finish->tv_usec -= start.tv_usec;
  
  #ifdef HAVE_SYS_RESOURCE_H
+ #ifndef linux
    *exitcode = (int) status.w_T.w_Retcode;
+ #else
+   *exitcode = (int) status.w_retcode;
+ #endif
  #else
    *exitcode = status >> 8;
  #endif
