Git-Url: 
http://git.frugalware.org/gitweb/gitweb.cgi?p=frugalware-0.8.git;a=commitdiff;h=05129ab5922c9d99e1f3c1bc6d1de5f630e46cef

commit 05129ab5922c9d99e1f3c1bc6d1de5f630e46cef
Author: Miklos Vajna <[EMAIL PROTECTED]>
Date:   Sat Mar 22 02:24:26 2008 +0100

tetex-3.0-13kalgan1-i686
- added tetex-3.0-CVE-2007-5935.patch and tetex-3.0-CVE-2007-5936+5937.patch
- closes #2592

diff --git a/source/xapps-extra/tetex/FrugalBuild 
b/source/xapps-extra/tetex/FrugalBuild
index 9af05c3..5b9cf82 100644
--- a/source/xapps-extra/tetex/FrugalBuild
+++ b/source/xapps-extra/tetex/FrugalBuild
@@ -4,7 +4,7 @@

pkgname=tetex
pkgver=3.0
-pkgrel=12
+pkgrel=13kalgan1
pkgdesc="teTeX is a complete TeX distribution for UNIX compatible systems - 
base files, librarys, fonts"
url="http://www.tug.org/teTeX/";
depends=('libstdc++' 'libxp' 'libxmu' 'libxft' 'libxpm' 'freetype2' 
'fontconfig' 'expat' 'openmotif' 'zlib' 'libpng' 'tetex-kpathsea')
@@ -13,12 +13,15 @@ groups=('xapps-extra')
archs=('i686' 'x86_64')
up2date="lynx --dump 
'ftp://dante.ctan.org/tex-archive/systems/unix/teTeX/current/distrib/'|grep 
\"tar.gz\" |sed -e 's/.*tetex-src-\(.*\).tar.*/\1/;q'"
source=(ftp://dante.ctan.org/tex-archive/systems/unix/teTeX/current/distrib/tetex-texmf-$pkgver.tar.gz
 
ftp://dante.ctan.org/tex-archive/systems/unix/teTeX/current/distrib/tetex-src-$pkgver.tar.gz
 \
-       tetex-3.0-CVE-2005-3193.patch tetex-3.0-CVE-2007-0650.patch 
tetex-3.0-CVE-2007-3387.patch)
+       tetex-3.0-CVE-2005-3193.patch tetex-3.0-CVE-2007-0650.patch 
tetex-3.0-CVE-2007-3387.patch \
+       tetex-3.0-CVE-2007-5935.patch tetex-3.0-CVE-2007-5936+5937.patch)
sha1sums=('1be97f57a26a6e9b72ebfd932e45914a959aff16' \
'7637789f7f4929694aed1b89820f5bad4753e8fc' \
'4a275b1d9a211e94bc13286d05ef619cdf873770' \
'28208eb13f493c1c9c6538f254f04fc0c2aaff1e' \
-          '3ad00a8f16dd16acc765953e10dc68f181e0a156')
+          '3ad00a8f16dd16acc765953e10dc68f181e0a156' \
+          'f97712ef399a53c39c762883febc8c61d9ed3d46' \
+          '5bc76c08516bd3edc2b1bd23b743946b790b1e7e')
backup=('/usr/share/texmf/web2c/texmf.cnf')
removes=('/usr/share/texmf/web2c/latex.fmt' '/usr/share/texmf/web2c/latex.log')
conflicts=('xdvik')
diff --git a/source/xapps-extra/tetex/tetex-3.0-CVE-2007-5935.patch 
b/source/xapps-extra/tetex/tetex-3.0-CVE-2007-5935.patch
new file mode 100644
index 0000000..a667fab
--- /dev/null
+++ b/source/xapps-extra/tetex/tetex-3.0-CVE-2007-5935.patch
@@ -0,0 +1,81 @@
+diff -Nur tetex-bin-3.0/texk/dvipsk/hps.c tetex-bin-3.0.new/texk/dvipsk/hps.c
+--- tetex-bin-3.0/texk/dvipsk/hps.c    2005-01-15 19:05:00.000000000 -0500
++++ tetex-bin-3.0.new/texk/dvipsk/hps.c        2007-12-04 10:35:18.000000000 
-0500
+@@ -441,19 +441,28 @@
+
+ void stamp_hps P1C(Hps_link *, pl)
+ {
+-  char tmpbuf[200] ;
++  char * tmpbuf;
+   if (pl == NULL) {
+-    error("Null pointer, oh no!") ;
++    error("stamp_hps: null pl pointer, oh no!") ;
+     return ;
+-  } else {
+-    /* print out the proper pdfm with local page info only
+-     *  target info will be in the target dictionary */
+-    (void)sprintf(tmpbuf,
+-                " (%s) [[%.0f %.0f %.0f %.0f] [%i %i %i [%i %i]] [%.0f %.0f 
%.0f]] pdfm ", pl->title, pl->rect.llx, pl->rect.lly, pl->rect.urx, 
pl->rect.ury,
+-                pl->border[0], pl->border[1], pl->border[2], 
pl->border[3],pl->border[4],
+-                pl->color[0], pl->color[1], pl->color[2]) ;
+-    cmdout(tmpbuf) ;
+-  }
++  }
++  if(pl->title == NULL) {
++    error("stamp_hps: null pl->title pointer, oh no!") ;
++    return ;
++  }
++
++  tmpbuf = (char *) xmalloc(strlen(pl->title)+200);
++
++  /* print out the proper pdfm with local page info only
++   *  target info will be in the target dictionary */
++  (void)sprintf(tmpbuf,
++              " (%s) [[%.0f %.0f %.0f %.0f] [%i %i %i [%i %i]] [%.0f %.0f 
%.0f]] pdfm ",
++              pl->title, pl->rect.llx, pl->rect.lly, pl->rect.urx, 
pl->rect.ury,
++              pl->border[0], pl->border[1], pl->border[2], 
pl->border[3],pl->border[4],
++              pl->color[0], pl->color[1], pl->color[2]) ;
++  cmdout(tmpbuf) ;
++  free(tmpbuf);
++
+
+ }
+
+@@ -462,18 +471,27 @@
+  */
+ void stamp_external P2C(char *, s, Hps_link *, pl)
+ {
+-  char tmpbuf[200];
++  char *tmpbuf;
+   if (pl == NULL) {
+-    error("Null pointer, oh no!") ;
++    error("stamp_external: null pl pointer, oh no!") ;
+     return ;
+-  } else {
+-    /* print out the proper pdfm with local page info only
+-     *  target info will be in the target dictionary */
+-    (void)sprintf(tmpbuf," [[%.0f %.0f %.0f %.0f] [%i %i %i [%i %i]] [%.0f 
%.0f %.0f]] (%s) pdfm ", pl->rect.llx, pl->rect.lly, pl->rect.urx, pl->rect.ury,
+-                pl->border[0], pl->border[1], pl->border[2], 
pl->border[3],pl->border[4],
+-                pl->color[0], pl->color[1], pl->color[2], s) ;
+-    cmdout(tmpbuf) ;
+-  }
++  }
++
++  if (s == NULL) {
++    error("stamp_external: null s pointer, oh no!") ;
++    return ;
++  }
++
++  tmpbuf = (char *) xmalloc(strlen(s) + 200);
++
++  /* print out the proper pdfm with local page info only
++   *  target info will be in the target dictionary */
++  (void)sprintf(tmpbuf," [[%.0f %.0f %.0f %.0f] [%i %i %i [%i %i]] [%.0f %.0f 
%.0f]] (%s) pdfm ",
++              pl->rect.llx, pl->rect.lly, pl->rect.urx, pl->rect.ury,
++              pl->border[0], pl->border[1], pl->border[2], 
pl->border[3],pl->border[4],
++              pl->color[0], pl->color[1], pl->color[2], s) ;
++  cmdout(tmpbuf) ;
++  free(tmpbuf);
+ }
+
+ void finish_hps P1H(void) {
diff --git a/source/xapps-extra/tetex/tetex-3.0-CVE-2007-5936+5937.patch 
b/source/xapps-extra/tetex/tetex-3.0-CVE-2007-5936+5937.patch
new file mode 100644
index 0000000..f9cb5ab
--- /dev/null
+++ b/source/xapps-extra/tetex/tetex-3.0-CVE-2007-5936+5937.patch
@@ -0,0 +1,795 @@
+diff -Nur tetex-bin-3.0/texk/dviljk/dvi2xx.c 
tetex-bin-3.0.new/texk/dviljk/dvi2xx.c
+--- tetex-bin-3.0/texk/dviljk/dvi2xx.c 1999-02-06 16:46:34.000000000 -0500
++++ tetex-bin-3.0.new/texk/dviljk/dvi2xx.c     2007-12-05 13:24:42.000000000 
-0500
+@@ -173,7 +173,7 @@
+   y_origin = YDEFAULTOFF; /* y-origin in dots                    */
+
+   setbuf(ERR_STREAM, NULL);
+-  (void) strcpy(G_progname, argv[0]);
++  G_progname = argv[0];
+ #ifdef KPATHSEA
+   kpse_set_progname(argv[0]);
+   kpse_set_program_enabled (kpse_pk_format, MAKE_TEX_PK_BY_DEFAULT, 
kpse_src_compile);
+@@ -2968,8 +2968,8 @@
+ #endif
+ {
+   int     argind;            /* argument index for flags      */
+-  char    curarea[STRSIZE];  /* current file area             */
+-  char    curname[STRSIZE];  /* current file name             */
++  char    *curarea;        /* current file area             */
++  char    *curname;                /* current file name             */
+   char    *tcp, *tcp1;       /* temporary character pointers  */
+   char    *this_arg;
+   double  x_offset = 0.0, y_offset = 0.0;
+@@ -2988,9 +2988,9 @@
+ #endif
+ #endif
+
+-  if (argc == 2 && (strcmp (argv[1], "--version") == 0)) {
++  if (argc == 2 && EQ(argv[1], "--version")) {
+     extern KPSEDLL char *kpathsea_version_string;
+-    puts ("dvilj(k) 2.6");
++    puts (VERSION);
+     puts (kpathsea_version_string);
+     puts ("Copyright (C) 1997 Gustaf Neumann.\n\
+ There is NO warranty.  You may redistribute this software\n\
+@@ -3328,8 +3328,8 @@
+       }
+     } else {
+
+-      (void) strcpy(filename, tcp);
+-      if (!strcmp(filename, "-")) {
++      filename = tcp;
++      if (EQ(filename, "-")) {
+         EmitFileName = "-";
+ #ifdef RISC_USE_OSL
+         dvifp = BINOPEN("Kbd:");
+@@ -3339,57 +3339,68 @@
+         AssureBinary(fileno(dvifp));
+ #endif
+       } else {
++      /* Since this code is used only once during startup, we don't care
++         about free()ing the allocated strings that represent filenames.
++         It will be more work to realize proper deallocation handling than
++         it's worth in terms of saving a few bytes. We consider these
++         bytes actually static memory where we don't know the size in
++         advance and don't add them to the allocated_storage count.
++         [27 Jun 07 -js] */
+ #ifdef KPATHSEA
+         /* split into directory + file name */
+       int tcplen, argvlen;
+       tcp = (char *)xbasename(argv[argind]);/* this knows about any kind of 
slashes */
+       tcplen = strlen(tcp);
++      if ( tcplen == 0 ) {
++        /* This happens when the DVI file name has a trailing slash; this
++           is not a valid name. Then we terminate the argument parsing
++           loop, a usage message will be output below. */
++        break;
++      }
+       argvlen = strlen(argv[argind]);
+       if (tcplen == argvlen)
+-        curarea[0] = '\0';
++        curarea = "";
+       else {
+-        (void) strcpy(curarea, argv[argind]);
++        curarea = xstrdup(argv[argind]);
+         curarea[argvlen-tcplen] = '\0';
+       }
+ #else
+         tcp = strrchr(argv[argind], '/');
+         /* split into directory + file name */
+         if (tcp == NULL) {
+-          curarea[0] = '\0';
++          curarea[0] = "";
+           tcp = argv[argind];
+         } else {
+-          (void) strcpy(curarea, argv[argind]);
++        curarea = xstrdup(argv[argind]);
+           curarea[tcp-argv[argind]+1] = '\0';
+           tcp += 1;
+         }
+ #endif
+
++        curname = (char *) xmalloc(strlen(tcp)+5);  /* + space for ".dvi" */
+         (void) strcpy(curname, tcp);
+         /* split into file name + extension */
+-        tcp1 = strrchr(tcp, '.');
++        tcp1 = strrchr(curname, '.');
+         if (tcp1 == NULL) {
+-          (void) strcpy(rootname, curname);
++          rootname = xstrdup(curname);
+           strcat(curname, ".dvi");
+         } else {
+           *tcp1 = '\0';
+-          (void) strcpy(rootname, curname);
++          rootname = xstrdup(curname);
+           *tcp1 = '.';
+         }
+
++      filename = (char *) xmalloc(strlen(curarea)+strlen(curname)+1);
+         (void) strcpy(filename, curarea);
+         (void) strcat(filename, curname);
+
+         if ((dvifp = BINOPEN(filename)) == FPNULL) {
+           /* do not insist on .dvi */
+           if (tcp1 == NULL) {
+-            int l = strlen(curname);
+-            if (l > 4)
+-              curname[l - 4] = '\0';
+-            l = strlen(filename);
+-            if (l > 4)
+-              filename[l - 4] = '\0';
++          filename[strlen(filename) - 4] = '\0';
++          dvifp = BINOPEN(filename);
+           }
+-          if (tcp1 != NULL || (dvifp = BINOPEN(filename)) == FPNULL) {
++          if (dvifp == FPNULL) {
+ #ifdef MSC5
+             Fatal("%s: can't find DVI file \"%s\"\n\n",
+                   G_progname, filename);
+@@ -3507,13 +3518,8 @@
+     exit(1);
+   }
+   if (EQ(EmitFileName, "")) {
+-    if ((EmitFileName = (char *)malloc( STRSIZE )) != NULL)
+-      allocated_storage += STRSIZE;
+-    else
+-      Fatal("Can't allocate storage of %d bytes\n",STRSIZE);
+-    (void) strcpy(EmitFileName, curname);
+-    if ((tcp1 = strrchr(EmitFileName, '.')))
+-      *tcp1 = '\0';
++    EmitFileName = (char *) 
xmalloc(strlen(rootname)+sizeof(EMITFILE_EXTENSION));
++    (void) strcpy(EmitFileName, rootname);
+     strcat(EmitFileName, EMITFILE_EXTENSION);
+   }
+   if (G_quiet)
+@@ -3698,6 +3704,8 @@
+ #endif
+   }
+   CloseFiles();
++  if ( tmp_dir[0] != '\0' )
++    rmdir (tmp_dir);                  /* ignore errors */
+   exit(G_errenc);
+ }
+
+@@ -3895,22 +3903,21 @@
+ int  n;
+ #endif
+ {
+-  char    spbuf[STRSIZE], xs[STRSIZE], ys[STRSIZE];
+-  char    *sf = NULL, *psfile = NULL;
++  char    xs[STRSIZE], ys[STRSIZE];
++  char    *include_file = NULL;
++  enum    { VerbFile, HPFile, PSFile } file_type;
+   float   x,y;
+   long4   x_pos, y_pos;
+   KeyWord k;
+   int     i, j, j1;
+   static  int   GrayScale = 10, Pattern = 1;
+   static  bool  GrayFill = _TRUE;
+-  static  long4 p_x[80], p_y[80];
+-  int llx=0, lly=0, urx=0, ury=0, rwi=0, rhi=0;
+-#ifdef WIN32
+-  char    *gs_path;
+-#endif
++  static  long4 p_x[MAX_SPECIAL_DEFPOINTS], p_y[MAX_SPECIAL_DEFPOINTS];
++  int llx=0, lly=0, urx=0, ury=0, rwi=0;
+
+   str[n] = '\0';
+-  spbuf[0] = '\0';
++  for ( i=0 ; i<MAX_SPECIAL_DEFPOINTS ; i++ )
++    p_x[i] = p_y[i] = -1;
+
+   SetPosn(h, v);
+ #ifdef __riscos
+@@ -3924,41 +3931,30 @@
+     /* get all keyword-value pairs */
+     /* for compatibility, single words are taken as file names */
+     if ( k.vt == None && access(k.Key, 0) == 0) {
+-      if ( sf
+-#ifdef KPATHSEA
+-           && !kpse_tex_hush ("special")
+-#endif
+-         )
+-        Warning("More than one \\special file name given. %s ignored", sf);
+-      (void) strcpy(spbuf, k.Key);
+-      sf = spbuf;
+-      /*
+-        for (j = 1; ((sf[j]=='/' ? sf[j]='\\':sf[j]) != '\0'); j++);
+-        */
+-    } else if ( GetKeyVal( &k, KeyTab, NKEYS, &i ) && i != -1 )
++      if ( include_file && !kpse_tex_hush ("special") ) {
++        Warning("More than one \\special file name given. %s ignored", 
include_file);
++      free (include_file);
++      }
++      include_file = xstrdup(k.Key);
++      file_type = VerbFile;
++    } else if ( GetKeyVal( &k, KeyTab, NKEYS, &i ) && i != -1 ) {
+       switch (i) {
+       case PSFILE:
+-        if (sf
+-#ifdef KPATHSEA
+-            && !kpse_tex_hush ("special")
+-#endif
+-            )
+-            Warning("More than one \\special file name given. %s ignored", 
sf);
+-        (void) strcpy(spbuf, k.Val);
+-        psfile = spbuf;
+-        /*
+-          for (j=1; ((sf[j]=='/' ? sf[j]='\\':sf[j]) != '\0'); j++);
+-          */
++        if ( include_file ) {
++        Warning("More than one \\special file name given. %s ignored", 
include_file);
++        free(include_file);
++      }
++        include_file = xstrdup(k.Val);
++      file_type = PSFile;
+         break;
+
+       case HPFILE:
+-        if (sf)
+-            Warning("More than one \\special file name given. %s ignored", 
sf);
+-        (void) strcpy(spbuf, k.Val);
+-        sf = spbuf;
+-        /*
+-          for (j=1; ((sf[j]=='/' ? sf[j]='\\':sf[j]) != '\0'); j++);
+-          */
++        if ( include_file && !kpse_tex_hush ("special") ) {
++        Warning("More than one \\special file name given. %s ignored", 
include_file);
++        free(include_file);
++      }
++        include_file = xstrdup(k.Val);
++      file_type = HPFile;
+         break;
+
+       case ORIENTATION:
+@@ -3978,23 +3974,24 @@
+         }
+ #endif
+         else
+-#ifdef KPATHSEA
+-           if (!kpse_tex_hush ("special"))
+-#endif
+           Warning( "Invalid orientation (%d)given; ignored.", k.v.i);
+         break;
+
+       case RESETPOINTS:
+-        (void) strcpy(spbuf, k.Val);
+-
+-        sf = NULL;
++      for ( i=0 ; i<MAX_SPECIAL_DEFPOINTS ; i++ )
++        p_x[i] = p_y[i] = -1;
+         break;
+
+       case DEFPOINT:
+-        (void) strcpy(spbuf, k.Val);
+-        i = sscanf(spbuf,"%d(%[^,],%s)",&j,xs,ys);
++      /* 254 is STRSIZE-1. cpp should be used to construct that number. */
++        i = sscanf(k.Val,"%d(%254[^,],%254s)",&j,xs,ys);
+         if (i>0) {
+-          x_pos = h;
++        if ( j < 0  ||  j >= MAX_SPECIAL_DEFPOINTS ) {
++          Warning ("defpoint %d ignored, must be between 0 and %d",
++                   j, MAX_SPECIAL_DEFPOINTS);
++          break;
++        }
++          x_pos = h;
+           y_pos = v;
+           if (i>1) {
+             if (sscanf(xs,"%fpt",&x)>0) {
+@@ -4011,19 +4008,32 @@
+           p_x[j]=x_pos;
+           p_y[j]=y_pos;
+         } else
+-#ifdef KPATHSEA
+-              if (!kpse_tex_hush ("special"))
+-#endif
+           Warning("invalid point definition\n");
+-
+-        sf = NULL;
+         break;
+
+       case FILL:
+-        (void) strcpy(spbuf, k.Val);
+-        i = sscanf(spbuf,"%d/%d %s",&j,&j1,xs);
++      /* 254 is STRSIZE-1. cpp should be used to construct that number. */
++        i = sscanf(k.Val,"%d/%d %254s",&j,&j1,xs);
+         if (i>1) {
+ #ifdef LJ
++        if ( j < 0 || j >= MAX_SPECIAL_DEFPOINTS ) {
++          Warning ("fill ignored, point %d must be between 0 and %d",
++                   j, MAX_SPECIAL_DEFPOINTS);
++          break;
++        }
++        if ( p_x[j] == -1 ) {
++          Warning ("fill ignored, point %d is undefined\n", j);
++          break;
++        }
++        if ( j1 < 0 || j1 >= MAX_SPECIAL_DEFPOINTS ) {
++          Warning ("fill ignored, point %d must be between 0 and %d",
++                   j1, MAX_SPECIAL_DEFPOINTS);
++          break;
++        }
++        if ( p_x[j1] == -1 ) {
++          Warning ("fill ignored, point %d is undefined\n", j1);
++          break;
++        }
+           SetPosn(p_x[j], p_y[j]);
+           x_pos = (long4)PIXROUND(p_x[j1]-p_x[j], hconv);
+           y_pos = (long4)PIXROUND(p_y[j1]-p_y[j], vconv);
+@@ -4044,9 +4054,6 @@
+           GrayScale = k.v.i;
+           GrayFill = _TRUE;
+         } else
+-#ifdef KPATHSEA
+-           if (!kpse_tex_hush ("special"))
+-#endif
+           Warning( "Invalid gray scale (%d) given; ignored.", k.v.i);
+         break;
+
+@@ -4055,9 +4062,6 @@
+           Pattern = k.v.i;
+           GrayFill = _FALSE;
+         } else
+-#ifdef KPATHSEA
+-           if (!kpse_tex_hush ("special"))
+-#endif
+           Warning( "Invalid pattern (%d) given; ignored.", k.v.i);
+         break;
+
+@@ -4066,75 +4070,122 @@
+       case URX: urx = k.v.i; break;
+       case URY: ury = k.v.i; break;
+       case RWI: rwi = k.v.i; break;
+-      case RHI: rhi = k.v.i; break;
++      case RHI:
++      if (!kpse_tex_hush ("special"))
++            Warning("Whatever rhi was good for once, it is ignored now.");
++      break;
+
+       default:
+-#ifdef KPATHSEA
+-           if (!kpse_tex_hush ("special"))
+-#endif
++      if ( !kpse_tex_hush ("special") )
+         Warning("Can't handle %s=%s command; ignored.", k.Key, k.Val);
+         break;
+       }
+-
+-    else
+-#ifdef KPATHSEA
+-           if (!kpse_tex_hush ("special"))
+-#endif
++
++    } else if (!kpse_tex_hush ("special")) {
+       Warning("Invalid keyword or value in \\special - <%s> ignored", k.Key);
++    }
++
++    free (k.Key);
++    if ( k.Val != NULL )  free(k.Val);
+   }
+
+-  if ( sf || psfile ) {
++  if ( include_file ) {
+     last_rx = last_ry = UNKNOWN;
+ #ifdef IBM3812
+     PMPflush;
+ #endif
+-    if (sf) {
+-      if (i == HPFILE)
+-        CopyHPFile( sf );
+-      else
+-        CopyFile( sf );
+-    }
+-    else
++
+ #ifdef LJ
+-      if (psfile) {
++      if ( file_type == PSFile) {
+         /* int height = rwi * (urx - llx) / (ury - lly);*/
+         int width  = urx - llx;
+         int height = ury - lly;
+         char cmd[255];
+-        int scale_factor    = 3000 * width / rwi;
+-        int adjusted_height = height * 300/scale_factor;
+-        int adjusted_llx    = llx    * 300/scale_factor;
++        char *cmd_format = "%s -q -dSIMPLE -dSAFER -dNOPAUSE -sDEVICE=%s 
-sOutputFile=%s %s %s showpage.ps -c quit";
++        char *gs_cmd;
++        int scale_factor, adjusted_height, adjusted_llx;
+         char *printer = "ljetplus"; /* use the most stupid one */
+
+-
+-        char scale_file_name[255];
+-        char *scale_file = tmpnam(scale_file_name);
+-        char *pcl_file = tmpnam(NULL);
++        char pcl_file[STRSIZE];
++        char scale_file[STRSIZE];
+         FILEPTR scalef;
+
+-        if ( (scalef = BOUTOPEN(scale_file)) == FPNULL ) {
+-          Warning("Unable to open file %s for writing", scale_file );
+-          return;
+-        }
+-        fprintf(scalef, "%.2f %.2f scale\n%d %d translate\n",
+-                300.0/scale_factor, 300.0/scale_factor,
+-                0, adjusted_height == height ? 0 : ury);
+-        BCLOSE( scalef );
++        if ( urx == 0 || ury == 0 || rwi == 0 ) {
++      /* Since dvips' psfile special has a different syntax, this might
++         well be one of those specials, i.e., a non-dviljk special. Then
++         the Warning should be suppressable. */
++      if ( !kpse_tex_hush ("special") )
++        Warning ("Ignoring psfile special without urx, ury and rwi 
attributes");
++      free (include_file);
++      return;
++      }
++      scale_factor    = 3000 * width / rwi;
++      adjusted_height = height * 300/scale_factor;
++      adjusted_llx    = llx    * 300/scale_factor;
++
++      /* We cannot use mkstemp, as we cannot pass two open file descriptors
++       portably to Ghostscript. We don't want to use tmpnam() or tempnam()
++       either, as they have tempfile creation race conditions. Instead we
++       create a temporary directory with mkdtemp(). We need to create the
++       temporary directory only once per run; it will be deleted in
++         AllDone(). */
++      if ( tmp_dir[0] == '\0' ) {
++      char * base_dir;
++      if ( (base_dir = getenv("TMPDIR")) == NULL ) {
++        base_dir = "/tmp";
++      } else if ( strlen(base_dir) > STRSIZE - 
sizeof("/dviljkXXXXXX/include.pcl") ) {
++        Warning ("TMPDIR %s is too long, using /tmp instead", base_dir);
++        base_dir = "/tmp";
++      }
++      if ( base_dir[0] == '/'  && base_dir[1] == '\0' ) {
++        Warning ("Feeling naughty, do we? / is no temporary directory, dude");
++        base_dir = "/tmp";
++      }
++      strcpy (tmp_dir, base_dir);
++      strcat (tmp_dir, "/dviljkXXXXXX");
++      if ( mkdtemp(tmp_dir) == NULL ) {
++        Warning ("Could not create temporary directory %s, errno = %d; 
ignoring include file special",
++                 tmp_dir, errno);
++        return;
++      }
++      }
++      strcpy(pcl_file, tmp_dir);
++      strcat(pcl_file, "/include.pcl");
++      strcpy(scale_file, tmp_dir);
++      strcat(scale_file, "/scale.ps");
++
++      if ( (scalef = BOUTOPEN(scale_file)) == FPNULL ) {
++      Warning("Unable to open file %s for writing", scale_file );
++      free (include_file);
++      unlink(scale_file);             /* ignore error */
++      return;
++      }
++      fprintf(scalef, "%.2f %.2f scale\n%d %d translate\n",
++            300.0/scale_factor, 300.0/scale_factor,
++            0, adjusted_height == height ? 0 : ury);
++      BCLOSE( scalef );
+
+ #ifdef WIN32
+-      gs_path = getenv("GS_PATH");
+-      if (!gs_path)
+-        gs_path = "gswin32c.exe";
+-        sprintf(cmd,"%s -q -dSIMPLE -dSAFER -dNOPAUSE -sDEVICE=%s 
-sOutputFile=%s %s %s showpage.ps -c quit",
+-              gs_path, printer, pcl_file, scale_file, psfile);
++      if ( (gs_cmd = getenv("GS_PATH")) == NULL )
++      gs_cmd = "gswin32c.exe";
+ #else
+-        sprintf(cmd,"gs -q -dSIMPLE -dSAFER -dNOPAUSE -sDEVICE=%s 
-sOutputFile=%s %s %s showpage.ps -c quit",
+-                printer, pcl_file, scale_file, psfile);
++      gs_cmd = "gs";
+ #endif
++      if ( strlen(cmd_format)-10 + strlen(gs_cmd) + strlen(printer) +
++             strlen(pcl_file) + strlen(scale_file) + strlen(include_file) +1 >
++         sizeof(cmd) ) {
++      Warning ("Ghostscript command for %s would be too long, skipping 
special", include_file);
++      free (include_file);
++      unlink(scale_file);             /* ignore errors */
++      unlink(pcl_file);
++      return;
++      }
++      sprintf(cmd, cmd_format,
++            gs_cmd, printer, pcl_file, scale_file, include_file);
+ #ifdef DEBUGGS
+         fprintf(stderr,
+           "PS-file '%s' w=%d, h=%d, urx=%d, ury=%d, llx=%d, lly=%d, rwi=%d\n",
+-                psfile, urx - llx, height, urx,ury,llx,lly, rwi);
++            include_file, urx - llx, height, urx,ury,llx,lly, rwi);
+         fprintf(stderr,"%s\n",cmd);
+ #endif
+         if (system(cmd)) {
+@@ -4158,11 +4209,21 @@
+ #endif
+
+           CopyHPFile( pcl_file );
+-          /* unlink(pcl_file); */
+-          /* unlink(scale_file); */
+-        }
+       }
++      unlink(scale_file);             /* ignore errors */
++      unlink(pcl_file);
++    }
++    else
+ #endif /* LJ */
++
++    if ( file_type == HPFile )
++      CopyHPFile( include_file );
++    else if ( file_type == VerbFile )
++      CopyFile( include_file );
++    else
++      Warning ("This can't happen: unknown file_type value %d", file_type);
++
++    if ( include_file != NULL )  free(include_file);
+   }
+ }
+
+@@ -4173,12 +4234,11 @@
+ /**********************************************************************/
+ /*****************************  GetKeyStr  ****************************/
+ /**********************************************************************/
+-/* extract first keyword-value pair from string (value part may be null)
+- * return pointer to remainder of string
+- * return NULL if none found
++/* Extract first keyword-value pair from string (value part may be null),
++ * keyword and value are allocated and must be free by caller.
++ * Return pointer to remainder of string,
++ * return NULL if none found.
+  */
+-char    KeyStr[STRSIZE];
+-char    ValStr[STRSIZE];
+ #if NeedFunctionPrototypes
+ char *GetKeyStr(char *str, KeyWord *kw )
+ #else
+@@ -4187,39 +4247,46 @@
+ KeyWord *kw;
+ #endif
+ {
+-  char    *s, *k, *v, t;
++  char *s, *start;
++  char save_char, quote_char;
+   if ( !str )
+     return( NULL );
+   for (s = str; *s == ' '; s++)
+     ;          /* skip over blanks */
+   if (*s == '\0')
+     return( NULL );
+-  for (k = KeyStr; /* extract keyword portion */
+-       *s != ' ' && *s != '\0' && *s != '=';
+-       *k++ = *s++)
+-    ;
+-  *k = '\0';
+-  kw->Key = KeyStr;
+-  kw->Val = v = NULL;
++  start = s++;                                /* start of keyword */
++  while ( *s != ' ' && *s != '\0' && *s != '=' )  /* locate end */
++    s++;
++  save_char = *s;
++  *s = '\0';
++  kw->Key = xstrdup(start);
++  kw->Val = NULL;
+   kw->vt = None;
+-  for ( ; *s == ' '; s++)
+-    ;            /* skip over blanks */
+-  if ( *s != '=' )         /* look for "=" */
++  if ( save_char == '\0' )            /* shortcut when we're at the end */
++    return (s);
++  *s = save_char;                     /* restore keyword end char */
++  while ( *s == ' ' ) s++ ;           /* skip over blanks */
++  if ( *s != '=' )                    /* no "=" means no value */
+     return( s );
+-  for (s++; *s == ' '; s++);      /* skip over blanks */
+-  if ( *s == '\'' || *s == '\"' )  /* get string delimiter */
+-    t = *s++;
++  for (s++; *s == ' '; s++)
++    ;                                 /* skip over blanks */
++  if ( *s == '\'' || *s == '\"' )     /* get string delimiter */
++    quote_char = *s++;
+   else
+-    t = ' ';
+-  for (v = ValStr; /* copy value portion up to delim */
+-       *s != t && *s != '\0';
+-       *v++ = *s++)
+-    ;
+-  if ( t != ' ' && *s == t )
+-    s++;
+-  *v = '\0';
+-  kw->Val = ValStr;
++    quote_char = ' ';
++  start = s;                          /* no increment, might be "" as value */
++  while ( *s != quote_char && *s != '\0' )
++    s++;                        /* locate end of value portion */
++  save_char = *s;
++  *s = '\0';
++  kw->Val = xstrdup(start);
+   kw->vt = String;
++  if ( save_char != '\0' ) {          /* save_char is now quote_char */
++    *s = save_char;
++    if ( quote_char != ' ' )          /* we had real quote chars */
++      s++;
++  }
+   return( s );
+ }
+
+@@ -4819,13 +4886,14 @@
+      the resident fonts.  */
+   if (tfm_read_info(fontptr->n, &tfm_info)
+       && tfm_info.family[0]
+-      && strcmp((char *)tfm_info.family, "HPAUTOTFM") == 0) {
++      && EQ((char *)tfm_info.family, "HPAUTOTFM")) {
+     unsigned i;
+     double factor = fontptr->s / (double)0x100000;
+
+     resident_count++;
+     fontptr->resident_p = _TRUE;
+-    strcpy(fontptr->symbol_set, (char *)tfm_info.coding_scheme);
++    strncpy(fontptr->symbol_set, (char *)tfm_info.coding_scheme, 39);
++    fontptr->symbol_set[39] = '\0';
+     fontptr->resid = tfm_info.typeface_id;
+     fontptr->spacing = tfm_info.spacing;
+     fontptr->style = tfm_info.style;
+@@ -4878,7 +4946,7 @@
+     fontptr->resident_p = _FALSE;
+
+     if (tfm_info.family[0]
+-        && strcmp((char *)tfm_info.family, "UNSPECIFIED") == 0) {
++        && EQ((char *)tfm_info.family, "UNSPECIFIED")) {
+       Warning("font family for %s is UNSPECIFIED; need to run dvicopy?",
+               fontptr->n);
+       fontptr->font_file_id = NO_FILE;
+@@ -5031,10 +5099,9 @@
+   if (tfontptr->resident_p)
+     return;
+
+-  if (!(resident_font_located)) {
++  if (!(resident_font_located))
+ #endif
+
+-#ifdef KPATHSEA
+     {
+       kpse_glyph_file_type font_ret;
+       char *name;
+@@ -5047,9 +5114,9 @@
+       if (name)
+         {
+           font_found = _TRUE;
+-          strcpy (tfontptr->name, name);
+-          free (name);
+-
++          tfontptr->name = name;
++          allocated_storage += strlen(name)+1;
++
+           if (!FILESTRCASEEQ (tfontptr->n, font_ret.name)) {
+               fprintf (stderr,
+                        "dvilj: Font %s not found, using %s at %d instead.\n",
+@@ -5071,29 +5138,6 @@
+             tfontptr->n, dpi);
+         }
+     }
+-#else /* not KPATHSEA */
+-    if (!(findfile(PXLpath,
+-                   tfontptr->n,
+-                   tfontptr->font_mag,
+-                   tfontptr->name,
+-                   _FALSE,
+-                   0))) {
+-      Warning(tfontptr->name); /* contains error messsage */
+-      tfontptr->font_file_id = NO_FILE;
+-#ifdef __riscos
+-      MakeMetafontFile(PXLpath, tfontptr->n, tfontptr->font_mag);
+-#endif
+-    }
+-    else {
+-      font_found = _TRUE;
+-      if (G_verbose)
+-        fprintf(ERR_STREAM,"%d: using font <%s>\n", plusid, tfontptr->name);
+-    }
+-#endif /* not KPATHSEA */
+-
+-#ifdef LJ_RESIDENT_FONTS
+-  }
+-#endif
+
+   tfontptr->plusid = plusid;
+   plusid++;
+diff -Nur tetex-bin-3.0/texk/dviljk/dvi2xx.h 
tetex-bin-3.0.new/texk/dviljk/dvi2xx.h
+--- tetex-bin-3.0/texk/dviljk/dvi2xx.h 1999-03-16 02:03:33.000000000 -0500
++++ tetex-bin-3.0.new/texk/dviljk/dvi2xx.h     2007-12-05 13:24:42.000000000 
-0500
+@@ -10,8 +10,8 @@
+
+ #ifdef KPATHSEA
+ #include <kpathsea/config.h>
++#include <kpathsea/c-std.h>
+ #include <kpathsea/c-limits.h>
+-#include <kpathsea/c-memstr.h>
+ #include <kpathsea/magstep.h>
+ #include <kpathsea/proginit.h>
+ #include <kpathsea/progname.h>
+@@ -24,6 +24,7 @@
+ #include <string.h>
+ #include <stdio.h>
+ #include <stdlib.h>
++#include <unistd.h>
+ #ifdef  unix
+ #include <limits.h>
+ #endif
+@@ -41,9 +42,6 @@
+ #ifdef MSC5
+ #include <dos.h>     /* only for binaryopen on device  */
+ #endif
+-#if defined (unix) && !defined (KPATHSEA)
+-#include <limits.h>
+-#endif
+
+
+ #include "config.h"
+@@ -116,6 +114,7 @@
+ #define  HUGE_SIZE  (unsigned char) 2
+ #define  HUGE_CHAR_PATTERN 32767l
+ #define  BYTES_PER_PIXEL_LINE 500    /* max number of bytes per pixel line */
++#define  MAX_SPECIAL_DEFPOINTS 80    /* max number of defpoint specials */
+
+
+ #define PK_POST 245
+@@ -281,7 +280,14 @@
+ #define VisChar(c) (unsigned char)(c)
+ #endif
+
+-#define GetBytes(fp,buf,n) read_multi(buf,1,n,fp) /* used to be a function */
++/* Used to be a function. buf is always an array, never a pointer.
++   Without that invariant, we would have to introduce full dynamic
++   memory management in this driver -- probably it would be easier to
++   write a new one. [27 Jun 07 -js] */
++#define GetBytes(fp,buf,n) \
++    ( sizeof(buf) != sizeof(void *) && sizeof(buf) > n ? \
++        read_multi(buf, 1, n, fp) \
++      : Fatal("Try to read %d bytes in an array of size %d", n, sizeof(buf)) )
+
+
+ /**********************************************************************/
+@@ -307,6 +313,7 @@
+ int     sscanf();
+ int     strcmp();
+ char   *strcpy();
++char   *strncpy();
+ #   ifdef MSC5
+ unsigned int strlen();
+ #   endif
+@@ -393,7 +400,7 @@
+     char n[STRSIZE];          /* FNT_DEF command parameters                */
+     long4    font_mag;         /* computed from FNT_DEF s and d parameters  */
+     /*char psname[STRSIZE];*/ /* PostScript name of the font               */
+-    char    name[STRSIZE];    /* full name of PXL file                     */
++    char    *name;           /* full name of PXL file                     */
+     FILEPTR font_file_id;      /* file identifier (NO_FILE if none)         */
+ #ifdef USEPXL
+     long4    magnification;    /* magnification read from PXL file          */
+@@ -487,8 +494,8 @@
+ long4   NoSignExtend DVIPROTO((FILEPTR, int));
+ void    OpenFontFile DVIPROTO((void));
+ long4   PixRound DVIPROTO((long4, long4));
+-void    PkRaster DVIPROTO((struct char_entry *, int));
+-void    RasterLine DVIPROTO((struct char_entry *, unsigned int,
++void    PkRaster DVIPROTO((struct char_entry *, int));
++void    RasterLine DVIPROTO((struct char_entry *, unsigned int,
+                            unsigned int, unsigned char *));
+ void    RasterChar DVIPROTO((struct char_entry *));
+ void    ReadFontDef DVIPROTO((long4));
+@@ -534,11 +541,12 @@
+ #ifndef KPATHSEA
+ char   *PXLpath = FONTAREA;
+ #endif
+-char    G_progname[STRSIZE];     /* program name                        */
+-char    filename[STRSIZE];       /* DVI file name                       */
+-char    rootname[STRSIZE];       /* DVI filename without extension      */
++char   *G_progname;            /* program name                        */
++char   *filename;              /* DVI file name                       */
++char   *rootname;              /* DVI filename without extension      */
+ char   *HeaderFileName = "";     /* file name & path of Headerfile      */
+ char   *EmitFileName = "";       /* file name & path for output         */
++char    tmp_dir[STRSIZE] = "";         /* temporary directory for auxilliary 
files */
+ #ifdef IBM3812
+ bool    FirstAlternate = _FALSE; /* first page from alternate casette ?   */
+ #endif
_______________________________________________
Frugalware-git mailing list
[email protected]
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to