Pipe to identify CUPS printers: Difference between revisions

From VistApedia
Jump to navigationJump to search
No edit summary
 
mNo edit summary
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
Here is a code snippet that uses the pipe device to query Linux for the names of available CUPS printers. It returns them in an MUMPS array.
Here is a code snippet that uses the pipe device to query Linux for the names of available CUPS printers. It returns them in a MUMPS array.


lpstat(DEVICE)  ;;
lpstat(DEVICE)  ;;
Line 18: Line 18:
         Close P
         Close P
         Quit
         Quit
Compare to GetPrinters^TMGPRNTR(Printers)

Latest revision as of 16:08, 17 August 2009

Here is a code snippet that uses the pipe device to query Linux for the names of available CUPS printers. It returns them in a MUMPS array.

lpstat(DEVICE)  ;;

       ;; (CUPS has been configured with
       ;;  the desired printers defined.)
       ;;Sample run:
       ;; GTM>d lpstat^testing(.jlz)
       ;; GTM>zwr
       ;;    jlz=""
       ;;    jlz("HP_LaserJet_1100A")=""
       ;;    jlz("Photosmart_192.168.5.103")=""
       ;;
       New P Set P="pipe"
       Open P:(command="lpstat -a")::P
       For  Use P Read DEVICE Quit:$ZEOF  Do
       . Set DEVICE($P(DEVICE," "))=""
       . Quit
       Close P
       Quit

Compare to GetPrinters^TMGPRNTR(Printers)