/***********************************************************************1* *2* This software is part of the ast package *3* Copyright (c) 1989-2011 AT&T Intellectual Property *4* and is licensed under the *5* Eclipse Public License, Version 1.0 *6* by AT&T Intellectual Property *7* *8* A copy of the License is available at *9* http://www.eclipse.org/org/documents/epl-v10.html *10* (with md5 checksum b35adb5213ca9657e911e9befb180842) *11* *12* Information and Software Systems Research *13* AT&T Research *14* Florham Park NJ *15* *16* Glenn Fowler <[email protected]> *17* *18***********************************************************************/19#pragma prototyped20/*21* AT&T Bell Laboratories22* mamexec state support23*24* mamstate reference [ file ... | <files ]25*26* stdout is list of <file,delta> pairs where delta27* is diff between reference and file times28* non-existent files are not listed29*/3031static const char id[] = "\n@(#)$Id: mamstate (AT&T Bell Laboratories) 1989-06-26 $\0\n";3233#include <stdio.h>34#include <sys/types.h>35#include <sys/stat.h>3637int38main(int argc, register char** argv)39{40register char* s;41char* id;42unsigned long ref;43struct stat st;44char buf[1024];4546id = "mamstate";47if (!(s = *++argv))48{49fprintf(stderr, "%s: reference file argument expected\n", id);50return 1;51}52if (stat(s, &st))53{54fprintf(stderr, "%s: %s: cannot stat\n", id, s);55return 1;56}57ref = (unsigned long)st.st_mtime;58if (s = *++argv)59do60{61if (!stat(s, &st))62printf("%s %ld\n", s, (unsigned long)st.st_mtime - ref);63} while (s = *++argv);64else65while (s = fgets(buf, sizeof(buf), stdin))66if (!stat(s, &st))67printf("%s %ld\n", s, (unsigned long)st.st_mtime - ref);68return 0;69}707172