|
|
1.1 ! root 1: /* ! 2: * Copyright (c) 1980 Regents of the University of California. ! 3: * All rights reserved. The Berkeley software License Agreement ! 4: * specifies the terms and conditions for redistribution. ! 5: * ! 6: * %W% %G% ! 7: * ! 8: * first arg is lib name. ! 9: * Put them in Version.c ! 10: */ ! 11: ! 12: #include <stdio.h> ! 13: ! 14: #define SCCS_ID "@(#)" ! 15: #define VERSION "Version.c" ! 16: ! 17: main(argc, argv) ! 18: int argc; char **argv; ! 19: { ! 20: char buf[256]; ! 21: char *s, *e; ! 22: char *index(), *ctime(); ! 23: long t; ! 24: FILE *V, *fdopen(); ! 25: ! 26: V = stdout; /* fdopen(creat(VERSION, 0644), "w"); */ ! 27: if (!V) ! 28: { ! 29: perror("mkvers"); ! 30: exit(1); ! 31: } ! 32: if (argc > 1 && argv[1][0] != '.') ! 33: { ! 34: fprintf(V, "char *"); ! 35: for (s = argv[1]; *s && *s != '.'; s++) ! 36: fputc(*s, V); ! 37: fprintf(V, "_id[] = {\n"); ! 38: } ! 39: else ! 40: fprintf(V, "char *sccs_id[] = {\n"); ! 41: if (argc-- > 1) ! 42: { ! 43: time(&t); ! 44: s = ctime(&t) + 4; ! 45: s[20] = '\0'; ! 46: fprintf(V, "\t\"%s%s\t%s\",\n", SCCS_ID, *++argv, s); ! 47: } ! 48: while (--argc) ! 49: { ! 50: if (freopen(*++argv, "r", stdin) == NULL) ! 51: { ! 52: perror(*argv); ! 53: continue; ! 54: } ! 55: while(gets(buf)) ! 56: { ! 57: s = buf; ! 58: while(s = index(s, '@')) ! 59: if (strncmp(s, SCCS_ID, 4) == 0) ! 60: break; ! 61: if (s) ! 62: { ! 63: e = index(s, '"'); ! 64: if (e) ! 65: *e = '\0'; ! 66: fprintf(V, "\t\"%s\",\n", s); ! 67: break; ! 68: } ! 69: } ! 70: if (feof(stdin)) ! 71: fprintf(stderr, "%s: no sccs id string\n", *argv); ! 72: } ! 73: fprintf(V, "};\n"); ! 74: fclose(V); ! 75: fflush(stdout); ! 76: fflush(stderr); ! 77: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.