This is VERY clever...  and Lars found a 'mis speak' or a 'mis doc'
or a 'mis bug'...  See the end for details.

> From [EMAIL PROTECTED] Thu Jul 20 21:05:31 2000
> Date: Thu, 20 Jul 2000 23:03:29 -0400 (EDT)
> From: Lars Kellogg-Stedman <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED]
> Subject: LPRng: IFHP: common filters and '+='
>
> Hello again,
>
> I'm fiddling with the ifhp.conf on my system, and I'm getting an
> (apparently nonfatal) error from ifhp that I haven't been able to figure
> out.
>
> What I'd like is for the default ifhp entry to contain the following
> file_output_match:
>
>   file_output_match = [
>         *gif*                   filter  \%s{gif_converter}
>         *jpeg*                  filter  \%s{jpeg_converter}
>         *tiff*                  filter  \%s{tiff_converter}
>
>         *gzip_compressed*       filter  \%s{gzip_decompress}
>   ]
>
> (The image converters all convert from some image format to pnm, which is
> then converted to something else [e.g., postscript] for individual
> printers).
>
> Then, for another printer entry, I'd like to supplement the default
> converters with printer specific ones, like this:
>
>   [ apple postscript ps ]
>
>
> Now, this *seems* to be working -- for instance, if I try to print a gzip
> compressed JPEG image, this is what I get:
>
>  Filter_status: started FILE_UTIL- '/usr/bin/file -' at 22:55:04.300
>  Filter_status: file information = 
>'gzip_compressed_data,_deflated,_original_filename,_last_modified:_mon_apr_24_16:05:11_2000,_os:_unix'
> at 22:55:04.583
>  Filter_status: initial job type 
>'gzip_compressed_data,_deflated,_original_filename,_last_modified:_mon_apr_24_16:05:11_2000,_os:_unix'
> at 22:55:04.584
>  Filter_status: decoded job type 'FILTER' at 22:55:04.585
>  Filter_status: job type 'FILTER', converter '/usr/bin/gzip -c -d   ' at 22:55:04.585
>  Filter_status: started CONVERTER- '/usr/bin/gzip -c -d   ' at 22:55:04.588
>  Filter_status: converter done, output 2559 bytes at 22:55:04.605
>  Filter_status: file program = '/usr/bin/file -' at 22:55:04.606
>  Filter_status: started FILE_UTIL- '/usr/bin/file -' at 22:55:04.609
>  Filter_status: file information = 'jpeg/jfif_compressed_image' at 22:55:04.848
>  Filter_status: initial job type 'jpeg/jfif_compressed_image' at 22:55:04.848
>  Filter_status: decoded job type 'FILTER' at 22:55:04.849
>  Filter_status: job type 'FILTER', converter '/usr/bin/jpegtopnm  ' at 22:55:04.849
>  Filter_status: started CONVERTER- '/usr/bin/jpegtopnm  ' at 22:55:04.852
>  Filter_status: 'CONVERTER' error msg 'jpegtopnm: WRITING PPM FILE' at 22:55:05.222
>  Filter_status: converter done, output 781 bytes at 22:55:05.229
>  Filter_status: file program = '/usr/bin/file -' at 22:55:05.230
>  Filter_status: started FILE_UTIL- '/usr/bin/file -' at 22:55:05.233
>  Filter_status: file information = 'ppm_"rawbits"_image_data' at 22:55:05.627
>  Filter_status: initial job type 'ppm_"rawbits"_image_data' at 22:55:05.627
>
>  Filter_status: bad pattern in 'file_output_match' - ']' at 22:55:05.628
>
>  Filter_status: decoded job type 'POSTSCRIPT' at 22:55:05.629
>  Filter_status: job type 'POSTSCRIPT', converter '/usr/bin/pnmtops  ' at 22:55:05.629
>  Filter_status: started CONVERTER- '/usr/bin/pnmtops  ' at 22:55:05.632
>  Filter_status: 'CONVERTER' error msg 'pnmtops: writing color PostScript...' at 
>22:55:05.821
>  Filter_status: converter done, output 2026 bytes at 22:55:05.826
>  Filter_status: transferring 2026 bytes at 22:55:05.845
>  Filter_status: 100 percent done at 22:55:05.846
>  Filter_status: data sent at 22:55:05.847
>  Filter_status: sent job file at 22:55:05.847
>  Filter_status: pagecounter 0, pages 0 at 22:55:05.847
>  Filter_status: done at 22:55:05.848
>
> What concerns me is the "bad pattern" error:
>
>   Filter_status: bad pattern in 'file_output_match' - ']' at 22:55:05.628
>
> This *only* occurs if I use '+=' in the above file_output_match...if I manually
> include the common filters, it works just fine.  Is there an obvious
> syntax error that I'm missing?

Nothing.  Here is what is happening:

When the first 'file_output_match' was found it was stored as the string:

"[\n\t*gif*\tfilter  \%s{gif_converter}\n\t*jpeg*\tfilter \   <- line break added for 
formatting
 \%s{jpeg_converter}... \n]

Now you hit the second one.  This gets appended to the line:
"[\n\t*gif*\tfilter  \%s{gif_converter}\n\t*jpeg*\tfilter \   <- line break added for 
formatting
 \%s{jpeg_converter}... \n] [\n\t*postscript*            ps ...

                          ^^^ note the "] [" line.
The "] [" line is what is being complained about.

You can apply the following patch and get a better message:

*** ifhp.c      2000/07/17 02:35:46     1.60
--- ifhp.c      2000/07/21 19:57:52
***************
*** 3213,3219 ****
                        s = l.list[0];
                        if( !strcmp(s,"]") || !strcmp(s,"[") ){
                                if( l.count != 1 ){
!                                       LOGMSG( "Send_job: bad pattern in 
'file_output_match' - '%s'", s );
                                }
                                continue;
                        }
--- 3213,3219 ----
                        s = l.list[0];
                        if( !strcmp(s,"]") || !strcmp(s,"[") ){
                                if( l.count != 1 ){
!                                       LOGMSG( "Send_job: bad pattern in 
'file_output_match' - '%s'", match.list[i] );
                                }
                                continue;
                        }

You can avoid this problem by using:

   file_output_match +=
    [
         *postscript*            ps
         *roff*                  ps      \%s{troff_converter}
         *text*                  ps      \%s{a2ps_converter}

         *pdf*                   ps      \%s{pdf_converter}
         *dvi*                   ps      \%s{dvi_converter}
         *pnm*                   ps      \%s{pnm_converter}
         *ppm*                   ps      \%s{pnm_converter}
   ]


>
> Thanks,
>
>   -- Lars
>
> -- 
> Lars Kellogg-Stedman <[EMAIL PROTECTED]> --> http://www.larsshack.org/
>

-----------------------------------------------------------------------------
If you need help, send email to [EMAIL PROTECTED] (or lprng-requests
or lprng-digest-requests) with the word 'help' in the body.  For the impatient,
to subscribe to a list with name LIST,  send mail to [EMAIL PROTECTED]
with:                           | example:
subscribe LIST <mailaddr>       |  subscribe lprng-digest [EMAIL PROTECTED]
unsubscribe LIST <mailaddr>     |  unsubscribe lprng [EMAIL PROTECTED]

If you have major problems,  send email to [EMAIL PROTECTED] with the word
LPRNGLIST in the SUBJECT line.
-----------------------------------------------------------------------------

Reply via email to