Pipe to identify CUPS printers

From VistApedia
Revision as of 13:16, 15 August 2009 by JohnLeoZ (talk | contribs)
Jump to: navigation, search

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