]> diplodocus.org Git - nmh/blob - docs/historical/mh-nov-1983/subs/m_replace.c
Removed --depth 1 from git clone invocation.
[nmh] / docs / historical / mh-nov-1983 / subs / m_replace.c
1 #include "mh.h"
2
3
4 m_replace(key,value)
5 char *key, *value;
6
7 {
8 register struct node *np;
9
10 m_getdefs();
11 for(np = m_defs; ; np = np->n_next) {
12 if(uleq(np->n_name, key)) {
13 if(strcmp(value, np->n_field) != 0) {
14 cndfree(np->n_field);
15 np->n_field = value;
16 def_flags |= DEFMOD;
17 }
18 return;
19 }
20 if(!np->n_next)
21 break;
22 }
23 np->n_next = (struct node *) malloc(sizeof *np);
24 np = np->n_next;
25 np->n_name = getcpy(key);
26 np->n_next = 0;
27 np->n_field = value;
28 def_flags |= DEFMOD;
29 }