summaryrefslogtreecommitdiff
path: root/share/man/man9/style.9
diff options
context:
space:
mode:
authorRay Lai <ray@cvs.openbsd.org>2006-03-21 03:25:00 +0000
committerRay Lai <ray@cvs.openbsd.org>2006-03-21 03:25:00 +0000
commitfc32c0f1601be362ed82dfd717791abafba73746 (patch)
treed14ff2d1fa94ee0a9b86d64b3a1175bd43c59c4b /share/man/man9/style.9
parent1f64c87b23834a8bc2fa2a0a90dcf10ccd6d19f5 (diff)
Encourage using strtonum(3).
Sync variable declarations with variables used in getopt(3) loop. OK otto@
Diffstat (limited to 'share/man/man9/style.9')
-rw-r--r--share/man/man9/style.915
1 files changed, 6 insertions, 9 deletions
diff --git a/share/man/man9/style.9 b/share/man/man9/style.9
index f6750ae30e2..a06f306bf9f 100644
--- a/share/man/man9/style.9
+++ b/share/man/man9/style.9
@@ -22,7 +22,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $OpenBSD: style.9,v 1.43 2006/03/19 19:17:58 ray Exp $
+.\" $OpenBSD: style.9,v 1.44 2006/03/21 03:24:59 ray Exp $
.\"
.Dd June 18, 2001
.Dt STYLE 9
@@ -251,10 +251,8 @@ typedef struct _bar {
int
main(int argc, char *argv[])
{
- long num;
- int ch;
- char *ep;
-
+ int aflag, bflag, ch, num;
+ const char *errstr;
.Ed
.Pp
For consistency,
@@ -277,10 +275,9 @@ while ((ch = getopt(argc, argv, "abn:")) != -1)
bflag = 1;
break;
case 'n':
- num = strtol(optarg, &ep, 10);
- if (num <= 0 || *ep != '\e0') {
- warnx("illegal number, -n argument -- %s",
- optarg);
+ num = strtonum(optarg, 0, INT_MAX, &errstr);
+ if (errstr) {
+ warnx("number is %s: %s", errstr, optarg);
usage();
}
break;