Fix spelling errors, including binaries ones
[mmh] / sbr / context_del.c
1 /*
2 ** context_del.c -- delete an entry from the context/profile list
3 **
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.
7 */
8
9 #include <h/mh.h>
10 #include <h/utils.h>
11
12 /*
13 ** Delete a key/value pair from the context/profile list.
14 ** Return 0 if key is found, else return 1.
15 */
16
17 int
18 context_del(char *key)
19 {
20         struct node *np, *pp;
21
22         for (np = m_defs, pp = NULL; np; pp = np, np = np->n_next) {
23                 if (!mh_strcasecmp(np->n_name, key)) {
24                         if (!np->n_context)
25                                 admonish(NULL, "bug: context_del(key=\"%s\")", np->n_name);
26                         if (pp)
27                                 pp->n_next = np->n_next;
28                         else
29                                 m_defs = np->n_next;
30                         mh_free0(&(np->n_name));
31                         if (np->n_field)
32                                 mh_free0(&(np->n_field));
33                         mh_free0(&np);
34                         ctxflags |= CTXMOD;
35                         return 0;
36                 }
37         }
38
39         return 1;
40 }