falling back to POSIX compatible commands, fgets in stead of getline. MacOSX / BSD doesn't come with glibc on default

This commit is contained in:
Roel Verdult 2011-02-05 20:52:55 +00:00
parent fa4f6ca2ad
commit ffd1eb1875

View file

@ -107,10 +107,11 @@ int main(int argc, const char* argv[])
size_t n; size_t n;
int s; int s;
if (input != NULL) { if (input != NULL) {
s = getline(&cmd, &n, input); fgets(cmd, n, input);
} else { } else {
s = getline(&cmd, &n, stdin); fgets(cmd, n, stdin);
} }
s = strlen(cmd);
if (s <= 0) { if (s <= 0) {
printf("Bye!\n"); printf("Bye!\n");
free(cmd); free(cmd);