typop: don't use strlen() and use STDIN_FILENO
This commit is contained in:
parent
36a7166b7a
commit
e97de30ec6
|
@ -10,7 +10,7 @@
|
||||||
int
|
int
|
||||||
main(int argc, char **argv)
|
main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
int i;
|
int i, bytes;
|
||||||
|
|
||||||
ON_NOT_RUNNING_IN_TERMINOLOGY_EXIT_1();
|
ON_NOT_RUNNING_IN_TERMINOLOGY_EXIT_1();
|
||||||
|
|
||||||
|
@ -28,8 +28,9 @@ main(int argc, char **argv)
|
||||||
|
|
||||||
path = argv[i];
|
path = argv[i];
|
||||||
if (realpath(path, buf)) path = buf;
|
if (realpath(path, buf)) path = buf;
|
||||||
snprintf(tbuf, sizeof(tbuf), "%c}pn%s", 0x1b, path);
|
bytes = snprintf(tbuf, sizeof(tbuf), "%c}pn%s", 0x1b, path);
|
||||||
if (write(0, tbuf, strlen(tbuf) + 1) != (signed)(strlen(tbuf) + 1)) perror("write");
|
bytes++;
|
||||||
|
if (write(STDIN_FILENO, tbuf, bytes) != bytes) perror("write");
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue