summaryrefslogtreecommitdiff
path: root/pat
diff options
context:
space:
mode:
Diffstat (limited to 'pat')
-rw-r--r--pat/pat.man90
-rwxr-xr-xpat/patcil.SH14
-rwxr-xr-xpat/patdiff.SH22
3 files changed, 67 insertions, 59 deletions
diff --git a/pat/pat.man b/pat/pat.man
index bc957d1..326df1e 100644
--- a/pat/pat.man
+++ b/pat/pat.man
@@ -1,42 +1,42 @@
.rn '' }`
-''' $Id: pat.man 3 2006-08-25 21:39:07Z rmanfredi $
-'''
-''' Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi
-'''
-''' You may redistribute only under the terms of the Artistic Licence,
-''' as specified in the README file that comes with the distribution.
-''' You may reuse parts of this distribution only within the terms of
-''' that same Artistic Licence; a copy of which may be found at the root
-''' of the source tree for dist 4.0.
-'''
-''' $Log: pat.man,v $
-''' Revision 3.0.1.7 1997/02/28 16:32:45 ram
-''' patch61: documents contents of the message sent by patnotify
-'''
-''' Revision 3.0.1.6 1995/09/25 09:20:41 ram
-''' patch59: new -i option for patsend to add extra instructions
-'''
-''' Revision 3.0.1.5 1995/05/12 12:25:28 ram
-''' patch54: updated my e-mail address
-'''
-''' Revision 3.0.1.4 1994/10/29 16:38:31 ram
-''' patch36: documents new patlog script and the files it uses
-''' patch36: the RCS layer section has been extended slightly
-'''
-''' Revision 3.0.1.3 1993/08/27 14:40:19 ram
-''' patch7: random cleanup
-'''
-''' Revision 3.0.1.2 1993/08/25 14:05:02 ram
-''' patch6: new -q option for patsend and patnotify
-'''
-''' Revision 3.0.1.1 1993/08/24 12:15:42 ram
-''' patch3: added patnotify and patsnap
-''' patch3: patcol has a new -S option
-''' patch3: the users file built by mailagent is now listed under FILES
-'''
-''' Revision 3.0 1993/08/18 12:10:37 ram
-''' Baseline for dist 3.0 netwide release.
-'''
+.\" $Id: pat.man 3 2006-08-25 21:39:07Z rmanfredi $
+.\"
+.\" Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi
+.\"
+.\" You may redistribute only under the terms of the Artistic Licence,
+.\" as specified in the README file that comes with the distribution.
+.\" You may reuse parts of this distribution only within the terms of
+.\" that same Artistic Licence; a copy of which may be found at the root
+.\" of the source tree for dist 4.0.
+.\"
+.\" $Log: pat.man,v $
+.\" Revision 3.0.1.7 1997/02/28 16:32:45 ram
+.\" patch61: documents contents of the message sent by patnotify
+.\"
+.\" Revision 3.0.1.6 1995/09/25 09:20:41 ram
+.\" patch59: new -i option for patsend to add extra instructions
+.\"
+.\" Revision 3.0.1.5 1995/05/12 12:25:28 ram
+.\" patch54: updated my e-mail address
+.\"
+.\" Revision 3.0.1.4 1994/10/29 16:38:31 ram
+.\" patch36: documents new patlog script and the files it uses
+.\" patch36: the RCS layer section has been extended slightly
+.\"
+.\" Revision 3.0.1.3 1993/08/27 14:40:19 ram
+.\" patch7: random cleanup
+.\"
+.\" Revision 3.0.1.2 1993/08/25 14:05:02 ram
+.\" patch6: new -q option for patsend and patnotify
+.\"
+.\" Revision 3.0.1.1 1993/08/24 12:15:42 ram
+.\" patch3: added patnotify and patsnap
+.\" patch3: patcol has a new -S option
+.\" patch3: the users file built by mailagent is now listed under FILES
+.\"
+.\" Revision 3.0 1993/08/18 12:10:37 ram
+.\" Baseline for dist 3.0 netwide release.
+.\"
.de Sh
.br
.ne 5
@@ -48,10 +48,10 @@
.if t .sp .5v
.if n .sp
..
-'''
-''' Set up \*(-- to give an unbreakable dash;
-''' string Tr holds user defined translation string.
-'''
+.\"
+.\" Set up \*(-- to give an unbreakable dash;
+.\" string Tr holds user defined translation string.
+.\"
.ie n \{\
.tr \(*W-\*(Tr
.ds -- \(*W-
@@ -408,9 +408,9 @@ may be used from the top level directory or within the \fIbugs\fR directory.
It will list all the patches and their \fISubject:\fR lines. This program
knows about compressed patches and will decompress them while producing
the listing.
-'''
-''' R C S L a y e r
-'''
+.\"
+.\" R C S L a y e r
+.\"
.SH RCS LAYER
This section describes the RCS layer, in case something in the tools breaks,
so that you may fix your RCS files and restart the operation.
diff --git a/pat/patcil.SH b/pat/patcil.SH
index c6912b3..d8d0511 100755
--- a/pat/patcil.SH
+++ b/pat/patcil.SH
@@ -61,6 +61,8 @@ $startperl
!GROK!THIS!
cat >>patcil <<'!NO!SUBS!'
+use File::Temp qw/ tempfile tempdir /;
+
$progname = &profile; # Read ~/.dist_profile
require 'getopts.pl';
&usage unless $#ARGV >= 0;
@@ -504,12 +506,12 @@ x Toggle patch# prefix.
sub edit {
local($text) = join("\n", @_);
- open(TMP,">/tmp/cil$$") || die "Can't create /tmp/cil$$";
- print TMP $text;
- close TMP;
- system $EDITOR, "/tmp/cil$$";
- $text = `cat /tmp/cil$$`;
- unlink "/tmp/cil$$";
+ my $tmp = File::Temp->new();
+ print $tmp $text;
+ close $tmp;
+ system $EDITOR, "$tmp";
+ $text = `cat "$tmp"`;
+ unlink "$tmp";
$text;
}
diff --git a/pat/patdiff.SH b/pat/patdiff.SH
index 991d4bf..3ca1973 100755
--- a/pat/patdiff.SH
+++ b/pat/patdiff.SH
@@ -49,6 +49,8 @@ $startperl
!GROK!THIS!
cat >>patdiff <<'!NO!SUBS!'
+use File::Temp qw/ tempfile tempdir /;
+
$RCSEXT = ',v' unless $RCSEXT;
$TOPDIR = ''; # We are at top-level directory
@@ -159,9 +161,11 @@ foreach $file (@ARGV) {
close DIFF;
system 'rcs', "-Nlastpat:$new", @files;
} else {
- &copyright'expand("co -p -rlastpat $file", "/tmp/pdo$$");
- &copyright'expand("co -p -r$new $file", "/tmp/pdn$$");
- open(DIFF, "$mydiff /tmp/pdo$$ /tmp/pdn$$ |") ||
+ my $tmpo = File::Temp->new();
+ my $tmpn = File::Temp->new();
+ &copyright'expand("co -p -rlastpat $file", "$tmpo");
+ &copyright'expand("co -p -r$new $file", "$tmpn");
+ open(DIFF, "$mydiff $tmpo $tmpn |") ||
die "Can't run $mydiff";
while (<DIFF>) { # Contextual or unified diff
if ($. == 1) {
@@ -177,7 +181,7 @@ foreach $file (@ARGV) {
}
close DIFF;
system 'rcs', "-Nlastpat:$new", @files;
- unlink "/tmp/pdn$$", "/tmp/pdo$$";
+ unlink "$tmpo", "$tmpn";
}
} else {
if ($mydiff eq '') {
@@ -191,9 +195,11 @@ foreach $file (@ARGV) {
}
close DIFF;
} else {
- system "co -p -rlastpat $files >/tmp/pdo$$";
- system "cp $file /tmp/pdn$$";
- open(DIFF, "$mydiff /tmp/pdo$$ /tmp/pdn$$ |") ||
+ my $tmpo = File::Temp->new();
+ my $tmpn = File::Temp->new();
+ system "co -p -rlastpat $files >$tmpo";
+ system "cp $file $tmpn";
+ open(DIFF, "$mydiff $tmpo $tmpn |") ||
die "$progname: can't fork $mydiff: $!\n";
while (<DIFF>) {
# Contextual or unified diff
@@ -209,7 +215,7 @@ foreach $file (@ARGV) {
print PATCH;
}
close DIFF;
- unlink "/tmp/pdn$$", "/tmp/pdo$$";
+ unlink "$tmpo", "$tmpn";
}
}
}