summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Build/source/texk/seetexk/ChangeLog11
-rw-r--r--Build/source/texk/seetexk/dvibook.c32
-rw-r--r--Build/source/texk/seetexk/dvibook.man11
-rw-r--r--Build/source/texk/seetexk/dvitodvi.c32
-rw-r--r--Build/source/texk/seetexk/dvitodvi.man11
5 files changed, 71 insertions, 26 deletions
diff --git a/Build/source/texk/seetexk/ChangeLog b/Build/source/texk/seetexk/ChangeLog
index e1aa288e695..9fd691c1aef 100644
--- a/Build/source/texk/seetexk/ChangeLog
+++ b/Build/source/texk/seetexk/ChangeLog
@@ -1,3 +1,14 @@
+2020-09-08 Karl Berry <karl@freefriends.org>
+
+ * dvitodvi.man,
+ * dvibook.man: insert date, mention maintained as part of TL.
+
+2020-05-01 Manuel Stoeckl <texlive@mstoeckl.com>
+
+ * dvitodvi.c,
+ * dvibook.c (MAXDVIPAGES): remove; dynamically allocate.
+ https://tug.org/pipermail/tex-live/2020-September/046051.html
+
2020-05-01 TANAKA Takuji <ttk@t-lab.opal.ne.jp>
* configure.ac: SeeTeX Ver.20200501
diff --git a/Build/source/texk/seetexk/dvibook.c b/Build/source/texk/seetexk/dvibook.c
index 39bf291b78c..47e51efcaea 100644
--- a/Build/source/texk/seetexk/dvibook.c
+++ b/Build/source/texk/seetexk/dvibook.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 1987, 1989, 2012 University of Maryland Department of
+/* Copyright (c) 1987, 1989, 2012, 2020 University of Maryland Department of
Computer Science.
Permission is hereby granted, free of charge, to any person obtaining
@@ -60,8 +60,6 @@ extern int optind;
#define white(x) ((x) == ' ' || (x) == '\t' || (x) == ',')
-#define MAXDVIPAGES 1000 /* max (absolute) pages in DVI file */
-
char *ProgName;
/* Globals */
@@ -100,8 +98,8 @@ const char *DVIFileName; /* name of input DVI file */
FILE *inf; /* the input file itself */
FILE *outf; /* the output DVI file */
-long StartOfPage[MAXDVIPAGES]; /* The file positions of the
- input pages */
+long *StartOfPage; /* The file positions of the input pages */
+long StartOfPageSpace; /* Number of entries of StartOfPage array */
long StartOfLastPage; /* The file position just before we
started the last page */
@@ -126,7 +124,8 @@ i32 Count[10]; /* the 10 \count variables */
char writeerr[] = "error writing DVI file";
#ifndef KPATHSEA
-char *malloc(), *realloc();
+void *malloc(), *realloc();
+void free();
#endif
/*
* You may get lint warnings about sprintf's return value.
@@ -519,6 +518,12 @@ Usage: %s [-s signature] [-q] [-i infile] [-o outfile] [infile [outfile]]\n",
#endif
InputPageNumber = 0;
StartOfLastPage = -1;
+ StartOfPageSpace = 32;
+ StartOfPage = malloc(sizeof(long) * StartOfPageSpace);
+ if (!StartOfPage) {
+ error(1, -1, "cannot allocate list of pages; out of memory");
+ }
+
HandlePreAmble();
ScanDVIFile();
#ifdef ASCIIPTEX
@@ -527,6 +532,7 @@ Usage: %s [-s signature] [-q] [-i infile] [-o outfile] [infile [outfile]]\n",
else
#endif
HandleDVIFile();
+ free(StartOfPage);
HandlePostAmble();
if (!SFlag)
(void) fprintf(stderr, "\nWrote %d page%s, %ld bytes\n",
@@ -730,11 +736,23 @@ char oplen[128] = {
static void
ScanDVIFile(void)
{
+ long *tmp;
+
UseThisPage = 0;
StartOfPage[InputPageNumber] = ftell(inf);
while (HandlePage()) { /* scan DVI file */
- StartOfPage[++InputPageNumber] = ftell(inf);
+ ++InputPageNumber;
+ if (InputPageNumber >= StartOfPageSpace) {
+ StartOfPageSpace *= 2;
+ tmp = realloc(StartOfPage, sizeof(long) * StartOfPageSpace);
+ if (!tmp) {
+ error(1, -1, "cannot grow list of pages; out of memory");
+ }
+ StartOfPage = tmp;
+ }
+
+ StartOfPage[InputPageNumber] = ftell(inf);
}
}
diff --git a/Build/source/texk/seetexk/dvibook.man b/Build/source/texk/seetexk/dvibook.man
index 715c9be766b..d484f588613 100644
--- a/Build/source/texk/seetexk/dvibook.man
+++ b/Build/source/texk/seetexk/dvibook.man
@@ -1,6 +1,6 @@
-.\" Copyright (c) 1987-2012 UMD-CS, released under the X11 license;
+.\" Copyright (c) 1987-2020 UMD-CS, released under the X11 license;
.\" see README and source files.
-.TH DVIBOOK 1
+.TH DVIBOOK 1 "8 September 2020" "TeX Live"
.SH NAME
dvibook \- rearrange pages in DVI file into signatures
.SH SYNOPSIS
@@ -48,13 +48,12 @@ Dvibook normally prints the page numbers of the pages rearranged; the
option suppresses this.
.SH AUTHOR
Angus Duggan, from dviselect(1), by
-Chris Torek, University of Maryland
+Chris Torek, University of Maryland. Currently maintained as part
+of TeX Live (https://tug.org/texlive).
.SH "SEE ALSO"
-dviconcat(1), dviselect(1), latex(1), tex(1)
+dvitodvi(1), dviconcat(1), dviselect(1), latex(1), tex(1)
.br
.I "MC-TeX User's Guide"
-.br
-.I "The TeXbook"
.SH BUGS
.I Dvibook
does not adjust the parameters in the postamble; however, since these
diff --git a/Build/source/texk/seetexk/dvitodvi.c b/Build/source/texk/seetexk/dvitodvi.c
index 50a36ebda82..637f4731cfa 100644
--- a/Build/source/texk/seetexk/dvitodvi.c
+++ b/Build/source/texk/seetexk/dvitodvi.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 1987, 1989, 2012 University of Maryland Department of
+/* Copyright (c) 1987, 1989, 2012, 2020 University of Maryland Department of
Computer Science.
Permission is hereby granted, free of charge, to any person obtaining
@@ -60,8 +60,6 @@ extern int optind;
#define white(x) ((x) == ' ' || (x) == '\t' || (x) == ',')
-#define MAXDVIPAGES 1000 /* max (absolute) pages in DVI file */
-
char *ProgName;
/* Globals */
@@ -105,8 +103,8 @@ const char *DVIFileName; /* name of input DVI file */
FILE *inf; /* the input file itself */
FILE *outf; /* the output DVI file */
-long StartOfPage[MAXDVIPAGES]; /* The file positions of the
- input pages */
+long *StartOfPage; /* The file positions of the input pages */
+long StartOfPageSpace; /* Number of entries of StartOfPage array */
long StartOfLastPage; /* The file position just before we
started the last page */
@@ -131,7 +129,8 @@ i32 Count[10]; /* the 10 \count variables */
/* save some string space: we use this a lot */
char writeerr[] = "error writing DVI file";
#ifndef KPATHSEA
-char *malloc(), *realloc();
+void *malloc(), *realloc();
+void free();
#endif
static void WriteFont(struct fontinfo *fi);
@@ -739,7 +738,13 @@ Usage: %s [-q] [-i infile] [-o outfile] [-w width] [-h height] <pagespecs> [infi
ptexdvi = 0;
#endif
InputPageNumber = 0;
+ StartOfPageSpace = 32;
StartOfLastPage = -1;
+ StartOfPage = malloc(sizeof(long) * StartOfPageSpace);
+ if (!StartOfPage) {
+ error(1, -1, "cannot allocate list of pages; out of memory");
+ }
+
HandlePreAmble();
ScanDVIFile();
if (fseek(inf, 16L, 1) == -1)
@@ -753,6 +758,7 @@ Usage: %s [-q] [-i infile] [-o outfile] [-w width] [-h height] <pagespecs> [infi
PageSpecs = ParseSpecs(specstring, 1);
HandleDVIFile();
+ free(StartOfPage);
if (WritingPage)
EndPage(1);
HandlePostAmble();
@@ -1186,11 +1192,23 @@ PutEmptyPage(void)
static void
ScanDVIFile(void)
{
+ long *tmp;
+
UseThisPage = 0;
StartOfPage[InputPageNumber] = ftell(inf);
while (HandlePage(0, 0, 0, 0)) { /* scan DVI file */
- StartOfPage[++InputPageNumber] = ftell(inf);
+ ++InputPageNumber;
+ if (InputPageNumber >= StartOfPageSpace) {
+ StartOfPageSpace *= 2;
+ tmp = realloc(StartOfPage, sizeof(long) * StartOfPageSpace);
+ if (!tmp) {
+ error(1, -1, "cannot grow list of pages; out of memory");
+ }
+ StartOfPage = tmp;
+ }
+
+ StartOfPage[InputPageNumber] = ftell(inf);
}
}
diff --git a/Build/source/texk/seetexk/dvitodvi.man b/Build/source/texk/seetexk/dvitodvi.man
index d2f85f3eddf..7578542f58e 100644
--- a/Build/source/texk/seetexk/dvitodvi.man
+++ b/Build/source/texk/seetexk/dvitodvi.man
@@ -1,6 +1,6 @@
-.\" Copyright (c) 1987-2013 UMD-CS, released under the X11 license;
+.\" Copyright (c) 1987-2020 UMD-CS, released under the X11 license;
.\" see README and source files.
-.TH DVITODVI 1
+.TH DVITODVI 1 "8 September 2020" "TeX Live"
.SH NAME
dvitodvi \- rearrange pages in a DVI file
.SH SYNOPSIS
@@ -128,13 +128,12 @@ To select all of the odd pages in reverse order, use:
.sp
.SH AUTHOR
Angus Duggan, from dviselect(1), by
-Chris Torek, University of Maryland
+Chris Torek, University of Maryland. Currently maintained as part
+of TeX Live (https://tug.org/texlive).
.SH "SEE ALSO"
-dviconcat(1), dvibook(1), dviselect(1), latex(1), tex(1)
+dvibook(1), dviconcat(1), dviselect(1), latex(1), tex(1)
.br
.I "MC-TeX User's Guide"
-.br
-.I "The TeXbook"
.SH BUGS
.I Dvitodvi
does not adjust some of the parameters in the postamble. This may be a problem