I am uploading a LowNMU to DELAYED/10 to fix this and move the experimental 
changes to unstable.
The debdiff is attached.
diff -Nru dvidvi-1.0/debian/changelog dvidvi-1.0/debian/changelog
--- dvidvi-1.0/debian/changelog 2023-09-01 17:14:53.000000000 +0000
+++ dvidvi-1.0/debian/changelog 2023-09-01 17:05:38.000000000 +0000
@@ -1,3 +1,10 @@
+dvidvi (1.0-10.2) unstable; urgency=medium
+
+  * Non-maintainer upload.
+  * Convert to 3.0 source format. (Closes: #1007061)
+
+ -- Bastian Germann <[email protected]>  Fri, 01 Sep 2023 17:05:38 +0000
+
 dvidvi (1.0-10.1) experimental; urgency=medium
 
   * Non-maintainer upload.
@@ -5,9 +12,6 @@
       - debian/compat: removed.
       - debian/control: changed from 'debhelper' to 'debhelper-compat' in
         Build-Depends field and bumped level to 13.
-      - Closes: #817441
-  * debian/control: depend on ${misc:Depends}.
-  * debian/rules: using dh_prep instead of dh_clean -k.
 
  -- Joao Eriberto Mota Filho <[email protected]>  Mon, 21 Sep 2020 21:52:53 
-0300
 
@@ -24,6 +28,35 @@
 
  -- Lionel Elie Mamane <[email protected]>  Tue, 20 Feb 2007 17:57:36 +0100
 
+dvidvi (1.0-8.2) unstable; urgency=medium
+
+  * Non-maintainer upload.
+  * Fix the NMU version.
+  * Fix FTCBFS: Use triplet-prefixed compiler. Thanks to
+    Helmut Grohne <[email protected]>. (Closes: #843346)
+
+ -- Joao Eriberto Mota Filho <[email protected]>  Thu, 22 Dec 2016 18:12:22 
-0200
+
+dvidvi (1.0-8etch2.1) unstable; urgency=medium
+
+  * Non-maintainer upload.
+
+  [ Logan Rosen ]
+
+  * debian/control: depend on ${misc:Depends}.
+  * debian/rules:
+      - Add recommended build-arch and build-indep targets.
+      - Use dh_prep instead of dh_clean -k.
+
+  [ Joao Eriberto Mota Filho ]
+
+  * Bumped DH level to 10. (Closes: #817441)
+  * debian/control:
+      - Added the Homepage field.
+      - Bumped Standards-Version to 3.9.8.
+
+ -- Joao Eriberto Mota Filho <[email protected]>  Wed, 26 Oct 2016 15:00:57 
-0200
+
 dvidvi (1.0-8etch2) unstable; urgency=low
 
   * Replace versions of texlive that contained dvidvi
@@ -116,14 +149,14 @@
 
 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.
+  * Put original distribution in dvidvi_1.0.orig.tar.gz.  Changed rules 
+    to remove the executable as well. 
 
  -- David A. van Leeuwen <[email protected]>  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.
+    a5 pages on one a5 page side by side. 
 
  -- David A. van Leeuwen <[email protected]>  Mon, 13 Oct 1997 
23:05:41 +0200
diff -Nru dvidvi-1.0/debian/control dvidvi-1.0/debian/control
--- dvidvi-1.0/debian/control   2023-09-01 17:14:53.000000000 +0000
+++ dvidvi-1.0/debian/control   2023-09-01 16:56:04.000000000 +0000
@@ -2,12 +2,13 @@
 Section: tex
 Priority: optional
 Maintainer: Lionel Elie Mamane <[email protected]>
-Standards-Version: 3.7.2.2
+Standards-Version: 3.9.8
 Build-Depends: debhelper-compat (= 13)
+Homepage: https://www.ctan.org/tex-archive/dviware/dvidvi
 
 Package: dvidvi
 Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends}
+Depends: ${misc: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
diff -Nru dvidvi-1.0/debian/patches/debian-with-kohm.patch 
dvidvi-1.0/debian/patches/debian-with-kohm.patch
--- dvidvi-1.0/debian/patches/debian-with-kohm.patch    1970-01-01 
00:00:00.000000000 +0000
+++ dvidvi-1.0/debian/patches/debian-with-kohm.patch    2023-09-01 
17:05:38.000000000 +0000
@@ -0,0 +1,572 @@
+--- 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
+@@ -14,52 +14,88 @@
+  *      print both on same page               -m 2:0,1(5.5in,0in)
+  *      do folded brochures                   -m 4:-3,0(5.5in,0in)
+  *                                            -m 4:1,-2(5.5in,0in)
++ *      round up number of pages to a
++ *        multiple of n                       -p n
++ *      sort pages to print one from top      -j
++ *        next one from end
+  *      etc.
+  *
+  *    The original program is by Tomas Rokicki (version 0.5) but it was
+  *    modified and improved by Esteban ZIMANYI [email protected]
+  *    to give version 1.0.
++ *    To give version 1.1 it was improved by [email protected].
+  *
+  *    This version has been tested for the IBM PC and compatibles under
+- *    compilers Turbo C 2.0 and Microsoft C 6.0.
++ *    compilers Turbo C 2.0 and Microsoft C 6.0 and for Atari ST under
++ *    compiler Turbo C 2.0 with MiNTLIB.
+  *
+  */
+ #define SEEK_SET 0
+ #define SEEK_CUR 1
+ #define SEEK_END 2
+ 
+-#define BANNER "\nThis is dvidvi 1.0, Copyright (C) 1988-91, Radical Eye 
Software\n"
+-#define STRINGSIZE (500)  /* maximum number of strings in program */
++#define BANNER "\nThis is dvidvi 1.1, Copyright (C) 1988-91, Radical Eye 
Software\n" \
++                 "Improved from 1.0 to 1.1, 1994, Markus Kohm\n"
++#define STRINGSIZE (500L)  /* maximum number of strings in program */
++
++#ifdef WIN32
++#include <stdlib.h>
++#include <malloc.h>
++#endif
++void error(char *);
+ 
++#include "dvidvi.h"
+ #ifndef VMS
++#include <stdlib.h>
+ #include <stdio.h>
+ #include <string.h>
++#include <unistd.h>
+ #else /* VMS */
+ #include "sys$library:stdio.h"       /* AKT: added sys$library: */
+ #include <alloc.h>
+ #endif /* VMS */
+ #define MAXPPERP (32)
+ 
+-/* defines READBIN, WRITEBIN, PATHSEP and DIRSEP*/
++/* defines READBIN, WRITEBIN, PATHSEP and IS_DIR_SEP*/
+ 
+-#ifdef MSDOS
++#ifdef HAVE_CONFIG_H
++#include <config.h>
++#endif
++
++#ifdef KPATHSEA
++#include <kpathsea/c-fopen.h>
++#define READBIN         FOPEN_RBIN_MODE
++#ifdef VMS
++#define WRITEBIN        "wb"  /* VMS doesn't have FOPEN_WBIN_MODE defined */
++#else
++#define WRITEBIN        FOPEN_WBIN_MODE
++#endif
++#include <kpathsea/c-pathch.h>
++#define PATHSEP         ENV_SEP
++#else  /* not KPATHSEA */
++#if defined(__TOS__)
++#define READBIN         "rb"    /* TOS must use binary mode */
++#define WRITEBIN        "wb"
++#define PATHSEP         ';'
++#define IS_DIR_SEP(c)   ((c) == '\\')
++#elif defined (MSDOS) || defined(WIN32)
+ #define READBIN         "rb"    /* MSDOS must use binary mode */
+ #define WRITEBIN        "wb"
+ #define PATHSEP         ';'
+-#define DIRSEP          '\\'
+-#else
+-#ifdef VMS
++#define IS_DIR_SEP(c)   ((c) == '\\' || (c) == '/')
++#elif defined(VMS)
+ #define READBIN         "rb"    /* VMS must use binary mode */
+ #define WRITEBIN        "wb"
+ #define PATHSEP         ','
+-#define DIRSEP          ':'
++#define IS_DIR_SEP(c)   ((c) == ':')
+ #else
+ #define READBIN         "r"     /* UNIX doesn't care */
+ #define WRITEBIN        "w"
+ #define PATHSEP         ':'
+-#define DIRSEP          '/'
+-#endif
++#define IS_DIR_SEP(c)   ((c) == '/')
++#define SET_BINARY(f)
+ #endif
++#endif /* not KPATHSEA */
+ 
+ #ifdef XENIX
+ #define SHORTINT
+@@ -69,6 +105,11 @@
+ #ifdef MSDOS
+ #define SHORTINT
+ #endif
++#ifdef __TOS__
++#ifdef __TURBOC__
++#define SHORTINT
++#endif
++#endif
+ 
+ /*
+  *   Type declarations.  integer must be a 32-bit signed; shalfword must
+@@ -76,7 +117,6 @@
+  *   quarterword must be an eight-bit unsigned.
+  */
+ typedef long integer;
+-typedef char boolean;
+ typedef short shalfword ;
+ typedef unsigned short halfword ;
+ typedef unsigned char quarterword ;
+@@ -89,6 +129,7 @@ integer numpages ;      /* the total num
+ integer TeXfonts[256] ; /* information about each font */
+ char fontseen[256] ; /* have we defined this font yet? */
+ int modulo ;         /* our mod value */
++integer pagemodulo ;     /* additional mod value for number of pages */
+ struct pagespec {
+    int pageno, reversed ;
+    long hoffset, voffset ; /* in scaled points */
+@@ -113,9 +154,11 @@ int rem0special ;       /* should we rem
+ integer prevpp = -1 ;      /* previous page pointer on output */
+ integer outputpages ;   /* number of pages output */
+ integer dviloc ;        /* our position in the output file */
+-integer pagefake ;      /* number of pages, rounded up to multiple of modulo 
*/
++integer pagefake ;      /* number of pages, rounded up to multiple of 
++                         pagemodulo */
+ 
+ Boolean firsttransf = 0, lasttransf = 0;
++Boolean jumpingpages = 0;
+ integer firstpage ;     /* first page selected (option -p) */
+ integer lastpage ;      /* last page selected (option -l) */
+ integer maxpages ;      /* maximum number of page selected (option -n) */
+@@ -136,6 +179,12 @@ integer *pageloc ;
+ 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 +338,19 @@ integer p;
+ 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");
+@@ -306,7 +359,8 @@ usage() {
+    (void)fprintf(stderr,"    [-i {n1..n2 | n3}[,...]] include pages\n");
+    (void)fprintf(stderr,"    [-x {n1..n2 | n3}[,...]] exclude pages\n");
+    (void)fprintf(stderr,"    [-q] quiet mode               [-r] reverse 
pages\n");
+-   (void)fprintf(stderr,"    [-m modulo:pagespecs]\n");
++   (void)fprintf(stderr,"    [-m modulo:pagespecs]         [-j] jumping 
pages\n");
++   (void)fprintf(stderr,"    [-p pagemodulo]\n");
+ #ifndef VMS
+    exit(1) ;
+ #else /* VMS */
+@@ -317,8 +371,7 @@ usage() {
+ /*
+  *   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 +420,7 @@ integer whole, num, den, sf ;
+  *
+  *   (Could blow up if a parameter * mag / 1000 > 2^30 sp.)
+  */
+-scalemag(p)
++void scalemag(p)
+ long *p ;
+ {
+    int negative ;
+@@ -507,6 +560,7 @@ initialize()
+ int i;
+ /* initialize values in case of option -m is not specified */
+    modulo = 1 ;
++   pagemodulo = 0;
+    pages[0].hoffset = 0 ;
+    pages[0].voffset = 0 ;
+    pages[0].pageno = 0 ;
+@@ -538,11 +592,12 @@ int i;
+  *   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,12 +675,22 @@ case 'l':
+              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 ;
++case 'p' :
++            if (*p == 0 && argv[i+1])
++               p = argv[++i] ;
++#ifdef SHORTINT
++            if (sscanf(p, "%d", &pagemodulo)==0)
++#else   /* ~SHORTINT */
++            if (sscanf(p, "%ld", &pagemodulo)==0)
++#endif  /* ~SHORTINT */
++               error("! Bad pagemodulo option (-p).") ;
++            break ;
+ case 'm' :
+             if (*p == 0 && argv[i+1])
+                p = argv[++i] ;
+@@ -684,9 +749,9 @@ case 'n' :
+             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 ;
+@@ -696,6 +761,9 @@ case 'q' : case 'Q' :
+ case 'r' : case 'R' :
+             pages[0].reversed = 1;
+             break ;
++case 'j' : case 'J' :
++            jumpingpages = 1;
++            break;
+ case 'x' :
+             if (*p == 0 && argv[i+1])
+                p = argv[++i] ;
+@@ -745,7 +813,7 @@ default:
+                *nextstring = *p++ ;
+                if (*nextstring == '.')
+                   lastext = nextstring - iname ;
+-               else if (*nextstring == '/' || *nextstring == ':')
++               else if (IS_DIR_SEP(*nextstring)       || *nextstring == ':')
+                   lastext = 0 ;
+                nextstring++ ;
+             }
+@@ -770,7 +838,7 @@ default:
+                *nextstring = *p++ ;
+                if (*nextstring == '.')
+                   lastext = nextstring - oname ;
+-               else if (*nextstring == '/' || *nextstring == ':')
++               else if (IS_DIR_SEP(*nextstring)       || *nextstring == ':')
+                   lastext = 0 ;
+                nextstring++ ;
+             }
+@@ -792,8 +860,11 @@ default:
+        error("! no input file specified");
+    }
+    /* Inserted by [email protected] 3.8.1994 */
+-   if(!oname)
++   if(!oname) {
+      oname="stdout";
++     if (!isatty(fileno(stdout)))
++       SET_BINARY(fileno(stdout));
++   }
+ 
+    if (*oname != 0 && !quiet) {
+        (void)fprintf(stderr, banner) ;
+@@ -835,11 +906,12 @@ void searchpageloc()
+    (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 +981,7 @@ readdvifile() {
+  */
+ 
+    p = pageloc[0L] + 45 ;
++nextcmd:
+    c=dvibuf(p);
+    while (comlen[c]) {
+       p += comlen[c] ;
+@@ -920,11 +993,35 @@ readdvifile() {
+         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 +1031,7 @@ unsigned char c ;
+ /*
+  *   Send out two bytes.
+  */
++void
+ outdvi2(v)
+ integer v ;
+ {
+@@ -943,6 +1041,7 @@ integer v ;
+ /*
+  *   Send out a longword.
+  */
++void
+ outdviquad(v)
+ integer v ;
+ {
+@@ -953,6 +1052,7 @@ integer v ;
+  *   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 +1062,7 @@ integer length ;
+ /*
+  *   This routine outputs a string, terminated by null.
+  */
++void
+ putstr(s)
+ register unsigned char *s ;
+ {
+@@ -971,6 +1072,7 @@ register unsigned char *s ;
+ /*
+  *   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 +1083,7 @@ writepreamble() {
+ /*
+  *   This routine writes out a font definition.
+  */
++void
+ putfontdef(f)
+ int f ;
+ {
+@@ -994,6 +1097,7 @@ int f ;
+ /*
+  *   The postamble is next.
+  */
++void
+ writepostamble() {
+    int i ;
+    integer p ;
+@@ -1019,6 +1123,7 @@ writepostamble() {
+ /*
+  *   This routine starts a page, by writing out a bop command.
+  */
++void
+ beginpage() {
+    int i ;
+    integer p ;
+@@ -1035,10 +1140,11 @@ beginpage() {
+  *   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 +1169,40 @@ integer num ;
+       }
+       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<nb_headers; i++ ) {
++          outdvibyte(239);
++          outdvibyte(ln_headers[i]);
++          putstr(headers[i]);
++          if ( !quiet ) {
++             fprintf(stderr,"<%s>",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 +1267,7 @@ default:       fprintf(stderr, "Bad dvi
+ /*
+  *   Here we end a page.  Simple enough.
+  */
++void
+ endpage() {
+    outputpages++ ;
+    outdvibyte(140) ;
+@@ -1144,25 +1276,34 @@ endpage() {
+  *   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 ;
++   integer actualpageno, lastpageno ;
+    struct pagespec *ps ;
+-   integer p ;
+    Boolean beginp ;
+ 
+    writepreamble() ;
+-   pagefake = (pagecount + modulo - 1) / modulo * modulo ;
++   if ( !pagemodulo )
++      pagefake = (pagecount + modulo - 1) / modulo * modulo ;
++   else
++      pagefake = (pagecount + pagemodulo - 1) / pagemodulo * pagemodulo ;
+    if ( maxpages < pagefake ) pagefake = maxpages;
+-   for (pagenum = 0; pagenum < pagefake; pagenum += modulo) {
++   for (lastpageno = -1, pagenum = 0; pagenum < pagefake / ( jumpingpages + 
1); pagenum += modulo) {
+       beginp = 1 ;
+       for (ppp = 0, ps=pages; ppp < pagesperpage; ppp++, ps++) {
+          if (ps->reversed)
+             actualpageno = pagefake - pagenum - modulo + ps->pageno ;
+          else
+             actualpageno = pagenum + ps->pageno ;
+-         if (actualpageno < pagecount && selectedpage(actualpageno+1) ) {
++         if ( jumpingpages )
++            ps->reversed = !ps->reversed;
++         if ( actualpageno == lastpageno ) {
++            pagenum = pagefake;
++            break;
++         }
++   if (actualpageno < pagecount && selectedpage(actualpageno+1) ) {
+             if (beginp) {
+                 beginpage() ;
+                 beginp = 0 ;
+@@ -1178,6 +1319,8 @@ writedvifile() {
+                 outdvibyte(146) ;
+                 outdviquad(ps->hoffset) ;
+             }
++            if ( pagemodulo )
++                lastpageno = actualpageno;
+             if (ps->voffset) {
+                 outdvibyte(160) ;
+                 outdviquad(ps->voffset) ;
+@@ -1191,6 +1334,7 @@ writedvifile() {
+    }
+    writepostamble() ;
+ }
++int
+ main(argc, argv)
+ int argc ;
+ char *argv[] ;
+@@ -1198,5 +1342,9 @@ char *argv[] ;
+    processargs(argc, argv) ;
+    readdvifile() ;
+    writedvifile() ;
++   if (!quiet) {
++      fprintf(stderr,"\n");
++   }
++   return 0;
+ }
+ 
+--- /dev/null
++++ dvidvi-1.0/dvidvi.h
+@@ -0,0 +1 @@
++void error(char *s);
diff -Nru dvidvi-1.0/debian/patches/series dvidvi-1.0/debian/patches/series
--- dvidvi-1.0/debian/patches/series    1970-01-01 00:00:00.000000000 +0000
+++ dvidvi-1.0/debian/patches/series    2023-09-01 17:05:38.000000000 +0000
@@ -0,0 +1 @@
+debian-with-kohm.patch
diff -Nru dvidvi-1.0/debian/rules dvidvi-1.0/debian/rules
--- dvidvi-1.0/debian/rules     2023-09-01 17:14:53.000000000 +0000
+++ dvidvi-1.0/debian/rules     2023-09-01 16:51:11.000000000 +0000
@@ -1,8 +1,15 @@
 #!/usr/bin/make -f
 
+include /usr/share/dpkg/architecture.mk
+ifeq ($(origin CC),default)
+CC := $(DEB_HOST_GNU_TYPE)-gcc
+endif
+
 CFLAGS := -Wall -g -O$(if $(findstring noopt,$(DEB_BUILD_OPTIONS)),0,2)
 
-build: dvidvi
+build: build-arch build-indep
+build-arch: dvidvi
+build-indep: dvidvi
 
 clean:
        dh_testdir
@@ -35,4 +42,4 @@
        dh_builddeb
 
 binary: binary-indep binary-arch
-.PHONY: build clean binary binary-arch binary-indep install
+.PHONY: build build-arch build-indep clean binary binary-arch binary-indep 
install
diff -Nru dvidvi-1.0/debian/source/format dvidvi-1.0/debian/source/format
--- dvidvi-1.0/debian/source/format     1970-01-01 00:00:00.000000000 +0000
+++ dvidvi-1.0/debian/source/format     2023-09-01 17:05:38.000000000 +0000
@@ -0,0 +1 @@
+3.0 (quilt)
diff -Nru dvidvi-1.0/dvidvi.1 dvidvi-1.0/dvidvi.1
--- dvidvi-1.0/dvidvi.1 2023-09-01 17:14:53.000000000 +0000
+++ dvidvi-1.0/dvidvi.1 1997-10-05 11:27:48.000000000 +0000
@@ -1,4 +1,4 @@
-.TH DVIDVI 1 "March 1994"
+.TH DVIDVI L "March 1994"
 .SH NAME
 .PP
 dvidvi \- selects and/or re-arranges pages in a TeX dvi file
diff -Nru dvidvi-1.0/dvidvi.c dvidvi-1.0/dvidvi.c
--- dvidvi-1.0/dvidvi.c 2023-09-01 17:14:53.000000000 +0000
+++ dvidvi-1.0/dvidvi.c 1997-10-05 11:28:02.000000000 +0000
@@ -14,88 +14,52 @@
  *      print both on same page               -m 2:0,1(5.5in,0in)
  *      do folded brochures                   -m 4:-3,0(5.5in,0in)
  *                                            -m 4:1,-2(5.5in,0in)
- *      round up number of pages to a
- *        multiple of n                       -p n
- *      sort pages to print one from top      -j
- *        next one from end
  *      etc.
  *
  *    The original program is by Tomas Rokicki (version 0.5) but it was
  *    modified and improved by Esteban ZIMANYI [email protected]
  *    to give version 1.0.
- *    To give version 1.1 it was improved by [email protected].
  *
  *    This version has been tested for the IBM PC and compatibles under
- *    compilers Turbo C 2.0 and Microsoft C 6.0 and for Atari ST under
- *    compiler Turbo C 2.0 with MiNTLIB.
+ *    compilers Turbo C 2.0 and Microsoft C 6.0.
  *
  */
 #define SEEK_SET 0
 #define SEEK_CUR 1
 #define SEEK_END 2
 
-#define BANNER "\nThis is dvidvi 1.1, Copyright (C) 1988-91, Radical Eye 
Software\n" \
-                 "Improved from 1.0 to 1.1, 1994, Markus Kohm\n"
-#define STRINGSIZE (500L)  /* maximum number of strings in program */
-
-#ifdef WIN32
-#include <stdlib.h>
-#include <malloc.h>
-#endif
-void error(char *);
+#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 <stdlib.h>
 #include <stdio.h>
 #include <string.h>
-#include <unistd.h>
 #else /* VMS */
 #include "sys$library:stdio.h"       /* AKT: added sys$library: */
 #include <alloc.h>
 #endif /* VMS */
 #define MAXPPERP (32)
 
-/* defines READBIN, WRITEBIN, PATHSEP and IS_DIR_SEP*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+/* defines READBIN, WRITEBIN, PATHSEP and DIRSEP*/
 
-#ifdef KPATHSEA
-#include <kpathsea/c-fopen.h>
-#define READBIN         FOPEN_RBIN_MODE
-#ifdef VMS
-#define WRITEBIN        "wb"   /* VMS doesn't have FOPEN_WBIN_MODE defined */
-#else
-#define WRITEBIN        FOPEN_WBIN_MODE
-#endif
-#include <kpathsea/c-pathch.h>
-#define PATHSEP         ENV_SEP
-#else  /* not KPATHSEA */
-#if defined(__TOS__)
-#define READBIN         "rb"    /* TOS must use binary mode */
-#define WRITEBIN        "wb"
-#define PATHSEP         ';'
-#define IS_DIR_SEP(c)   ((c) == '\\')
-#elif defined (MSDOS) || defined(WIN32)
+#ifdef MSDOS
 #define READBIN         "rb"    /* MSDOS must use binary mode */
 #define WRITEBIN        "wb"
 #define PATHSEP         ';'
-#define IS_DIR_SEP(c)   ((c) == '\\' || (c) == '/')
-#elif defined(VMS)
+#define DIRSEP          '\\'
+#else
+#ifdef VMS
 #define READBIN         "rb"    /* VMS must use binary mode */
 #define WRITEBIN        "wb"
 #define PATHSEP         ','
-#define IS_DIR_SEP(c)   ((c) == ':')
+#define DIRSEP          ':'
 #else
 #define READBIN         "r"     /* UNIX doesn't care */
 #define WRITEBIN        "w"
 #define PATHSEP         ':'
-#define IS_DIR_SEP(c)   ((c) == '/')
-#define SET_BINARY(f)
+#define DIRSEP          '/'
+#endif
 #endif
-#endif /* not KPATHSEA */
 
 #ifdef XENIX
 #define SHORTINT
@@ -105,11 +69,6 @@
 #ifdef MSDOS
 #define SHORTINT
 #endif
-#ifdef __TOS__
-#ifdef __TURBOC__
-#define SHORTINT
-#endif
-#endif
 
 /*
  *   Type declarations.  integer must be a 32-bit signed; shalfword must
@@ -117,6 +76,7 @@
  *   quarterword must be an eight-bit unsigned.
  */
 typedef long integer;
+typedef char boolean;
 typedef short shalfword ;
 typedef unsigned short halfword ;
 typedef unsigned char quarterword ;
@@ -129,7 +89,6 @@
 integer TeXfonts[256] ; /* information about each font */
 char fontseen[256] ; /* have we defined this font yet? */
 int modulo ;         /* our mod value */
-integer pagemodulo ;     /* additional mod value for number of pages */
 struct pagespec {
    int pageno, reversed ;
    long hoffset, voffset ; /* in scaled points */
@@ -154,11 +113,9 @@
 integer prevpp = -1 ;      /* previous page pointer on output */
 integer outputpages ;   /* number of pages output */
 integer dviloc ;        /* our position in the output file */
-integer pagefake ;      /* number of pages, rounded up to multiple of 
-                          pagemodulo */
+integer pagefake ;      /* number of pages, rounded up to multiple of modulo */
 
 Boolean firsttransf = 0, lasttransf = 0;
-Boolean jumpingpages = 0;
 integer firstpage ;     /* first page selected (option -p) */
 integer lastpage ;      /* last page selected (option -l) */
 integer maxpages ;      /* maximum number of page selected (option -n) */
@@ -179,12 +136,6 @@
 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
@@ -338,19 +289,15 @@
 void stringdvibuf(p,n)
 integer p,n;
 {
-  char *s = temp;
   fseek(infile,p,SEEK_SET);
   while ( n-- > 0 )
-    *s++ = dvibyte();
+    *temp++ = dvibyte();
 }
 
 /*
  *   Print a usage error messsage, and quit.
  */
-#ifdef __GNUC__
-__attribute__((noreturn))
-#endif
-void usage() {
+usage() {
    (void)fprintf(stderr,banner);
    (void)fprintf(stderr,"Usage:  dvidvi [options] input[.dvi] [output]\n");
    (void)fprintf(stderr,"where options are:\n");
@@ -359,8 +306,7 @@
    (void)fprintf(stderr,"    [-i {n1..n2 | n3}[,...]] include pages\n");
    (void)fprintf(stderr,"    [-x {n1..n2 | n3}[,...]] exclude pages\n");
    (void)fprintf(stderr,"    [-q] quiet mode               [-r] reverse 
pages\n");
-   (void)fprintf(stderr,"    [-m modulo:pagespecs]         [-j] jumping 
pages\n");
-   (void)fprintf(stderr,"    [-p pagemodulo]\n");
+   (void)fprintf(stderr,"    [-m modulo:pagespecs]\n");
 #ifndef VMS
    exit(1) ;
 #else /* VMS */
@@ -371,7 +317,8 @@
 /*
  *   Print an error message, and exit if it is fatal.
  */
-void error(char *s)
+error(s)
+char *s ;
 {
    (void)fprintf(stderr, "%s\n", s) ;    /* AKT: was dvidvi: %s */
    if (*s == '!')
@@ -420,7 +367,7 @@
  *
  *   (Could blow up if a parameter * mag / 1000 > 2^30 sp.)
  */
-void scalemag(p)
+scalemag(p)
 long *p ;
 {
    int negative ;
@@ -560,7 +507,6 @@
 int i;
 /* initialize values in case of option -m is not specified */
    modulo = 1 ;
-   pagemodulo = 0;
    pages[0].hoffset = 0 ;
    pages[0].voffset = 0 ;
    pages[0].pageno = 0 ;
@@ -592,12 +538,11 @@
  *   Parse the arguments to the routine, and stuff everything away
  *   into those globals above.
  */
-void
 processargs(argc, argv)
 int argc ;
 char *argv[] ;
 {
-   char *q ;
+   char *p, *q ;
    int i, pageno, lastext = -1 ;
    long hoffset, voffset ;
    int reversed ;
@@ -675,21 +620,11 @@
               p++; lasttransf = 1 ;
               }
 #ifdef SHORTINT
-            if(sscanf(p, "%d", &lastpage)==0)
-#else   /* ~SHORTINT */
             if(sscanf(p, "%ld", &lastpage)==0)
-#endif  /* ~SHORTINT */
-               error("! Bad last page option (-l).") ;
-            break ;
-case 'p' :
-            if (*p == 0 && argv[i+1])
-               p = argv[++i] ;
-#ifdef SHORTINT
-            if (sscanf(p, "%d", &pagemodulo)==0)
 #else   /* ~SHORTINT */
-            if (sscanf(p, "%ld", &pagemodulo)==0)
+            if(sscanf(p, "%d", &lastpage)==0)
 #endif  /* ~SHORTINT */
-               error("! Bad pagemodulo option (-p).") ;
+               error("! Bad last page option (-l).") ;
             break ;
 case 'm' :
             if (*p == 0 && argv[i+1])
@@ -749,9 +684,9 @@
             if (*p == 0 && argv[i+1])
                p = argv[++i] ;
 #ifdef SHORTINT
-            if (sscanf(p, "%d", &maxpages)==0)
-#else   /* ~SHORTINT */
             if (sscanf(p, "%ld", &maxpages)==0)
+#else   /* ~SHORTINT */
+            if (sscanf(p, "%d", &maxpages)==0)
 #endif  /* ~SHORTINT */
                error("! Bad number of pages option (-n).") ;
             break ;
@@ -761,9 +696,6 @@
 case 'r' : case 'R' :
             pages[0].reversed = 1;
             break ;
-case 'j' : case 'J' :
-            jumpingpages = 1;
-            break;
 case 'x' :
             if (*p == 0 && argv[i+1])
                p = argv[++i] ;
@@ -813,7 +745,7 @@
                *nextstring = *p++ ;
                if (*nextstring == '.')
                   lastext = nextstring - iname ;
-               else if (IS_DIR_SEP(*nextstring)        || *nextstring == ':')
+               else if (*nextstring == '/' || *nextstring == ':')
                   lastext = 0 ;
                nextstring++ ;
             }
@@ -838,7 +770,7 @@
                *nextstring = *p++ ;
                if (*nextstring == '.')
                   lastext = nextstring - oname ;
-               else if (IS_DIR_SEP(*nextstring)        || *nextstring == ':')
+               else if (*nextstring == '/' || *nextstring == ':')
                   lastext = 0 ;
                nextstring++ ;
             }
@@ -860,11 +792,8 @@
        error("! no input file specified");
    }
    /* Inserted by [email protected] 3.8.1994 */
-   if(!oname) {
+   if(!oname)
      oname="stdout";
-     if (!isatty(fileno(stdout)))
-       SET_BINARY(fileno(stdout));
-   }
 
    if (*oname != 0 && !quiet) {
        (void)fprintf(stderr, banner) ;
@@ -906,12 +835,11 @@
    (void)dvibuf(p);
    pagenumbers[num]=signedquad();
 }
-
 /*
  *   This routine simply reads the entire dvi file, and then initializes
  *   some values about it.
  */
-void readdvifile() {
+readdvifile() {
    integer p ;
    unsigned char c,d,e ;
 
@@ -981,7 +909,6 @@
  */
 
    p = pageloc[0L] + 45 ;
-nextcmd:
    c=dvibuf(p);
    while (comlen[c]) {
       p += comlen[c] ;
@@ -993,35 +920,11 @@
         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 ;
 {
@@ -1031,7 +934,6 @@
 /*
  *   Send out two bytes.
  */
-void
 outdvi2(v)
 integer v ;
 {
@@ -1041,7 +943,6 @@
 /*
  *   Send out a longword.
  */
-void
 outdviquad(v)
 integer v ;
 {
@@ -1052,7 +953,6 @@
  *   This routine just copies some stuff from the buffer on out.
  *   Suppose the file is positioned correctly before
  */
-void
 putbuf(length)
 integer length ;
 {
@@ -1062,7 +962,6 @@
 /*
  *   This routine outputs a string, terminated by null.
  */
-void
 putstr(s)
 register unsigned char *s ;
 {
@@ -1072,7 +971,6 @@
 /*
  *   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);
@@ -1083,7 +981,6 @@
 /*
  *   This routine writes out a font definition.
  */
-void
 putfontdef(f)
 int f ;
 {
@@ -1097,7 +994,6 @@
 /*
  *   The postamble is next.
  */
-void
 writepostamble() {
    int i ;
    integer p ;
@@ -1123,7 +1019,6 @@
 /*
  *   This routine starts a page, by writing out a bop command.
  */
-void
 beginpage() {
    int i ;
    integer p ;
@@ -1140,11 +1035,10 @@
  *   This routine sends out a page.  We need to handle the
  *   landscape special, though.
  */
-void
 dopage(num)
 integer num ;
 {
-   register integer p ;
+   register integer p,q ;
    register int len ;
    integer v, oldp ;
    unsigned char c;
@@ -1169,40 +1063,15 @@
       }
       prettycolumn += i + 1 ;
 #ifdef SHORTINT
-      (void)fprintf(stderr, "[%d", num+1) ;
-#else  /* ~SHORTINT */
       (void)fprintf(stderr, "[%ld", num+1) ;
+#else  /* ~SHORTINT */
+      (void)fprintf(stderr, "[%d", 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<nb_headers; i++ ) {
-           outdvibyte(239);
-           outdvibyte(ln_headers[i]);
-           putstr(headers[i]);
-           if ( !quiet ) {
-              fprintf(stderr,"<%s>",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) ;
@@ -1267,7 +1136,6 @@
 /*
  *   Here we end a page.  Simple enough.
  */
-void
 endpage() {
    outputpages++ ;
    outdvibyte(140) ;
@@ -1276,34 +1144,25 @@
  *   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, lastpageno ;
+   integer actualpageno ;
    struct pagespec *ps ;
+   integer p ;
    Boolean beginp ;
 
    writepreamble() ;
-   if ( !pagemodulo )
-      pagefake = (pagecount + modulo - 1) / modulo * modulo ;
-   else
-      pagefake = (pagecount + pagemodulo - 1) / pagemodulo * pagemodulo ;
+   pagefake = (pagecount + modulo - 1) / modulo * modulo ;
    if ( maxpages < pagefake ) pagefake = maxpages;
-   for (lastpageno = -1, pagenum = 0; pagenum < pagefake / ( jumpingpages + 
1); pagenum += modulo) {
+   for (pagenum = 0; pagenum < pagefake; pagenum += modulo) {
       beginp = 1 ;
       for (ppp = 0, ps=pages; ppp < pagesperpage; ppp++, ps++) {
          if (ps->reversed)
             actualpageno = pagefake - pagenum - modulo + ps->pageno ;
          else
             actualpageno = pagenum + ps->pageno ;
-         if ( jumpingpages )
-            ps->reversed = !ps->reversed;
-         if ( actualpageno == lastpageno ) {
-            pagenum = pagefake;
-            break;
-         }
-   if (actualpageno < pagecount && selectedpage(actualpageno+1) ) {
+         if (actualpageno < pagecount && selectedpage(actualpageno+1) ) {
             if (beginp) {
                 beginpage() ;
                 beginp = 0 ;
@@ -1319,8 +1178,6 @@
                 outdvibyte(146) ;
                 outdviquad(ps->hoffset) ;
             }
-            if ( pagemodulo )
-                lastpageno = actualpageno;
             if (ps->voffset) {
                 outdvibyte(160) ;
                 outdviquad(ps->voffset) ;
@@ -1334,7 +1191,6 @@
    }
    writepostamble() ;
 }
-int
 main(argc, argv)
 int argc ;
 char *argv[] ;
@@ -1342,9 +1198,5 @@
    processargs(argc, argv) ;
    readdvifile() ;
    writedvifile() ;
-   if (!quiet) {
-      fprintf(stderr,"\n");
-   }
-   return 0;
 }
 
diff -Nru dvidvi-1.0/dvidvi.h dvidvi-1.0/dvidvi.h
--- dvidvi-1.0/dvidvi.h 2023-09-01 17:14:53.000000000 +0000
+++ dvidvi-1.0/dvidvi.h 1970-01-01 00:00:00.000000000 +0000
@@ -1 +0,0 @@
-void error(char *s);

Reply via email to