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