--- dvidvi-1.0.orig/dvidvi.1 +++ dvidvi-1.0/dvidvi.1 @@ -1,4 +1,4 @@ -.TH DVIDVI L "March 1994" +.TH DVIDVI 1 "March 1994" .SH NAME .PP dvidvi \- selects and/or re-arranges pages in a TeX dvi file --- dvidvi-1.0.orig/dvidvi.c +++ dvidvi-1.0/dvidvi.c @@ -31,7 +31,9 @@ #define BANNER "\nThis is dvidvi 1.0, Copyright (C) 1988-91, Radical Eye Software\n" #define STRINGSIZE (500) /* maximum number of strings in program */ +#include "dvidvi.h" #ifndef VMS +#include #include #include #else /* VMS */ @@ -136,6 +138,12 @@ integer *pagenumbers ; int prettycolumn ; /* the column we are at when running pretty */ +// To handle xxx1 for headers +// Lets suppose there will be less than 256 of those. +char *headers[256]; +integer ln_headers[256]; +integer nb_headers = 0L; + /* * This array holds values that indicate the length of a command, if * we aren't concerned with that command (which is most of them) or @@ -289,15 +297,19 @@ void stringdvibuf(p,n) integer p,n; { + char *s = temp; fseek(infile,p,SEEK_SET); while ( n-- > 0 ) - *temp++ = dvibyte(); + *s++ = dvibyte(); } /* * Print a usage error messsage, and quit. */ -usage() { +#ifdef __GNUC__ +__attribute__((noreturn)) +#endif +void usage() { (void)fprintf(stderr,banner); (void)fprintf(stderr,"Usage: dvidvi [options] input[.dvi] [output]\n"); (void)fprintf(stderr,"where options are:\n"); @@ -317,8 +329,7 @@ /* * Print an error message, and exit if it is fatal. */ -error(s) -char *s ; +void error(char *s) { (void)fprintf(stderr, "%s\n", s) ; /* AKT: was dvidvi: %s */ if (*s == '!') @@ -367,7 +378,7 @@ * * (Could blow up if a parameter * mag / 1000 > 2^30 sp.) */ -scalemag(p) +void scalemag(p) long *p ; { int negative ; @@ -538,11 +549,12 @@ * Parse the arguments to the routine, and stuff everything away * into those globals above. */ +void processargs(argc, argv) int argc ; char *argv[] ; { - char *p, *q ; + char *q ; int i, pageno, lastext = -1 ; long hoffset, voffset ; int reversed ; @@ -620,9 +632,9 @@ p++; lasttransf = 1 ; } #ifdef SHORTINT - if(sscanf(p, "%ld", &lastpage)==0) -#else /* ~SHORTINT */ if(sscanf(p, "%d", &lastpage)==0) +#else /* ~SHORTINT */ + if(sscanf(p, "%ld", &lastpage)==0) #endif /* ~SHORTINT */ error("! Bad last page option (-l).") ; break ; @@ -684,9 +696,9 @@ if (*p == 0 && argv[i+1]) p = argv[++i] ; #ifdef SHORTINT - if (sscanf(p, "%ld", &maxpages)==0) -#else /* ~SHORTINT */ if (sscanf(p, "%d", &maxpages)==0) +#else /* ~SHORTINT */ + if (sscanf(p, "%ld", &maxpages)==0) #endif /* ~SHORTINT */ error("! Bad number of pages option (-n).") ; break ; @@ -835,11 +847,12 @@ (void)dvibuf(p); pagenumbers[num]=signedquad(); } + /* * This routine simply reads the entire dvi file, and then initializes * some values about it. */ -readdvifile() { +void readdvifile() { integer p ; unsigned char c,d,e ; @@ -909,6 +922,7 @@ */ p = pageloc[0L] + 45 ; +nextcmd: c=dvibuf(p); while (comlen[c]) { p += comlen[c] ; @@ -920,11 +934,35 @@ landscape = p ; rem0special = 1 ; } + stringdvibuf(p+2L,6L); + if (strncmp(temp, "header", 6)==0) { + char l1; + l1 = dvibuf(p+1); + stringdvibuf(p+2,l1); + if ( nb_headers == 256 ) { + fprintf(stderr,"\n" + "There are more than 256 PS headers in your DVI file.\n" + "Please ask a wizzard to enlarge me :-)\n"); + } + ln_headers[nb_headers] = l1; + headers[nb_headers++] = strdup(temp); + /* + * Seek at the end of the xxx1, then goto reading next commands. + * In a normal DVI file, as produced by LaTeX, all of those special + * commands (xxx1 with PS headers) are outputed on the very first + * page, all together. So a simple loop might be enough. Just in + * case we have a strange file we accept that there might be some + * typesetting commandes between those xxx1. + */ + p = p + l1 + 2; + goto nextcmd; + } } } /* * Output a single byte, keeping track of where we are. */ +void outdvibyte(c) unsigned char c ; { @@ -934,6 +972,7 @@ /* * Send out two bytes. */ +void outdvi2(v) integer v ; { @@ -943,6 +982,7 @@ /* * Send out a longword. */ +void outdviquad(v) integer v ; { @@ -953,6 +993,7 @@ * This routine just copies some stuff from the buffer on out. * Suppose the file is positioned correctly before */ +void putbuf(length) integer length ; { @@ -962,6 +1003,7 @@ /* * This routine outputs a string, terminated by null. */ +void putstr(s) register unsigned char *s ; { @@ -971,6 +1013,7 @@ /* * Here we write the preamble to the dvi file. */ +void writepreamble() { /* just copy the first 14 bytes of the file */ fseek(infile,0L,SEEK_SET); @@ -981,6 +1024,7 @@ /* * This routine writes out a font definition. */ +void putfontdef(f) int f ; { @@ -994,6 +1038,7 @@ /* * The postamble is next. */ +void writepostamble() { int i ; integer p ; @@ -1019,6 +1064,7 @@ /* * This routine starts a page, by writing out a bop command. */ +void beginpage() { int i ; integer p ; @@ -1035,10 +1081,11 @@ * This routine sends out a page. We need to handle the * landscape special, though. */ +void dopage(num) integer num ; { - register integer p,q ; + register integer p ; register int len ; integer v, oldp ; unsigned char c; @@ -1063,15 +1110,40 @@ } prettycolumn += i + 1 ; #ifdef SHORTINT - (void)fprintf(stderr, "[%ld", num+1) ; -#else /* ~SHORTINT */ (void)fprintf(stderr, "[%d", num+1) ; +#else /* ~SHORTINT */ + (void)fprintf(stderr, "[%ld", num+1) ; #endif /* ~SHORTINT */ (void)fflush(stderr) ; } p = pageloc[num] + 45 ; c=dvibuf(p); while (c != 140) { + if ( nb_headers ) { + integer i; + /* + * Need to output the 'nb_headers' headers that we collected. + * If we are outputing the real first page of the previous + * DVI file, then the headers will be doubled, which is not + * troublesome: dvips will keep only one of those. + */ + for ( i=0; i",headers[i]+7); + prettycolumn += ln_headers[i]+2-7; + } + } + /* + * We will output the headers only one time. That is possible that + * those headers are not usefull (the pages where they are used might + * not be kept in the out file, but there is no simple way to avoid + * it. + */ + nb_headers = 0; + } if ((len=comlen[c]) > 0) { /* most commands are simple */ outdvibyte(c); putbuf((long)len-1) ; @@ -1136,6 +1208,7 @@ /* * Here we end a page. Simple enough. */ +void endpage() { outputpages++ ; outdvibyte(140) ; @@ -1144,12 +1217,12 @@ * This is our main routine for output, which runs through all the * pages we need to output. */ +void writedvifile() { integer pagenum ; int ppp ; integer actualpageno ; struct pagespec *ps ; - integer p ; Boolean beginp ; writepreamble() ; @@ -1191,6 +1264,7 @@ } writepostamble() ; } +int main(argc, argv) int argc ; char *argv[] ; @@ -1198,5 +1272,9 @@ processargs(argc, argv) ; readdvifile() ; writedvifile() ; + if (!quiet) { + fprintf(stderr,"\n"); + } + return 0; } --- dvidvi-1.0.orig/dvidvi.h +++ dvidvi-1.0/dvidvi.h @@ -0,0 +1 @@ +void error(char *s); --- dvidvi-1.0.orig/debian/a5booklet +++ dvidvi-1.0/debian/a5booklet @@ -0,0 +1,36 @@ +#!/bin/sh +# dvidvi 1.0, Copyright (C) 1988-91, Radical Eye Software +# a5booklet (c) 1997 David van Leeuwen + +# Takes a .dvi file as argument. The .dvi file should contain +# A5 sized pages. Output are two .dvi files with A4, landscape +# pages that can be printed on front and back. Reshuffle pages +# before stapling them! + +# We don't use TeX page numbers, but real ones. + +file=$1 +[ $# -gt 0 ] || { echo "No input .dvi file specified"; exit; } +[ -e $file -o -e $file.dvi ] || { echo "Input file $file not found"; exit; } + +name=`basename $file .dvi` + +name1=$name-1 +name2=$name-2 + +# from manpage dvidvi: +dvidvi -m '4:-1,2(14.85cm,0)' $name $name1 +dvidvi -m '4:-3,0(14.85cm,0)' $name $name2 + +cat < +Standards-Version: 3.7.2.2 +Build-Depends: debhelper (>= 4) + +Package: dvidvi +Architecture: any +Depends: ${shlibs:Depends} +Replaces: texlive-extra-utils (<< 2005.dfsg.2-12) +Description: Manipulate .dvi files + Allows you to select, change the order, and/or shift the pages in + a .dvi file. + . + This can for example be used to print an A5 booklet on A4 paper, in + such a way that you can put a staple through the bundle. A shell + script that does just that is provided. --- dvidvi-1.0.orig/debian/a5booklet.1 +++ dvidvi-1.0/debian/a5booklet.1 @@ -0,0 +1,64 @@ +.TH A5BOOKLET 1 "OCTOBER 1997" +.SH NAME +a5booklet \- copy two A5 pages from a .dvi file to one A4 page in another. +.SH SYNOPSIS +.B a5booklet +.IB file [.dvi] + +.SH DESCRIPTION +.IX a5booklet +.LP +.B A5booklet +is a little script that allows you to typeset two A5 pages next to +eachother on a single A4 page (landscape), combining pages from +the original file in such a way that after double sided printing and +some reshuffeling of the pages you get a nice a5 booklet that is ready +for a staple in the middle. + +The script calls a very clever program +.BR dvidvi , +written by Tomas Rokicki (the author of +.BR dvips ), +that does the real work. + +The output is written to two files, +.IB file -1.dvi +and +.IB file -2.dvi +. Print the first file, using the command +.LP +.B dvips -ta4 -tlandscape +.IB file -1 +.LP +then put the stack upside doen in the printer, and print the second +file using +.LP +.B dvips -ta4 -tlandscape +.IB file -2 +.LP +Make sure that the bottom of the A5-pages is on the correct side of +the paper when you put the stack back for printing the back side. +After the two print jobs, you must re-shuffle the paper stack before +you can staple it. + +.SH SEE ALSO +.BR tex (1), +.BR dvips (1), +.BR dvidvi (1). +.LP +.SH BUGS +.LP +The script has A4 papersize hardwired into it. Admittedly, a +European-centered way of thinking. + +Page number 1 is always the first page in the original .dvi file, not +the page numbered 1 by TeX's numbering scheme. + +.SH AUTHOR +.B A5booklet +is written by David A. van Leeuwen (david@ElseWare.cistron.nl), but is +is not original in any way. The main two lines that do the work are +inspired from the man page of +.BR dvidvi . +.B A5booklet +is available under the conditions of the Gnu Public Licence. --- dvidvi-1.0.orig/debian/changelog +++ dvidvi-1.0/debian/changelog @@ -0,0 +1,106 @@ +dvidvi (1.0-8etch2) unstable; urgency=low + + * Replace versions of texlive that contained dvidvi + (closes: #412006) + + -- Lionel Elie Mamane Fri, 23 Feb 2007 22:13:37 +0100 + +dvidvi (1.0-8etch1) unstable; urgency=low + + * Tweak description some more (thanks to Marc 'HE' Brockschmidt for the kick) + + -- Lionel Elie Mamane Wed, 21 Feb 2007 11:54:39 +0100 + +dvidvi (1.0-8) unstable; urgency=low + + * Do not depend on tetex-bin + * Bump up Standards-Version to 3.7.2.2 + * Tweak description a bit + + -- Lionel Elie Mamane Tue, 20 Feb 2007 17:21:39 +0100 + +dvidvi (1.0-7) unstable; urgency=low + + * New maintainer (closes: #274276) + * Integrate patch by Benjamin Bayart to take into account PostScript + inclusion \special's in the first page even if the first page is not + kept in the final result. Fixes handling of dvi files making use of + PStricks or colour or other advanced PostScript features. + * Bump up Standards-Version to 3.6.2 + * Make the C code warning-free. + + -- Lionel Elie Mamane Tue, 27 Sep 2005 08:44:40 +0200 + +dvidvi (1.0-6) unstable; urgency=low + + * QA upload. + * dvidvi.c (stringdvibuf): Fix "unexpected eof" error; thanks to + Benjamin BAYART for the patch. Closes: #231275. + * Switch to debhelper 4. + * debian/rules: Add support for DEB_BUILD_OPTIONS=noopt. + * Conforms to Standards version 3.6.1. + + -- Matej Vela Mon, 2 May 2005 01:00:51 +0200 + +dvidvi (1.0-5) unstable; urgency=low + + * QA Group upload orphaning this package + * Incorporates old NMUs (closes: #91439, #120958, #168387) + * dvidvi.1: change .TH macro to 1 instead of L + * Removed postinst and prerm because they didn't do anything + + -- Andrew Pollock Tue, 9 Nov 2004 21:52:24 +1100 + +dvidvi (1.0-4.1) unstable; urgency=low + + * Non-maintainer upload with approval from maintainer + * Reformat debian/control description to avoid initial '.' which may + cause parsing problems (Closes: #120958) + * debian/control: short description doesn't need trailing '.' + * Added Build-Depends (Closes: #168387) + * debian/rules: comment out dh_testversion (deprecated) + * debian/postinst: no longer need to set /usr/doc -> /usr/share/doc link. + + -- Hwei Sheng Teoh Tue, 26 Nov 2002 15:28:31 -0500 + +dvidvi (1.0-4) unstable testing; urgency=low + + * moved to debhelper rules file. + + * removed /usr/doc and /usr/man installs (closes: Bug#91146, coses: + Bug#91439) + + + -- David A. van Leeuwen Tue, 3 Apr 2001 13:44:14 +0200 + +dvidvi (1.0-3.1) unstable frozen; urgency=low + + * NMU with permission of David A. van Leeuwen. + * Dependency on libc6 is now calculated using "${shlibs:Depends}". + (closes: #65051) + * Added notice that dvidvi is under the GPL in the copyright file. + (closes: #65052) + * Upload sponsored by Tony Mancill . + + -- Adrian Bunk Mon, 3 Jul 2000 12:46:29 +0200 + +dvidvi (1.0-3) unstable; urgency=low + + * libc6 compile. + + -- David A. van Leeuwen Wed, 19 Nov 1997 23:35:54 +0100 + +dvidvi (1.0-2) unstable; urgency=low + + * Put original distribution in dvidvi_1.0.orig.tar.gz. Changed rules + to remove the executable as well. + + -- David A. van Leeuwen Sun, 9 Nov 1997 12:21:57 +0100 + +dvidvi (1.0-1) unstable; urgency=low + + * First compile. Added script `a5booklet' that allows you to print two + a5 pages on one a5 page side by side. + + -- David A. van Leeuwen Mon, 13 Oct 1997 23:05:41 +0200 + --- dvidvi-1.0.orig/debian/compat +++ dvidvi-1.0/debian/compat @@ -0,0 +1 @@ +4 --- dvidvi-1.0.orig/debian/copyright +++ dvidvi-1.0/debian/copyright @@ -0,0 +1,35 @@ +dvidvi: + + From the executable: + + This is dvidvi 1.0, Copyright (C) 1988-91, Radical Eye Software + + +The author Tomas G. Rokicki stated the program is copyrighted unter +the terms of the GPL: + + + Date: Mon, 26 Jun 2000 15:25:21 -0700 (PDT) + From: Tomas G. Rokicki + To: bunk@fs.tum.de, ezimanyi@rc1.vub.ac.be, rokicki@radicaleye.com + Subject: Re: Copyright for dvidvi + + I give full license for that code to be used under the GPL. + + -tom + +The package also includes patches by Benjamin Bayart. + +a5booklet (the little shell script): + + (c) 1997 David A. van Leeuwen + + +From the manual page: + + A5booklet is available under the conditions of the Gnu Public Licence. + + + +On Debian GNU/Linux systems, the complete text of the GNU General +Public License can be found in `/usr/share/common-licenses/GPL'. --- dvidvi-1.0.orig/debian/rules +++ dvidvi-1.0/debian/rules @@ -0,0 +1,38 @@ +#!/usr/bin/make -f + +CFLAGS := -Wall -g -O$(if $(findstring noopt,$(DEB_BUILD_OPTIONS)),0,2) + +build: dvidvi + +clean: + dh_testdir + dh_testroot + dh_clean dvidvi + +install: build + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs + dh_install dvidvi debian/a5booklet usr/bin + +binary-indep: build install + +binary-arch: build install + dh_testdir + dh_testroot + dh_installchangelogs + dh_installdocs + dh_installexamples a5test.tex a5bookle.hlp + dh_installman dvidvi.1 debian/a5booklet.1 + dh_strip + dh_compress + dh_fixperms + dh_installdeb + dh_shlibdeps + dh_gencontrol + dh_md5sums + dh_builddeb + +binary: binary-indep binary-arch +.PHONY: build clean binary binary-arch binary-indep install