From owner-svn-src-all@freebsd.org Wed Mar 27 22:09:36 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 66056155D0AF; Wed, 27 Mar 2019 22:09:36 +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 0A5596B860; Wed, 27 Mar 2019 22:09:36 +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 D7084D7E0; Wed, 27 Mar 2019 22:09:35 +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 x2RM9ZFb062621; Wed, 27 Mar 2019 22:09:35 GMT (envelope-from jilles@FreeBSD.org) Received: (from jilles@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2RM9ZAp062619; Wed, 27 Mar 2019 22:09:35 GMT (envelope-from jilles@FreeBSD.org) Message-Id: <201903272209.x2RM9ZAp062619@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jilles set sender to jilles@FreeBSD.org using -f From: Jilles Tjoelker Date: Wed, 27 Mar 2019 22:09:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r345617 - stable/11/bin/sh X-SVN-Group: stable-11 X-SVN-Commit-Author: jilles X-SVN-Commit-Paths: stable/11/bin/sh X-SVN-Commit-Revision: 345617 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 0A5596B860 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(-1.00)[-0.995,0]; NEURAL_HAM_SHORT(-0.96)[-0.965,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,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: Wed, 27 Mar 2019 22:09:36 -0000 Author: jilles Date: Wed Mar 27 22:09:35 2019 New Revision: 345617 URL: https://svnweb.freebsd.org/changeset/base/345617 Log: MFC r344306: sh: Send normal output from bind builtin to stdout PR: 233343 Modified: stable/11/bin/sh/histedit.c stable/11/bin/sh/output.c stable/11/bin/sh/output.h Directory Properties: stable/11/ (props changed) Modified: stable/11/bin/sh/histedit.c ============================================================================== --- stable/11/bin/sh/histedit.c Wed Mar 27 22:05:57 2019 (r345616) +++ stable/11/bin/sh/histedit.c Wed Mar 27 22:09:35 2019 (r345617) @@ -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/11/bin/sh/output.c ============================================================================== --- stable/11/bin/sh/output.c Wed Mar 27 22:05:57 2019 (r345616) +++ stable/11/bin/sh/output.c Wed Mar 27 22:09:35 2019 (r345617) @@ -345,6 +345,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/11/bin/sh/output.h ============================================================================== --- stable/11/bin/sh/output.h Wed Mar 27 22:05:57 2019 (r345616) +++ stable/11/bin/sh/output.h Wed Mar 27 22:09:35 2019 (r345617) @@ -37,6 +37,7 @@ #include #include +#include struct output { char *nextc; @@ -73,6 +74,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)->nleft < 0? (emptyoutbuf(file), *(file)->nextc++ = (c)) : (*(file)->nextc++ = (c)))