1: /* $Header: slappend.c,v 1.2 85/03/18 13:18:28 nicklin Exp $ */
2:
3: /*
4: * Author: Peter J. Nicklin
5: */
6:
7: /*
8: * slappend() saves a null-terminated key string somewhere and inserts a
9: * pointer to the key at the tail of list slist. Returns a pointer to
10: * the somewhere, or a null pointer if out of memory.
11: */
12: #include <stdio.h>
13: #include "macro.h"
14: #include "null.h"
15: #include "slist.h"
16:
17: extern char *PGN; /* program name */
18:
19: char *
20: slappend(key, slist)
21: char *key; /* key string */
22: SLIST *slist; /* pointer to list head block */
23: {
24: char *malloc(); /* memory allocator */
25: char *strcpy(); /* string copy */
26: int strlen(); /* string length */
27: SLBLK *slbptr; /* pointer to list block */
28: unsigned int klen; /* key length */
29:
30: if (slist == NULL)
31: return(NULL);
32: klen = strlen(key);
33: slist->maxkey = MAX(slist->maxkey, klen);
34: if ((slbptr = (SLBLK *) malloc(sizeof(SLBLK))) == NULL ||
35: (slbptr->key = malloc(klen+1)) == NULL)
36: {
37: if (*PGN != '\0')
38: fprintf(stderr, "%s: ", PGN);
39: fprintf(stderr, "out of memory\n");
40: return(NULL);
41: }
42: strcpy(slbptr->key, key);
43: slbptr->next = NULL;
44: if (slist->tail == NULL)
45: slist->head = slist->tail = slbptr;
46: else
47: slist->tail = slist->tail->next = slbptr;
48: slist->nk++;
49: return(slbptr->key);
50: }
Defined functions
slappend
defined in line
19; used 24 times
- in /usr/src/new/mkmf/src/buildlist.c line
28-33(2),
81,
179,
189,
210,
239,
245
- in /usr/src/new/mkmf/src/depend.c line
62,
71,
77,
83,
200,
211,
222,
497,
548,
600,
652,
704,
756
- in /usr/src/new/mkmf/src/rule.c line
181-186(2)
- in /usr/src/new/mkmf/src/slist.h line
35