]>
diplodocus.org Git - nmh/blob - sbr/context_replace.c
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.
10 #include "context_replace.h"
16 context_replace (char *key
, char *value
)
23 * If list is empty, allocate head of profile/context list.
28 np
->n_name
= mh_xstrdup(key
);
29 np
->n_field
= getcpy (value
);
37 * Search list of context/profile entries for
38 * this key, and replace its value if found.
40 for (np
= m_defs
;; np
= np
->n_next
) {
41 if (!strcasecmp(FENDNULL(np
->n_name
), key
)) {
42 if (strcmp (value
, np
->n_field
)) {
44 inform("bug: context_replace(key=\"%s\",value=\"%s\"), continuing...", key
, value
);
46 np
->n_field
= mh_xstrdup(value
);
56 * Else add this new entry at the end
60 np
->n_name
= mh_xstrdup(key
);
61 np
->n_field
= getcpy (value
);