/* ;=======================================================================; ; ; ; ... ... ... ..... ... ... ... ; ; ............. ....... ... ... ... _______________________ ; ; .... ... ... ... ... ... ... ... ; ; ... ... ... ... ... ... ... MORRIS CODE WORKS ; ; ... ... ... ... ... ... ... ; ; ... ... ... ... ... ... ... SYSTEM SOFTWARE FILE ; ; ... ... ... ... ... ... ... ... _______________________ ; ; ... ... ... ....... ........... ; ; ... ... ... ..... .. .. ; ; ; ; ; ;=======================================================================; ; Copyright (c) 1985 by Morris Code Works ; ;=======================================================================; ; ; ; File: MAKEMEM.C ; ; ; ; Description: UNIX like 'make' command ; ; ; ; Create Date: 06 Aug 85 ; ; ; ;=======================================================================; ; ; ; Revision History ; ; ; ; When Who Description ; ; --------- --- ---------------------------------------------- ; ; 06 Aug 85 TGM Module created ; ; 27 Aug 85 TGM Released foe use ; ; ; ;=======================================================================; */ #include #include "make.h" /********************************************************/ /* */ /* g e t b l o c k o f m e m o r y */ /* */ /********************************************************/ char *getmem( size ) int size; /* block size to allocate */ { char *malloc(); /* memory allocator */ char *mp; /* ptr to alloc'd mem */ void setmem(); /* set block to value */ /* try to allocate a block of memory */ if( (mp = malloc( size )) == NULL ) OutOfMem(); /* we were successful... clear the block to NULL */ setmem( mp, size, NULL ); /* now return the pointer to the caller */ return( mp ); } /********************************************************/ /* */ /* O u t o f M e m o r y */ /* */ /********************************************************/ OutOfMem() { fprintf( stderr, "Insufficient memory for make.\n" ); fprintf( stderr, "Try reducing size of makefile.\n" ); exit( 1 ); Š} struct str { struct str *next; /* link to next entry */ }; /********************************************************/ /* */ /* c h a i n s t r u c t u r e t o l i s t */ /* */ /********************************************************/ void chain( l, a ) /* add array(a) to end of list(l) */ struct str *l; /* ptr to head of chain ptr */ struct str *a; /* ptr to struct to add at end */ { /* scan for current end of structure */ while( l->next ) l = l->next; /* add this entry to end of chain */ l->next = a; }