date and time created 85/05/22 22:13:40 by libs
authorDon Libes? <libs@ucbvax.Berkeley.EDU>
Thu, 23 May 1985 13:13:40 +0000 (05:13 -0800)
committerDon Libes? <libs@ucbvax.Berkeley.EDU>
Thu, 23 May 1985 13:13:40 +0000 (05:13 -0800)
SCCS-vsn: usr.bin/f77/libI77/mkvers.c 1.1

usr/src/usr.bin/f77/libI77/mkvers.c [new file with mode: 0644]

diff --git a/usr/src/usr.bin/f77/libI77/mkvers.c b/usr/src/usr.bin/f77/libI77/mkvers.c
new file mode 100644 (file)
index 0000000..dfee0d3
--- /dev/null
@@ -0,0 +1,73 @@
+char id_mkvers[] = "@(#)mkvers.c       1.2";
+/*
+ * extract sccs id strings from source files
+ * first arg is lib name.
+ * Put them in Version.c
+ */
+
+#include       <stdio.h>
+
+#define SCCS_ID                "@(#)"
+#define VERSION                "Version.c"
+
+main(argc, argv)
+int argc; char **argv;
+{
+       char buf[256];
+       char *s, *e;
+       char *index(), *ctime();
+       long t;
+       FILE *V, *fdopen();
+
+       V = stdout; /* fdopen(creat(VERSION, 0644), "w"); */
+       if (!V)
+       {
+               perror("mkvers");
+               exit(1);
+       }
+       if (argc > 1 && argv[1][0] != '.')
+       {
+               fprintf(V, "char *");
+               for (s = argv[1]; *s && *s != '.'; s++)
+                       fputc(*s, V);
+               fprintf(V, "_id[] = {\n");
+       }
+       else
+               fprintf(V, "char *sccs_id[] = {\n");
+       if (argc-- > 1)
+       {
+               time(&t);
+               s = ctime(&t) + 4;
+               s[20] = '\0';
+               fprintf(V, "\t\"%s%s\t%s\",\n", SCCS_ID, *++argv, s);
+       }
+       while (--argc)
+       {
+               if (freopen(*++argv, "r", stdin) == NULL)
+               {
+                       perror(*argv);
+                       continue;
+               }
+               while(gets(buf))
+               {
+                       s = buf;
+                       while(s = index(s, '@'))
+                               if (strncmp(s, SCCS_ID, 4) == 0)
+                                       break;
+                       if (s)
+                       {
+                               e = index(s, '"');
+                               if (e)
+                                       *e = '\0';
+                               fprintf(V, "\t\"%s\",\n", s);
+                               break;
+                       }
+               }
+               if (feof(stdin))
+                       fprintf(stderr, "%s: no sccs id string\n", *argv);
+       }
+       fprintf(V, "};\n");
+       fclose(V);
+       fflush(stdout);
+       fflush(stderr);
+}