From patchwork Fri Sep 7 08:34:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrej Shadura X-Patchwork-Id: 10592265 X-Patchwork-Delegate: herbert@gondor.apana.org.au Delivered-To: konstantin@linuxfoundation.org Received: by 2002:a0c:fb06:0:0:0:0:0 with SMTP id c6-v6csp1459488qvp; Fri, 7 Sep 2018 01:35:12 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbpyVzE8M/zUZd6oWFa4UFnW1kBMEPpS3u3pzJ6DgQGshVcvM+AyCXb0YSbjJgaH8/0n9vy X-Received: by 2002:a17:902:8506:: with SMTP id bj6-v6mr6701551plb.210.1536309312532; Fri, 07 Sep 2018 01:35:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536309312; cv=none; d=google.com; s=arc-20160816; b=Y9esPY99A35ZyH0YAeYQ+1eXNSuv1kBqAdmpFEJqfqpmA/X8xRZE8KAN9dbvfgLx9u kTX9msv9iOgTKyWrKIA7Rmw/q4dY81pXWuALvez2O4Q0/Jo8zqD+sp6MRWbbru6yjocR dqOBmkZi8Uo7l1c+Omz04gCxmmkVJNXG77YVGLIPBOvZ+sORcLNaPwVp1J9Ptk0xqSNV 0Sn0SGA8uVnHj3375CdK2nrU5nuvAiwwC7fE8ytbK0DkUS2d4Ve6pAinNmLsPABrwjQz OpST2zPho0+skRvbygZte4CqrGZdpa4McPE0VfC3Bsez8t4IQTX2lKDIGgwUTO9nDALz rsmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:to:from; bh=SXPS5JEyZrwCnsHqouZrPT+A96gaT6L7PlS0IRhirq0=; b=CjgHHb307dc5v2LXdZzV/mELsOx810tonEn5OLEntT/9rexiWTVNC1B735cjlai0ul ZbnWA2VR2dPzjUlDJYpwZt1kHI/mgu8MEbzUz668X9dz6lkIUh4J6UqfhrR/lM7eH5wr Q/SNsD6qaK7B2UhCSOvM9nk5whRT0Lb8yVbQQbVll+zW4YayH49YT3fiFLPpDgkEzYu0 YrIuxaMQp7rVKIoWMupEEtVVuo1GeyTS3XlNCux/h4/D8Fpj66ggVWurCmmhXxVd6AS4 kTM7PFZuVHUQt8/mz3laPBv0yKzs61hTK0/tMoJ6RKqKiGnvh1gkBEEc9kPcr1fc4LQW xuug== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of dash-owner@kernel.org designates 198.145.29.98 as permitted sender) smtp.mailfrom=dash-owner@kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.co.uk Return-Path: Received: from mail.wl.linuxfoundation.org (mail.wl.linuxfoundation.org. [198.145.29.98]) by mx.google.com with ESMTPS id e22-v6si7630605pfb.185.2018.09.07.01.35.12 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 07 Sep 2018 01:35:12 -0700 (PDT) Received-SPF: pass (google.com: domain of dash-owner@kernel.org designates 198.145.29.98 as permitted sender) client-ip=198.145.29.98; Authentication-Results: mx.google.com; spf=pass (google.com: domain of dash-owner@kernel.org designates 198.145.29.98 as permitted sender) smtp.mailfrom=dash-owner@kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.co.uk Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2BE7F2ADDE for ; Fri, 7 Sep 2018 08:35:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2078C2ADE1; Fri, 7 Sep 2018 08:35:12 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D23442ADD8 for ; Fri, 7 Sep 2018 08:35:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C705D2ADE1; Fri, 7 Sep 2018 08:35:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 72B7F2ADD8 for ; Fri, 7 Sep 2018 08:35:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728088AbeIGNPC (ORCPT ); Fri, 7 Sep 2018 09:15:02 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:35254 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727848AbeIGNPC (ORCPT ); Fri, 7 Sep 2018 09:15:02 -0400 Received: from localhost (2a02-ab04-03b9-5e00-0000-0000-0000-0003.dynamic.v6.chello.sk [IPv6:2a02:ab04:3b9:5e00::3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: andrewsh) by bhuna.collabora.co.uk (Postfix) with ESMTPSA id 76E262706ED; Fri, 7 Sep 2018 09:35:06 +0100 (BST) From: Andrej Shadura To: dash@vger.kernel.org Subject: [PATCH 6/6] main: Print \n upon EOF (CTRL-D) when run interactively Date: Fri, 7 Sep 2018 10:34:14 +0200 Message-Id: <20180907083414.14673-7-andrew.shadura@collabora.co.uk> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180907083414.14673-1-andrew.shadura@collabora.co.uk> References: <20180907083414.14673-1-andrew.shadura@collabora.co.uk> Sender: dash-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dash@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP X-Virus-Scanned: ClamAV using ClamSMTP Status: O Content-Length: 1105 Lines: 48 From: Gerrit Pape Exiting dash via a ^D instead of with "exit" causes dash to forget to print a newline. sh-3.1$ sh sh-3.1$ ^D sh-3.1$ dash $ sh-3.1$ It is more neat and tidy to send a newline similarly to what bash does, so it doesn't make the next prompt of the parent shell look ugly. Suggested by jidanni. Signed-off-by: Gerrit Pape Signed-off-by: Jonathan Nieder [reworded the patch description] Signed-off-by: Andrej Shadura Bug-Debian: http://bugs.debian.org/476422 --- src/main.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main.c b/src/main.c index e8e4256..6d53e00 100644 --- a/src/main.c +++ b/src/main.c @@ -221,8 +221,15 @@ cmdloop(int top) if (!top || numeof >= 50) break; if (!stoppedjobs()) { - if (!Iflag) + if (!Iflag) { + if (iflag) { + out2c('\n'); +#ifdef FLUSHERR + flushout(out2); +#endif + } break; + } out2str("\nUse \"exit\" to leave shell.\n"); } numeof++;