common.c (259B)
1 #include "common.h" 2 3 #include <stdlib.h> 4 #include <string.h> 5 #include <unistd.h> 6 7 void die() { 8 if (getpid() == 1) { 9 while (1) 10 ; 11 } else { 12 exit(1); 13 } 14 } 15 16 char* strdupn(const char* str) { 17 if (str[0] == '\0') 18 return NULL; 19 else 20 return strdup(str); 21 }