Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 27 Jan 2013 19:49:11 +0000 (UTC)
From:      Gabor Kovesdan <gabor@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r245997 - head/usr.bin/sort
Message-ID:  <201301271949.r0RJnBnG062621@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: gabor
Date: Sun Jan 27 19:49:10 2013
New Revision: 245997
URL: http://svnweb.freebsd.org/changeset/base/245997

Log:
  - Simplify and unify diagnostic and error message handling
  
  Submitted by:	Christoph Mallon <christoph.mallon@gmx.de>
  Reviewed by:	Oleg Moskalenko <oleg.moskalenko@citrix.com>

Modified:
  head/usr.bin/sort/sort.c

Modified: head/usr.bin/sort/sort.c
==============================================================================
--- head/usr.bin/sort/sort.c	Sun Jan 27 19:44:41 2013	(r245996)
+++ head/usr.bin/sort/sort.c	Sun Jan 27 19:49:10 2013	(r245997)
@@ -434,8 +434,7 @@ parse_memory_buffer_value(const char *va
 				    100;
 				break;
 			default:
-				fprintf(stderr, "%s: %s\n", strerror(EINVAL),
-				   optarg);
+				warnc(EINVAL, "%s", optarg);
 				membuf = available_free_memory;
 			}
 		}
@@ -658,7 +657,7 @@ parse_pos(const char *s, struct key_spec
 		errno = 0;
 		ks->f2 = (size_t) strtoul(f, NULL, 10);
 		if (errno != 0)
-			errx(2, "%s: -k", strerror(errno));
+			err(2, "-k");
 		if (ks->f2 == 0) {
 			warn("%s",getstr(5));
 			goto end;
@@ -667,7 +666,7 @@ parse_pos(const char *s, struct key_spec
 		errno = 0;
 		ks->f1 = (size_t) strtoul(f, NULL, 10);
 		if (errno != 0)
-			errx(2, "%s: -k", strerror(errno));
+			err(2, "-k");
 		if (ks->f1 == 0) {
 			warn("%s",getstr(5));
 			goto end;
@@ -685,12 +684,12 @@ parse_pos(const char *s, struct key_spec
 			errno = 0;
 			ks->c2 = (size_t) strtoul(c, NULL, 10);
 			if (errno != 0)
-				errx(2, "%s: -k", strerror(errno));
+				err(2, "-k");
 		} else {
 			errno = 0;
 			ks->c1 = (size_t) strtoul(c, NULL, 10);
 			if (errno != 0)
-				errx(2, "%s: -k", strerror(errno));
+				err(2, "-k");
 			if (ks->c1 == 0) {
 				warn("%s",getstr(6));
 				goto end;
@@ -1041,8 +1040,7 @@ main(int argc, char **argv)
 
 				if (parse_k(optarg, &(keys[keys_num - 1]))
 				    < 0) {
-					errx(2, "%s: -k %s\n",
-					    strerror(EINVAL), optarg);
+					errc(2, EINVAL, "-k %s", optarg);
 				}
 
 				break;
@@ -1067,8 +1065,7 @@ main(int argc, char **argv)
 			case 't':
 				while (strlen(optarg) > 1) {
 					if (optarg[0] != '\\') {
-						errx(2, "%s: %s\n",
-						    strerror(EINVAL), optarg);
+						errc(2, EINVAL, "%s", optarg);
 					}
 					optarg += 1;
 					if (*optarg == '0') {
@@ -1155,8 +1152,7 @@ main(int argc, char **argv)
 				errno = 0;
 				long mof = strtol(optarg, NULL, 10);
 				if (errno != 0)
-					errx(2, "--batch-size: %s",
-					    strerror(errno));
+					err(2, "--batch-size");
 				if (mof >= 2)
 					max_open_files = (size_t) mof + 1;
 			}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201301271949.r0RJnBnG062621>