+/*
+ * 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
-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"
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 (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);
}
- 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)