From owner-svn-src-stable-12@freebsd.org Tue Sep 3 14:05:50 2019 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 88B1FDBE80; Tue, 3 Sep 2019 14:05:47 +0000 (UTC) (envelope-from yuripv@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [96.47.72.132]) (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 "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46N7yg0dk8z4NqZ; Tue, 3 Sep 2019 14:05:47 +0000 (UTC) (envelope-from yuripv@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 1452) id F423119B59; Tue, 3 Sep 2019 14:05:46 +0000 (UTC) X-Original-To: yuripv@localmail.freebsd.org Delivered-To: yuripv@localmail.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [96.47.72.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client CN "mx1.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by freefall.freebsd.org (Postfix) with ESMTPS id 92E631718; Wed, 27 Mar 2019 21:53:49 +0000 (UTC) (envelope-from owner-src-committers@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2610:1c1:1:6074::16:84]) (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 "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 369DD6ADD7; Wed, 27 Mar 2019 21:53:49 +0000 (UTC) (envelope-from owner-src-committers@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 538) id 1A0691716; Wed, 27 Mar 2019 21:53:49 +0000 (UTC) Delivered-To: src-committers@localmail.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client CN "mx1.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by freefall.freebsd.org (Postfix) with ESMTPS id 483A7170B for ; Wed, 27 Mar 2019 21:53:46 +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 DDD8B6ADC5; Wed, 27 Mar 2019 21:53:45 +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 A114DD633; Wed, 27 Mar 2019 21:53:45 +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 x2RLrjms057015; Wed, 27 Mar 2019 21:53:45 GMT (envelope-from jilles@FreeBSD.org) Received: (from jilles@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2RLrifl057012; Wed, 27 Mar 2019 21:53:44 GMT (envelope-from jilles@FreeBSD.org) Message-Id: <201903272153.x2RLrifl057012@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jilles set sender to jilles@FreeBSD.org using -f From: Jilles Tjoelker To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r345613 - stable/12/bin/sh X-SVN-Group: stable-12 X-SVN-Commit-Author: jilles X-SVN-Commit-Paths: stable/12/bin/sh X-SVN-Commit-Revision: 345613 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk X-Loop: FreeBSD.org Sender: owner-src-committers@freebsd.org X-Rspamd-Queue-Id: 369DD6ADD7 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[freebsd.org]; NEURAL_HAM_MEDIUM(-0.99)[-0.993,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.96)[-0.964,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] Status: O X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Date: Tue, 03 Sep 2019 14:05:50 -0000 X-Original-Date: Wed, 27 Mar 2019 21:53:44 +0000 (UTC) X-List-Received-Date: Tue, 03 Sep 2019 14:05:50 -0000 Author: jilles Date: Wed Mar 27 21:53:44 2019 New Revision: 345613 URL: https://svnweb.freebsd.org/changeset/base/345613 Log: MFC r344306: sh: Send normal output from bind builtin to stdout PR: 233343 Modified: stable/12/bin/sh/histedit.c stable/12/bin/sh/output.c stable/12/bin/sh/output.h Directory Properties: stable/12/ (props changed) Modified: stable/12/bin/sh/histedit.c ============================================================================== --- stable/12/bin/sh/histedit.c Wed Mar 27 21:50:07 2019 (r345612) +++ stable/12/bin/sh/histedit.c Wed Mar 27 21:53:44 2019 (r345613) @@ -474,10 +474,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: stable/12/bin/sh/output.c ============================================================================== --- stable/12/bin/sh/output.c Wed Mar 27 21:50:07 2019 (r345612) +++ stable/12/bin/sh/output.c Wed Mar 27 21:53:44 2019 (r345613) @@ -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: stable/12/bin/sh/output.h ============================================================================== --- stable/12/bin/sh/output.h Wed Mar 27 21:50:07 2019 (r345612) +++ stable/12/bin/sh/output.h Wed Mar 27 21:53:44 2019 (r345613) @@ -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)))