summaryrefslogtreecommitdiff
path: root/a2ps/a2ps-4.13c.patch
blob: 2633e9268cfa79f0e7782579e3ee957e2340261e (plain)
    1 diff -Nru a2ps-4.13.orig/contrib/Makefile.in a2ps-4.13/contrib/Makefile.in
    2 --- a2ps-4.13.orig/contrib/Makefile.in	2005-04-16 21:34:09.000000000 +0200
    3 +++ a2ps-4.13/contrib/Makefile.in	2005-04-16 21:36:27.000000000 +0200
    4 @@ -162,7 +162,7 @@
    5  install_sh = @install_sh@
    6  lispdir = @lispdir@
    7  
    8 -SUBDIRS = sample emacs
    9 +SUBDIRS = sample
   10  
   11  bin_SCRIPTS = card fixps pdiff psmandup psset texi2dvi4a2ps
   12  bin_PROGRAMS = fixnt
   13 diff -Nru a2ps-4.13.orig/contrib/fixps.in a2ps-4.13/contrib/fixps.in
   14 --- a2ps-4.13.orig/contrib/fixps.in	2005-04-16 21:34:09.000000000 +0200
   15 +++ a2ps-4.13/contrib/fixps.in	2005-04-16 21:34:54.000000000 +0200
   16 @@ -38,7 +38,7 @@
   17  run_gs=0
   18  # What action to perform: fixps, cat, check, and gs
   19  task=fixps
   20 -tmpdir=/tmp/$program.$$
   21 +tmpdir=`mktemp -d -t fixps.XXXXXX` || { echo "$program: Cannot create temporary dir!" >&2 ; exit 1; }
   22  verbose=echo
   23  
   24  # The version/usage strings
   25 @@ -191,7 +191,6 @@
   26    trap "/bin/rm -rf $tmpdir" 0 1 2 3 13 15
   27  fi
   28  
   29 -mkdir $tmpdir
   30  fixps_sed=$tmpdir/fixps.sed
   31  
   32  # If printing from stdin, save into a tmp file
   33 diff -Nru a2ps-4.13.orig/contrib/psmandup.in a2ps-4.13/contrib/psmandup.in
   34 --- a2ps-4.13.orig/contrib/psmandup.in	2005-04-16 21:34:09.000000000 +0200
   35 +++ a2ps-4.13/contrib/psmandup.in	2005-04-16 21:35:05.000000000 +0200
   36 @@ -36,7 +36,7 @@
   37  message=
   38  psselect=${PSSELECT:-psselect}
   39  psset=${PSSET:-psset}
   40 -tmpdir=/tmp/$program.$$
   41 +tmpdir=`mktemp -d -t fixps.XXXXXX` || { echo "$program: Cannot create temporary dir!" >&2 ; exit 1; }
   42  
   43  # These two must be kept in synch.  They are opposed.
   44  verbose=echo
   45 @@ -185,7 +185,6 @@
   46    trap "/bin/rm -rf $tmpdir" 0 1 2 3 13 15
   47  fi
   48  
   49 -mkdir $tmpdir
   50  
   51  # If printing from stdin, save into a tmp file
   52  if test $file = '-'; then
   53 diff -Nru a2ps-4.13.orig/lib/path-concat.c a2ps-4.13/lib/path-concat.c
   54 --- a2ps-4.13.orig/lib/path-concat.c	2005-04-16 21:34:09.000000000 +0200
   55 +++ a2ps-4.13/lib/path-concat.c	2005-04-16 21:36:01.000000000 +0200
   56 @@ -31,7 +31,6 @@
   57  #endif
   58  #include <sys/types.h>
   59  
   60 -char *malloc ();
   61  
   62  #ifndef DIRECTORY_SEPARATOR
   63  # define DIRECTORY_SEPARATOR '/'
   64 diff -Nru a2ps-4.13.orig/src/select.c a2ps-4.13/src/select.c
   65 --- a2ps-4.13.orig/src/select.c	2005-04-16 21:34:09.000000000 +0200
   66 +++ a2ps-4.13/src/select.c	2005-04-16 21:35:11.000000000 +0200
   67 @@ -131,6 +131,36 @@
   68    return 1;
   69  }
   70  
   71 +/* escapes the name of a file so that the shell groks it in 'single' q.marks. 
   72 +   The resulting pointer has to be free()ed when not longer used. */
   73 +char *
   74 +shell_escape(const char *fn)
   75 +{
   76 +  size_t len = 0;
   77 +  const char *inp;
   78 +  char *retval, *outp;
   79 +
   80 +  for(inp = fn; *inp; ++inp)
   81 +    switch(*inp)
   82 +    {
   83 +      case '\'': len += 4; break;
   84 +      default:   len += 1; break;
   85 +    }
   86 +
   87 +  outp = retval = malloc(len + 1);
   88 +  if(!outp)
   89 +    return NULL; /* perhaps one should do better error handling here */
   90 +  for(inp = fn; *inp; ++inp)
   91 +    switch(*inp)
   92 +    {
   93 +      case '\'': *outp++ = '\''; *outp++ = '\\'; *outp++ = '\'', *outp++ = '\''; break;
   94 +      default:   *outp++ = *inp; break;
   95 +    }
   96 +  *outp = 0;
   97 +
   98 +  return retval;
   99 +}
  100 +
  101  /* What says file about the type of a file (result is malloc'd).  NULL
  102    if could not be run.  */
  103  
  104 @@ -144,11 +174,15 @@
  105    if (IS_EMPTY (job->file_command))
  106      return NULL;
  107  
  108 +  filename = shell_escape(filename);
  109 +  if(filename == NULL)
  110 +    return NULL;
  111    /* Call file(1) with the correct option */
  112 -  command = ALLOCA (char, (2
  113 +  command = ALLOCA (char, (4
  114  			   + strlen (job->file_command)
  115  			   + ustrlen (filename)));
  116 -  sprintf (command, "%s %s", job->file_command, (const char *) filename);
  117 +  sprintf (command, "%s '%s'", job->file_command, (const char *) filename);
  118 +  free(filename);
  119    message (msg_tool, (stderr, "Reading pipe: `%s'\n", command));
  120    file_out = popen (command, "r");
  121  

Generated by cgit