[m-rev.] diff: allow cvspatch to work from stdin.

Tyson Dowd trd at miscrit.be
Wed Aug 22 21:00:20 AEST 2001


Hi,

It annoyed me too much that cvspatch doesn't work like patch and allow
input from stdin.  So now it does.

This isn't a 10/10 solution but it's not much worse than what was
already there (not great temporary files, no trapping of signals, etc).

===================================================================


Estimated hours taken: 0.2
Branches: main

tools/cvspatch:
	Allow cvspatch to take input from stdin.


Index: tools/cvspatch
===================================================================
RCS file: /home/mercury1/repository/mercury/tools/cvspatch,v
retrieving revision 1.2
diff -u -r1.2 cvspatch
--- tools/cvspatch	19 Nov 1999 23:20:38 -0000	1.2
+++ tools/cvspatch	22 Aug 2001 10:40:41 -0000
@@ -1,12 +1,11 @@
 #!/bin/sh
 
 case $# in
-	1)	;;
+	0)	cat > .cvspatch.input; inputfile=.cvspatch.input ;;
+	1)	inputfile=$1 ;;
 	*)	echo 1>&2 "Usage: cvspatch cvs_diff_file"; exit 1 ;;
 esac
 
-inputfile=$1
-
 awk '
 BEGIN	{
 		startline = 1;
@@ -46,5 +45,7 @@
 	awk "{ if ($start <= NR && NR <= $end) print}" < $inputfile > $dirname/.cvspatch
 	( cd $dirname ; patch < .cvspatch ; /bin/rm .cvspatch )
 done
+
+rm -f .cvspatch.input
 
 exit 0

--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list