There's no need to keep a "FILE *" for the file being printed to in a
[obnox/wireshark/wip.git] / print.ps
1 %!
2 %
3 % Code between start/end remarks is put into ps.c
4 % Anything else is thrown away, and is for testing only.
5 %
6 % ---- ethereal preamble start ---- %
7 %!
8 %!PS-Adobe-2.0
9 %
10 % Ethereal - Network traffic analyzer
11 % By Gerald Combs <gerald@ethereal.com>
12 % Copyright 1998 Gerald Combs
13 %
14 %%Creator: Ethereal
15 %%Title: ethereal.ps
16 %%DocumentFonts: Helvetica Courier
17 %%EndComments
18 %!
19
20 % Get the Imagable Area of the page
21 clippath pathbbox
22
23 % Set vmax to the vertical size of the page,
24 % hmax to the horizontal size of the page.
25 /vmax exch def
26 /hmax exch def
27 pop pop         % junk
28
29 % 1-inch margins
30 /lmargin 72 def
31 /tmargin vmax 72 sub def
32 /bmargin 72 def
33 /pagenumtab hmax 72 sub def
34
35 % Counters
36 /vpos vmax 40 sub def
37 /thispagenum 1 def
38
39 % Strings
40 /pagenostr 7 string def
41
42 % Prints text with possible indenting
43 /putline {
44         exch 10 mul lmargin add         % X
45         vpos                                            % Y
46         moveto
47         show
48
49         /vpos vpos 10 sub def
50
51         vpos bmargin le                         % is vpos <= bottom margin?
52         {
53                 printpagenum showpage
54                 /vpos tmargin def
55         }
56         if                                                      % then formfeed and start at top
57 } def
58
59 % A put line with smaller spacing and no formfeed
60 /titleline {
61         lmargin                                         % X
62         vpos                                            % Y
63         moveto
64         show
65
66         /vpos vpos 8 sub def
67 } def
68
69 % Prints the page number at the top right
70 /printpagenum {
71         gsave
72                 % Set the font to 8 point
73                 /Helvetica findfont 8 scalefont setfont
74
75                 pagenumtab                                      % X
76                 vmax 40 sub                                     % Y
77                 moveto
78                 (Page ) show
79                 thispagenum pagenostr cvs show
80
81                 % thispagenum++
82                 /thispagenum thispagenum 1 add def
83         grestore
84 } def
85         
86 % Set the font to 8 point
87 /Helvetica findfont 8 scalefont setfont
88
89 % Create the title
90 (Ethereal) titleline
91
92 % Reset the vertical position
93 /vpos tmargin def
94
95 % Set the font to 10 point
96 /Courier findfont 10 scalefont setfont
97 % ---- ethereal preamble end ---- %
98
99 % Display our output lines.
100 0 (Ethernet II \(98 on wire, 68 captured\)) putline
101 1 (Destination: 00:00:0c:36:00:2a) putline
102 1 (Source: 00:c0:4f:c7:eb:c0) putline
103 1 (Type: IP \(0x0800\)) putline
104 0 (Ethernet II \(98 on wire, 68 captured\)) putline
105 1 (Source: 00:c0:4f:c7:eb:c0) putline
106 1 (Type: IP \(0x0800\)) putline
107 0 (Source: 00:c0:4f:c7:eb:c0) putline
108
109 0 () putline
110 0 (0000  cc 00 00 00 00 00 07 02 00 00 00 00 00 00 00 00   ................ ) putline
111 0 (0010  00 00 bd 0e fe 16 01 00 3e 00 03 08 58 4c 20 38   ........>...XL 8 ) putline
112 0 (0020  30 20 49 4d 33 00 16 01 00 34 00 16 01 01 35 00   0 IM3....4....5. ) putline
113 0 (0030  16 01 02 36 00 16 01 03 6e 00 16 01 ff 6f 00 16   ...6....n....o.. ) putline
114 0 (0040  01 ff 70 00 16 01 ff 71 00 16 01 ff 48 00 01 04   ..p....q....H... ) putline
115 0 (0050  ff 03 07 00 24 00 01 01 05 25 00 01 01 05 26 00   ....$....%....&. ) putline
116 0 (0060  01 01 05 27 00 01 01 05 6a 00 01 01 00 6b 00 01   ...'....j....k.. ) putline
117 0 (0070  01 00 6c 00 01 01 00 6d 00 01 01 00 3d 00 01 02   ..l....m....=... ) putline
118 0 (0080  02 00 c0 00 03 08 80 00 00 00 00 00 00 00 b4 00   ................ ) putline
119 0 (0090  01 04 c0 a8 42 ef 39 00 16 08 05 05 05 05 00 00   ....B.9......... ) putline
120 0 (00a0  00 00 00 03 20 36 41 20 52 69 6e 67 00 00 00 00   .... 6A Ring.... ) putline
121 0 (00b0  00 00 00 00 00 00                                 ......           ) putline
122
123 % ---- ethereal finale start ---- %
124 % If this is not the first page, then print the page number
125 thispagenum 1 gt                                % is thispagenum > 1 ?
126 {
127         printpagenum
128 }
129 if
130
131 showpage
132 % ---- ethereal finale end ---- %