correct misuse of warnx, which leads to non-informative error

message when we specify nonexisting file as argument, like:

% uudecode hoge
uudecode: hoge
This commit is contained in:
itojun 2002-06-29 17:58:50 +00:00
parent c589b132db
commit 8e32c24c2e

View File

@ -1,4 +1,4 @@
/* $NetBSD: uudecode.c,v 1.15 2002/06/11 06:06:21 itojun Exp $ */ /* $NetBSD: uudecode.c,v 1.16 2002/06/29 17:58:50 itojun Exp $ */
/*- /*-
* Copyright (c) 1983, 1993 * Copyright (c) 1983, 1993
@ -43,7 +43,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 1993\n\
#if 0 #if 0
static char sccsid[] = "@(#)uudecode.c 8.2 (Berkeley) 4/2/94"; static char sccsid[] = "@(#)uudecode.c 8.2 (Berkeley) 4/2/94";
#endif #endif
__RCSID("$NetBSD: uudecode.c,v 1.15 2002/06/11 06:06:21 itojun Exp $"); __RCSID("$NetBSD: uudecode.c,v 1.16 2002/06/29 17:58:50 itojun Exp $");
#endif /* not lint */ #endif /* not lint */
#if HAVE_CONFIG_H #if HAVE_CONFIG_H
@ -101,7 +101,7 @@ main(argc, argv)
rval = 0; rval = 0;
do { do {
if (!freopen(filename = *argv, "r", stdin)) { if (!freopen(filename = *argv, "r", stdin)) {
warnx("%s", *argv); warn("%s", *argv);
rval = 1; rval = 1;
continue; continue;
} }
@ -177,7 +177,7 @@ decode()
/* create output file, set mode */ /* create output file, set mode */
if (!pflag && (!freopen(fn, "w", stdout) || if (!pflag && (!freopen(fn, "w", stdout) ||
fchmod(fileno(stdout), mode & 0666))) { fchmod(fileno(stdout), mode & 0666))) {
warnx("%s: %s", fn, filename); warn("%s: %s", fn, filename);
return(1); return(1);
} }