Module Name:    src
Committed By:   rillig
Date:           Fri Oct 29 19:52:59 UTC 2021

Modified Files:
        src/usr.bin/indent: args.c

Log Message:
indent: parse options in a platform-independent way

Previously, on an ILP32 platform, the option '-ts30000000000000000'
resulted in the error message 'must be an integer', on LP64 platforms it
resulted in the error message 'must be between 1 and 80'. Remove this
unnecessary difference.


To generate a diff of this commit:
cvs rdiff -u -r1.66 -r1.67 src/usr.bin/indent/args.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/indent/args.c
diff -u src/usr.bin/indent/args.c:1.66 src/usr.bin/indent/args.c:1.67
--- src/usr.bin/indent/args.c:1.66	Thu Oct 28 22:20:08 2021
+++ src/usr.bin/indent/args.c	Fri Oct 29 19:52:59 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: args.c,v 1.66 2021/10/28 22:20:08 rillig Exp $	*/
+/*	$NetBSD: args.c,v 1.67 2021/10/29 19:52:59 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -43,7 +43,7 @@ static char sccsid[] = "@(#)args.c	8.1 (
 
 #include <sys/cdefs.h>
 #if defined(__NetBSD__)
-__RCSID("$NetBSD: args.c,v 1.66 2021/10/28 22:20:08 rillig Exp $");
+__RCSID("$NetBSD: args.c,v 1.67 2021/10/29 19:52:59 rillig Exp $");
 #elif defined(__FreeBSD__)
 __FBSDID("$FreeBSD: head/usr.bin/indent/args.c 336318 2018-07-15 21:04:21Z pstef $");
 #endif
@@ -52,7 +52,6 @@ __FBSDID("$FreeBSD: head/usr.bin/indent/
 
 #include <ctype.h>
 #include <err.h>
-#include <errno.h>
 #include <limits.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -241,10 +240,9 @@ found:
 	return;
     }
 
-    errno = 0;
     char *end;
     long num = strtol(arg_arg, &end, 10);
-    if (!(errno == 0 && *end == '\0'))
+    if (*end != '\0')
 	errx(1, "%s: argument \"%s\" to option \"-%s\" must be an integer",
 	    option_source, arg_arg, p->p_name);
 

Reply via email to