public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH, 4/5] check_GNU_style.sh: Put stdin into temp file
@ 2015-05-12  7:30 Tom de Vries
  2015-05-12 15:07 ` Jeff Law
  0 siblings, 1 reply; 2+ messages in thread
From: Tom de Vries @ 2015-05-12  7:30 UTC (permalink / raw)
  To: GCC Patches

[-- Attachment #1: Type: text/plain, Size: 202 bytes --]

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


[-- Attachment #2: 0004-check_GNU_style.sh-Put-stdin-into-temp-file.patch --]
[-- Type: text/x-patch, Size: 1257 bytes --]

[PATCH 4/5] check_GNU_style.sh: Put stdin into temp file

2015-05-11  Tom de Vries  <tom@codesourcery.com>

	* 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



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH, 4/5] check_GNU_style.sh: Put stdin into temp file
  2015-05-12  7:30 [PATCH, 4/5] check_GNU_style.sh: Put stdin into temp file Tom de Vries
@ 2015-05-12 15:07 ` Jeff Law
  0 siblings, 0 replies; 2+ messages in thread
From: Jeff Law @ 2015-05-12 15:07 UTC (permalink / raw)
  To: Tom de Vries, GCC Patches

On 05/12/2015 01:29 AM, Tom de Vries wrote:
> 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
>
>
> 0004-check_GNU_style.sh-Put-stdin-into-temp-file.patch
>
>
> [PATCH 4/5] check_GNU_style.sh: Put stdin into temp file
>
> 2015-05-11  Tom de Vries<tom@codesourcery.com>
>
> 	* check_GNU_style.sh: Put stdin into a temp file.
OK.
jeff

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-05-12 15:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-12  7:30 [PATCH, 4/5] check_GNU_style.sh: Put stdin into temp file Tom de Vries
2015-05-12 15:07 ` Jeff Law

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).