|
|
1.1 root 1:
2: #ifndef lint
3: static char *rcsid = "$Header: /f/osi/others/quipu/uips/sd/RCS/symtab.c,v 7.0 90/06/12 13:14:06 mrose Exp $";
4: #endif
5:
6: /*
7: * $Header: /f/osi/others/quipu/uips/sd/RCS/symtab.c,v 7.0 90/06/12 13:14:06 mrose Exp $
8: */
9:
10: /*
11: * $Log: symtab.c,v $
12: * Revision 7.0 90/06/12 13:14:06 mrose
13: * *** empty log message ***
14: *
15: * Revision 1.6 90/04/26 10:36:33 emsrdsm
16: * *** empty log message ***
17: *
18: * Revision 1.5 90/04/25 15:07:46 emsrdsm
19: * i) lint'ed
20: *
21: * Revision 1.4 90/04/20 17:58:02 emsrdsm
22: * i) no more freeing
23: *
24: * Revision 1.3 90/04/18 18:28:08 emsrdsm
25: * fixed i) does not move to leaves
26: * ii) added default mechanism described using "typeDefaults" file.
27: * iii) added 'sorting' to attribute display
28: *
29: * Revision 1.2 90/03/15 16:32:12 emsrdsm
30: * fixes i) Prints messages correctly on exit.
31: * ii) Added rfc822 to greybook mailbox conversion
32: * iii) Removed bug that caused crash if 'local_dit' undefined
33: *
34: * Revision 1.1 90/03/09 17:40:38 emsrdsm
35: * Initial revision
36: *
37: * Revision 1.1 90/03/09 13:37:47 emsrdsm
38: * Initial revision
39: *
40: */
41:
42: #include <string.h>
43: #include <malloc.h>
44:
45: #include "symtab.h"
46:
47: put_symbol_value(table, name, val)
48: table_entry table;
49: char *name;
50: char *val;
51: {
52: if (!name) return;
53:
54: while(table && strcmp(name, table->name)) {
55: table = table->next;
56: }
57: if (table) {
58: free(table->val);
59: if (val) {
60: table->val =
61: (char *) malloc((unsigned) strlen(val) + 1);
62: (void) strcpy(table->val, val);
63: } else
64: table->val = (char *) 0;
65: } else {
66: table = (table_entry) malloc(sizeof(table_entry));
67: table->next = NULLSYM;
68: table->name = (char *) malloc((unsigned) strlen(name) + 1);
69: (void) strcpy(table->name, name);
70: if (val) {
71: table->val =
72: (char *) malloc((unsigned) strlen(val) + 1);
73: (void) strcpy(table->val, val);
74: } else
75: table->val = 0;
76: }
77: }
78:
79: char *
80: get_symbol_value(table, name)
81: table_entry table;
82: char *name;
83: {
84: while(table && strcmp(name, table->name)) table = table->next;
85: if (table)
86: return table->val;
87: return (char *) 0;
88: }
89:
90:
91: free_table(table)
92: table_entry table;
93: {
94: table_entry entry;
95:
96: while(table) {
97: if (table->val)
98: free(table->val);
99: free(table->name);
100: entry = table;
101: table = table->next;
102: free((char *) entry);
103: }
104: }
105:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.