From 6d3f084d9c74ab4b52796cd1911a94b80696b835 Mon Sep 17 00:00:00 2001 From: DTB Date: Thu, 18 Apr 2024 10:14:52 -0600 Subject: [PATCH] peek(1): remove unused variables, clean up some typos --- src/peek.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/peek.c b/src/peek.c index 67d0a42..a769e90 100644 --- a/src/peek.c +++ b/src/peek.c @@ -20,7 +20,7 @@ #include /* fprintf(3), fgetc(3), perror(3), fputc(3), stderr, stdin, * stdout, EOF, NULL */ #include /* exit(3), EXIT_FAILURE */ -#if !defined EX_OK || !defined EX_OSERR || !defined EX_USAGE +#if !defined EX_IOERR || !defined EX_OK || !defined EX_USAGE # include #endif #include /* tcgetattr(3), tcsetattr(3), struct termios, ECHO */ @@ -46,7 +46,6 @@ static void restore_echo(int sig){ return; } -static int oserr(char *s){ perror(s); return EX_OSERR; } static int ioerr(char *s){ perror(s); restore_echo(0); return EX_IOERR; } static int usage(char *s){ fprintf(stderr, "Usage: %s (-1enot) (-p [program [arguments...]])\n", s); @@ -58,7 +57,7 @@ int main(int argc, char *argv[]){ if(argc < 1) return usage(program_name); - { /* options parsing */ + { /* option parsing */ char allow_nonterminals; int c; @@ -108,8 +107,8 @@ int main(int argc, char *argv[]){ { /* actual input loop */ int c; - while((c = getc(stdin)) != EOF) - if(putc(c, stdout) == EOF) + while((c = fgetc(stdin)) != EOF) + if(fputc(c, stdout) == EOF) return ioerr(argv[0]); }