1: /* m_delete.c - delete an entry from the profile */ 2: 3: #include "../h/mh.h" 4: #include <stdio.h> 5: 6: 7: m_delete (key) 8: register char *key; 9: { 10: register struct node *np, 11: *pp; 12: 13: m_getdefs (); 14: for (np = m_defs, pp = NULL; np; pp = np, np = np -> n_next) { 15: if (uleq (np -> n_name, key)) { 16: if (!np -> n_context) 17: admonish (NULLCP, "bug: m_delete(key=\"%s\")", np -> n_name); 18: if (pp) 19: pp -> n_next = np -> n_next; 20: else 21: m_defs = np -> n_next; 22: free (np -> n_name); 23: if (np -> n_field) 24: free (np -> n_field); 25: free ((char *) np); 26: ctxflags |= CTXMOD; 27: return 0; 28: } 29: } 30: 31: return 1; 32: }