projects
/
unix-history
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
tags
|
clone url
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
new copyright notice
[unix-history]
/
usr
/
src
/
usr.bin
/
rdist
/
lookup.c
diff --git
a/usr/src/usr.bin/rdist/lookup.c
b/usr/src/usr.bin/rdist/lookup.c
index
cebbb6f
..
1415916
100644
(file)
--- a/
usr/src/usr.bin/rdist/lookup.c
+++ b/
usr/src/usr.bin/rdist/lookup.c
@@
-1,6
+1,13
@@
+/*
+ * Copyright (c) 1983 Regents of the University of California.
+ * All rights reserved.
+ *
+ * %sccs.include.redist.c%
+ */
+
#ifndef lint
#ifndef lint
-static char
*sccsid = "@(#)lookup.c 4.4 (Berkeley) 84/02/09
";
-#endif
+static char
sccsid[] = "@(#)lookup.c 5.5 (Berkeley) %G%
";
+#endif
/* not lint */
#include "defs.h"
#include "defs.h"
@@
-38,7
+45,7
@@
define(name)
value = NULL;
} else if (cp[1] != '(') {
*cp++ = '\0';
value = NULL;
} else if (cp[1] != '(') {
*cp++ = '\0';
- value = makenl(
name
);
+ value = makenl(
cp
);
} else {
nl = NULL;
*cp++ = '\0';
} else {
nl = NULL;
*cp++ = '\0';
@@
-92,6
+99,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,18
+113,19
@@
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 (s->s_type == CONST)
- fatal("%s redefined\n", name);
- if (action == INSERT) {
- warn("%s redefined\n", name);
- s->s_value = value;
+ if (action != INSERT || s->s_type != CONST) {
+ (void)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) {
+ (void)sprintf(buf, "%s undefined", name);
+ yyerror(buf);
+ return(NULL);
+ }
s = ALLOC(syment);
if (s == NULL)
s = ALLOC(syment);
if (s == NULL)