From f4e03704b1edf9205d5f42b6a7fbcd5637d22814 Mon Sep 17 00:00:00 2001 From: Jean Guyomarc'h Date: Sat, 30 Jan 2016 22:32:56 +0100 Subject: [PATCH] ty*: use STDIN_FILENO --- src/bin/tyalpha.c | 2 +- src/bin/tybg.c | 4 ++-- src/bin/tycat.c | 6 +++--- src/bin/tyls.c | 2 +- src/bin/tyq.c | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/bin/tyalpha.c b/src/bin/tyalpha.c index 7b55b7a2..9bcaae74 100644 --- a/src/bin/tyalpha.c +++ b/src/bin/tyalpha.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; } diff --git a/src/bin/tybg.c b/src/bin/tybg.c index cc3df433..98924a49 100644 --- a/src/bin/tybg.c +++ b/src/bin/tybg.c @@ -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; } diff --git a/src/bin/tycat.c b/src/bin/tycat.c index 982e072c..8de9804d 100644 --- a/src/bin/tycat.c +++ b/src/bin/tycat.c @@ -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))) { diff --git a/src/bin/tyls.c b/src/bin/tyls.c index 9bdd3054..9b5ef080 100644 --- a/src/bin/tyls.c +++ b/src/bin/tyls.c @@ -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)) { diff --git a/src/bin/tyq.c b/src/bin/tyq.c index f78fcc0d..52d485da 100644 --- a/src/bin/tyq.c +++ b/src/bin/tyq.c @@ -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; }