Added -v (version) option to assembler.
authorRobert R. Henry <rrh@ucbvax.Berkeley.EDU>
Sun, 18 Apr 1982 08:07:43 +0000 (00:07 -0800)
committerRobert R. Henry <rrh@ucbvax.Berkeley.EDU>
Sun, 18 Apr 1982 08:07:43 +0000 (00:07 -0800)
SCCS-vsn: old/as.vax/asmain.c 4.10

usr/src/old/as.vax/asmain.c

index 5a73720..0592cfe 100644 (file)
@@ -2,7 +2,7 @@
  *     Copyright (c) 1982 Regents of the University of California
  */
 #ifndef lint
  *     Copyright (c) 1982 Regents of the University of California
  */
 #ifndef lint
-static char sccsid[] = "@(#)asmain.c 4.9 %G%";
+static char sccsid[] = "@(#)asmain.c 4.10 %G%";
 #endif not lint
 
 #include <stdio.h>
 #endif not lint
 
 #include <stdio.h>
@@ -15,7 +15,7 @@ static char sccsid[] = "@(#)asmain.c 4.9 %G%";
 #include "asexpr.h"
 
 #ifdef UNIX
 #include "asexpr.h"
 
 #ifdef UNIX
-#define        unix_lang_name "VAX/UNIX Assembler V%G% 4.9"
+#define        unix_lang_name "VAX/UNIX Assembler V%G% 4.10"
 #endif
 
 #ifdef VMS
 #endif
 
 #ifdef VMS
@@ -259,6 +259,9 @@ argprocess(argc, argv)
                                        yyerror("Unknown flag: %c", *--cp);
                                        cp++;
                                        break;
                                        yyerror("Unknown flag: %c", *--cp);
                                        cp++;
                                        break;
+                                case 'v':
+                                       selfwhat(stdout);
+                                       exit(1);
                                 case 'd':
                                        d124 = *cp++ - '0';
                                        if ( (d124 != 1) && (d124 != 2) && 
                                 case 'd':
                                        d124 = *cp++ - '0';
                                        if ( (d124 != 1) && (d124 != 2) && 
@@ -317,6 +320,37 @@ argprocess(argc, argv)
        }
        /* innames[ninfiles] = 0; */
 }
        }
        /* innames[ninfiles] = 0; */
 }
+/*
+ *     poke through the data space and find all sccs identifiers.
+ *     We assume:
+ *     a) that extern char **environ; is the first thing in the bss
+ *     segment (true, if one is using the new version of cmgt.crt0.c)
+ *     b) that the sccsid's have not been put into text space.
+ */
+selfwhat(place)
+       FILE    *place;
+{
+       extern  char **environ;
+       register        char    *ub;
+       register        char *cp;
+       register        char    *pat;
+       char    *sbrk();
+
+       for (cp = (char *)&environ, ub = sbrk(0); cp < ub; cp++){
+               if (cp[0] != '@') continue;
+               if (cp[1] != '(') continue;
+               if (cp[2] != '#') continue;
+               if (cp[3] != ')') continue;
+               fputc('\t', place);
+               for (cp += 4; cp < ub; cp++){
+                       if (*cp == 0) break;
+                       if (*cp == '>') break;
+                       if (*cp == '\n') break;
+                       fputc(*cp, place);
+               }
+               fputc('\n', place);
+       }
+}
 
 initialize()
 {
 
 initialize()
 {