This is s.rmprop.c in view mode; [Download] [Up]
h46233
s 00000/00000/00057
d D 1.2 85/11/26 23:02:23 dgl 2 1
c eliminated LOOKED_ALREADY from getheader to cure bug
c re. trying to add property to stdin if no header exists yet.
e
s 00057/00000/00000
d D 1.1 85/11/25 10:00:04 dgl 1 0
c original version
e
u
U
f i
t
T
I 1
/* %M% %I% (CARL) %G% %U% */
#include <stdio.h>
#include <carl/carl.h>
#include <carl/procom.h>
/*
* rmprop - take property off of list
* takes:
* iop
* n - name of property to remove
* side effects:
* if property removed is the head of the list,
* fb[fileno(iop)]->p is updated to point to
* the new head
*/
rmprop(iop, n)
FILE *iop;
char *n;
{
register struct fltbuf *f;
register PROP *cpl;
if (iop == NULL || n == NULL)
return(-1);
f = &fb[fileno(iop)];
for (cpl = f->p; cpl != NULL; cpl = cpl->nextprop) {
if (!strcmp(n, cpl->propname))
return(delprop(f, cpl));
}
return(-1);
}
delprop(f, pl)
struct fltbuf *f;
PROP *pl;
{
if (f == NULL || f->p == NULL || pl == NULL)
return(-1);
if (pl->lastprop != NULL) /* swallow back link */
pl->lastprop->nextprop = pl->nextprop;
if (pl->nextprop != NULL) /* swallow foreward link */
pl->nextprop->lastprop = pl->lastprop;
if (pl->lastprop == NULL) /* head of list? */
f->p = pl->nextprop; /* save new head */
if (pl->propname != NULL)
free(pl->propname);
if (pl->propval != NULL)
free(pl->propval);
pl->nextprop = pl->lastprop = NULL; /* silver stake in the heart! */
free(pl);
return(0);
}
E 1
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.