home *** CD-ROM | disk | FTP | other *** search
-
- Xprompt provides a means by which programs can ask the user
- for one or more responses. I have found it especially useful for
- reducing the size of my twm menus.
- Instead of hardwiring alternatives into a menu, a single script is used
- to call xprompt and then invoke the appropriate thing.
-
- For example, I have a twm menu item:
-
- "RLOGIN" !"xprompt.rlogin &"
-
- that invokes a shell script called xprompt.rlogin:
-
- #! /bin/sh
-
- defaulthost=${HOME}/.xprompt.rlogin
- reply=
-
- if [ -r $defaulthost ]
- then
- reply=`cat $defaulthost`
- fi
-
- reply=`xprompt -p "Hostname" -r "$reply"`
- if [ $? = 1 ]
- then
- exit 0
- fi
- echo "$reply" > $defaulthost
-
- xhost "$reply" > /dev/null 2>&1
- xterm -T "rlogin $reply" -e rlogin "$reply" &
-
- exit 0
-
- Xprompt relies on the user to set its geometry to something reasonable.
- I set the following resources in my .xresources:
- XPrompt*cursor: left_ptr
- XPrompt*Geometry: 800x30+300+2
- XPrompt*Rlen: 70
- XPrompt*borderWidth: 2
- XPrompt*Grab: off
- XPrompt*Warp: on
- XPrompt*returnExit: on
- XPrompt*textTranslations: #override \n\
- Ctrl<Key>W: erase-word() \n\
- <Btn1Up>: select-start() \n\
- <Btn2Up>: insert-selection(PRIMARY,CUT_BUFFER0) \n\
- <Btn3Up>: next-prompt-or-finish()
-
- This is my first X program and there's a good chance I've made a few major
- X faux pas. Suggestions on how to clean it up will be gratefully received.
- There are a few minor problems, perhaps my fault, perhaps the fault
- of the text widget. Horizontal scrolling, for example, doesn't seem
- to work correctly. Still, I've found the program useful and perhaps others
- will as well.
-
- The program has been tested with the server running on a monochrome Sun 3/50
- (SunOS 4.0) and has been compiled with gcc 1.32 and greater.
- The program has executed on all manner of Sun 3 and a Sun 4/260.
- It has been written for X11R3. I can't vouch for the Imakefile. The
- enclosed Makefile was not made by imake.
-
- I have a man page for trcomp() should anyone think it's a useful library
- function. Ask and I'll mail it.
-
- Please report bugs, enhancements, suggestions, etc. to me rather than
- posting to the net.
-
- -----
- Barry Brachman | UUCP: {alberta,uw-beaver,uunet}!
- Dept. of Computer Science| ubc-vision!ubc-csgrads!brachman
- Univ. of British Columbia| Internet: brachman@cs.ubc.ca
- Vancouver, B.C. V6T 1W5 | brachman%ubc.csnet@csnet-relay.arpa
- (604) 228-4327 | brachman@ubc.csnet
-
-