From owner-svn-src-all@freebsd.org Tue Feb 19 21:27:31 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7EDD814DA17D; Tue, 19 Feb 2019 21:27:31 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 22F0774BC3; Tue, 19 Feb 2019 21:27:31 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0454723894; Tue, 19 Feb 2019 21:27:31 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x1JLRUP3012639; Tue, 19 Feb 2019 21:27:30 GMT (envelope-from jilles@FreeBSD.org) Received: (from jilles@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x1JLRUD3012636; Tue, 19 Feb 2019 21:27:30 GMT (envelope-from jilles@FreeBSD.org) Message-Id: <201902192127.x1JLRUD3012636@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jilles set sender to jilles@FreeBSD.org using -f From: Jilles Tjoelker Date: Tue, 19 Feb 2019 21:27:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r344306 - head/bin/sh X-SVN-Group: head X-SVN-Commit-Author: jilles X-SVN-Commit-Paths: head/bin/sh X-SVN-Commit-Revision: 344306 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 22F0774BC3 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.95)[-0.945,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-0.999,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Feb 2019 21:27:31 -0000 Author: jilles Date: Tue Feb 19 21:27:30 2019 New Revision: 344306 URL: https://svnweb.freebsd.org/changeset/base/344306 Log: sh: Send normal output from bind builtin to stdout PR: 233343 Submitted by: Yuichiro NAITO (original version) Modified: head/bin/sh/histedit.c head/bin/sh/output.c head/bin/sh/output.h Modified: head/bin/sh/histedit.c ============================================================================== --- head/bin/sh/histedit.c Tue Feb 19 21:22:22 2019 (r344305) +++ head/bin/sh/histedit.c Tue Feb 19 21:27:30 2019 (r344306) @@ -472,10 +472,31 @@ str_to_event(const char *str, int last) int bindcmd(int argc, char **argv) { + int ret; + FILE *old; + FILE *out; if (el == NULL) error("line editing is disabled"); - return (el_parse(el, argc, __DECONST(const char **, argv))); + + INTOFF; + + out = out1fp(); + if (out == NULL) + error("Out of space"); + + el_get(el, EL_GETFP, 1, &old); + el_set(el, EL_SETFP, 1, out); + + ret = el_parse(el, argc, __DECONST(const char **, argv)); + + el_set(el, EL_SETFP, 1, old); + + fclose(out); + + INTON; + + return ret; } #else Modified: head/bin/sh/output.c ============================================================================== --- head/bin/sh/output.c Tue Feb 19 21:22:22 2019 (r344305) +++ head/bin/sh/output.c Tue Feb 19 21:27:30 2019 (r344306) @@ -340,6 +340,12 @@ doformat(struct output *dest, const char *f, va_list a } } +FILE * +out1fp(void) +{ + return fwopen(out1, doformat_wr); +} + /* * Version of write which resumes after a signal is caught. */ Modified: head/bin/sh/output.h ============================================================================== --- head/bin/sh/output.h Tue Feb 19 21:22:22 2019 (r344305) +++ head/bin/sh/output.h Tue Feb 19 21:27:30 2019 (r344306) @@ -39,6 +39,7 @@ #include #include +#include struct output { char *nextc; @@ -75,6 +76,7 @@ void out1fmt(const char *, ...) __printflike(1, 2); void out2fmt_flush(const char *, ...) __printflike(1, 2); void fmtstr(char *, int, const char *, ...) __printflike(3, 4); void doformat(struct output *, const char *, va_list) __printflike(2, 0); +FILE *out1fp(void); int xwrite(int, const char *, int); #define outc(c, file) ((file)->nextc == (file)->bufend ? (emptyoutbuf(file), *(file)->nextc++ = (c)) : (*(file)->nextc++ = (c)))