From owner-svn-src-stable-9@FreeBSD.ORG Sat Dec 31 19:48:05 2011 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CCB33106566B; Sat, 31 Dec 2011 19:48:05 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 634FE8FC08; Sat, 31 Dec 2011 19:48:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBVJm5nQ079997; Sat, 31 Dec 2011 19:48:05 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBVJm5Qs079994; Sat, 31 Dec 2011 19:48:05 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201112311948.pBVJm5Qs079994@svn.freebsd.org> From: Dimitry Andric Date: Sat, 31 Dec 2011 19:48:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229143 - stable/9/bin/ed X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Dec 2011 19:48:05 -0000 Author: dim Date: Sat Dec 31 19:48:04 2011 New Revision: 229143 URL: http://svn.freebsd.org/changeset/base/229143 Log: MFC r228595: Fix some obtuse fprintf tricks in bin/ed. Modified: stable/9/bin/ed/io.c stable/9/bin/ed/main.c Directory Properties: stable/9/bin/ed/ (props changed) Modified: stable/9/bin/ed/io.c ============================================================================== --- stable/9/bin/ed/io.c Sat Dec 31 19:46:06 2011 (r229142) +++ stable/9/bin/ed/io.c Sat Dec 31 19:48:04 2011 (r229143) @@ -53,7 +53,8 @@ read_file(char *fn, long n) errmsg = "cannot close input file"; return ERR; } - fprintf(stdout, !scripted ? "%lu\n" : "", size); + if (!scripted) + fprintf(stdout, "%lu\n", size); return current_addr - n; } @@ -161,7 +162,8 @@ write_file(char *fn, const char *mode, l errmsg = "cannot close output file"; return ERR; } - fprintf(stdout, !scripted ? "%lu\n" : "", size); + if (!scripted) + fprintf(stdout, "%lu\n", size); return n ? m - n + 1 : 0; } Modified: stable/9/bin/ed/main.c ============================================================================== --- stable/9/bin/ed/main.c Sat Dec 31 19:46:06 2011 (r229142) +++ stable/9/bin/ed/main.c Sat Dec 31 19:48:04 2011 (r229143) @@ -192,9 +192,10 @@ top: fputs("?\n", stderr); errmsg = "warning: file modified"; if (!isatty(0)) { - fprintf(stderr, garrulous ? - "script, line %d: %s\n" : - "", lineno, errmsg); + if (garrulous) + fprintf(stderr, + "script, line %d: %s\n", + lineno, errmsg); quit(2); } clearerr(stdin); @@ -225,27 +226,26 @@ top: fputs("?\n", stderr); /* give warning */ errmsg = "warning: file modified"; if (!isatty(0)) { - fprintf(stderr, garrulous ? - "script, line %d: %s\n" : - "", lineno, errmsg); + if (garrulous) + fprintf(stderr, "script, line %d: %s\n", + lineno, errmsg); quit(2); } break; case FATAL: - if (!isatty(0)) - fprintf(stderr, garrulous ? - "script, line %d: %s\n" : "", - lineno, errmsg); - else - fprintf(stderr, garrulous ? "%s\n" : "", - errmsg); + if (!isatty(0)) { + if (garrulous) + fprintf(stderr, "script, line %d: %s\n", + lineno, errmsg); + } else if (garrulous) + fprintf(stderr, "%s\n", errmsg); quit(3); default: fputs("?\n", stderr); if (!isatty(0)) { - fprintf(stderr, garrulous ? - "script, line %d: %s\n" : "", - lineno, errmsg); + if (garrulous) + fprintf(stderr, "script, line %d: %s\n", + lineno, errmsg); quit(2); } break;