texlive/source-dviutils.dif

1393 lines
37 KiB
Plaintext

--- m4/kpse-kpathsea-flags.m4
+++ m4/kpse-kpathsea-flags.m4 2010-11-12 11:51:59.947926203 +0000
@@ -19,7 +19,7 @@
AC_DEFUN([KPSE_KPATHSEA_FLAGS],
[AC_REQUIRE([KPSE_SAVE_FLAGS])[]dnl
_KPSE_TEXLIB_FLAGS([kpathsea], [kpathsea], [lt],
- [-IBLD/texk -ISRC/texk], [BLD/texk/kpathsea/libkpathsea.la], [],
+ [-IBLD/texk/kpathsea -ISRC/texk/kpathsea -IBLD/texk -ISRC/texk], [BLD/texk/kpathsea/libkpathsea.la], [],
[${top_srcdir}/../kpathsea/*.[ch]],
[${top_builddir}/../kpathsea/paths.h])
m4_if(m4_index([ $1 ], [ no-debug ]), [-1],
--- texk/seetexk/scaletfm.c
+++ texk/seetexk/scaletfm.c 2009-08-28 14:13:32.873901460 +0000
@@ -6,7 +6,7 @@
*/
#ifndef lint
-static char rcsid[] = "$Header: /usr/src/local/tex/local/mctex/lib/RCS/scaletfm.c,v 3.2 89/11/23 16:34:43 chris Exp $";
+static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/src/local/tex/local/mctex/lib/RCS/scaletfm.c,v 3.2 89/11/23 16:34:43 chris Exp $";
#endif
#include "types.h"
@@ -87,6 +87,7 @@ ScaleOneWidth(t, z)
* Scale a set of glyphs [l..h) in font f according to f->f_dvimag
* (that is, set g_tfmwidth from g_rawtfmwidth).
*/
+void
ScaleGlyphs(f, l, h)
register struct font *f;
int l, h;
--- texk/seetexk/rstfont.c
+++ texk/seetexk/rstfont.c 2009-08-28 14:13:32.873901460 +0000
@@ -12,18 +12,22 @@
*/
#ifndef lint
-static char rcsid[] = "$Header$";
+static char rcsid[] __attribute__ ((unused)) = "$Header$";
#endif
+#include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
+#include <unistd.h>
#include <errno.h>
#include "types.h"
#include "error.h"
#include "font.h"
#include "fio.h"
+extern int FontHasGlyphs();
+
/*
* RST (Imagen's font format) font operations.
*/
@@ -77,12 +81,6 @@ struct rst_details {
*/
#define ftord(f) ((struct rst_details *)(f)->f_details)
-#if !defined( WIN32 ) && !defined( _AMIGA )
-extern errno;
-char *malloc();
-long ftell();
-#endif
-
/*
* Read an RST file.
*/
--- texk/seetexk/search.c
+++ texk/seetexk/search.c 2009-08-28 14:13:32.877901585 +0000
@@ -19,6 +19,7 @@
* it runs in increasing-key-value sequence).
*/
+#include <stdlib.h>
#include "types.h"
#include "search.h"
@@ -30,10 +31,6 @@
static int DOffset; /* part of alignment code */
-#ifndef KPATHSEA
-char *malloc(), *realloc();
-#endif
-
struct search *
SCreate(unsigned int dsize)
{
--- texk/seetexk/scanpost.c
+++ texk/seetexk/scanpost.c 2009-08-28 14:13:32.873901460 +0000
@@ -6,7 +6,7 @@
*/
#ifndef lint
-static char rcsid[] = "$Header: /usr/local/src/SeeTeX/libtex/RCS/scanpost.c,v 1.2 90/07/10 14:33:23 grunwald Exp Locker: grunwald $";
+static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/local/src/SeeTeX/libtex/RCS/scanpost.c,v 1.2 90/07/10 14:33:23 grunwald Exp Locker: grunwald $";
#endif
/*
@@ -20,7 +20,9 @@ static char rcsid[] = "$Header: /usr/loc
#include "gripes.h"
#include "postamble.h"
-ScanPostAmble(f, headerfunc, fontfunc)
+extern int FindPostAmble ();
+
+int ScanPostAmble(f, headerfunc, fontfunc)
register FILE *f;
void (*headerfunc)();
register void (*fontfunc)();
--- texk/seetexk/sdecode.c
+++ texk/seetexk/sdecode.c 2009-08-28 14:13:32.873901460 +0000
@@ -6,7 +6,7 @@
*/
#ifndef lint
-static char rcsid[] = "$Header: /usr/src/local/tex/local/mctex/lib/RCS/sdecode.c,v 3.4 89/11/06 15:01:07 chris Exp $";
+static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/src/local/tex/local/mctex/lib/RCS/sdecode.c,v 3.4 89/11/06 15:01:07 chris Exp $";
#endif
#include <stdio.h>
@@ -18,6 +18,7 @@ static char rcsid[] = "$Header: /usr/src
#include "types.h"
#include "error.h"
#include "sdecode.h"
+#include "gripes.h"
static char cclass[256]; /* XXX assumes 8-bit char */
#define CCL_SPACE 0x01 /* white space */
@@ -26,7 +27,7 @@ static char cclass[256]; /* XXX assumes
static int sdset; /* flag says whether cclass[] set up */
static void args(), badarg();
-static int scan(struct decode_info *di, char **fmt, ...), scan_i(), scan_d();
+static int scan_i(), scan_d();
extern char *strsave();
@@ -84,6 +85,7 @@ struct decode_info {
char *di_kw; /* the keyword */
int di_bkw; /* true iff keyword is in static buffer */
};
+static int scan(register struct decode_info * di,...);
/*
* `Edit' the text in the buffer in-place.
@@ -398,7 +400,7 @@ args(tp, di)
register struct decode_info *di;
{
char *fmt;
- int n, room, f1;
+ int n = 0, room, f1;
i32 *ip, i[4];
double d[2];
@@ -600,17 +602,14 @@ out:
#else
static int
-scan(va_alist)
- va_dcl
+scan(register struct decode_info * di,...)
{
- register struct decode_info *di;
register char *fmt;
register int c;
char **fmtp;
va_list ap;
- va_start(ap);
- di = va_arg(ap, struct decode_info *);
+ va_start(ap, di);
fmtp = va_arg(ap, char **);
fmt = *fmtp;
while ((c = *fmt++) != 0) {
--- texk/seetexk/a4toa5
+++ texk/seetexk/a4toa5 2010-11-12 11:50:39.552426619 +0000
@@ -0,0 +1,26 @@
+#!/bin/csh -f
+# 1993 (c) Werner Fink <Werner.Fink@itap.physik.uni-stuttgart.de>
+#
+
+if (${#argv} <= 1) then
+ echo " ${0}: Usage: infile outfile"
+ exit
+endif
+
+set NumP=`mydvichk $1 | sed -e 's/totalpages=//g'`
+
+if (${NumP} % 2) then
+ echo " Odd number of pages --- this doesn't work"
+ echo " Please use odd2even: This gives an additional first pages"
+ echo " Or"
+ echo " use dvibook: It sort the pages in book form"
+ exit
+endif
+
+echo "${0}: For Printing: dvips -t landscape outfile"
+echo "${0}: For Viewing: xdvi -paper a4r outfile"
+
+#
+#exec dvitodvi -q '2:707@0(-5.5mm,-10mm)+1(204mm,-10mm)' $1 $2
+#
+exec dvitodvi -q '2:707@0(-5.5mm,-10mm)+1(190mm,-10mm)' $1 $2
--- texk/seetexk/bcopy.c
+++ texk/seetexk/bcopy.c 2009-08-28 14:13:32.721901870 +0000
@@ -1,5 +1,6 @@
+#ifndef __GNUC__
#ifndef lint
-static char rcsid[] = "$Header: /usr/src/local/tex/local/mctex/lib/RCS/bcopy.c,v 3.1 89/08/22 21:42:07 chris Exp $";
+static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/src/local/tex/local/mctex/lib/RCS/bcopy.c,v 3.1 89/08/22 21:42:07 chris Exp $";
#endif
/*
@@ -7,13 +8,12 @@ static char rcsid[] = "$Header: /usr/src
* This should be rewritten to be as fast as possible for your
* machine.
*/
-void bcopy(from, to, count)
- register char *from, *to;
+char *bcopy(from, to, count)
+ char *from, *to;
register int count;
{
-
if (from == to)
- return;
+ return from;
if (from > to) {
while (--count >= 0)
*to++ = *from++;
@@ -23,4 +23,6 @@ void bcopy(from, to, count)
while (--count >= 0)
*--to = *--from;
}
+ return from;
}
+#endif
--- texk/seetexk/bzero.c
+++ texk/seetexk/bzero.c 2009-08-28 14:13:32.721901870 +0000
@@ -1,5 +1,5 @@
#ifndef lint
-static char rcsid[] = "$Header: /usr/src/local/tex/local/mctex/lib/RCS/bzero.c,v 3.1 89/08/22 21:42:12 chris Exp $";
+static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/src/local/tex/local/mctex/lib/RCS/bzero.c,v 3.1 89/08/22 21:42:12 chris Exp $";
#endif
/*
@@ -7,7 +7,7 @@ static char rcsid[] = "$Header: /usr/src
* This should be rewritten to be as fast as possible for your
* machine.
*/
-bzero(addr, count)
+void bzero(addr, count)
register char *addr;
register int count;
{
--- texk/seetexk/configure
+++ texk/seetexk/configure 2009-09-04 13:23:18.898401799 +0000
@@ -14169,7 +14169,7 @@ if test "x$with_kpathsea_libdir" != x &&
KPATHSEA_LIBS="-L$with_kpathsea_libdir $KPATHSEA_LIBS"
fi
else
- KPATHSEA_INCLUDES=`echo '-IBLD/texk -ISRC/texk' | sed \
+ KPATHSEA_INCLUDES=`echo '-IBLD/texk/kpathsea -ISRC/texk/kpathsea -IBLD/texk -ISRC/texk' | sed \
-e "s,SRC/,$kpse_SRC/,g" \
-e "s,BLD/,$kpse_BLD/,g"`
KPATHSEA_LIBS=`echo 'BLD/texk/kpathsea/libkpathsea.la' | sed \
--- texk/seetexk/conv.c
+++ texk/seetexk/conv.c 2009-08-28 14:13:32.721901870 +0000
@@ -6,7 +6,7 @@
*/
#ifndef lint
-static char rcsid[] = "$Header: /usr/src/local/tex/local/mctex/lib/RCS/conv.c,v 3.1 89/08/22 21:48:01 chris Exp $";
+static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/src/local/tex/local/mctex/lib/RCS/conv.c,v 3.1 89/08/22 21:48:01 chris Exp $";
#endif
/*
--- texk/seetexk/dvi_draw.c
+++ texk/seetexk/dvi_draw.c 2009-08-28 14:13:32.721901870 +0000
@@ -57,11 +57,12 @@
* it's worth it.
*/
-static char *rcsid="$Header: /usr/local/src/Uiuctex/libtex/RCS/dvi_draw.c,v 1.3 88/02/19 17:00:34 grunwald Exp Locker: grunwald $" ;
+static char *rcsid __attribute__ ((unused)) ="$Header: /usr/local/src/Uiuctex/libtex/RCS/dvi_draw.c,v 1.3 88/02/19 17:00:34 grunwald Exp Locker: grunwald $" ;
#include <math.h>
#include <stdio.h>
#include <ctype.h>
+#include <stdlib.h>
#define MAXPOINTS 300 /* Max points in a path */
#define TWOPI (3.14159265359*2.0)
@@ -85,6 +86,7 @@ extern void dot_at(), line_btw(), do_att
extern int dviDPI, currentShrink, shrinkFactor[];
+void draw_ellipse();
/*
* Issue warning/error messages
@@ -160,7 +162,7 @@ int dotted;
int i, numdots, x0, y0, x1, y1;
int cx0, cy0, cx1, cy1;
float inchesperdash;
- double d, spacesize, a, b, dx, dy, milliperdash;
+ double d, spacesize, a, b = 0.0, dx, dy, milliperdash;
if (sscanf(cp, " %f ", &inchesperdash) != 1) {
Warning("illegal format for dotted/dashed line: %s", cp);
@@ -298,13 +300,10 @@ char *cp;
*/
void flush_spline()
{
- int xp, yp, N, lastx=(-1), lasty;
+ int xp, yp, N, lastx=(-1), lasty = -1;
int t1, t2, t3, steps, j;
register int i, w;
-#ifdef lint
- lasty = -1;
-#endif
N = path_len + 1;
xx[0] = xx[1]; yy[0] = yy[1];
xx[N] = xx[N-1]; yy[N] = yy[N-1];
@@ -362,7 +361,7 @@ void blacken_last()
/*
* Draw an ellipse with the indicated center and radices.
*/
-draw_ellipse(xc, yc, xr, yr)
+void draw_ellipse(xc, yc, xr, yr)
int xc, yc, xr, yr;
{
double angle, theta;
--- texk/seetexk/dvibook.c
+++ texk/seetexk/dvibook.c 2009-08-28 14:13:32.721901870 +0000
@@ -27,6 +27,7 @@ extern char *optarg;
extern int optind;
#endif
+#include <stdlib.h>
#include "types.h"
#include "dviclass.h"
#include "dvicodes.h"
@@ -35,6 +36,8 @@ extern int optind;
#include "gripes.h"
#include "search.h"
#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
#include <ctype.h>
#include "seek.h"
@@ -101,9 +104,6 @@ i32 Count[10]; /* the 10 \count variabl
/* save some string space: we use this a lot */
char writeerr[] = "error writing DVI file";
-#ifndef KPATHSEA
-char *malloc(), *realloc();
-#endif
/*
* You may get lint warnings about sprintf's return value.
* Older versions of 4BSD have `char *sprintf()'. ANSI and
--- texk/seetexk/dviconcat.c
+++ texk/seetexk/dviconcat.c 2009-08-28 14:31:09.497902049 +0000
@@ -25,6 +25,8 @@ extern char *optarg;
extern int optind;
#endif
+#include <stdlib.h>
+#include <string.h>
#include "types.h"
#include "dviclass.h"
#include "dvicodes.h"
@@ -87,15 +89,9 @@ i16 DVIStackSize; /* max of all stack s
char writeerr[] = "error writing DVI file";
static void HandleDVIFile(void);
-#ifdef _AMIGA
#define bcmp(s1, s2, len) memcmp(s1, s2, len)
#define bzero(s, len) memset(s, '\0', len)
#define index(s, c) strchr(s, c)
-#endif /* _AMIGA */
-
-#ifndef KPATHSEA
-char *malloc(), *realloc();
-#endif
/* extern int getopt(int, char **, char*); */
--- texk/seetexk/dviselect.c
+++ texk/seetexk/dviselect.c 2009-08-28 14:32:32.286401443 +0000
@@ -38,7 +38,10 @@ extern int optind;
#include "gripes.h"
#include "search.h"
#include <stdio.h>
+#include <stdlib.h>
#include <ctype.h>
+#include <stdlib.h>
+#include <string.h>
#define white(x) ((x) == ' ' || (x) == '\t' || (x) == ',')
@@ -148,15 +151,9 @@ static int ParsePages(char *);
static void HandleDVIFile(void);
static void PutFontSelector(i32);
-#ifdef _AMIGA
#define bcmp(s1, s2, len) memcmp(s1, s2, len)
#define bzero(s, len) memset(s, '\0', len)
#define index(s, c) strchr(s, c)
-#endif /* _AMIGA */
-
-#ifndef KPATHSEA
-char *malloc(), *realloc();
-#endif /* not KPATHSEA */
/*
* You may get lint warnings about sprintf's return value.
@@ -550,7 +547,7 @@ Usage: %s [-s] [-i infile] [-o outfile]
static struct pagelist *
InstallPL(struct pagesel *ps, int n, int absolute)
{
- register struct pagelist *pl;
+ struct pagelist *pl;
pl = (struct pagelist *)malloc(sizeof *pl);
if (pl == NULL)
--- texk/seetexk/dvistate.c
+++ texk/seetexk/dvistate.c 2009-08-28 14:13:32.729901520 +0000
@@ -6,7 +6,7 @@
*/
#ifndef lint
-static char rcsid[] = "$Header: /usr/src/local/tex/local/mctex/lib/RCS/dvistate.c,v 1.1 89/08/22 21:49:03 chris Exp $";
+static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/src/local/tex/local/mctex/lib/RCS/dvistate.c,v 1.1 89/08/22 21:49:03 chris Exp $";
#endif
/*
@@ -14,6 +14,7 @@ static char rcsid[] = "$Header: /usr/src
*/
#include <stdio.h>
+#include <stdlib.h>
#include "types.h"
#include "conv.h"
#include "dvicodes.h"
@@ -35,10 +36,6 @@ static int s_errs;
static void pre(), post(), fntdef();
-#if !defined( WIN32 ) && !defined( _AMIGA )
-char *malloc();
-#endif
-
/*
* Read through the postamble and the preamble and set up the
* global DVI state. Each font is passed to (*fontfn)().
--- texk/seetexk/dvistuff.c
+++ texk/seetexk/dvistuff.c 2009-08-28 14:13:32.729901520 +0000
@@ -32,17 +32,23 @@
*/
#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
#include <ctype.h>
#include "dvistuff.h" /* includes types & fonts */
-static char *rcsid="$Header: /home/reed/grunwald/Iptex/drivers/RCS/dvistuff.c,v 1.17 88/07/07 23:25:32 grunwald Exp Locker: grunwald $" ;
+static char *rcsid __attribute__ ((unused)) ="$Header: /home/reed/grunwald/Iptex/drivers/RCS/dvistuff.c,v 1.17 88/07/07 23:25:32 grunwald Exp Locker: grunwald $" ;
#include "dviclass.h"
#include "dvicodes.h"
#include "postamble.h"
#include "search.h"
#include "fio.h"
+#include "error.h"
+#include "gripes.h"
+
+extern void SkipFontDef();
int dviHH = -1; /* current horizontal position, in DEVs */
int dviVV = -1; /* current vertical position, in DEVs */
@@ -244,7 +250,7 @@ register struct PostAmbleFont *p;
register struct fontinfo *fi;
register struct font *f;
- char *fname;
+ char *fname = NULL;
int def = S_CREATE | S_EXCL;
fi = (struct fontinfo *) SSearch(FontFinder, p->paf_DVIFontIndex,
@@ -573,7 +579,7 @@ dviPreparePage(page)
int page;
{
register int c;
- register i32 p;
+ register i32 p = 0;
int advance;
if (page < 0) {
@@ -1139,7 +1145,7 @@ int shrinkW;
printf("New glyph:\n");
seeGlyph(shrunkRaster, shrunkHeight, shrunkBytesWide);
}
-#endif UNDEF
+#endif /* UNDEF */
ngly = (struct glyph *) malloc(sizeof(struct glyph));
bzero(ngly, sizeof(struct glyph));
@@ -1187,4 +1193,4 @@ int w;
}
-#endif UNDEF
+#endif /* UNDEF */
--- texk/seetexk/dvistuff.h
+++ texk/seetexk/dvistuff.h 2009-08-28 14:13:32.729901520 +0000
@@ -31,7 +31,7 @@
*
*/
-static char *dvistuff_header_rcsid="$Header: /home/reed/grunwald/Iptex/drivers/RCS/dvistuff.h,v 1.11 89/02/15 16:31:56 grunwald Exp $" ;
+static char *dvistuff_header_rcsid __attribute__ ((unused)) ="$Header: /home/reed/grunwald/Iptex/drivers/RCS/dvistuff.h,v 1.11 89/02/15 16:31:56 grunwald Exp $" ;
/*
* Include the following from the CTex distribution
--- texk/seetexk/dvitodvi.c
+++ texk/seetexk/dvitodvi.c 2009-08-28 14:13:32.729901520 +0000
@@ -27,6 +27,7 @@ extern char *optarg;
extern int optind;
#endif
+#include <stdlib.h>
#include "types.h"
#include "dviclass.h"
#include "dvicodes.h"
@@ -35,6 +36,8 @@ extern int optind;
#include "gripes.h"
#include "search.h"
#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
#include <ctype.h>
#define white(x) ((x) == ' ' || (x) == '\t' || (x) == ',')
@@ -71,6 +74,7 @@ struct fontinfo {
i32 Width; /* width of page */
i32 Height; /* height of page */
i32 Magnification; /* Magnification of pages */
+i32 MyMag;
int Modulo; /* page spec modulo */
struct pagespec *PageSpecs; /* page specification list */
@@ -105,9 +109,6 @@ i32 Count[10]; /* the 10 \count variabl
/* save some string space: we use this a lot */
char writeerr[] = "error writing DVI file";
-#ifndef KPATHSEA
-char *malloc(), *realloc();
-#endif
static void WriteFont(struct fontinfo *fi);
static void PutFontSelector(i32 index);
@@ -168,6 +169,15 @@ scale(i32 whole, int num, int den, i32 s
return (v) ;
}
+i32 myscale(i32 whole, i32 verus, i32 sf)
+{
+ i32 v;
+
+ v = (i32) (( (double)whole * ( (double)sf / (double)verus ) ) + 0.5 );
+ return(v);
+}
+
+
struct pagespec {
int reversed, pageno, add;
i32 xoff, yoff;
@@ -275,6 +285,8 @@ parsedimen(char **sp)
fac = Height;
s++;
}
+ if (MyMag)
+ fac = myscale(fac,MyMag,1000);
whole = scale(whole, num, den, fac) ;
*sp = s;
return (neg ? -whole : whole);
@@ -473,9 +485,15 @@ HandlePostAmble(void)
PutLong(outf, Denominator);
PutLong(outf, DVIMag);
c = GetLong(inf);
- PutLong(outf, c); /* tallest page height */
+ if ( c >= Height )
+ PutLong(outf, c); /* tallest page height */
+ else
+ PutLong(outf, Height);
c = GetLong(inf);
- PutLong(outf, c); /* widest page width */
+ if ( c >= Width )
+ PutLong(outf, c); /* widest page width */
+ else
+ PutLong(outf, Width);
c = GetWord(inf)+1;
PutWord(outf, c); /* DVI stack size */
PutWord(outf, NumberOfOutputPages);
@@ -568,7 +586,8 @@ HandlePreAmble(void)
DVIFileName, DVI_VERSION);
Numerator = GetLong(inf);
Denominator = GetLong(inf);
- DVIMag = GetLong(inf) * Magnification / 1000;
+ MyMag = GetLong(inf);
+ DVIMag = MyMag * Magnification / 1000;
putbyte(outf, DVI_PRE);
putbyte(outf, DVI_VERSION);
PutLong(outf, Numerator);
@@ -595,6 +614,7 @@ main(int argc, char **argv)
Width = 0;
Height = 0;
Magnification = 1000;
+ MyMag = 0;
Modulo = 1;
ProgName = *argv;
@@ -691,12 +711,16 @@ Usage: %s [-q] [-i infile] [-o outfile]
if (fseek(inf, 16L, 1) == -1)
error(1, -1, "can't seek postamble");
if (Height == 0) /* get height from postamble */
- Height = GetLong(inf);
+ Height = myscale(GetLong(inf),1000,MyMag);
else
(void) GetLong(inf); /* ignore height */
if (Width == 0) /* get width from postamble */
- Width = GetLong(inf);
+ Width = myscale(GetLong(inf),1000,MyMag);
+ else
+ (void) GetLong(inf);
PageSpecs = ParseSpecs(specstring, 1);
+ Height = myscale(Height,MyMag,1000);
+ Width = myscale(Width,MyMag,1000);
HandleDVIFile();
HandlePostAmble();
--- texk/seetexk/error.c
+++ texk/seetexk/error.c 2010-11-12 11:52:47.916425348 +0000
@@ -10,7 +10,12 @@
* optionally quit.
*
*/
+#include <stdarg.h>
#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <c-auto.h>
+#include <errno.h>
#ifdef HAVE_CONFIG_H
#include <config.h>
@@ -22,20 +27,11 @@
extern char *ProgName; /* program name from argv[0] */
-#include <errno.h>
-#ifndef errno
-extern int errno;
-#endif
-
static FILE *trap_file; /* error diversion file, if any */
static void (*trap_fn)(int, const char *); /* trap function */
static char *trap_buf; /* buffer for trapped error strings */
static int trap_size; /* size of trap_buf */
-#ifndef KPATHSEA
-extern char *malloc(), *realloc();
-#endif
-
#if !defined (HAVE_STRERROR) && !defined (strerror)
static char *
strerror (int errnum)
--- texk/seetexk/findpost.c
+++ texk/seetexk/findpost.c 2009-08-28 14:13:32.729901520 +0000
@@ -6,7 +6,7 @@
*/
#ifndef lint
-static char rcsid[] = "$Header: /usr/src/local/tex/local/mctex/lib/RCS/findpost.c,v 2.3 89/08/22 21:50:11 chris Exp $";
+static char rcsid[] __attribute__ ((unused))= "$Header: /usr/src/local/tex/local/mctex/lib/RCS/findpost.c,v 2.3 89/08/22 21:50:11 chris Exp $";
#endif
/*
@@ -35,7 +35,7 @@ static char rcsid[] = "$Header: /usr/src
long ftell(); /* should be declared in stdio.h */
#endif
-FindPostAmble(f)
+int FindPostAmble(f)
register FILE *f;
{
register long offset;
--- texk/seetexk/font.c
+++ texk/seetexk/font.c 2009-08-28 14:13:32.777901505 +0000
@@ -6,7 +6,7 @@
*/
#ifndef lint
-static char rcsid[] = "$Header: /homes/grunwald/Src/SeeTeX/libtex/RCS/font.c,v 1.2 1992/07/22 16:26:02 grunwald Exp grunwald $";
+static char rcsid[] __attribute__ ((unused)) = "$Header: /homes/grunwald/Src/SeeTeX/libtex/RCS/font.c,v 1.2 1992/07/22 16:26:02 grunwald Exp grunwald $";
#endif
/*
@@ -17,13 +17,21 @@ static char rcsid[] = "$Header: /homes/g
*/
#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
#include <errno.h>
#include <ctype.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
#include "types.h"
#include "conv.h"
#include "error.h"
#include "font.h"
+extern int split();
+
/*
* Define the default configuration file.
* Also define the maximum path name length.
@@ -75,8 +83,7 @@ static struct font *getafont(char *nm, i
/*
* Imports.
*/
-extern int errno;
-char *getenv(), *malloc(), *strncpy(), *strsave();
+char *strsave();
/*
* You may get warnings from lint about sprintf(), which is of type
@@ -149,7 +156,7 @@ readconf(char *name)
register FILE *f; /* config file */
register int c; /* char and word counter */
int isenv; /* true => doing `fontenv', not `font' */
- char *env; /* value from getenv() */
+ char *env = NULL; /* value from getenv() */
struct fontconf proto; /* prototype fontconf */
char *v[20]; /* word vector */
char line[BUFSIZ]; /* input line */
@@ -331,7 +338,7 @@ badcf(char *why)
static void
basify(char *s, char *buf, int size)
{
- register char *p, *endp;
+ register char *p, *endp = NULL;
register int n;
for (p = s; *p; p++)
--- texk/seetexk/font_subr.c
+++ texk/seetexk/font_subr.c 2009-08-28 14:13:32.829901219 +0000
@@ -6,23 +6,24 @@
*/
#ifndef lint
-static char rcsid[] = "$Header: /usr/src/local/tex/local/mctex/lib/RCS/font_subr.c,v 2.8 89/10/30 04:08:52 chris Exp $";
+static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/src/local/tex/local/mctex/lib/RCS/font_subr.c,v 2.8 89/10/30 04:08:52 chris Exp $";
#endif
/*
* Subroutines common to all fonts.
*/
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
#include "types.h"
#include "error.h"
#include "font.h"
static struct glyph *freeglyphs;
-#if !defined( WIN32 ) && !defined( _AMIGA )
-char *malloc();
-extern errno;
-#endif
+extern void ScaleGlyphs(register struct font *f, int l, int h);
+extern void SetRotation(register struct glyph *g, int r);
/*
* Set up the font structures to note that a font has glyphs in
@@ -31,6 +32,7 @@ extern errno;
* SHOULD I ALLOW ADDITIONS TO THE RANGE VIA SUBSEQUENT CALLS TO
* FontHasGlyphs?
*/
+int
FontHasGlyphs(f, low, high)
register struct font *f;
register int low, high;
--- texk/seetexk/gfclass.c
+++ texk/seetexk/gfclass.c 2009-08-28 14:13:32.829901219 +0000
@@ -6,7 +6,7 @@
*/
#ifndef lint
-static char rcsid[] = "$Header: /usr/src/local/tex/local/mctex/lib/RCS/gfclass.c,v 2.3 89/08/22 21:52:30 chris Exp $";
+static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/src/local/tex/local/mctex/lib/RCS/gfclass.c,v 2.3 89/08/22 21:52:30 chris Exp $";
#endif
/*
--- texk/seetexk/gffont.c
+++ texk/seetexk/gffont.c 2009-08-28 14:13:32.829901219 +0000
@@ -6,12 +6,15 @@
*/
#ifndef lint
-static char rcsid[] = "$Header: /usr/src/local/tex/local/mctex/lib/RCS/gffont.c,v 2.9 89/09/02 17:16:17 chris Exp $";
+static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/src/local/tex/local/mctex/lib/RCS/gffont.c,v 2.9 89/09/02 17:16:17 chris Exp $";
#endif
#include <stdio.h>
+#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
+#include <unistd.h>
+#include <errno.h>
#include "types.h"
#include "error.h"
#include "font.h"
@@ -19,6 +22,8 @@ static char rcsid[] = "$Header: /usr/src
#include "gfclass.h"
#include "num.h"
+extern int FontHasGlyphs();
+
/*
* GF font operations.
*
@@ -75,11 +80,6 @@ struct gf_details {
* Get the gf_details from font f.
*/
#define ftogd(f) ((struct gf_details *)(f)->f_details)
-
-#if !defined( WIN32 ) && !defined( _AMIGA )
-extern int errno;
-extern char *malloc();
-#endif
char *copyit();
/*
@@ -394,7 +394,7 @@ drawchar(p, abbrev, globalb, gfname)
register i32 m; /* m register (column) */
register char *colp; /* pointer to byte corresponding to m */
register int c; /* temporary */
- register i32 i; /* temporary */
+ register i32 i = 0; /* temporary */
register int black; /* true when paint_switch==black */
register i32 n; /* n register (row) */
int stride; /* multiplier to convert linear to 2d array */
@@ -794,7 +794,7 @@ gf_getgly(f, l, h)
register i32 c;
register int i;
register i32 thisboc;
- int abbrev;
+ int abbrev = 0;
struct gf_details *gd = ftogd(f);
/*
@@ -926,8 +926,8 @@ gf_rasterise(f, l, h)
struct font *f;
int l, h;
{
-
panic("gf_rasterise(%s, %d, %d)", f->f_path, l, h);
+ /* NOTREACHED */
}
/*
--- texk/seetexk/gripes.h
+++ texk/seetexk/gripes.h 2010-11-12 11:55:39.148426060 +0000
@@ -13,16 +13,17 @@ extern const char *DVIFileName;
* Declarations for the various gripes.
*/
-void GripeOutOfMemory(int n, const char *why);
+#define __NR__ __attribute__ ((noreturn))
+void GripeOutOfMemory(int n, const char *why) __NR__;
void GripeCannotGetFont(const char *name, i32 mag, i32 dsz, const char *dev, const char *fullname);
void GripeDifferentChecksums(const char *font, i32 tfmsum, i32 fontsum);
-void GripeMissingFontsPreventOutput(int n);
-void GripeNoSuchFont(i32 n);
-void GripeFontAlreadyDefined(i32 n);
-void GripeUnexpectedDVIEOF(void);
-void GripeUnexpectedOp(const char *s);
-void GripeMissingOp(const char *s);
-void GripeCannotFindPostamble(void);
-void GripeMismatchedValue(const char *s);
-void GripeUndefinedOp(int n);
+void GripeMissingFontsPreventOutput(int n) __NR__;
+void GripeNoSuchFont(i32 n) __NR__;
+void GripeFontAlreadyDefined(i32 n) __NR__;
+void GripeUnexpectedDVIEOF(void) __NR__;
+void GripeUnexpectedOp(const char *s) __NR__;
+void GripeMissingOp(const char *s) __NR__;
+void GripeCannotFindPostamble(void) __NR__;
+void GripeMismatchedValue(const char *s) __NR__;
+void GripeUndefinedOp(int n) __NR__;
void GripeBadGlyph(i32 c, struct font *f);
--- texk/seetexk/gripes0.c
+++ texk/seetexk/gripes0.c 2009-08-28 14:38:06.501901818 +0000
@@ -10,14 +10,12 @@
*/
#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
#include "types.h"
#include "error.h"
#include "gripes.h"
-#ifndef WIN32
-extern int errno;
-#endif
-
/*
* Cannot allocate memory.
*/
@@ -26,7 +24,7 @@ GripeOutOfMemory(int n, const char *why)
{
error(1, -1, "ran out of memory allocating %d bytes for %s", n, why);
- /* NOTREACHED */
+ exit(-1); /* NOTREACHED */
}
/*
@@ -71,7 +69,7 @@ WARNING: TeX and I have different checks
\t\"%s\"\n\
\tPlease notify your TeX maintainer\n\
\t(TFM checksum = 0%lo, my checksum = 0%lo)",
- font, (long)tfmsum, (long)fontsum);
+ font ? font : "", (long)tfmsum, (long)fontsum);
}
/*
@@ -84,5 +82,5 @@ GripeMissingFontsPreventOutput(int n)
error(1, 0, "%d missing font%s prevent%s output (sorry)", n,
n > 1 ? s : &s[1], n == 1 ? s : &s[1]);
- /* NOTREACHED */
+ exit(0); /* NOTREACHED */
}
--- texk/seetexk/gripes1.c
+++ texk/seetexk/gripes1.c 2009-08-28 14:13:32.869901244 +0000
@@ -10,6 +10,7 @@
*/
#include <stdio.h>
+#include <stdlib.h>
#include "types.h"
#include "error.h"
#include "font.h"
@@ -25,7 +26,7 @@ dfn(void)
/*
* Save string space by declaring these here.
*/
-#if __STDC__ >= 1
+#if 0
static const char dfl[] = "DVI file";
static const char areyousure[] = "(are you sure %s is a %s?)";
#else
@@ -42,7 +43,7 @@ GripeNoSuchFont(i32 n)
error(0, 0, "%s wants font %ld, which it never defined", dfl, (long)n);
error(1, 0, areyousure, dfn(), dfl);
- /* NOTREACHED */
+ exit (0); /* NOTREACHED */
}
/*
@@ -54,7 +55,7 @@ GripeFontAlreadyDefined(i32 n)
error(0, 0, "%s redefines font %ld", dfl, n);
error(1, 0, areyousure, dfn(), dfl);
- /* NOTREACHED */
+ exit (0); /* NOTREACHED */
}
/*
@@ -77,7 +78,7 @@ GripeUnexpectedOp(const char *s)
error(0, 0, "unexpected %s in %s", s, dfl);
error(1, 0, areyousure, dfn(), dfl);
- /* NOTREACHED */
+ exit (0); /* NOTREACHED */
}
/*
@@ -89,7 +90,7 @@ GripeMissingOp(const char *s)
error(0, 0, "missing %s in %s", s, dfl);
error(1, 0, areyousure, dfn(), dfl);
- /* NOTREACHED */
+ exit (0); /* NOTREACHED */
}
/*
@@ -101,7 +102,7 @@ GripeCannotFindPostamble(void)
error(0, 0, "cannot find postamble");
error(1, 0, areyousure, dfn(), dfl);
- /* NOTREACHED */
+ exit (0); /* NOTREACHED */
}
/*
@@ -113,7 +114,7 @@ GripeMismatchedValue(const char *s)
error(0, 0, "mismatched %s in %s", s, dfl);
error(1, 0, areyousure, dfn(), dfl);
- /* NOTREACHED */
+ exit (0); /* NOTREACHED */
}
/*
@@ -125,7 +126,7 @@ GripeUndefinedOp(int n)
error(0, 0, "undefined DVI opcode %d", n);
error(1, 0, areyousure, dfn(), dfl);
- /* NOTREACHED */
+ exit (0); /* NOTREACHED */
}
/*
--- texk/seetexk/mydvichk
+++ texk/seetexk/mydvichk 2010-11-12 11:50:39.783926350 +0000
@@ -0,0 +1,12 @@
+#!/bin/csh -f
+# 1993 (c) Werner Fink <Werner.Fink@itap.physik.uni-stuttgart.de>
+#
+dvitype ${1} <<DONE |& tr " " "\012" | fgrep totalpages
+0
+
+
+
+0
+DONE
+
+exit(0)
--- texk/seetexk/odd2even
+++ texk/seetexk/odd2even 2010-11-12 11:50:39.783926350 +0000
@@ -0,0 +1,22 @@
+#!/bin/csh -f
+# 1993 (c) Werner Fink <Werner.Fink@itap.physik.uni-stuttgart.de>
+#
+
+if (${#argv} <= 1) then
+ echo " ${0}: Usage: infile outfile"
+ exit
+endif
+
+set NumP=`mydvichk $1 | sed -e 's/totalpages=//g'`
+
+if (${NumP} % 2) then
+ dviselect -s '=1' $1 | \
+ dvibook -q | \
+ dviselect -s '=1' | \
+ dviconcat -o $2 - $1 >& /dev/null
+ echo " ${0}: ready"
+else
+ echo " ${0}: even number of pages --- nothing to do"
+endif
+
+exit 0
--- texk/seetexk/pkfont.c
+++ texk/seetexk/pkfont.c 2009-08-28 14:13:32.873901460 +0000
@@ -6,17 +6,22 @@
*/
#ifndef lint
-static char rcsid[] = "$Header: /usr/src/local/tex/local/mctex/lib/RCS/pkfont.c,v 2.10 89/08/22 21:54:49 chris Exp $";
+static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/src/local/tex/local/mctex/lib/RCS/pkfont.c,v 2.10 89/08/22 21:54:49 chris Exp $";
#endif
#include <stdio.h>
+#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
+#include <unistd.h>
+#include <errno.h>
#include "types.h"
#include "error.h"
#include "font.h"
#include "num.h"
+extern int FontHasGlyphs();
+
/*
* PK font operations.
*
@@ -127,11 +132,6 @@ struct pk_details {
static int scan_characters();
-#if !defined( WIN32 ) && !defined( _AMIGA )
-extern int errno;
-char *malloc();
-#endif
-
/*
* PK subroutines.
*/
--- texk/seetexk/pxlfont.c
+++ texk/seetexk/pxlfont.c 2009-08-28 14:13:32.873901460 +0000
@@ -6,18 +6,22 @@
*/
#ifndef lint
-static char rcsid[] = "$Header: /usr/src/local/tex/local/mctex/lib/RCS/pxlfont.c,v 2.5 89/08/22 21:55:34 chris Exp $";
+static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/src/local/tex/local/mctex/lib/RCS/pxlfont.c,v 2.5 89/08/22 21:55:34 chris Exp $";
#endif
#include <stdio.h>
+#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
+#include <unistd.h>
#include <errno.h>
#include "types.h"
#include "error.h"
#include "font.h"
#include "fio.h"
+extern int FontHasGlyphs();
+
/*
* PXL font operations.
*/
@@ -63,11 +67,6 @@ struct pxl_details {
*/
#define ftopd(f) ((struct pxl_details *) (f)->f_details)
-extern errno;
-#ifndef KPATHSEA
-char *malloc();
-#endif
-
/*
* Read a PXL file.
*/
--- texk/seetexk/rotate.c
+++ texk/seetexk/rotate.c 2009-08-28 14:13:32.873901460 +0000
@@ -6,7 +6,7 @@
*/
#ifndef lint
-static char rcsid[] = "$Header: /usr/src/local/tex/local/mctex/lib/RCS/rotate.c,v 2.4 89/08/22 21:56:05 chris Exp $";
+static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/src/local/tex/local/mctex/lib/RCS/rotate.c,v 2.4 89/08/22 21:56:05 chris Exp $";
#endif
/*
@@ -16,17 +16,14 @@ static char rcsid[] = "$Header: /usr/src
* from being rotated of course!).
*/
+#include <stdlib.h>
+#include <errno.h>
#include "types.h"
#include "error.h"
#include "font.h"
static void RotateClockwise();
-#if !defined( WIN32 ) && !defined( _AMIGA )
-extern int errno;
-char *malloc();
-#endif
-
/*
* Rounding, but by powers of two only.
*/
@@ -131,7 +128,7 @@ RotateClockwise(glyph)
* the old raster, can discard the original i and j.
*/
{
- register int mapj, c, k, mapi;
+ register int mapj, c = 0, k, mapi;
mapi = oheight;
owidth *= nplus;
--- texk/seetexk/seek.c
+++ texk/seetexk/seek.c 2009-08-28 14:13:32.877901585 +0000
@@ -32,6 +32,10 @@
#endif
#include <stdio.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include <errno.h>
#include "types.h" /* for BSD_FILE_SYSTEM */
#include "seek.h"
#include "tempfile.h"
@@ -44,12 +48,7 @@
#endif
#include <sys/stat.h>
-#ifndef KPATHSEA
-long lseek();
-char *malloc();
-
-extern int errno;
-#endif
+extern int MakeRWTempFile();
/*
* Make and return a version of `f' on which fseek works (unconditionally).
--- texk/seetexk/skip.c
+++ texk/seetexk/skip.c 2009-08-28 14:13:32.877901585 +0000
@@ -6,7 +6,7 @@
*/
#ifndef lint
-static char rcsid[] = "$Header: /usr/src/local/tex/local/mctex/lib/RCS/skip.c,v 3.1 89/08/22 21:45:13 chris Exp $";
+static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/src/local/tex/local/mctex/lib/RCS/skip.c,v 3.1 89/08/22 21:45:13 chris Exp $";
#endif
#include <stdio.h>
@@ -16,7 +16,7 @@ static char rcsid[] = "$Header: /usr/src
/*
* Skip a font definition. The font number has already been consumed.
*/
-SkipFontDef(fp)
+void SkipFontDef(fp)
register FILE *fp;
{
register int i;
--- texk/seetexk/split.c
+++ texk/seetexk/split.c 2009-08-28 14:13:32.881901811 +0000
@@ -6,7 +6,7 @@
*/
#ifndef lint
-static char rcsid[] = "$Header: /usr/src/local/tex/local/mctex/lib/RCS/split.c,v 3.1 89/08/22 21:59:36 chris Exp $";
+static char rcsid[] __attribute__((unused)) = "$Header: /usr/src/local/tex/local/mctex/lib/RCS/split.c,v 3.1 89/08/22 21:59:36 chris Exp $";
#endif
#include <ctype.h>
@@ -44,7 +44,7 @@ split(s, w, nw)
register int c;
register char *canon = s;
register int wleft = nw;
- enum lexstate state, prebkstate;
+ enum lexstate state, prebkstate = S_BLANK;
/*
* Start out in the `blank' state (outside a word). Handle
--- texk/seetexk/strsave.c
+++ texk/seetexk/strsave.c 2009-08-28 14:13:32.905901116 +0000
@@ -9,13 +9,14 @@
* Save a string in managed memory.
*/
-#if !defined( WIN32 ) && !defined( _AMIGA )
-char *malloc(), *realloc();
-extern int errno;
-#endif
-
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
#include "types.h" /* for bcopy */
#include "error.h"
+#ifndef bcopy
+#define bcopy(from, to, len) memmove(to, from, len)
+#endif
char *
strsave(s)
--- texk/seetexk/tempfile.c
+++ texk/seetexk/tempfile.c 2009-08-28 14:13:32.905901116 +0000
@@ -10,6 +10,7 @@
#endif
#include <stdio.h>
+#include <stdlib.h>
#include <sys/types.h>
#ifdef HAVE_UNISTD_H
@@ -24,9 +25,7 @@
#include "types.h"
#else
#include <sys/file.h>
-
-char *getenv();
-
+#include <unistd.h>
#endif
#include "tempfile.h"
--- texk/seetexk/tfm.c
+++ texk/seetexk/tfm.c 2009-08-28 14:13:32.913901063 +0000
@@ -6,7 +6,7 @@
*/
#ifndef lint
-static char rcsid[] = "$Header: /usr/src/local/tex/local/mctex/lib/RCS/tfm.c,v 3.1 89/08/22 22:00:12 chris Exp $";
+static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/src/local/tex/local/mctex/lib/RCS/tfm.c,v 3.1 89/08/22 22:00:12 chris Exp $";
#endif
/*
@@ -16,17 +16,15 @@ static char rcsid[] = "$Header: /usr/src
* finish
*/
+#include <stdlib.h>
#include <stdio.h>
+#include <stdlib.h>
#include "types.h"
#include "fio.h"
#include "tfm.h"
static int trd_header(), trd_ci(), trd_fix();
-#if !defined( WIN32 ) && !defined( _AMIGA )
-char *malloc();
-#endif
-
#define ALLOC(n, type) ((type *)malloc((unsigned)((n) * sizeof(type))))
int
--- texk/seetexk/tfmfont.c
+++ texk/seetexk/tfmfont.c 2009-08-28 14:13:32.913901063 +0000
@@ -6,16 +6,24 @@
*/
#ifndef lint
-static char rcsid[] = "$Header: /usr/src/local/tex/local/mctex/lib/RCS/tfmfont.c,v 3.4 89/11/29 02:29:58 chris Exp $";
+static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/src/local/tex/local/mctex/lib/RCS/tfmfont.c,v 3.4 89/11/29 02:29:58 chris Exp $";
#endif
#include <stdio.h>
+#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
+#include <unistd.h>
+#include <errno.h>
#include "types.h"
#include "conv.h"
#include "font.h"
#include "tfm.h"
+#include "error.h"
+#include "gripes.h"
+
+extern int FontHasGlyphs();
+extern int readtfmfile();
/*
* TFM font operations. This defines three fonts:
@@ -63,11 +71,6 @@ struct tfm_details {
static int do_read();
-#if !defined( WIN32 ) && !defined( _AMIGA )
-extern int errno;
-char *malloc();
-#endif
-
/*
* Read a Box font.
*/
--- texk/seetexk/types.h
+++ texk/seetexk/types.h 2009-08-28 14:13:32.921901032 +0000
@@ -43,8 +43,9 @@
*
* (The bcopy provided in lib/bcopy.c does handle overlap.)
*/
-/* #define BLOCK_COPY(from, to, len) memmove(to, from, len) */
-#define BLOCK_COPY(from, to, len) bcopy(from, to, len)
+#include <string.h>
+#define BLOCK_COPY(from, to, len) memmove(to, from, len)
+/* #define BLOCK_COPY(from, to, len) bcopy(from, to, len) */
/*
* Define void as int if your compiler does not support void,