home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / misc / volume1 / 8712 / mkmf / 2 / src / slinit.c < prev    next >
Encoding:
C/C++ Source or Header  |  1990-07-13  |  691 b   |  35 lines

  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. }
  35.