Article View: mod.std.unix
Article #384public-domain implementation of V8 "newer"
From: Moderator, John Quarterman
Date: Tue, 04 Nov 1986 01:34
Date: Tue, 04 Nov 1986 01:34
50 lines
1682 bytes
1682 bytes
From: gwyn@brl.arpa (VLD/VMB) (Douglas A. Gwyn)
Date: Mon, 3 Nov 86 10:37:13 EST
/*
newer -- test file modification dates
last edit: 86/03/30 D A Gwyn
*/
#ifndef lint
static char SCCS_ID[] = "@(#)newer.c 1.1";
#endif
#include <sys/types.h>
#include <sys/stat.h>
#define EXIT _exit /* non-STDIO exit(), if available */
#define STDERR 2 /* standard error file descriptor */
extern void EXIT();
extern int stat(), write();
main( argc, argv )
int argc;
char *argv[];
{
static char usage[] = "Usage: newer file1 file2\n";
static struct stat file1; /* file1 statistics */
static struct stat file2; /* file2 statistics */
if ( argc != 3 )
{ /* wrong number of arguments */
(void)write( STDERR, usage, sizeof usage - 1 );
EXIT( 3 );
}
if ( stat( argv[1], &file1 ) != 0 )
EXIT( 2 ); /* file1 doesn't exist */
if ( stat( argv[2], &file2 ) != 0 )
EXIT( 0 ); /* file2 doesn't exist */
#ifdef lint
return file1.st_mtime < file2.st_mtime ? 1 : 0;
#else
EXIT( file1.st_mtime < file2.st_mtime ? 1 : 0 );
#endif
}
Volume-Number: Volume 8, Number 29
Technical Details
Message-ID:
<6216@ut-sally.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!mnetor!seismo!ut-sally!std-unixShow Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!ut-sally!std-unix From: std-unix@ut-sally.UUCP (Moderator, John Quarterman) Newsgroups: mod.std.unix Subject: public-domain implementation of V8 "newer" Message-ID: <6216@ut-sally.UUCP> Date: Mon, 3-Nov-86 20:34:23 EST Article-I.D.: ut-sally.6216 Posted: Mon Nov 3 20:34:23 1986 Date-Received: Tue, 4-Nov-86 06:10:54 EST Organization: IEEE P1003 Portable Operating System for Computer Environments Committee Lines: 50 Approved: jsq@sally.utexas.edu