3 if test -f config.sh; then TOP=.;
4 elif test -f ../config.sh; then TOP=..;
5 elif test -f ../../config.sh; then TOP=../..;
6 elif test -f ../../../config.sh; then TOP=../../..;
7 elif test -f ../../../../config.sh; then TOP=../../../..;
9 echo "Can't find config.sh."; exit 1
15 */*) cd `expr X$0 : 'X\(.*\)/'` ;;
17 echo "Extracting pat/patpost (with variable substitutions)"
18 cat >patpost <<!GROK!THIS!
20 eval "exec perl -S \$0 \$*"
21 if \$running_under_some_shell;
23 # $Id: patpost.SH,v 3.0.1.4 1995/05/12 12:25:58 ram Exp $
25 # Copyright (c) 1991-1993, Raphael Manfredi
27 # You may redistribute only under the terms of the Artistic Licence,
28 # as specified in the README file that comes with the distribution.
29 # You may reuse parts of this distribution only within the terms of
30 # that same Artistic Licence; a copy of which may be found at the root
31 # of the source tree for dist 3.0.
33 # Original Author: Larry Wall <lwall@netlabs.com>
35 # $Log: patpost.SH,v $
36 # Revision 3.0.1.4 1995/05/12 12:25:58 ram
37 # patch54: added explicit From: header line pointing to the maintainer
39 # Revision 3.0.1.3 1994/01/24 14:32:09 ram
40 # patch16: now prefix error messages with program's name
41 # patch16: added ~/.dist_profile awareness
43 # Revision 3.0.1.2 1993/08/24 12:19:48 ram
44 # patch3: added ~name expansion for orgname
45 # patch3: random cleanup
47 # Revision 3.0.1.1 1993/08/19 06:42:41 ram
48 # patch1: leading config.sh searching was not aborting properly
50 # Revision 3.0 1993/08/18 12:10:47 ram
51 # Baseline for dist 3.0 netwide release.
54 \$inews='${inews-/usr/lib/news/inews}';
56 \$version = '$VERSION';
57 \$patchlevel = '$PATCHLEVEL';
60 cat >>patpost <<'!NO!SUBS!'
62 $progname = &profile; # Read ~/.dist_profile
64 &usage unless $#ARGV >= 0;
65 &usage unless &Getopts("hrV");
68 print STDERR "$progname $version PL$patchlevel\n";
74 $RCSEXT = ',v' unless $RCSEXT;
75 if ($inews eq 'inews') {
76 $inews = '/usr/lib/news/inews' if -f '/usr/lib/news/inews';
79 chdir '..' if -d '../bugs';
83 $orgname = &tilda_expand($orgname);
84 chop($orgname = `cat $orgname`) if $orgname =~ m|^/|;
87 $repost = ' (REPOST)';
91 if (/^(patch)?[1-9][\d\-]*$/) {
98 $newsgroups = join(',',@newsgroups) unless $#newsgroups < 0;
99 &usage unless $newsgroups;
102 open(PL,"patchlevel.h") || die "$progname: can't open patchlevel.h: $!\n";
104 $maxnum = $1 if /^#define\s+PATCHLEVEL\s+(\d+)/;
107 die "$progname: malformed patchlevel.h file.\n" if $maxnum eq '';
110 @patseq = &patseq($maxnum);
111 $lastpat = pop(@patseq);
112 $argv = &rangeargs("$lastpat-$maxnum");
115 $argv = &rangeargs(@ARGV);
118 @ARGV = split(' ',$argv);
122 print STDERR "$progname: no patches specified.\n";
126 "$progname: posting $package $baserev patches $argv to $newsgroups...\n";
129 "$progname: posting $package $baserev patch $argv to $newsgroups...\n";
132 chdir 'bugs' || die "$progname: can't cd to bugs: $!\n";
138 open(PATCH,"patch$patnum") ||
139 die "$progname: can't open patch$patnum: $!\n";
140 open(XHEAD,"|$inews -h") || die "$progname: can't fork $inews: $!\n";
142 "From: $maintloc ($maintname)
143 Newsgroups: $newsgroups
144 Subject: $package $baserev patch #$patnum$repost
145 Summary: This is an official patch for $package $baserev. Please apply it.
150 Organization: $orgname
159 die "$progname: could not post patch$patnum.\n" if $?;
164 Usage: $progname [-hrV] patchlist newsgroups
165 -h : print this message and exit
166 -r : signals a repost
167 -V : print version number and exit
173 $grep -v '^;#' ../pl/package.pl >>patpost
174 $grep -v '^;#' ../pl/rangeargs.pl >>patpost
175 $grep -v '^;#' ../pl/patseq.pl >>patpost
176 $grep -v '^;#' ../pl/tilde.pl >>patpost
177 $grep -v '^;#' ../pl/profile.pl >>patpost