ty*: use STDIN_FILENO

devs/jayji/fixes
Jean Guyomarc'h 7 years ago committed by Jean Guyomarc'h
parent 832db27dca
commit f4e03704b1
  1. 2
      src/bin/tyalpha.c
  2. 4
      src/bin/tybg.c
  3. 6
      src/bin/tycat.c
  4. 2
      src/bin/tyls.c
  5. 2
      src/bin/tyq.c

@ -37,7 +37,7 @@ main(int argc, char **argv)
snprintf(tbuf, sizeof(tbuf), "%c}ap%s", 0x1b, argv[i]);
else
snprintf(tbuf, sizeof(tbuf), "%c}at%s", 0x1b, argv[i]);
if (write(0, tbuf, strlen(tbuf) + 1) != (signed)(strlen(tbuf) + 1)) perror("write");
if (write(STDIN_FILENO, tbuf, strlen(tbuf) + 1) != (signed)(strlen(tbuf) + 1)) perror("write");
}
return 0;
}

@ -29,7 +29,7 @@ main(int argc, char **argv)
{
char tbuf[32];
snprintf(tbuf, sizeof(tbuf), "%c}bt", 0x1b);
if (write(0, tbuf, strlen(tbuf) + 1) != (signed)(strlen(tbuf) + 1)) perror("write");
if (write(STDIN_FILENO, tbuf, strlen(tbuf) + 1) != (signed)(strlen(tbuf) + 1)) perror("write");
return 0;
}
for (i = 1; i < argc; i++)
@ -48,7 +48,7 @@ main(int argc, char **argv)
snprintf(tbuf, sizeof(tbuf), "%c}bp%s", 0x1b, path);
else
snprintf(tbuf, sizeof(tbuf), "%c}bt%s", 0x1b, path);
if (write(0, tbuf, strlen(tbuf) + 1) != (signed)(strlen(tbuf) + 1)) perror("write");
if (write(STDIN_FILENO, tbuf, strlen(tbuf) + 1) != (signed)(strlen(tbuf) + 1)) perror("write");
}
return 0;
}

@ -97,7 +97,7 @@ prnt(const char *path, int w, int h, int mode)
bytes = snprintf(buf, sizeof(buf), "%c}if#%i;%i;%s", 0x1b, w, h, path);
else
bytes = snprintf(buf, sizeof(buf), "%c}is#%i;%i;%s", 0x1b, w, h, path);
if (write(0, buf, bytes + 1) < 0) perror("write");
if (write(STDIN_FILENO, buf, bytes + 1) < 0) perror("write");
i = 0;
line[i++] = 0x1b;
line[i++] = '}';
@ -113,7 +113,7 @@ prnt(const char *path, int w, int h, int mode)
line[i++] = '\n';
for (y = 0; y < h; y++)
{
if (write(0, line, i) < 0) perror("write");
if (write(STDIN_FILENO, line, i) < 0) perror("write");
}
free(line);
}
@ -336,7 +336,7 @@ main(int argc, char **argv)
evas = ecore_evas_get(ee);
echo_off();
bytes = snprintf(buf, sizeof(buf), "%c}qs", 0x1b);
if (write(0, buf, bytes + 1) < 0) perror("write");
if (write(STDIN_FILENO, buf, bytes + 1) < 0) perror("write");
if (scanf("%i;%i;%i;%i", &tw, &th, &cw, &ch) != 4 ||
((tw <= 0) || (th <= 0) || (cw <= 1) || (ch <= 1)))
{

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

@ -29,7 +29,7 @@ main(int argc, char **argv)
path = argv[i];
if (realpath(path, buf)) path = buf;
snprintf(tbuf, sizeof(tbuf), "%c}pq%s", 0x1b, path);
if (write(0, tbuf, strlen(tbuf) + 1) != (signed)(strlen(tbuf) + 1)) perror("write");
if (write(STDIN_FILENO, tbuf, strlen(tbuf) + 1) != (signed)(strlen(tbuf) + 1)) perror("write");
}
return 0;
}

Loading…
Cancel
Save