]>
diplodocus.org Git - nmh/blob - sbr/context_replace.c
d4926deca372b007dca64aae38c2a9ec0b3379d4
2 * context_replace.c -- add/replace an entry in the context/profile list
4 * This code is Copyright (c) 2002, by the authors of nmh. See the
5 * COPYRIGHT file in the root directory of the nmh distribution for
6 * complete copyright information.
14 context_replace (char *key
, char *value
)
19 * If list is empty, allocate head of profile/context list.
24 np
->n_name
= getcpy (key
);
25 np
->n_field
= getcpy (value
);
33 * Search list of context/profile entries for
34 * this key, and replace its value if found.
36 for (np
= m_defs
;; np
= np
->n_next
) {
37 if (!strcasecmp (np
->n_name
? np
->n_name
: "", key
? key
: "")) {
38 if (strcmp (value
, np
->n_field
)) {
40 inform("bug: context_replace(key=\"%s\",value=\"%s\"), continuing...", key
, value
);
41 mh_xfree(np
->n_field
);
42 np
->n_field
= mh_xstrdup(value
);
52 * Else add this new entry at the end
56 np
->n_name
= getcpy (key
);
57 np
->n_field
= getcpy (value
);