]>
diplodocus.org Git - nmh/blob - docs/historical/mh-6.8.5/sbr/m_replace.c
1 /* m_replace.c - replace an entry in the profile */
7 void m_replace (key
, value
)
11 register struct node
*np
;
15 np
= m_defs
= (struct node
*) malloc (sizeof *np
);
17 adios (NULLCP
, "unable to allocate profile storage");
19 np
-> n_name
= getcpy (key
);
20 np
-> n_field
= getcpy (value
);
27 for (np
= m_defs
;; np
= np
-> n_next
) {
28 if (uleq (np
-> n_name
, key
)) {
29 if (strcmp (value
, np
-> n_field
) != 0) {
31 admonish (NULLCP
, "bug: m_replace(key=\"%s\",value=\"%s\")",
35 np
-> n_field
= getcpy (value
);
43 np
-> n_next
= (struct node
*) malloc (sizeof *np
);
44 if (np
-> n_next
== NULL
)
45 adios (NULLCP
, "unable to allocate profile storage");
48 np
-> n_name
= getcpy (key
);
49 np
-> n_field
= getcpy (value
);