diff options
Diffstat (limited to 'print/enscript/patches/patch-ab')
-rw-r--r-- | print/enscript/patches/patch-ab | 85 |
1 files changed, 32 insertions, 53 deletions
diff --git a/print/enscript/patches/patch-ab b/print/enscript/patches/patch-ab index 12d40ccb4bd..77f72d304fd 100644 --- a/print/enscript/patches/patch-ab +++ b/print/enscript/patches/patch-ab @@ -1,57 +1,36 @@ -$NetBSD: patch-ab,v 1.1 2002/01/25 18:58:02 kleink Exp $ +$NetBSD: patch-ab,v 1.2 2005/03/17 12:24:13 salo Exp $ ---- src/psgen.c.orig Thu Jun 25 09:18:54 1998 -+++ src/psgen.c Fri Jan 25 19:39:07 2002 -@@ -2398,7 +2398,7 @@ - read_float (InputStream *is, int units, int horizontal) - { - char buf[256]; -- int i, ch; -+ int i, ch = 0; - double val; +--- src/psgen.c.orig 2002-01-24 08:38:58.000000000 +0100 ++++ src/psgen.c 2005-03-17 11:56:57.000000000 +0100 +@@ -2034,8 +2034,9 @@ + else + { + ftail++; +- strncpy (buf, fname, ftail - fname); +- buf[ftail - fname] = '\0'; ++ i = ftail - fname >= sizeof (buf)-1 ? sizeof (buf)-1 : ftail - fname; ++ strncpy (buf, fname, i); ++ buf[i] = '\0'; + } - for (i = 0; (i < sizeof (buf) - 1 -@@ -2618,31 +2618,15 @@ - static void - divert () - { -- char *cp; -- - assert (divertfp == NULL); + if (nup > 1) +@@ -2385,9 +2386,10 @@ + MESSAGE (2, (stderr, "^@epsf=\"%s\"\n", token->u.epsf.filename)); - /* Open divert file. */ + i = strlen (token->u.epsf.filename); ++ /* + if (i > 0 && token->u.epsf.filename[i - 1] == '|') + { +- /* Read EPS data from pipe. */ ++ / * Read EPS data from pipe. * / + token->u.epsf.pipe = 1; + token->u.epsf.filename[i - 1] = '\0'; + token->u.epsf.fp = popen (token->u.epsf.filename, "r"); +@@ -2400,6 +2402,7 @@ + } + } + else ++ */ + { + char *filename; -- cp = tempnam (NULL, "ens"); -- if (cp == NULL) -- FATAL ((stderr, _("couldn't create divert file name: %s"), -- strerror (errno))); -- -- strcpy (divertfname, cp); -- -- divertfp = fopen (divertfname, "w+b"); -+ divertfp = tmpfile (); - if (divertfp == NULL) - FATAL ((stderr, _("couldn't create divert file \"%s\": %s"), divertfname, - strerror (errno))); - -- if (remove (divertfname) == 0) -- /* Remove successfull, no need to remove file in undivert(). */ -- divertfname[0] = '\0'; -- -- /* Free the buffer allocated by tempnam(). */ -- free (cp); -- - cofp = divertfp; - } - -@@ -2696,10 +2680,6 @@ - - fclose (divertfp); - divertfp = NULL; -- -- /* Do we have to remove the divert file? */ -- if (divertfname[0]) -- (void) remove (divertfname); - - cofp = ofp; - } |