Skip to content

Commit 44c4522

Browse files
committed
lib/cmdline: use macro from unistd.h to specify standard FDs
Signed-off-by: Denis Pronin <[email protected]>
1 parent edd3f4b commit 44c4522

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

lib/cmdline/cmdline_os_unix.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@ terminal_adjust(struct cmdline *cl)
1717

1818
memcpy(&term, &cl->oldterm, sizeof(term));
1919
term.c_lflag &= ~(ICANON | ECHO | ISIG);
20-
tcsetattr(0, TCSANOW, &term);
20+
tcsetattr(STDIN_FILENO, TCSANOW, &term);
2121

2222
setbuf(stdin, NULL);
2323
}
2424

2525
void
2626
terminal_restore(const struct cmdline *cl)
2727
{
28-
tcsetattr(fileno(stdin), TCSANOW, &cl->oldterm);
28+
tcsetattr(STDIN_FILENO, TCSANOW, &cl->oldterm);
2929
}
3030

3131
ssize_t

lib/cmdline/cmdline_socket.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
* All rights reserved.
55
*/
66

7-
#include <stdio.h>
87
#include <unistd.h>
98
#include <fcntl.h>
109

@@ -34,7 +33,7 @@ cmdline_stdin_new(cmdline_parse_ctx_t *ctx, const char *prompt)
3433
{
3534
struct cmdline *cl;
3635

37-
cl = cmdline_new(ctx, prompt, 0, 1);
36+
cl = cmdline_new(ctx, prompt, STDIN_FILENO, STDOUT_FILENO);
3837

3938
if (cl != NULL)
4039
terminal_adjust(cl);

0 commit comments

Comments
 (0)