Cups Filter...How do I get out of $TMPDIR and back to $6

Paul pconklin at gentlemanslife.com
Wed Oct 20 11:17:57 PDT 2010


> Paul wrote:
>
> > I have a need to insert a charecter at the beginning of a raw job (fully
> > encapsulated Zebra ZPL Code)  So I thought the best way would be to use
> > the generic text PPD and make my own script based filter.  this is the
> > only line i modified in the generic text PPD
> >
> > *cupsFilter:    "text/plain 0 rawzplrv"
> >
> > I then created my rawzplrv filter as well as conv file
> >
> > conv
> > text/plain application/vnd.cups-raw 0 rawzplrv
> >
> > rawzplrv filter
> > #!/bin/sh
> > echo "insert text here" >> $TMPDIR/$$.zpl
> > cat $6 >> $TMPDIR/$$.zpl
> > cat $TMPDIR/$$.zpl > $6
> > (purposely left off rm so I can debug)
> >
> > My problem is this, it properly generates the file in the $TMPDIR but i
> > can't get that info out to the spool file ($6)
> >
> > D [19/Oct/2010:17:42:57 -0500] [Job 413] /usr/lib/cups/filter/rawzplrv:
> > line 4: /var/spool/cups/d00415-001: Permission denied
> >
> > or when I try a move
> >
> > D [19/Oct/2010:17:38:11 -0500] [Job 412] mv: cannot move
> > `/var/spool/cups/tmp/19060.zpl' to `/var/spool/cups/d00415-001':
> > Permission denied
> >
> > /var/spool/cups/tmp>
> > # ls -l
> > total 8
> > -rw------- 1 lp lp  240 Oct 19 18:36 19060.zpl
> >
> > /var/spool/cups>
> > # ls -l d*
> > -rw-r----- 1 root lp 229 Oct 19 18:36 d00415-001
> >
> > I know it's because of permissions because the spool file is owned by
> > root, but how do i get around this?  looking at some of the other script
> > based filters, they execute a program and use $6 as the output.  I've
> > scowered the net and books, any help greatly appreciated!
>
> Why don't you stick to the CUPS filter conventions as to write all the final
> output to stdout?
> As you force your filter (by the PPD statement) to be the very last one
> before the backend, there is no need to write the data back to the spool
> directory.
>
> Helge
>
Helge,
Thanks for the reply.  My most pressing reason is what I am adding will have control charecters (Like ASCII chars 2,3,10,12,13,15,23,24,27) I'm not fully sure how I can write those out to stdout with a script, but if you have any suggestions, I'm open to ideas.  Thanks again.




More information about the cups mailing list