unix/dualinit

src/common.c in master
Repositories | Summary | Log | Files | LICENSE

common.c (259B) download


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