Pristine Ack-5.5
[Ack-5.5.git] / util / int / test / prtime.c
1 /* $Id: prtime.c,v 1.2 1994/06/24 10:50:55 ceriel Exp $ */
2
3 /*
4         Test access to fields in struct stat
5 */
6
7 #include        <sys/types.h>
8 #include        <sys/stat.h>
9 #include        <time.h>
10 extern char * ctime();
11
12 main(argc, argv) char *argv[];  {
13
14         while (argc > 1)        {
15                 prfiltime(argv[1]);
16                 if (argc > 2)
17                         printf("\n");
18                 argc--;
19                 argv++;
20         }
21         exit(0);
22 }
23
24 prfiltime(name) char *name;     {
25         struct stat buf;
26
27         printf("%s: ", name);
28         if (stat(name, &buf) != 0)
29                 printf(" not found\n");
30         else
31                 prtime(&buf);
32 }
33 prtime(buf)
34         struct stat *buf;
35 {
36         printf("%lu ", buf->st_mtime);
37         printf("%s\n", ctime(&buf->st_mtime));
38 }
39