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:
parent
fa4f6ca2ad
commit
ffd1eb1875
1 changed files with 3 additions and 2 deletions
|
@ -107,10 +107,11 @@ int main(int argc, const char* argv[])
|
|||
size_t n;
|
||||
int s;
|
||||
if (input != NULL) {
|
||||
s = getline(&cmd, &n, input);
|
||||
fgets(cmd, n, input);
|
||||
} else {
|
||||
s = getline(&cmd, &n, stdin);
|
||||
fgets(cmd, n, stdin);
|
||||
}
|
||||
s = strlen(cmd);
|
||||
if (s <= 0) {
|
||||
printf("Bye!\n");
|
||||
free(cmd);
|
||||
|
|
Loading…
Reference in a new issue