/***********************************************************************1* *2* This software is part of the ast package *3* Copyright (c) 1982-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* David Korn <[email protected]> *17* *18***********************************************************************/19/*20* AT&T Bell Laboratories21* make abstract machine file state support22*23* mamstate reference [ file ... | <files ]24*25* stdout is list of <file,delta> pairs where delta26* is diff between reference and file times27* non-existent files are not listed28*/2930#if !lint31static char id[] = "\n@(#)$Id: mamstate (AT&T Bell Laboratories) 1989-06-26 $\0\n";32#endif3334#include <stdio.h>35#include <sys/types.h>36#include <sys/stat.h>3738main(argc, argv)39int argc;40register char** argv;41{42register char* s;43register int c;44long ref;45struct stat st;46char buf[1024];4748if (!(s = *++argv) || stat(s, &st))49{50fprintf(stderr, "Usage: mamstate reference [ file ... | <files ]\n");51exit(1);52}53ref = (long)st.st_mtime;54if (s = *++argv) do55{56if (!stat(s, &st))57printf("%s %ld\n", s, (long)st.st_mtime - ref);58} while (s = *++argv);59else do60{61s = buf;62while ((c = getchar()) != EOF && c != ' ' && c != '\n')63if (s < buf + sizeof(buf) - 1) *s++ = c;64if (s > buf)65{66*s = 0;67if (!stat(buf, &st))68printf("%s %ld\n", buf, (long)st.st_mtime - ref);69}70} while (c != EOF);71exit(0);72}737475