]>
diplodocus.org Git - nmh/blob - sbr/context_replace.c
9dba8d87c7c396fc77bc751b6808c862d4d5903a
1 /* context_replace.c -- add/replace an entry in the context/profile list
3 * This code is Copyright (c) 2002, by the authors of nmh. See the
4 * COPYRIGHT file in the root directory of the nmh distribution for
5 * complete copyright information.
14 context_replace (char *key
, char *value
)
21 * If list is empty, allocate head of profile/context list.
26 np
->n_name
= mh_xstrdup(key
);
27 np
->n_field
= getcpy (value
);
35 * Search list of context/profile entries for
36 * this key, and replace its value if found.
38 for (np
= m_defs
;; np
= np
->n_next
) {
39 if (!strcasecmp(FENDNULL(np
->n_name
), key
)) {
40 if (strcmp (value
, np
->n_field
)) {
42 inform("bug: context_replace(key=\"%s\",value=\"%s\"), continuing...", key
, value
);
44 np
->n_field
= mh_xstrdup(value
);
54 * Else add this new entry at the end
58 np
->n_name
= mh_xstrdup(key
);
59 np
->n_field
= getcpy (value
);