peek(1): remove unused variables, clean up some typos

This commit is contained in:
dtb 2024-04-18 10:14:52 -06:00
parent c295f531cb
commit 6d3f084d9c
Signed by: trinity
GPG Key ID: 31FF85CCB6DC7641

View File

@ -20,7 +20,7 @@
#include <stdio.h> /* fprintf(3), fgetc(3), perror(3), fputc(3), stderr, stdin,
* stdout, EOF, NULL */
#include <stdlib.h> /* 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 <sysexits.h>
#endif
#include <termios.h> /* 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]);
}