1
0
Fork 0
mirror of https://git.sr.ht/~sircmpwn/gmni synced 2024-06-09 04:16:04 +02:00

Suppress trailing newline if stdout is not a TTY

This commit is contained in:
Drew DeVault 2020-09-20 14:37:43 -04:00
parent 2e593cd48b
commit 262ccc2005

View File

@ -17,7 +17,7 @@ static void
usage(char *argv_0)
{
fprintf(stderr,
"usage: %s [-LI] [-C cert] [-d input] gemini://...\n",
"usage: %s [-46lLiIN] [-C cert] [-d input] [-D path] gemini://...\n",
argv_0);
}
@ -209,7 +209,8 @@ main(int argc, char *argv[])
}
}
if (strncmp(resp.meta, "text/", 5) == 0
&& linefeed && last != '\n') {
&& linefeed && last != '\n'
&& isatty(STDOUT_FILENO)) {
printf("\n");
}
break;