|
|
1.1 root 1: /* $Header: /f/osi/others/quipu/uips/xd/RCS/symtab.c,v 7.0 90/06/12 13:10:53 mrose Exp $ */
2: #ifndef lint
3: static char *rcsid = "$Id: symtab.c,v 7.0 90/06/12 13:10:53 mrose Exp $";
4: #endif
5: /*
6: $Log: symtab.c,v $
7: * Revision 7.0 90/06/12 13:10:53 mrose
8: * *** empty log message ***
9: *
10: * Revision 1.5 90/04/26 10:22:48 emsrssn
11: * Installation fixed
12: *
13: *
14: * Revision 1.4 90/04/25 17:28:18 emsrssn
15: * Lint tidy up
16: *
17: *
18: * Revision 1.3 90/04/19 13:54:19 emsrssn
19: * keyboard accelerator now activates button highlight.
20: *
21: * search types available is dependent on current position
22: * to prevent unreasonable searches.
23: *
24: * the help popup changes automatically depending on the
25: * position of the cursor
26: *
27: * buttons remain a fixed size when the application is
28: * resized
29: *
30: * command line options are now handled properly
31: *
32: * logging added
33: *
34: * "reads" are now sorted to show mail address at top etc.
35: *
36: *
37: * Revision 1.2 90/03/09 15:57:36 emsrssn
38: * First public distribution
39: *
40: *
41: * Revision 1.1 90/03/08 13:18:42 emsrssn
42: * Initial revision
43: *
44: *
45: */
46:
47: #include <malloc.h>
48: #include "symtab.h"
49:
50: put_symbol_value(table, name, val)
51: table_entry table;
52: char *name, *val;
53: {
54: if (!name) return;
55:
56: while(table && strcmp(name, table->name)) {
57: table = table->next;
58: }
59: if (table) {
60: free(table->val);
61: if (val) {
62: table->val = (char *) malloc((unsigned int) (strlen(val) + 1) );
63: (void) strcpy((char *) table->val, val);
64: } else
65: table->val = (char *) 0;
66: } else {
67: table = (table_entry ) malloc((unsigned int) (sizeof(table_entry)) );
68: table->next = NULLSYM;
69: table->name = (char *) malloc((unsigned int) (strlen(name) + 1) );
70: (void) strcpy((char *) table->name, name);
71: if (val) {
72: table->val = (char *) malloc((unsigned int) (strlen(val) + 1) );
73: (void) strcpy((char *) table->val, val);
74: } else
75: table->val = (char *) 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.