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>
set_input_mode (void)
{
struct termios tattr;
- char *name;
/* Make sure stdin is a terminal. */
if (!isatty (STDIN_FILENO))
if (c == '\004') /* @kbd{C-d} */
break;
else
- putchar (c);
+ write (STDOUT_FILENO, &c, 1);
}
return EXIT_SUCCESS;