|
|
BSD 4.3reno
#ifndef lint
static char *rcsid = "$Header: /var/lib/cvsd/repos/CSRG/43BSDReno/contrib/isode-beta/others/quipu/uips/pod/symtab.c,v 1.1.1.1 2018/04/24 16:12:56 root Exp $";
#endif
/*
* $Header: /var/lib/cvsd/repos/CSRG/43BSDReno/contrib/isode-beta/others/quipu/uips/pod/symtab.c,v 1.1.1.1 2018/04/24 16:12:56 root Exp $
*/
/*
* $Log: symtab.c,v $
* Revision 1.1.1.1 2018/04/24 16:12:56 root
* BSD 4.3reno
*
* Revision 7.0 90/06/12 13:15:53 mrose
* *** empty log message ***
*
* Revision 1.5 90/04/26 10:21:26 emsrdsm
* *** empty log message ***
*
* Revision 1.4 90/04/25 13:47:56 emsrdsm
* i) lint'ed
*
* Revision 1.3 90/04/20 10:28:32 emsrdsm
* (i) fixed form bug
*
* Revision 1.2 90/04/18 18:48:32 emsrdsm
* i) added logging
*
* Revision 1.1 90/04/10 16:45:07 emsrdsm
* Initial revision
*
*/
#include "symtab.h"
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <malloc.h>
put_symbol_value(table, name, val)
table_entry table;
char *name;
char *val;
{
if (!name) return;
while(table && strcmp(name, table->name)) {
table = table->next;
}
if (table) {
free(table->val);
if (val) {
table->val =
(char *) malloc((unsigned int) (strlen(val) + 1));
(void) strcpy(table->val, val);
} else
table->val = (char *) 0;
} else {
table = (table_entry ) malloc(sizeof(table_entry));
table->next = NULLSYM;
table->name =
(char *) malloc((unsigned int) (strlen(name) + 1));
(void) strcpy(table->name, name);
if (val) {
table->val =
(char *) malloc((unsigned int) (strlen(val) + 1));
(void) strcpy(table->val, val);
} else
table->val = (char *) 0;
}
}
char *
get_symbol_value(table, name)
table_entry table;
char *name;
{
while(table && strcmp(name, table->name)) table = table->next;
if (table)
return table->val;
return (char *) 0;
}
free_table(table)
table_entry table;
{
table_entry entry;
while(table) {
if (table->val)
free(table->val);
free((char *) (table->name));
entry = table;
table = table->next;
free((char *)entry);
}
}
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.