]> diplodocus.org Git - nmh/blob - sbr/context_del.c
Escape literal leading full stop in man/new.man.
[nmh] / sbr / context_del.c
1
2 /*
3 * context_del.c -- delete an entry from the context/profile list
4 *
5 * This code is Copyright (c) 2002, by the authors of nmh. See the
6 * COPYRIGHT file in the root directory of the nmh distribution for
7 * complete copyright information.
8 */
9
10 #include <h/mh.h>
11 #include <h/utils.h>
12
13 /*
14 * Delete a key/value pair from the context/profile list.
15 * Return 0 if key is found, else return 1.
16 */
17
18 int
19 context_del (char *key)
20 {
21 struct node *np, *pp;
22
23 for (np = m_defs, pp = NULL; np; pp = np, np = np->n_next) {
24 if (!strcasecmp (np->n_name ? np->n_name : "", key ? key : "")) {
25 if (!np->n_context)
26 admonish (NULL, "bug: context_del(key=\"%s\")", np->n_name);
27 if (pp)
28 pp->n_next = np->n_next;
29 else
30 m_defs = np->n_next;
31 free (np->n_name);
32 mh_xfree(np->n_field);
33 free(np);
34 ctxflags |= CTXMOD;
35 return 0;
36 }
37 }
38
39 return 1;
40 }