1: /* $Header: slinit.c,v 1.2 85/03/18 13:18:52 nicklin Exp $ */
2:
3: /*
4: * Author: Peter J. Nicklin
5: */
6:
7: /*
8: * slinit() returns a pointer to the head block of a new list, or null
9: * pointer if out of memory.
10: */
11: #include <stdio.h>
12: #include "null.h"
13: #include "slist.h"
14:
15: extern char *PGN; /* program name */
16:
17: SLIST *
18: slinit()
19: {
20: char *malloc(); /* memory allocator */
21: SLIST *slist; /* pointer to list head block */
22:
23: if ((slist = (SLIST *) malloc(sizeof(SLIST))) == NULL)
24: {
25: if (*PGN != '\0')
26: fprintf(stderr, "%s: ", PGN);
27: fprintf(stderr, "out of memory\n");
28: return(NULL);
29: }
30: slist->nk = 0;
31: slist->maxkey = 0;
32: slist->head = slist->curblk = slist->tail = NULL;
33: return(slist);
34: }
Defined functions
slinit
defined in line
17; used 13 times