diff options
author | Carlos O'Donell <carlos@redhat.com> | 2023-11-20 13:15:34 -0500 |
---|---|---|
committer | Carlos O'Donell <carlos@redhat.com> | 2023-11-20 16:42:23 -0500 |
commit | 3cbaacdfd2c11cb726011ef6464dce00c186a2bf (patch) | |
tree | 76f43f0aab043d33a9f9d1c950db35d4a4aecac1 /manual/examples | |
parent | a8830c928540011120ac742d632ed51d52af01df (diff) | |
download | glibc-3cbaacdfd2c11cb726011ef6464dce00c186a2bf.zip glibc-3cbaacdfd2c11cb726011ef6464dce00c186a2bf.tar.gz glibc-3cbaacdfd2c11cb726011ef6464dce00c186a2bf.tar.bz2 |
manual: Fix termios.c example. (Bug 31078)
Remove the unused 'char *name;' from the example.
Use write instead of putchar to write input as it is read.
Example tested on x86_64 by compiling and running the example.
Tested by building the manual pdf and reviewing the results.
Reviewed-by: Florian Weimer <fweimer@redhat.com>
Diffstat (limited to 'manual/examples')
-rw-r--r-- | manual/examples/termios.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/manual/examples/termios.c b/manual/examples/termios.c index 751e57a..65bedad 100644 --- a/manual/examples/termios.c +++ b/manual/examples/termios.c @@ -34,7 +34,6 @@ void set_input_mode (void) { struct termios tattr; - char *name; /* Make sure stdin is a terminal. */ if (!isatty (STDIN_FILENO)) @@ -70,7 +69,7 @@ main (void) if (c == '\004') /* @kbd{C-d} */ break; else - putchar (c); + write (STDOUT_FILENO, &c, 1); } return EXIT_SUCCESS; |