Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
XPROMPT(1)		     General Commands Manual		      XPROMPT(1)

NAME
     xprompt - prompt a user for input

SYNOPSIS
     xprompt [ X toolkit options ] [-rlen number] [-ibw number]
	     [-grab] [-nograb] [-pfn fontname] [-rfn fontname]
	     [-re] [-nre] [-tf filename] [-w wordchars]
	     [-warp] [-nowarp]
	     -p prompt [-r reply] [-p prompt [-r reply]] ...

DESCRIPTION
     Xprompt pops up a window containing a prompt and an optional default reply.
     If  more than one prompt argument is given, the cursor-down key and the re-
     turn key select the next prompt and the cursor-up key selects the	previous
     prompt.   The  program  exits  normally  by typing <ctrl> D or pressing any
     mouse button inside the reply area of the window.	The replies are  printed
     to  stdout,  one per line.  Most standard editing characters (e.g., Delete,
     Backspace, <ctrl> U, cursor movement) are	available.   These  default  key
     bindings may be changed.

     Xprompt can be aborted by typing <ctrl> C.  In this case, no output is gen-
     erated and an exit code of 1 is returned by the program.

     The  default  is  to position the window in the middle of the screen and to
     grab keyboard input so that the cursor need not be  positioned  inside  the
     text area.  If no height or width geometry is provided, xprompt will calcu-
     late  it based on the length of the prompt, the reply length, and the fonts
     being used.  If a height (or width) is provided it is interpreted in  terms
     of the character height (or width) in the reply font.

OPTIONS
     The following command line flags are recognized:

     -rlen number
	     Specifies the maximum length of the reply.  The default is 80 char-
	     acters.

     -ibw number
	     Specifies the border width for the box bounding the text area.  The
	     default is 1.

     -nograb
	     The  cursor  must be in the text portion of the window for input to
	     be accepted.

     -grab   The cursor may be anywhere but input is directed to the text area.

     -r reply
	     Insert reply into the text area as the default reply.

     -pfn fontname
	     Specifies the font to be used for the prompt string.

     -rfn fontname
	     Specifies the font to be used for the reply string.

     -re     After all prompts have been seen, the return key causes the program
	     to exit normally (i.e., it becomes a synonym for <ctrl> D).

     -nre    The return key will not terminate the program.   This  is	the  de-
	     fault.

     -tf filename
	     Specifies	a  file  containing  text translations, one per line, to
	     override the defaults.  Xprompt recognizes the following  functions
	     in addition to those predefined:

	     abort()
		 The  program  terminates  and returns an exit status of 1.  The
		 default binding is Ctrl<Key>C.

	     erase-line()
		 Erases the entire reply.  The default binding is Ctrl<Key>U.

	     erase-word()
		 By default, a word is considered to consist of one or more  al-
		 phanumeric  characters.  Non-word characters following the cur-
		 sor are deleted, then word characters are deleted up until  the
		 next  non-word  character  or the end of line.  There is no de-
		 fault binding.

	     finish-prompt()
		 All replies are printed and the program terminates with an exit
		 status of 0.  The default bindings are Ctrl<Key>D,  <Btn1Down>,
		 <Btn2Down>, and <Btn3Down>.

	     next-prompt()
		 The next prompt is displayed.	The list of prompts is circular,
		 so  the  first prompt is displayed after the last.  The default
		 bindings are Ctrl<Key>J, Ctrl<Key>M, <Key>Down, and  <Key>Line-
		 feed.

	     next-prompt-or-finish()
		 If  all  prompts have been seen and returnExit is TRUE, finish-
		 prompt() will be called otherwise next-prompt() will be called.
		 The default binding is <Key>Return.

	     previous-prompt()
		 The previous prompt is displayed.  The last prompt  is  consid-
		 ered  to  be  previous  to  the  first.  The default binding is
		 <Key>Up.
     The resource textTranslations may also be used to specify translations.

     -w wordchars
	     The string wordchars specifies the characters that make up  a  word
	     for  the  purpose of the erase-word() function.  The string is in a
	     format similar to that used by the tar(1) command:

	     a)  A backslash followed by 1, 2, or 3 octal digits stands for  the
		 ASCII character corresponding to the octal value.  The value is
		 limited to 8 bits.

	     b)  A  backslash followed by a non-octal digit character stands for
		 the character.

	     c)  Other ASCII characters stand for themselves.

	     d)  The range of characters between two characters, <c1> and  <c2>,
		 is  specified	by  a  sequence  of the form <c1>-<c2> when <c1>
		 comes before <c2> in the ASCII character set.
     The default is "a-zA-Z0-9".

     -warp   Warp the cursor into the text area and return it  to  its	original
	     position before exiting.

     -nowarp
	     Don't warp the cursor.  This is the default.

X DEFAULTS
     The  standard  X  toolkit options and resources are accepted.  For example,
     the default font can be changed by the standard -fn fontname flag or by the
     resource XPrompt*Font.  In addition, the  following  resources  are  under-
     stood:

     Rlen (class Integer)
	     Specifies the maximum length of the reply.

     insideborderWidth (class BorderWidth)
	     Specifies the border width for the box bounding the text area.

     Grab (class Boolean)
	     Specifies	whether  keyboard  input  should be focussed on the text
	     area regardless of where the cursor is.

     replyFont (class Font)
	     The font to use for the reply string, overriding XPrompt*Font.

     promptFont (class Font)
	     The font to use for the prompt string, overriding XPrompt*Font.

     returnExit (class Boolean)
	     Specifies whether the return key should allow normal termination if
	     all prompts have been seen.

     textTranslations (class String)
	     Text widget translations.

     textTranslationFile (class String)
	     The name of a file containing text widget translations.

     Warp (class Boolean)
	     Warp the cursor into the text area.

     wordChars (class String)
	     The set of character that make up a word for  the	purpose  of  the
	     erase-word() function.

NOTE
     If xprompt is invoked from a Bourne shell script, the following hack can be
     used to quickly grab multi-reply output:

	 reply=`xprompt -p "Prompt1" -p "Prompt2" -p "Prompt3"`
	 IFS="
	 "
	 set $reply
	 echo "First reply is: $1"
	 echo "Second reply is: $2"
	 echo "Third reply is: $3"

EXIT STATUS
     On  normal  completion  0 is returned.  If the program is aborted, 1 is re-
     turned.

SEE ALSO
     tar(1)

AUTHOR
     Barry Brachman
     brachman@cs.ubc.ca
     Dept. of Computer Science
     University of British Columbia

     Valuable suggestions by Rick Morrison and Bob Mende.
     Conversion to X11R5 by Casey Leedom.

BUGS
     The reply is limited to a single line.  The user is responsible for  ensur-
     ing that a proper window size is chosen.

				 29 January 1989		      XPROMPT(1)

Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=xprompt&sektion=1&manpath=FreeBSD+Ports+15.1.quarterly>

home | help