2 %%BoundingBox: 25 25 290 900
3 %%Title: AMANDA Full Page Label
4 %%Creator: Amanda reporter
9 %% This template file is used by AMANDA to create PostScript dump log
10 %% listings for each run suitable for three-hole punching.
12 %% This prologue is based on one from Steven Freed <sfreed@gilasoft.com>
13 %% called 8.5x11.ps and was enhanced with assistance from Dale Talcott
16 %% John R. Jackson, Technical Software Specialist, jrj@purdue.edu
20 % If you are printing duplex, change the 0 to a 1 in the following line:
26 % The following string (inside the parenthesis) will be displayed as
27 % the "Location" (e.g. organization) on each page (see the page format
31 /LocationString (Magic Software Development, Inc.) def
34 % Set the margin widths. This may need adjustment based on how your
35 % printer defines the printable area on a page.
39 72 mul % one inch == 72 points
42 25.4 div % one inch == 25.4 mm
43 inch % convert inches to points
46 /TopMargin 0.25 inch def
47 /BottomMargin 0.25 inch def
49 /OddLeftMargin 0.625 inch def % 5/8 inch
50 /OddRightMargin 0.25 inch def
53 % even and odd are the same if duplex is not used
54 /EvenLeftMargin OddLeftMargin def
55 /EvenRightMargin OddRightMargin def
57 % otherwise they are reversed
58 /EvenLeftMargin OddRightMargin def
59 /EvenRightMargin OddLeftMargin def
63 % A page is made up of these parts. The base name of the internal variable
64 % related to each is shown in parenthesis:
68 % version of Amanda (Vers)
69 % location (e.g. organisation) (Loc)
71 % statistics (about the Amanda run) (Stat)
72 % message (how to do a restore) (Mess)
73 % header for the filesystem list (Heading)
74 % filesystem list (Host)
76 % Geometrically, an odd numbered page looks like this:
78 % +----+-------------------+
79 % | TAPE_NAME page | <- section 'A'
80 % | version location date | <- section 'B'
81 % +------------------------+
82 % |statistics | message | <- section 'C' | 'F'
83 % +----+--+--------+-------+
84 % | f# hst fs lvl O-KB C-KB| <- section 'D'
85 % +-------+--------+-------+
86 % | | | | <- section 'E'
90 % Even numbered pages look the same unless DoDuplex is turned on, in
91 % which case the "page" field is on the left and the gutter width for
92 % the punch is on the right (instead of the left).
96 % section 'A' fonts and strings
99 /TitleFontSize 24 def % 24 point Helvetica-Bold
101 /Helvetica-Bold findfont
102 TitleFontSize scalefont
105 /PageFontSize 11 def % 11 point Palatino-Bold
107 /Palatino-Bold findfont
108 PageFontSize scalefont
110 /PageString1 (Page ) def
111 /PageString2 ( of ) def
114 % section 'B' fonts and strings
117 /VersFontSize 11 def % 11 point Palatino-Bold
119 /Palatino-Bold findfont
120 VersFontSize scalefont
123 /LocFontSize 12 def % 12 point Helvetica-Bold
125 /Helvetica-Bold findfont
126 LocFontSize scalefont
129 /DateFontSize 11 def % 11 point Palatino-Bold
131 /Palatino-Bold findfont
132 DateFontSize scalefont
139 /StatFontSize 9 def % 9 point Courier
142 StatFontSize scalefont
146 % section 'D' font and strings
149 /HeadingFontSize 9 def % 9 point Palatino-Bold
151 /Palatino-Bold findfont
152 HeadingFontSize scalefont
155 /HeadingFileString (File #) def
156 /HeadingHostString (Host) def
157 /HeadingFsString (File System) def
158 /HeadingLvlString (Level) def
159 /HeadingOSizeString1 (Original) def
160 /HeadingOSizeString2 (File Size (KB)) def
161 /HeadingCSizeString1 (Compressed) def
162 /HeadingCSizeString2 (File Size (KB)) def
168 /HostFontSize 9 def % 9 point Courier
171 HostFontSize scalefont
175 % section 'F' font and strings
178 /MessFontSize 9 def % 9 point Courier
181 MessFontSize scalefont
184 /MessString1 (To restore:) def
185 /MessString2 ( position tape at the start of the file and run:) def
186 /MessString3 ( dd if=$TAPE bs=32k skip=1 | zcat | restore -ibf 2 -) def
187 /MessString4 ( or run:) def
188 /MessString5 ( amrestore -p $TAPE <host> <filesystem> | restore -ibf 2 -) def
191 %% END OF USER-CONFIGURABLE OPTIONS
193 %% The rest of this file contains the internal functions used to draw
194 %% the page and (hopefully) do not need any changes.
198 TitleFont setfont % make TitleFont current
201 PageFont setfont % make PageFont current
204 VersFont setfont % make VersFont current
207 LocFont setfont % make LocFont current
210 DateFont setfont % make DateFont current
213 StatFont setfont % make StatFont current
216 HeadingFont setfont % make HeadingFont current
219 HostFont setfont % make HostFont current
222 MessFont setfont % make MessFont current
226 % apush -- increase an array size by one and push a value on the end
227 % usage: value array apush array
228 % example: /jj 0 array def
229 % /jj (first) jj apush def
230 % /jj (second) jj apush def
231 % /jj (third) jj apush def
235 exch % [ array value ]
236 /.apush exch def % save and pop the value
238 aload % [ old ... array ]
239 length % length of the old array
241 1 add % bump it by one
242 % [ old ... length+1 ]
243 array % create the new array
244 % [ old ... newarray ]
245 .apush exch % [ old ... value newarray ]
246 astore % store the values
252 % usage: llx lly urx ury box -
256 3 index 2 1 add index moveto
257 3 index 0 1 add index lineto
258 1 index 0 1 add index lineto
259 1 index 2 1 add index lineto
265 % concat -- join two strings
266 % usage: str1 str2 concat new
272 length % str2 str1 str1l
273 2 index % str2 str1 str1l str2
274 length add string % str2 str1 new
275 dup dup % str2 str1 new new new
276 4 2 roll % str2 new new str1 new
277 copy % str2 new new (str1)
278 length % str2 new new newl
279 4 -1 roll % new new newl str2
284 % max -- return the max of two numbers
285 % usage: a b max a_or_b
289 1 index 1 index % [ a b a b ]
297 % Set the basic drawable area width and height.
300 clippath % make the clip area the path
301 pathbbox % and get its bounding box
302 % [ llx lly urx ury ]
303 exch % [ llx lly ury urx ]
304 4 1 roll % [ urx llx lly ury ]
305 exch sub % total height
306 TopMargin sub BottomMargin sub % minus the margins
307 /PageHeight exch def % [ urx llx ]
309 EvenLeftMargin sub EvenRightMargin sub % minus the margins
311 newpath % zap the path
314 % Define rectangles to separate the regions.
319 PageHeight % [ llx PageHeight ]
320 TitleFontSize PageFontSize max % 'A' height
321 2 add % space between 'A' and 'B'
322 4 add % space below 'B'
323 VersFontSize LocFontSize max
324 DateFontSize max % 'B' height
325 add % 'A' height+space+'B' height
327 PageWidth % [ llx lly urx ]
328 PageHeight % [ llx lly urx ury ]
332 TitleBox % [ llx lly urx ury ]
333 pop % [ llx lly urx ]
334 3 1 roll dup % [ urx llx lly lly ]
335 StatStrings length % number of status lines
336 StatFontSize mul % height of status lines
337 MessStrings length % number of message lines
338 MessFontSize mul % height of message lines
342 sub % [ urx llx ury lly ]
343 exch % [ urx llx lly ury ]
344 4 -1 roll % [ llx lly ury urx ]
345 exch % [ llx lly urx ury ]
349 StatBox % [ llx lly urx ury ]
350 3 1 roll % [ llx ury lly urx ]
351 pop exch % [ llx lly ury ]
352 3 -1 roll % [ lly ury llx ]
359 (nn) stringwidth pop add % left and right padding
361 3 1 roll % [ ly x uy x ]
362 4 1 roll % [ x ly x uy ]
366 StatBox % [ llx lly urx ury ]
367 pop % [ llx lly urx ]
368 3 1 roll dup % [ urx llx lly lly ]
369 HeadingFontSize 2 mul % two heading lines
372 sub % [ urx llx ury lly ]
373 exch % [ urx llx lly ury ]
374 4 -1 roll % [ llx lly ury urx ]
375 exch % [ llx lly urx ury ]
379 HeadingBox % [ llx lly urx ury ]
380 pop % [ llx lly urx ]
381 3 1 roll 0 % [ urx llx lly 0 ]
382 exch % [ urx llx lly ury ]
383 4 -1 roll % [ llx lly ury urx ]
384 exch % [ llx lly urx ury ]
388 % Compute the center point for the section 'A' title text.
392 TitleBox % [ llx lly urx ury ]
393 TitleFontSize sub % [ llx lly urx y ]
394 3 -1 roll % [ llx urx y lly ]
396 3 1 roll % [ y llx urx ]
397 exch dup % [ y urx llx llx ]
398 3 -1 roll % [ y llx llx urx ]
399 exch sub 2 div add % [ y x ]
404 % Compute the position of the odd page string (right adjusted).
408 TitleBox % [ llx lly urx ury ]
409 4 -2 roll % [ urx ury llx lly ]
413 (n) stringwidth pop sub % a little padding
420 % Compute the position of the even page string (left adjusted).
421 % Not used if DoDuplex is off.
425 TitleBox % [ llx lly urx ury ]
426 4 1 roll % [ ury llx lly urx ]
429 (n) stringwidth pop add % a little padding
436 % Compute the position of the version string.
440 TitleBox % [ llx lly urx ury ]
441 pop pop % [ llx lly ]
444 (n) stringwidth pop add % a little padding
450 % Compute the position of the location string (centered).
454 TitleBox % [ llx lly urx ury ]
455 pop % [ llx lly urx ]
456 3 -1 roll % [ lly urx llx ]
457 dup % [ lly urx llx llx ]
458 3 -1 roll % [ lly llx llx urx ]
459 exch sub 2 div add % [ y x ]
465 % Compute the position of the date string (right adjusted).
469 TitleBox % [ llx lly urx ury ]
470 pop % [ llx lly urx ]
471 3 -1 roll % [ lly urx llx ]
474 (n) stringwidth pop sub % a little padding
480 % Compute the position of the top status string.
484 StatBox % [ llx lly urx ury ]
485 exch pop % [ llx lly ury ]
486 dup % [ llx lly ury ury ]
487 3 1 roll % [ llx ury lly ury ]
488 exch sub % [ llx ury box_height ]
489 StatStrings length % number of status lines
490 StatFontSize mul % height of status lines
491 sub 2 div % [ llx ury space_above ]
493 StatFontSize sub % [ llx y ]
497 (n) stringwidth pop add % a little padding
502 % Compute the position of the top message string.
506 CFLine % [ lx ly ux uy ]
507 exch pop % [ lx ly uy ]
508 dup % [ lx ly uy uy ]
509 3 1 roll % [ lx uy ly uy ]
510 exch sub % [ lx uy box_height ]
511 MessStrings length % number of status lines
512 MessFontSize mul % height of status lines
513 sub 2 div % [ lx uy space_above ]
515 MessFontSize sub % [ lx y ]
519 (n) stringwidth pop add % a little padding
524 % Compute the heading positions that start at the left.
528 HeadingBox % [ llx lly urx ury ]
529 pop pop % [ llx lly ]
532 (n) stringwidth pop add % a little padding
534 HeadingFileString stringwidth pop add
535 /HeadingFilePosX exch def % for BuildHost
541 HeadingFilePos % [ x y ]
544 (nn) stringwidth pop add % a little padding
545 HeadingFileString stringwidth pop add
546 dup /HeadingHostPosX exch def % for BuildHost
551 HeadingHostPos % [ x y ]
553 setHostFont % use the host font for sizes
555 (nn) stringwidth pop add % a little padding
556 dup /HeadingFsPosX exch def % for BuildHost
558 setHeadingFont % leave it in the heading font
562 % Compute the heading positions that start at the right (and are right
567 HeadingBox % [ llx lly urx ury ]
568 pop % [ llx lly urx ]
569 3 -1 roll % [ lly urx llx ]
572 (n) stringwidth pop sub % a little padding
573 dup /HeadingCSizePosX exch def % for BuildHost
584 HeadingCSizePos2 % [ x y ]
587 HeadingCSizeString1 stringwidth pop
588 HeadingCSizeString2 stringwidth pop
591 (n) stringwidth pop sub % a little padding
592 dup /HeadingOSizePosX exch def % for BuildHost
602 HeadingOSizePos2 % [ x y ]
605 HeadingOSizeString1 stringwidth pop
606 HeadingOSizeString2 stringwidth pop
609 HeadingLvlString stringwidth pop
610 2 div sub % set up for centering
611 (n) stringwidth pop sub % a little padding
612 dup /HeadingLvlPosX exch def % for BuildHost
617 %% The following functions save strings for each kind of information
618 %% and handle the calls generated by amreport.
622 % DrawStat saves a string in the next position for section 'A'.
625 /StatStrings 0 array def
628 /StatStrings exch % [ /StatStrings value ]
629 StatStrings apush def
633 % DrawMess saves a string in the next position for section 'F'.
636 /MessStrings 0 array def
639 /MessStrings exch % [ /MessStrings value ]
640 MessStrings apush def
650 % DrawTitle saves the title string.
656 /TitleString exch def
660 % DrawDate save the date string.
670 % DrawLoc saves the location string. Amreport does not generate this
671 % call and the initial value has been set at the start of this file
672 % in the user-changeable area.
676 /LocationString exch def
680 % DrawVers saves the Amanda version string.
683 /VersionString () def
686 /VersionString exch def
690 % DrawHost expects six strings on the stack:
699 % They are saved for processing by the final showpage.
702 /HostStrings 0 array def
707 5 index % copy of host name
710 /HostNameWidth exch def % find maximum host name width
711 6 array astore % convert args to an array
712 /HostStrings exch % [ /HostStrings value ]
713 HostStrings apush def
717 %% Functions used during actual page drawing.
721 % Center a string on the current point.
731 % Right justify a string on the current point.
735 dup % [ (str) (str) ]
736 stringwidth pop % [ (str) width ]
741 % The main page drawing function called when a new page is started.
748 % translate to leave room for the margins
750 PageCount 2 mod 1 eq {
755 BottomMargin translate
759 currentgray % save the gray value
760 0 setgray % turn off gray
761 currentlinewidth % save the current line width
762 2 setlinewidth % thick lines
766 HeadingBox box stroke
768 CFLine moveto lineto stroke
770 setlinewidth % restore the line width
771 setgray % restore the gray value
781 % draw the page number string
785 32 string % big enough for the number
786 cvs % convert the number
787 PageString1 exch concat % (Page NN)
788 PageString2 concat % (Page NN of )
789 PageMaxString concat % (Page NN of MM)
790 PageCount 2 mod 1 eq {
802 /PageCount PageCount 1 add def % bump the page counter
804 % draw the version string
819 % draw the date string
827 % draw the status lines
833 exch dup CurrentY moveto
835 /CurrentY CurrentY StatFontSize sub def
837 pop % get rid of the X value
845 exch dup CurrentY moveto
847 /CurrentY CurrentY MessFontSize sub def
849 pop % get rid of the X value
854 HeadingFilePos moveto
857 HeadingHostPos moveto
867 HeadingOSizePos1 moveto
871 HeadingOSizePos2 moveto
875 HeadingCSizePos1 moveto
879 HeadingCSizePos2 moveto
884 % reset the host position variables
886 HeadingBox % [ llx lly urx ury ]
887 pop pop exch pop % [ lly ]
893 % Build the host line on the page.
898 HeadingCSizePosX CurrentY moveto
900 show % compressed size
901 HeadingOSizePosX CurrentY moveto
904 HeadingFilePosX CurrentY moveto
906 show % tape file number
907 HeadingLvlPosX CurrentY moveto
909 HeadingFsPosX CurrentY moveto
911 HeadingHostPosX CurrentY moveto
914 HostCount 0 gt { % if not at end of page
915 currentlinewidth % save the line width
916 .25 setlinewidth % thin lines
919 dup % keep this CurrentY
920 HostFontSize 2 add sub
921 /CurrentY exch def % update CurrentY for next host
923 2 sub % move down a little
927 PageWidth exch % [ PageWidth y ]
929 setlinewidth % restore the line width
934 % Magic time -- the input consists of lots of calls to the /DrawXXX
935 % functions, which gather the text into memory. It ends with a showpage,
936 % which we hook here to do all the real imaging after everything has
937 % been collected. The only reason to do all this is so we can know
938 % how many pages will be generated for the "Page N of M" line.
941 25 dict begin % emperically enough entries
942 /*showpage /showpage load def % rename showpage to *showpage
945 HostBox % [ llx lly urx ury ]
946 exch pop % [ llx lly ury ]
947 exch sub % [ llx height ]
948 exch pop % [ height ]
949 cvi % idiv requires integers
951 2 add % space below each line
952 idiv % hosts per page
957 /HostCount exch def % initialize the counter
959 dup % [ HostMax HostMax ]
960 HostStrings length % number of hosts
961 add 1 sub exch idiv % number of pages
963 /PageMaxString exch def
965 /HavePage 0 def % flag that page is built
968 aload pop % put host strings on the stack
969 HostCount HostMax eq {
970 BuildPage % time to build a new page
973 /HostCount HostCount 1 sub def
974 BuildHost % build this host line
976 *showpage % time to dump a page
978 /HostCount HostMax def
983 *showpage % dump the last page
987 % Normally there would be an "end" here to match the "begin" for our
988 % dictionary, but we want to leave it on top of the dictionary stack
989 % so the final showpage runs our showpage replacement.
993 %% END OF TEMPLATE FILE