/*
* Copyright (c) 1983 Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms are permitted
* provided that the above copyright notice and this paragraph are
* duplicated in all such forms and that any documentation,
* advertising materials, and other materials related to such
* distribution and use acknowledge that the software was developed
* by the University of California, Berkeley. The name of the
* University may not be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include "defs.h"
/* symbol types */
struct syment {
int s_type;
char *s_name;
};
/*
* Define a variable from a command line argument.
*/
void
define(name)
char *name;
{
register char *cp, *s;
if (debug)
*cp = '\0';
*cp++ = '\0';
} else {
*cp++ = '\0';
do
cp++;
for (s = cp; ; s++) {
switch (*s) {
case ')':
*s = '\0';
case '\0':
break;
case ' ':
case '\t':
*s++ = '\0';
while (*s == ' ' || *s == '\t')
s++;
if (*s == ')')
*s = '\0';
break;
default:
continue;
}
else {
}
if (*s == '\0')
break;
cp = s;
}
}
}
/*
* Lookup name in the table and return a pointer to it.
* LOOKUP - just do lookup, return NULL if not found.
* INSERT - insert name with value, error if already defined.
* REPLACE - insert or replace name with value.
*/
struct namelist *
char *name;
int action;
{
register unsigned n;
register char *cp;
register struct syment *s;
if (debug)
n = 0;
n += *cp++;
n %= HASHSIZE;
continue;
}
}
return(s->s_value);
}
return(NULL);
}
if (s == NULL)
fatal("ran out of memory\n");
hashtab[n] = s;
return(value);
}