Add copyright
[unix-history] / usr / src / usr.bin / rdist / lookup.c
index bd80871..908cdaf 100644 (file)
@@ -1,6 +1,12 @@
+/*
+ * Copyright (c) 1983 Regents of the University of California.
+ * All rights reserved.  The Berkeley software License Agreement
+ * specifies the terms and conditions for redistribution.
+ */
+
 #ifndef lint
 #ifndef lint
-static char *sccsid = "@(#)lookup.c    4.5 (Berkeley) 84/02/16";
-#endif
+static char sccsid[] = "@(#)lookup.c   5.1 (Berkeley) %G%";
+#endif not lint
 
 #include "defs.h"
 
 
 #include "defs.h"
 
@@ -92,6 +98,7 @@ lookup(name, action, value)
        register unsigned n;
        register char *cp;
        register struct syment *s;
        register unsigned n;
        register char *cp;
        register struct syment *s;
+       char buf[256];
 
        if (debug)
                printf("lookup(%s, %d, %x)\n", name, action, value);
 
        if (debug)
                printf("lookup(%s, %d, %x)\n", name, action, value);
@@ -105,14 +112,18 @@ lookup(name, action, value)
                if (strcmp(name, s->s_name))
                        continue;
                if (action != LOOKUP) {
                if (strcmp(name, s->s_name))
                        continue;
                if (action != LOOKUP) {
-                       if (action != INSERT || s->s_type != CONST)
-                               fatal("%s redefined\n", name);
+                       if (action != INSERT || s->s_type != CONST) {
+                               sprintf(buf, "%s redefined", name);
+                               yyerror(buf);
+                       }
                }
                return(s->s_value);
        }
 
                }
                return(s->s_value);
        }
 
-       if (action == LOOKUP)
-               fatal("%s not defined", name);
+       if (action == LOOKUP) {
+               yyerror(sprintf(buf, "%s undefined", name));
+               return(NULL);
+       }
 
        s = ALLOC(syment);
        if (s == NULL)
 
        s = ALLOC(syment);
        if (s == NULL)