Annotation of 42BSD/usr.lib/libI77/mkvers.c, revision 1.1.1.1

1.1       root        1: char id_mkvers[] = "@(#)mkvers.c       1.2";
                      2: /*
                      3:  * extract sccs id strings from source files
                      4:  * first arg is lib name.
                      5:  * Put them in Version.c
                      6:  */
                      7: 
                      8: #include       <stdio.h>
                      9: 
                     10: #define SCCS_ID                "@(#)"
                     11: #define VERSION                "Version.c"
                     12: 
                     13: main(argc, argv)
                     14: int argc; char **argv;
                     15: {
                     16:        char buf[256];
                     17:        char *s, *e;
                     18:        char *index(), *ctime();
                     19:        long t;
                     20:        FILE *V, *fdopen();
                     21: 
                     22:        V = stdout; /* fdopen(creat(VERSION, 0644), "w"); */
                     23:        if (!V)
                     24:        {
                     25:                perror("mkvers");
                     26:                exit(1);
                     27:        }
                     28:        if (argc > 1 && argv[1][0] != '.')
                     29:        {
                     30:                fprintf(V, "char *");
                     31:                for (s = argv[1]; *s && *s != '.'; s++)
                     32:                        fputc(*s, V);
                     33:                fprintf(V, "_id[] = {\n");
                     34:        }
                     35:        else
                     36:                fprintf(V, "char *sccs_id[] = {\n");
                     37:        if (argc-- > 1)
                     38:        {
                     39:                time(&t);
                     40:                s = ctime(&t) + 4;
                     41:                s[20] = '\0';
                     42:                fprintf(V, "\t\"%s%s\t%s\",\n", SCCS_ID, *++argv, s);
                     43:        }
                     44:        while (--argc)
                     45:        {
                     46:                if (freopen(*++argv, "r", stdin) == NULL)
                     47:                {
                     48:                        perror(*argv);
                     49:                        continue;
                     50:                }
                     51:                while(gets(buf))
                     52:                {
                     53:                        s = buf;
                     54:                        while(s = index(s, '@'))
                     55:                                if (strncmp(s, SCCS_ID, 4) == 0)
                     56:                                        break;
                     57:                        if (s)
                     58:                        {
                     59:                                e = index(s, '"');
                     60:                                if (e)
                     61:                                        *e = '\0';
                     62:                                fprintf(V, "\t\"%s\",\n", s);
                     63:                                break;
                     64:                        }
                     65:                }
                     66:                if (feof(stdin))
                     67:                        fprintf(stderr, "%s: no sccs id string\n", *argv);
                     68:        }
                     69:        fprintf(V, "};\n");
                     70:        fclose(V);
                     71:        fflush(stdout);
                     72:        fflush(stderr);
                     73: }

unix.superglobalmegacorp.com

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