[BACK]Return to main.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / make

Diff for /src/usr.bin/make/main.c between version 1.19 and 1.20

version 1.19, 1999/12/06 22:28:44 version 1.20, 1999/12/09 18:20:06
Line 1195 
Line 1195 
 }  }
   
 /*  /*
  * emalloc --  
  *      malloc, but die on error.  
  */  
 void *  
 emalloc(len)  
         size_t len;  
 {  
         void *p;  
   
         if ((p = malloc(len)) == NULL)  
                 enomem();  
         return(p);  
 }  
   
 /*  
  * estrdup --  
  *      strdup, but die on error.  
  */  
 char *  
 estrdup(str)  
         const char *str;  
 {  
         char *p;  
   
         if ((p = strdup(str)) == NULL)  
                 enomem();  
         return(p);  
 }  
   
 /*  
  * erealloc --  
  *      realloc, but die on error.  
  */  
 void *  
 erealloc(ptr, size)  
         void *ptr;  
         size_t size;  
 {  
         if ((ptr = realloc(ptr, size)) == NULL)  
                 enomem();  
         return(ptr);  
 }  
   
 /*  
  * enomem --  
  *      die when out of memory.  
  */  
 void  
 enomem()  
 {  
         (void)fprintf(stderr, "make: %s.\n", strerror(errno));  
         exit(2);  
 }  
   
 /*  
  * enunlink --  
  *      Remove a file carefully, avoiding directories.  
  */  
 int  
 eunlink(file)  
         const char *file;  
 {  
         struct stat st;  
   
         if (lstat(file, &st) == -1)  
                 return -1;  
   
         if (S_ISDIR(st.st_mode)) {  
                 errno = EISDIR;  
                 return -1;  
         }  
         return unlink(file);  
 }  
   
 /*  
  * usage --   * usage --
  *      exit with usage message   *      exit with usage message
  */   */

Legend:
Removed from v.1.19  
changed lines
  Added in v.1.20