|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T l
Length: 2238 (0x8be) Types: TextFile Names: »list_bpt.c«
└─⟦2d1937cfd⟧ Bits:30007241 EUUGD22: P.P 5.0 └─⟦dc59850a2⟧ »EurOpenD22/pp5.0/pp-5.tar.Z« └─⟦e5a54fb17⟧ └─⟦this⟧ »pp-5.0/Lib/pp/list_bpt.c«
/* list_bpt.c: utility routines for Body Part Types */ # ifndef lint static char Rcsid[] = "@(#)$Header: /cs/research/pp/hubris/pp-beta/Lib/pp/RCS/list_bpt.c,v 5.0 90/09/20 16:11:04 pp Exp Locker: pp $"; # endif /* * $Header: /cs/research/pp/hubris/pp-beta/Lib/pp/RCS/list_bpt.c,v 5.0 90/09/20 16:11:04 pp Exp Locker: pp $ * * $Log: list_bpt.c,v $ * Revision 5.0 90/09/20 16:11:04 pp * rcsforce : 5.0 public release * */ #include "util.h" #include "list_bpt.h" /* --------------------- Begin Routines -------------------------------- */ /* Creates a new list structure */ LIST_BPT* list_bpt_new (value) char *value; { LIST_BPT *list; PP_DBG (("Lib/pp/list_bpt_new (%s)", value)); if (value == NULLCP) return (NULLIST_BPT); list = list_bpt_malloc (); if (list == NULLIST_BPT) return (NULLIST_BPT); list -> li_name = strdup (value); return (list); } /* Duplicates */ LIST_BPT *list_bpt_dup (list) LIST_BPT *list; { LIST_BPT *retlist = NULLIST_BPT, *new; for (; list != NULLIST_BPT; list = list->li_next) { if ((new = list_bpt_malloc()) == NULLIST_BPT) return (NULLIST_BPT); new->li_name = strdup (list->li_name); list_bpt_add (&retlist, new); } return (retlist); } /* Adds item onto the end of base */ void list_bpt_add (base, new) LIST_BPT **base, *new; { LIST_BPT *ep = *base; if (ep == NULLIST_BPT) *base = new; else { while (ep->li_next != NULLIST_BPT) ep = ep->li_next; ep->li_next = new; } } /* Finds a specified item within a list */ LIST_BPT *list_bpt_find (list, item) LIST_BPT *list; char *item; { LIST_BPT *lp; PP_DBG (("Lib/pp/list_bpt_find (%s)", item)); for (lp = list; lp != NULLIST_BPT; lp = lp->li_next) if (lexequ (lp -> li_name, item) == 0) return (lp); return (NULLIST_BPT); } void list_bpt_free (list) LIST_BPT *list; { if (list == NULLIST_BPT) return; list_bpt_free (list->li_next); if (list -> li_name) free (list->li_name); free ((char *)list); } LIST_BPT *list_bpt_malloc() { LIST_BPT *new; new = (LIST_BPT *) smalloc (sizeof (LIST_BPT)); new->li_name = NULLCP; new->li_next = NULLIST_BPT; return (new); }