summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Cochrane <adrian@openwork.nz>2021-11-11 21:00:39 +1300
committerAdrian Cochrane <adrian@openwork.nz>2021-11-11 21:00:39 +1300
commit6b861831769905747381ad725f506d5567d7cf3d (patch)
treef298842e209927a6fcf9c35f5f8fef413a8057f4
parent5eb05d745a7f77a4f9dc4ec39ed4c3fdaebd5dc5 (diff)
downloadrhapsode-6b861831769905747381ad725f506d5567d7cf3d.tar.gz
rhapsode-6b861831769905747381ad725f506d5567d7cf3d.tar.bz2
rhapsode-6b861831769905747381ad725f506d5567d7cf3d.zip
Fix keyboard input handling.
-rw-r--r--src/main.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/main.c b/src/main.c
index fca7328..e1ae22a 100644
--- a/src/main.c
+++ b/src/main.c
@@ -325,7 +325,7 @@ int speak_finalize(char *ssml, char *v2j_profile, char **links, char **out_link)
if (*out_link == NULL) pid_waitwake = v2j_waitwake(v2j_profile);
}
free(line);
- } else {
+ } else if (ch > 0) {
// Read in a line
tcsetattr(0, TCSANOW, &stored_settings);
char buffer[512];
@@ -334,9 +334,9 @@ int speak_finalize(char *ssml, char *v2j_profile, char **links, char **out_link)
putchar(ch);
char *line = buffer + 1;
- size_t len = 512;
+ size_t len = 510;
if (getline(&line, &len, stdin) < 0)
- fprintf(stderr, "Failed to read stdin line!\n");
+ perror("Failed to read stdin line");
else if (out_link != NULL)
*out_link = select_link(links, buffer);
tcsetattr(0, TCSANOW, &no_echo);