]> sourceware.org Git - glibc.git/commitdiff
manual: Fix termios.c example. (Bug 31078)
authorCarlos O'Donell <carlos@redhat.com>
Mon, 20 Nov 2023 18:15:34 +0000 (13:15 -0500)
committerCarlos O'Donell <carlos@redhat.com>
Mon, 20 Nov 2023 21:42:23 +0000 (16:42 -0500)
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>
manual/examples/termios.c

index 751e57ad719f551e73b670f7d8349d4bdd63eb6a..65bedad9cc88ef84bfe8c037f691442153f8a43a 100644 (file)
@@ -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;
This page took 0.043717 seconds and 5 git commands to generate.