tycat/tyls: handle error on write()/scanf()

terminology-1.7
Boris Faure 3 years ago
parent 58a1adac38
commit a119ac10cc
Signed by: borisfaure
GPG Key ID: 35C0410516166BE8
  1. 6
      src/bin/tycat.c
  2. 10
      src/bin/tyls.c

@ -337,7 +337,11 @@ main(int argc, char **argv)
echo_off();
snprintf(buf, sizeof(buf), "%c}qs", 0x1b);
if (ty_write(1, buf, strlen(buf) + 1) < 0)
perror("write");
{
perror("write");
echo_on();
goto shutdown;
}
if (scanf("%i;%i;%i;%i", &tw, &th, &cw, &ch) != 4 ||
((tw <= 0) || (th <= 0) || (cw <= 1) || (ch <= 1)))
{

@ -760,18 +760,22 @@ main(int argc, char **argv)
int i, cw, ch;
int len;
char *rp;
evas = ecore_evas_get(ee);
echo_off();
snprintf(buf, sizeof(buf), "%c}qs", 0x1b);
len = strlen(buf);
if (ty_write(1, buf, len + 1) < (signed)len + 1)
perror("write");
{
perror("write");
echo_on();
return -1;
}
if ((scanf("%i;%i;%i;%i", &tw, &th, &cw, &ch) != 4)
|| (tw <= 0) || (th <= 0) || (cw <= 1) || (ch <= 1))
{
echo_on();
return 0;
return -1;
}
echo_on();
for (i = 1; i < argc; i++)

Loading…
Cancel
Save