From patchwork Tue May 12 07:29:34 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 471165 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 1FF061400A0 for ; Tue, 12 May 2015 17:29:49 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=aBnz4UNx; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:subject:content-type; q= dns; s=default; b=M+YzKyxNGw9nsNaPxF2bd6A+/7qDgh41V9GjpTQW4FpUss MhoDcJXOBLGIgNgtbZZ4OWWKXxPwogh+4blkF/DoG9KvlbJ00DIlpDGqne9n/B7S UOaMEwn3r4tNdfrn5/Gpk+ERNclIf6BppYOfAVayaLkqVVew6W0WzBGGMzGrc= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:subject:content-type; s= default; bh=p76b3tctwlo6405iOysvAvn16/8=; b=aBnz4UNx3/BNTzNYPaqc JxvqoeTSBsFwmM9L6eSURRvoQbWZyKONCbKY2WCjWTC/nM47w7Wz8dWbdEjnXyjm UKwfXD2zX/MN1ADuN0+p8vxCVwdEnuPyjGFM1K+xc1dfiAzOoiBM3pqdfykYPuAU UqvgctWBu5UtzjTYidB5tSM= Received: (qmail 47126 invoked by alias); 12 May 2015 07:29:42 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 47114 invoked by uid 89); 12 May 2015 07:29:41 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 12 May 2015 07:29:40 +0000 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=SVR-IES-FEM-02.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1Ys4dF-0001gI-Im from Tom_deVries@mentor.com for gcc-patches@gcc.gnu.org; Tue, 12 May 2015 00:29:37 -0700 Received: from [127.0.0.1] (137.202.0.76) by SVR-IES-FEM-02.mgc.mentorg.com (137.202.0.106) with Microsoft SMTP Server id 14.3.224.2; Tue, 12 May 2015 08:29:36 +0100 Message-ID: <5551ABDE.1090602@mentor.com> Date: Tue, 12 May 2015 09:29:34 +0200 From: Tom de Vries User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: GCC Patches Subject: [PATCH, 4/5] check_GNU_style.sh: Put stdin into temp file Hi, this patch makes sure we dump stdin into a file before we handle it in the rest of the script. This makes the stdin handling more like the handling of normal files. OK for trunk? Thanks, - Tom [PATCH 4/5] check_GNU_style.sh: Put stdin into temp file 2015-05-11 Tom de Vries * check_GNU_style.sh: Put stdin into a temp file. --- contrib/check_GNU_style.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/contrib/check_GNU_style.sh b/contrib/check_GNU_style.sh index f00b3d5..318eb6a 100755 --- a/contrib/check_GNU_style.sh +++ b/contrib/check_GNU_style.sh @@ -40,8 +40,15 @@ nfiles=$# files="$*" stdin=false +stdin_tmp="" if [ $nfiles -eq 1 ] && [ "$files" = "-" ]; then stdin=true + + # By putting stdin into a temp file, we can handle it just like any other + # file. F.i., we can cat it twice, which we can't do with stdin. + stdin_tmp=check_GNU_style.stdin + cat - > $stdin_tmp + files=$stdin_tmp else for f in $files; do if [ "$f" = "-" ]; then @@ -60,8 +67,8 @@ inp=check_GNU_style.inp tmp=check_GNU_style.tmp # Remove $tmp on exit and various signals. -trap "rm -f $inp $tmp" 0 -trap "rm -f $inp $tmp ; exit 1" 1 2 3 5 9 13 15 +trap "rm -f $inp $tmp $stdin_tmp" 0 +trap "rm -f $inp $tmp $stdin_tmp; exit 1" 1 2 3 5 9 13 15 if [ $nfiles -eq 1 ]; then # There's no need for the file prefix if we're dealing only with one file. -- 1.9.1