-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/print
Copy pathMore file actions
executable file
·234 lines (212 loc) · 7.63 KB
/print
File metadata and controls
executable file
·234 lines (212 loc) · 7.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
: "print print Emacs documentation"
# This script prints documents that are included in the Emacs distribution.
# Just type 'sh print' and it will ask you which documents you want to print,
# and then if you want to go ahead and print them right now. If you say yes,
# it will do so. Otherwise, it will leave a script called PrintScript in the
# top-level directory which contains shell commands to print the desired files.
# You can run PrintScript later by typing 'sh PrintScript'.
#
# You can also give various arguments to the print command.
#
# print with no args, asks about all documents and offers to
# print them immediately in background, or leaves a
# script that will print them when it is executed.
# WARNING: This produces a very large amount of output.
# print release prints release notes
# print instguide prints the Emacs Installation Guide
# print usrguide prints the Emacs User's guide
# print manpages prints the Emacs man pages
# print refman prints reference manual (a large document)
# print background executes the remaining arguments in background
# print clean cleans the distribution directories
# print viplus print viplus addon program documentation
# print cmacs print cmacs addon program documentation
# print watch monitor background print in progress
# print review examine print log from beginning
#
# Assignment arguments (e.g., TROFF=ditroff) are passed on to Make.
# The assignment arguments must precede the object to which they refer.
# For example,
#
# print TROFF=ditroff release
# or
# print TROFF=nroff release
#
# Parameters
#
# TROFF the name of the troff formatter on your system. gives the
# name of the troff formatter on your system. ptroff is
# suitable for standard TransScript installations on Suns, for
# instance. You can set this by 'print TROFF=troff manpages'.
#
# Each addon subsystem comes with a script, config/add<name>.sh, which expects
# to be invoked with the name of the operation it is supposed to perform as an
# argument.
#
# Run this script from the distribution root (the directory in which it is
# supplied in the distribution).
######################################################################
TROFF=ptroff
#MAKEN=-n
######################################################################
#
# If you don't have ptroff on your system, you can change to another
# program that you do have (like nroff, ditroff or troff).
#
export TROFF MAKEN
LOGFILE=print.LOG # background prints are logged here
PATH=:./config:$PATH; export PATH
# program names, relative to top-level distribution directory
#
TIME=/bin/time # runs its args follows by time summary
CONFIRM=config/confirm.sh
INTERVIEW=config/interview.sh
CONFIRM=config/confirm.sh
ADDPREFIX=config/add # prepended to argument
VERSION=V2.20
INSTDIR=doc/D.install # Installation Guide lives here
RELDIR=doc/D.relnotes # Release Notes lives here
MANPAGEDIR=man # man pages live here
UGDIR=man/D.usersguide # User's Guide lives here
REFMANDIR=man/D.refman # Reference Manual lives here
PRMSCRIPT=PrintScript
SCRIPT=/tmp/print-$$
#PARAMETERS="TROFF=$TROFF MAKEN=$MAKEN"
# find the local equivalent of more
#
for MORE in more page pg cat
do if sh -c "$MORE /dev/null" >/dev/null 2>&1
then break
fi
done
if [ $# = 0 ]
then set instguide cmacs viplus manpages release usrguide refman
echo
echo "UniPress Emacs V2.20 (24-Aug-89) Print Script"
echo
echo " You will be asked whether you want to print each of the Emacs"
echo " documents. You should respond to each question with 'TRUE' or"
echo " 'FALSE' followed by a RETURN."
echo " Nothing will actually be printed until the end, when you will be"
echo " asked if you want to print all the documents that you have chosen."
echo " (The print jobs may be quite large.)"
echo
echo "NOTE: The program that will be used to print these documents is" $TROFF"."
echo " If you don't have this program on your system, you will have to"
echo " change the Makefile to use a program that you do have."
echo
fi
set $* confirm background print
# LOGGING will be set to TRUE if we were started in background, or will
# otherwise be null.
#
if [ x$LOGGING != x ] ; then echo "Emacs Print Log: $* `date`"; fi
>$SCRIPT # clear the script
TOTALPAGES=0 # accumulate approx. expected page count here
for i
do shift
case $i in
# Uppercase args are assumed to be variable settings
[A-Z]*)
eval $i # set it in print script itself
PARAMETERS="$PARAMETERS $i" # arrange for it to be passed down
;;
background)
echo
echo "Executing '"$0 $*"' into $LOGFILE"
(LOGGING=TRUE sh $0 $* $PARAMETERS) >$LOGFILE 2>&1 &
if [ `$CONFIRM "Do you want to watch its progress? " TRUE` = TRUE ]
then exec $0 watch
else echo "Type 'print watch' any time to monitor it"
exit 0
fi
;;
confirm)
if [ -f $SCRIPT -a ! -z $SCRIPT ]
then mv $SCRIPT $PRMSCRIPT
echo "The total number of pages to be printed is expected to"
echo "be approximately $TOTALPAGES. If you answer 'y' now"
echo "they will be printed in the background (i.e., you"
echo "will be able to use the terminal for other things)."
echo "If you answer 'n' the commands to print the documents"
echo "will be left in a script ($PRMSCRIPT) which you may"
echo "execute later if you decide you want to print them."
if [ `$CONFIRM "Print the documents now? " TRUE` != TRUE ]
then echo "Exiting, not doing $*"
echo "Type 'sh $PRMSCRIPT' to print the documents."
exit 0
fi
fi
;;
watch)
echo "Monitoring print in progress in ${LOGFILE}:"
sed -n 1p $LOGFILE
echo " (type your interrupt character to return to your shell)"
echo
tail -f $LOGFILE
;;
review)
$MORE $LOGFILE
;;
print)
sh $PRMSCRIPT
exit 0
;;
clean)
echo; echo "cleaning Emacs distribution: $PARAMETERS "
(cd src; $TIME make cleanall $PARAMETERS)
;;
release)
NAME="Release Notes"
PAGES=100
if [ `$CONFIRM "Print $NAME (~$PAGES pages)?" TRUE` = TRUE ]
then echo "echo 'Printing Emacs $VERSION $NAME';
(cd $RELDIR; $TIME make $MAKEN print $PARAMETERS)" >>$SCRIPT
TOTALPAGES=`expr $TOTALPAGES + $PAGES`
fi
;;
instguide)
NAME="Installation Guide"
PAGES=44
if [ `$CONFIRM "Print $NAME (~$PAGES pages)?" TRUE` = TRUE ]
then echo "echo 'Printing Emacs $VERSION $NAME';
(cd $INSTDIR; $TIME make $MAKEN print $PARAMETERS)" >>$SCRIPT
TOTALPAGES=`expr $TOTALPAGES + $PAGES`
fi
;;
manpages)
NAME="man pages"
PAGES=20
if [ `$CONFIRM "Print $NAME (~$PAGES pages)?" TRUE` = TRUE ]
then echo "echo 'Printing Emacs $VERSION $NAME';
(cd $MANPAGEDIR; $TIME make $MAKEN print $PARAMETERS)" >>$SCRIPT
TOTALPAGES=`expr $TOTALPAGES + $PAGES`
fi
;;
usrguide)
NAME="User's Guide"
PAGES=210
if [ `$CONFIRM "Print $NAME (~$PAGES pages)?" TRUE` = TRUE ]
then echo "echo 'Printing Emacs $VERSION $NAME';
(cd $UGDIR; $TIME make $MAKEN print $PARAMETERS)" >>$SCRIPT
TOTALPAGES=`expr $TOTALPAGES + $PAGES`
fi
;;
refman)
NAME="Reference Manual"
PAGES=750
if [ `$CONFIRM "Print $NAME (~$PAGES pages)?" TRUE` = TRUE ]
then echo "echo 'Printing Emacs $VERSION $NAME';
(cd $REFMANDIR; $TIME make $MAKEN print $PARAMETERS)" >>$SCRIPT
TOTALPAGES=`expr $TOTALPAGES + $PAGES`
fi
;;
# treat otherwise unrecognized args as name of an addon
*)
if [ -f $ADDPREFIX${i}.sh ]
then (cd config;
eval "$PARAMETERS add${i}.sh $0 $PARAMETERS") >>$SCRIPT
fi
;;
esac
done