home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / sys / sun / apps / 1879 < prev    next >
Encoding:
Text File  |  1992-09-10  |  3.3 KB  |  109 lines

  1. Newsgroups: comp.sys.sun.apps
  2. Path: sparky!uunet!mcsun!sunic!ericom!eos.ericsson.se!etxmesa
  3. From: etxmesa@eos.ericsson.se (Michael Salmon)
  4. Subject: Re: openwin and DISPLAY
  5. Message-ID: <1992Sep10.130217.8665@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: <1992Sep6.123129.5343@ukw.uucp> <1992Sep10.120547.26796@cbnewsh.cb.att.com>
  11. Date: Thu, 10 Sep 1992 13:02:17 GMT
  12. Lines: 95
  13.  
  14. In article <1992Sep10.120547.26796@cbnewsh.cb.att.com>, 
  15. wolf@mt.att.com (Thomas Wolf) writes:
  16. |> In article 5343@ukw.uucp, lupe@ukw.uucp (Lupe Christoph) writes:
  17. |> "> "wolf@mt.att.com (Thomas Wolf) writes:
  18. |> "> "
  19. |> "> ">This is probably a FAQ: Why does the openwin script overwrite the DISPLAY
  20. |> "> ">variable with its own ":0"?  An application I'm running under OW3.0 needs
  21. |> "> ">to have at least "unix" or a hostname in that variable.  What's the simplest
  22. |> "> ">solution to retaining the variable?
  23. |> "> "
  24. |> "> "From "man openwin":
  25. |> "> "
  26. |> "> "     DISPLAY
  27. |> "> "          By default this is ":0" meaning this  xnews  server  is
  28. |> "> "          the first (zero based) one running on this machine.  If
  29. |> "> "          you need to  run  more  than  one  server  on  a  given
  30. |> "> "          machine, use the "-display" option.
  31. |> "> "
  32. |> "> "The man pages are a bit fuzzy on this. But you *can* use the -display
  33. |> "> "option with openwin just like that used by the clients.
  34. |> 
  35. |> That's not quite true.  When I try "openwin -display unix:0.0" (which is quite
  36. |> legal with most/some/whatever x-clients) the server complains about invalid
  37. |> command-line arguments.  I think the above just gives you the option of specifying
  38. |> a different display number - e.g. "openwin -display :1".
  39. |> 
  40. |> I originally asked the question because I had an "ill-behaving" application (ie.
  41. |> my application :-) that required the DISPLAY variable to have _something_ before
  42. |> the colon.  I didn't realize know, at the time, that wasn't necessarily the case.
  43. |> However, the question itself is still valid.  I don't think the "openwin" script
  44. |> should decide for the user what to set DISPLAY to -- iff the user already has an
  45. |> environment variable of that name set.
  46.  
  47. The problem here seems to be xnews, from its man page:
  48.  
  49. xnews [ :display ] ...
  50.  
  51. I your application needs DISPLAY set as you could just grab the openwin
  52. script, change:
  53.  
  54. # default DISPLAY is :0
  55. DISPLAY=":0"
  56.  
  57. to:
  58.  
  59. # default DISPLAY is :0
  60. DISPLAY="${DISPLAY-:0}"
  61.  
  62. and:
  63.  
  64. # start up xinit and thus the server.
  65. $OPENWINHOME/bin/xinit -- ${SERVER-$OPENWINHOME/bin/xnews} \
  66. $DISPLAY $PASSTHRU $AUTH 
  67.  
  68. to:
  69.  
  70. # start up xinit and thus the server.
  71. $OPENWINHOME/bin/xinit -- ${SERVER-$OPENWINHOME/bin/xnews} \
  72. `echo $DISPLAY|sed -e 's/^.*:/:/' $PASSTHRU $AUTH 
  73.  
  74. and get rid of the error display by changing:
  75.  
  76. # complain if $DISPLAY doesn't begin with a colon.
  77. case "$DISPLAY" in
  78.     :*)
  79.         ;;
  80.     *)
  81.         err "\"$DISPLAY\" is an illegal value for \$DISPLAY"
  82.         ;;
  83. esac
  84.  
  85. to:
  86.  
  87. # complain if $DISPLAY doesn't have a colon.
  88. case "$DISPLAY" in
  89.     *:*)
  90.         ;;
  91.     *)
  92.         err "\"$DISPLAY\" is an illegal value for \$DISPLAY"
  93.         ;;
  94. esac
  95.  
  96.  
  97. Untested I'm afraid, but not much can go wrong.
  98.  
  99. -- 
  100.  
  101. Michael Salmon
  102.  
  103. #include    <standard.disclaimer>
  104. #include    <witty.saying>
  105. #include    <fancy.pseudo.graphics>
  106.  
  107. Ericsson Telecom AB
  108. Stockholm
  109.