# pmquery

## NAME



           **pmconfirm** , **pmmessage** , **pmquery** - general purpose dialog box
    


## SYNOPSIS



           **pmconfirm**[**-c**] [**-b** _button-name_] [**-B** _default-button-name_] [**-t**
           _string_] [**-file** _filename_] [**-icon** _icontype_] [**-font** _font_] [**-header**
           _titlebar-string_] [**-useslider**] [**-noslider**] [**-noframe**] [**-exclusive**]
    
           **pmmessage**[**-buttons** _label1_[:_value1_][,_label2_[:_value2_][,...]]]
           [**-center**] [**-nearmouse**] [**-default** _button_] [**-file** _filename_] [**-print**]
           [**-timeout** _sec_] _message..._
    
           **pmquery**[**-input**] [**all above options...**]  [_message..._]
    


## DESCRIPTION



           **pmquery** provides a command-line-option compatible implementation
           of the **xconfirm** and **xmessage** tools, using a look-and-feel that is
           consistent with **pmchart**.  Several extensions to the functionality
           of the original tools have been made, in order to improve their
           specific utility for **pmchart** , but wherever possible the original
           semantics remain.
    
           **pmconfirm** displays a line of text for each **-t** option specified (or
           a file when the **-file** option is used), and a button for each **-b**
           option specified.  When one of the buttons is pressed, the label
           of that button is written to **pmquery's** standard output.  This
           provides a means of communication/feedback from within shell
           scripts and a means to display useful information to a user from
           an application.
    
           **pmmessage** displays a window containing a message from the command
           line, a file, or standard input.  It additionally allows buttons
           to be associated with an exit status, and only optionally will
           write the label of the button to standard output.
    
           **pmquery** extends the above tools to additionally support limited
           user input, as free form text.  In this **-input** mode, any text
           entered will be output when the default button is pressed.  A
           default text can be entered using the same mechanisms as the other
           tools.
    
           Command line options are available to specify font style, frame
           style, modality and one of several different icons to be presented
           for tailored visual feedback to the user.
    


## OPTIONS



           The available command line options are:
    
           **-c** , **-center**
                Center the window on the display.
    
           **-nearmouse**
                Pop up the window near the mouse cursor.
    
           **-b** _button-name_
                Displays a button with the label _button-name_.  If _button-name_
                is the empty string, the button in that position is not
                displayed.  If no **-b** options are present, the default is a
                button with the label Continue.  The exit status associated
                with _button-name_ is zero.
    
           **-B** _button-name_
                Displays a button with the label _button-name_ and specifies it
                as the button to be activated when enter is pressed.  The
                exit status associated with _button-name_ is zero.
    
           **-buttons** _button,button,..._
                This option will create one button for each comma-separated
                _button_ option.  Each _button_ consists of a label optionally
                followed by a colon and an exit value.  The exit value will
                be returned if that button is selected.  The default exit
                value is 100 plus the button number.  Buttons are numbered
                from the left starting with one.
    
           **-default** _label_
                Defines the button with a matching _label_ to be the default.
                If not specified there is no default.  The corresponding
                resource is **defaultButton**.  Pressing Return anywhere in the
                _xmessage_ window will activate the default button.  The
                default button has a wider border than the others.
    
           **-t** _message_
                Displays message.  Any number of strings can be listed on the
                command line (each must be preceded with the **-t** option).
    
           **-file** _filename_
                Displays the file _filename._  All **-t** options will be ignored.
                A _filename_ of `_-_ ' reads from standard input.
    
           **-icon** _icontype_
                Displays the icon _icontype_ where icontype is one of: _info_ ,
                _error_ , _question_ , _warning_ , _critical_.  _action_ is also accepted
                as a synonym for _error_ for backward compatibility.  **pmquery**
                introduces the additional _archive_ and _host_ icon types as well
                as the original **xconfirm** types listed earlier.
    
           **-font** _fontname_
                Use fontname as the font.  This option is only available when
                using the X Window System.
    
           **-header** _string_
                Use string as the window title.
    
           **-print**
                This causes the program to write the label of the button
                pressed to standard output.  It is the default behaviour for
                **pmconfirm** and **pmquery**.
    
           **-noprint**
                This causes the program to not write the label of the button
                pressed to standard output.  It is the default behaviour for
                **pmmessage**.
    
           **-geometry** _geometry-string_
                This provides the tool with an X-compatible geometry string
                specification.  This option is only available when using the
                X Window System.
    
           **-useslider**
                When displaying a file, always use a slider instead of
                determining automatically whether a slider is necessary.
    
           **-noslider**
                Do not create a slider, and clip text to the window size,
                instead of determining automatically whether a slider is
                necessary..
    
           **-noframe**
                Do not display a frame around the contents.
    
           **-exclusive**
                Grab the keyboard/pointer and do not allow further input
                until a button is pressed.
    
           **-timeout** _secs_
                Exit with status 0 after _secs_ seconds if the user has not
                clicked on a button yet.  The corresponding resource is
                **timeout**.
    
           **-?** , **-h** , **-help**
                Display usage message and exit.
    


## EXAMPLES



           The following shell script will display a window with an
           information icon, asking the user a yes or no question with "Yes"
           as the default.
    
            #! /bin/sh
            case `pmquery -t "Really power down?" -b No -B Yes -icon question
            in
              Yes) shutdown;;
              No) ;;
            esac
    
           A second example, which prompts for a hostname then starts a
           terminal with an ssh session connected to the requested host.
    
            #! /bin/sh
            host=`pmquery -input -icon host -b Cancel -B OK \
                          -header "Remote Terminal - Secure Shell"
            [ "$host" = "Cancel" -o -z "$host" ] && exit
            gnome-terminal -e "ssh $host"
    


## ENVIRONMENT



           **pmquery** is an excellent choice of utility for the
           **PCP_XCONFIRM_PROG** Performance Co-Pilot configuration parameter
           (refer to pcp.conf(5) for details).
    
           Note that **PCP_XCONFIRM_PROG** will be automatically set to **pmquery**
           inside tools like **pmchart** , unless **PCP_XCONFIRM_PROG** is already set
           in the environment.
    


## EXIT STATUS



           If it detects an error, **pmquery** always returns 1, so this value
           should not be associated with a button.  Unless _-button_ option has
           not been used, the return code will be zero on success.
    


* * *