Mercurial > illumos > illumos-gate
changeset 4222:dfc760ff4dbc
6490780 cut does not report system errors
6490754 wc does not report system errors
Contributed by River Tarnell <river@attenuate.org>.
author | cf46844 |
---|---|
date | Mon, 14 May 2007 08:48:37 -0700 |
parents | 50b4bab9766b |
children | 75d835eed918 |
files | usr/src/cmd/cut/cut.c usr/src/cmd/wc/wc.c |
diffstat | 2 files changed, 16 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- a/usr/src/cmd/cut/cut.c Mon May 14 08:39:48 2007 -0700 +++ b/usr/src/cmd/cut/cut.c Mon May 14 08:48:37 2007 -0700 @@ -20,7 +20,7 @@ */ /* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -40,6 +40,7 @@ #include <stdlib.h> #include <unistd.h> #include <string.h> +#include <errno.h> #define MAX_RANGES MAX_INPUT /* maximum number of ranges */ /* as input args */ @@ -140,7 +141,7 @@ if (nflag) { if (cflag || fflag) { (void) fprintf(stderr, gettext( - "cut: -n may only be used with -b\n")); + "cut: -n may only be used with -b\n")); usage(); } } @@ -149,10 +150,10 @@ if (bflag || cflag) { if (dflag) (void) fprintf(stderr, gettext( - "cut: -d may only be used with -f\n")); + "cut: -d may only be used with -f\n")); if (supflag) (void) fprintf(stderr, gettext( - "cut: -s may only be used with -f\n")); + "cut: -s may only be used with -f\n")); usage(); } } @@ -179,9 +180,8 @@ inptr = stdin; else if ((inptr = fopen(argv[filenr], "r")) == NULL) { - (void) fprintf(stderr, gettext( - "cut: cannot open %s\n"), - argv[filenr]); + (void) fprintf(stderr, "cut: %s: %s\n", + argv[filenr], strerror(errno)); status = 1; continue; }
--- a/usr/src/cmd/wc/wc.c Mon May 14 08:39:48 2007 -0700 +++ b/usr/src/cmd/wc/wc.c Mon May 14 08:48:37 2007 -0700 @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -24,7 +23,7 @@ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -39,6 +38,8 @@ #include <locale.h> #include <wctype.h> #include <stdlib.h> +#include <errno.h> +#include <string.h> #include <euc.h> #undef BUFSIZ @@ -125,8 +126,8 @@ i = 0; do { if (argc > 0 && (fptr = fopen(argv[i], "r")) == NULL) { - (void) fprintf(stderr, gettext( - "wc: cannot open %s\n"), argv[i]); + (void) fprintf(stderr, "wc: %s: %s\n", + argv[i], strerror(errno)); status = 2; continue; } @@ -152,9 +153,8 @@ */ if (ferror(fptr)) { (void) fprintf(stderr, gettext( - "wc: cannot read %s: "), - argv[i]); - perror(""); + "wc: cannot read %s: %s\n"), + argv[i], strerror(errno)); status = 2; errflag = 1; break;