1 diff -riwBu -Xex dtl\dt2dv.c dtl-modified\dt2dv.c
2 --- dtl\dt2dv.c Wed Mar 08 01:00:00 1995
3 +++ dtl-modified\dt2dv.c Mon Oct 02 13:28:35 2006
5 /* dt2dv - convert human-readable "DTL" file to DVI format
6 - this is intended to invert dv2dt version 0.6.0
7 - - version 0.6.1 - 14:38 GMT +11 Thu 9 March 1995
8 + - version 0.6.2 - 27 July 2005
9 - Geoffrey Tobin G.Tobin@ee.latrobe.edu.au
10 - fixes: Michal Tomczak-Jaegermann ntomczak@vm.ucs.ualberta.ca
11 Nelson H. F. Beebe beebe@math.utah.edu
12 + Angus Leeming leeming@lyx.org: Enable dt2dv to handle
13 + .dvi files containing strings longer than 1024 chars.
14 - Reference: "The DVI Driver Standard, Level 0",
15 by The TUG DVI Driver Standards Committee.
16 Appendix A, "Device-Independent File Format".
18 size_t max; /* capacity of buf */
19 S4 wrote; /* number of characters written into buf */
20 size_t read; /* position in buf of next character to read from buf */
21 - char * buf; /* line buffer */
22 + unsigned char * buf; /* line buffer */
25 char linebuf[MAXLINE+1];
30 - else if ( ! isprint (c) && ! isspace (c))
31 + else if ( ! isprint (c & 0x7f) && ! isspace (c))
36 /* transfer (length and) quoted string from dtl to dvi file, */
37 /* return number of bytes written to dvi file. */
40 + U4 k, k2, lstr_maxsize;
44 @@ -2232,12 +2234,13 @@
45 fprintf (stderr, "(xfer_len_string) : entering xfer_len_string.\n");
48 - init_Lstring (&lstr, LSIZE);
50 /* k[n] : length of special string */
52 k = get_unsigned (dtl);
54 + lstr_maxsize = (k > LSIZE) ? k : LSIZE;
55 + init_Lstring (&lstr, lstr_maxsize);
62 /* c[4] : (hexadecimal) checksum : I (gt) would prefer this */
63 xfer_hex (4, dtl, dvi);
64 -#else /NOT HEX_CHECKSUM */
65 +#else /*NOT HEX_CHECKSUM */
66 /* c[4] : checksum (octal, for comparison with tftopl's .pl file) */
67 xfer_oct (4, dtl, dvi);
69 diff -riwBu -Xex dtl\Makefile dtl-modified\Makefile
70 --- dtl\Makefile Tue Sep 19 23:59:17 2006
71 +++ dtl-modified\Makefile Wed Jul 05 17:54:20 2006
77 +# Changes 27 July 2005 by Angus Leeming to enable the Makefile to
78 +# work out of the box on both *nix and Windows machines under
79 +# the MinSYS environment.
81 +# The Makefile can also be used unaltered to build a Windows executable
82 +# from a Linux box if make is invoked as:
83 +# $ make EXEEXT='.exe' CC='i386-mingw32-gcc'
84 #=======================================================================
86 BINDIR = /usr/local/bin
93 +# This is a GNU make extension.
94 +# If you're flavour of make refuses to accept it,
95 +# then simply hardcode EXEEXT.
102 +DT2DV = dt2dv$(EXEEXT)
103 +DV2DT = dv2dt$(EXEEXT)
104 +EXES = $(DT2DV) $(DV2DT)
108 +MAN2PS = sh ./man2ps
109 MANDIR = /usr/local/man/man$(MANEXT)
111 OBJS = dt2dv.o dv2dt.o
114 #=======================================================================
120 doc: dt2dv.hlp dv2dt.hlp dt2dv.ps dv2dt.ps
125 check tests: hello example tripvdu edited
128 - $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $@.o
129 + $(CC) $(CFLAGS) $(LDFLAGS) -o $(DV2DT) dv2dt.o
132 - $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $@.o
133 + $(CC) $(CFLAGS) $(LDFLAGS) -o $(DT2DV) dt2dv.o
135 -hello: hello.dtl $(EXES)
136 - dt2dv hello.dtl hello2.dvi
137 - dv2dt hello2.dvi hello2.dtl
138 +hello: hello.dtl dv2dt dt2dv
139 + ./$(DT2DV) hello.dtl hello2.dvi
140 + ./$(DV2DT) hello2.dvi hello2.dtl
141 -@diff hello.dtl hello2.dtl > hello.dif
142 @if [ -s hello.dif ] ; \
143 then echo ERROR: differences in hello.dif ; \
148 - dv2dt hello.dvi hello.dtl
149 + ./$(DV2DT) hello.dvi hello.dtl
151 -example: example.dtl $(EXES)
152 - dt2dv example.dtl example2.dvi
153 - dv2dt example2.dvi example2.dtl
154 +example: example.dtl dv2dt dt2dv
155 + ./$(DT2DV) example.dtl example2.dvi
156 + ./$(DV2DT) example2.dvi example2.dtl
157 -@diff example.dtl example2.dtl > example.dif
158 @if [ -s example.dif ] ; \
159 then echo ERROR: differences in example.dif ; \
162 example.dtl: example.tex
164 - dv2dt example.dvi example.dtl
165 + ./$(DV2DT) example.dvi example.dtl
167 -tripvdu: tripvdu.dtl $(EXES)
168 - dt2dv tripvdu.dtl tripvdu2.dvi
169 - dv2dt tripvdu2.dvi tripvdu2.dtl
170 +tripvdu: tripvdu.dtl dv2dt dt2dv
171 + ./$(DT2DV) tripvdu.dtl tripvdu2.dvi
172 + ./$(DV2DT) tripvdu2.dvi tripvdu2.dtl
173 -@diff tripvdu.dtl tripvdu2.dtl > tripvdu.dif
174 @if [ -s tripvdu.dif ] ; \
175 then echo ERROR: differences in tripvdu.dif ; \
178 tripvdu.dtl: tripvdu.tex
180 - dv2dt tripvdu.dvi tripvdu.dtl
181 + ./$(DV2DT) tripvdu.dvi tripvdu.dtl
183 # edited.txt is already a dtl file.
185 -edited: edited.txt $(EXES)
186 - dt2dv edited.txt edited.dvi
187 - dv2dt edited.dvi edited2.dtl
188 - dt2dv edited2.dtl edited2.dvi
189 - dv2dt edited2.dvi edited3.dtl
190 +edited: edited.txt dv2dt dt2dv
191 + ./$(DT2DV) edited.txt edited.dvi
192 + ./$(DV2DT) edited.dvi edited2.dtl
193 + ./$(DT2DV) edited2.dtl edited2.dvi
194 + ./$(DV2DT) edited2.dvi edited3.dtl
195 @if [ -s edited.dif ] ; \
196 then echo ERROR : differences in edited.dif ; \
197 else $(RM) edited.dif ; \
198 diff -riwBu -Xex dtl\man2ps dtl-modified\man2ps
199 --- dtl\man2ps Tue Sep 19 23:59:22 2006
200 +++ dtl-modified\man2ps Wed Sep 20 00:03:05 2006
204 # We can use either GNU groff or Sun Solaris troff + dpost
205 -if [ -x /usr/local/bin/groff ]
206 +if [ which groff > /dev/null ]
208 TROFF="groff $FORMAT"
210 -elif [ -x /usr/lib/lp/postscript/dpost ]
211 ++elif [ which dpost > /dev/null ]
213 TROFF="troff $FORMAT"
214 TROFF2PS="/usr/lib/lp/postscript/dpost"
216 - echo "Cannot find troff-to-PostScript filter"
217 ++ echo "Cannot find troff-to-PostScript filter" >&2