From 22aa5d6e51acac5c119b8412911401362705335c Mon Sep 17 00:00:00 2001 From: hubertf Date: Wed, 7 Feb 2007 14:06:57 +0000 Subject: * Remove unneeded ctype.h * remove unneeded {}s * add some whitespace for readability Contributed by Slava Semushin in private mail. --- progress.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/progress.c b/progress.c index a598ec3..fbec39b 100644 --- a/progress.c +++ b/progress.c @@ -1,4 +1,4 @@ -/* $NetBSD: progress.c,v 1.12 2006/04/20 23:20:55 hubertf Exp $ */ +/* $NetBSD: progress.c,v 1.13 2007/02/07 14:06:57 hubertf Exp $ */ /*- * Copyright (c) 2003 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ #include #ifndef lint -__RCSID("$NetBSD: progress.c,v 1.12 2006/04/20 23:20:55 hubertf Exp $"); +__RCSID("$NetBSD: progress.c,v 1.13 2007/02/07 14:06:57 hubertf Exp $"); #endif /* not lint */ #include @@ -46,7 +46,6 @@ __RCSID("$NetBSD: progress.c,v 1.12 2006/04/20 23:20:55 hubertf Exp $"); #include #include -#include #include #include #include @@ -75,7 +74,7 @@ usage(void) fprintf(stderr, "usage: %s [-ez] [-f file] [-l length] [-p prefix] cmd [args...]\n", getprogname()); - exit(1); + exit(EXIT_FAILURE); } @@ -97,7 +96,7 @@ main(int argc, char *argv[]) /* defaults: Read from stdin, 0 filesize (no completion estimate) */ fd = STDIN_FILENO; filesize = 0; - prefix=NULL; + prefix = NULL; while ((ch = getopt(argc, argv, "ef:l:p:z")) != -1) switch (ch) { @@ -118,8 +117,8 @@ main(int argc, char *argv[]) case 'z': zflag++; break; - default: case '?': + default: usage(); /* NOTREACHED */ } @@ -128,6 +127,7 @@ main(int argc, char *argv[]) if (argc < 1) usage(); + if (infile && (fd = open(infile, O_RDONLY, 0)) < 0) err(1, "%s", infile); @@ -196,9 +196,9 @@ main(int argc, char *argv[]) progress = 1; ttyout = eflag ? stderr : stdout; - if (ioctl(fileno(ttyout), TIOCGSIZE, &ts) == -1) { + if (ioctl(fileno(ttyout), TIOCGSIZE, &ts) == -1) ttywidth = 80; - } else + else ttywidth = ts.ts_cols; if (pipe(outpipe) < 0) -- cgit v1.2.3-56-ge451