groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Groff] Inputfile_caseencapsulation --with-unpack (and --with-zlib)


From: Steffen Nurpmeso
Subject: Re: [Groff] Inputfile_caseencapsulation --with-unpack (and --with-zlib) support
Date: Mon, 28 Jul 2014 15:02:23 +0200
User-agent: s-nail v14.7.4-3-g32d76ea

First: someone messed up the subject when reencoding the message,
the correct one would have been

  Input file_case encapsulation --with-unpack (and --with-zlib) support

Sorry.  (Don't use Python.)

I wrote:
 [.]
 |  ea111b9 Add GROFF_UNPACK_CHECK m4++ / --with-unpack=XY (Public Domain)
 |
 |New option --with{,out}-unpack{=gz,bz2,xz}.  The default is
 |--with-unpack which in turn enables all of gz,bz2,xz which is
 |possibly not desirable.  I think a plain default of gz would be
 |more useful given how many stat(2)s are needed otherwise.

  diff --git a/m4/groff.m4 b/m4/groff.m4
  index 7078bde..67b2ef9 100644
  --- a/m4/groff.m4
  +++ b/m4/groff.m4
  @@ -73,20 +73,25 @@ AC_DEFUN([GROFF_PERL],
   
   # It is possible to directly use compressed files
   AC_DEFUN([GROFF_UNPACK_CHECK],
  -  [AC_ARG_WITH([unpack],
  +  [user=0
  +  AC_ARG_WITH([unpack],
       [AS_HELP_STRING([--with-unpack[[=TYPE]]],
         [choose wether support for unpacking of compressed files is desirable.
          TYPE can be `yes' or `no', or a comma-separated list of one or
          multiple of `bz2', `gz' and `xz', to restrict what can be unpacked])],
  -    [unpack="$withval"],
  +    [user=1; unpack="$withval"],
       [unpack=yes])
     test "x$unpack" = xno && unpack=''
   
     if test "x$unpack" = xyes; then
       HAVE_UNPACK=1
  -    HAVE_UNPACK_BZ2=1
  -    HAVE_UNPACK_GZ=1
  -    HAVE_UNPACK_XZ=1
  +    if test $user -eq 0; then
  +      HAVE_UNPACK_GZ=1
  +    else
  +      HAVE_UNPACK_BZ2=1
  +      HAVE_UNPACK_GZ=1
  +      HAVE_UNPACK_XZ=1
  +    fi
     else
       # Don't use case/esac, verify input.
       HAVE_UNPACK=0

 |  6ed7720 file_case: support transparent file decompression (Public Domain)..
 |
 |..via external decompressor commands, i.e., popen(3), using
 |a temporary file shall the callee need a seekable stream.
 |This also extends src/devices/gropdf/gropdf.pl accordingly.
 |
 |So with this one can say '$ xy troff.1' and '$ xy troff.1.gz' and
 |it'll find `troff.1.gz' and display it correctly (i.e., different
 |to the draft we also look wether the path already includes an
 |extension, then tries the plain file, then tries to auto-expand
 |with compressor extensions).

I've forgot to mention that the default of decompression support
for all files can be toggled by changing a single line in
file_case.h, in which case only explicit requests will be served.

Unfortunately i didn't use that explicit bit for soelim(1), which
would of course be the point of interest to support transparent
decompression of `.so' if groff(1) by itself wouldn't.
So this is a bug in my diff.

  diff --git a/src/preproc/soelim/soelim.cpp b/src/preproc/soelim/soelim.cpp
  index da8a675..9768024 100644
  --- a/src/preproc/soelim/soelim.cpp
  +++ b/src/preproc/soelim/soelim.cpp
  @@ -156,7 +156,8 @@ int do_file(const char *filename)
     enum { START, MIDDLE, HAD_DOT, HAD_s, HAD_so, HAD_l, HAD_lf } state = 
START;
   
     file_case *fcp;
  -  if ((fcp = include_search_path.open_file_cautious(filename)) == NULL) {
  +  if ((fcp = include_search_path.open_file_cautious(filename,
  +      fcp->mux_default | fcp->mux_unpack)) == NULL) {
       error("can't open `%1': %2", filename, strerror(errno));
       goto jleave;
     }

--steffen



reply via email to

[Prev in Thread] Current Thread [Next in Thread]