Annotation of researchv10no/cmd/efl/efixsrc/cpt.c, revision 1.1.1.1

1.1       root        1: /* Set time of second argument to that of first. */
                      2: #include <stdio.h>
                      3: #include <sys/types.h>
                      4: #include <sys/stat.h>
                      5: main(argc, argv)
                      6: int argc;
                      7: char **argv;
                      8: {
                      9:        struct stat buf;
                     10:        time_t timep[2];
                     11:        char *progname = argv[0], *s;
                     12:        int rc = 0;
                     13: 
                     14:        if (argc < 3) {
                     15:                fprintf(stderr,
                     16:        "usage: %s f1 f2 [f3 ...]\n\tto copy times from f1 to f2 [f3 ...]\n",
                     17:                        progname);
                     18:                exit(1);
                     19:                }
                     20:        s = *++argv;
                     21:        if (stat(s, &buf) != 0) {
                     22:                fprintf(stderr, "%s: can't stat %s!\n", progname, s);
                     23:                exit(1);
                     24:                }
                     25:        timep[0] = buf.st_atime;
                     26:        timep[1] = buf.st_mtime;
                     27:        while(s = *++argv)
                     28:                if (utime(s, timep) != 0) {
                     29:                        fprintf(stderr, "%s: can't set time of %s!\n",
                     30:                                progname, s);
                     31:                        ++rc;
                     32:                        }
                     33:        exit(rc);
                     34:        }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.