home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / lang / perl / 4905 < prev    next >
Encoding:
Text File  |  1992-07-22  |  1.9 KB  |  72 lines

  1. Newsgroups: comp.lang.perl
  2. Path: sparky!uunet!mcsun!sunic!ericom!eos.ericsson.se!etxmesa
  3. From: etxmesa@eos.ericsson.se (Michael Salmon)
  4. Subject: Re: X thing to get string?
  5. Message-ID: <1992Jul23.075555.4764@ericsson.se>
  6. Sender: news@ericsson.se
  7. Nntp-Posting-Host: eos6c02.ericsson.se
  8. Reply-To: etxmesa@eos.ericsson.se (Michael Salmon)
  9. Organization: Ericsson Telecom AB
  10. References:  <1992Jul22.161235.18528@cs.unca.edu>
  11. Date: Thu, 23 Jul 1992 07:55:55 GMT
  12. Lines: 58
  13.  
  14. In article <1992Jul22.161235.18528@cs.unca.edu>, mcmahan@cs.unca.edu (Scott McMahan -- Genesis mailing list owner) writes:
  15. |> Is there an X program, preferably Motif-oriented (not that I'm that
  16. |> picky :^)), that will pop a dialogue box, get a string from the user,
  17. |> and print it on the stdout?
  18.  
  19. This sounds very like xprompt:
  20.  
  21. Xprompt provides a means by which programs can ask the user
  22. for one or more responses.  I have found it especially useful for
  23. reducing the size of my (tv)twm menus.
  24. Instead of hardwiring alternatives into a menu, a single script is used
  25. to call xprompt and then invoke the appropriate thing.
  26.  
  27. For example, I have a twm menu item:
  28.  
  29.         "RLOGIN"        !"xprompt.rlogin &"
  30.  
  31. that invokes a shell script called xprompt.rlogin:
  32.  
  33. #! /bin/sh
  34.  
  35. defaulthost=${HOME}/.xprompt.rlogin
  36. reply=
  37.  
  38. if [ -r $defaulthost ]
  39. then
  40.         reply=`cat $defaulthost`
  41. fi
  42.  
  43. reply=`xprompt -p "Hostname" -r "$reply"`
  44. if [ $? = 1 ]
  45. then
  46.         exit 0
  47. fi
  48. echo "$reply" > $defaulthost
  49.  
  50. xhost "$reply" > /dev/null 2>&1
  51. xterm -T "rlogin $reply" -e rlogin "$reply" &
  52.  
  53. exit 0
  54.  
  55. The author is:
  56.  
  57. Barry Brachman           | {alberta,uw-beaver,uunet}!ubc-cs!brachman
  58. Dept. of Computer Science| brachman@cs.ubc.ca (cs.ubc.ca=137.82.8.5)
  59. Univ. of British Columbia| brachman@ubc.csnet
  60. Vancouver, B.C. V6T 1Z2  | Office: (604) 822-3123, FAX: (604) 822-5485
  61.  
  62. -- 
  63.  
  64. Michael Salmon
  65.  
  66. #include    <standard.disclaimer>
  67. #include    <witty.saying>
  68. #include    <fancy.pseudo.graphics>
  69.  
  70. Ericsson Telecom AB
  71. Stockholm
  72.