jmsellens@watdragon.waterloo.edu (11/15/88)
From: "John M. Sellens" <jmsellens>
X Window System Bug Report
xbugs@expo.lcs.mit.edu
VERSION:
R3
CLIENT MACHINE and OPERATING SYSTEM:
Any
DISPLAY:
Any
WINDOW MANAGER:
Any
AREA:
Xt
SYNOPSIS:
XtOpenDisplay() does things in the wrong order, parses badly,
doesn't notice errors.
DESCRIPTION:
XtOpenDisplay() (and hence XtInitialize()) does not notice or complain
about a missing argument following "-display" on the command line.
It does not parse the command line before doing things, which is
a bad idea - the command line should always be parsed (properly) and
any errors reported before a program actually does anything. So,
given a bad environment, a dead server, or a new user, anything using
the standard toolkit is annoying, giving useless error messages.
The following also demonstrates that XtInitialize() generates a bad
error message if XtOpenDisplay() fails (it should say what display
it was unable to open (in this case the dislpay called 'junk') and
it should say why it was unable to open the display e.g. bad display
name syntax, no such machine, no such display, no server running, etc.)
and demonstrates that the default error handler (_XtDefaultError())
is no good because it doesn't gice the name of the program generating
the error.
REPEAT BY:
Note that in all these cases, the toolkit misses the real errors
and instead just whines that it can't open some mythical unnamed
display.
% setenv DISPLAY junk
% xclock -help
X Toolkit Error: Can't Open display
Exit 1 xclock -help
% xclock -display
X Toolkit Error: Can't Open display
Exit 1 xclock -display
% xclock garbage
X Toolkit Error: Can't Open display
Exit 1 xclock garbage
SAMPLE FIX:
Re-think the toolkit? Add a routine like my XDisplayName() routine
that was adopted into X 10.4 and then left out of X11 for some
reason? Add a global variable containing the name of the program?
Add another error handler for this kind of error? Have XtInitialize()
and/or XtOpenDisplay() hide argv[0] away somewhere? Add a hook so
that the caller can get its share of the arguments parsed via
XOpenDisplay before the display is opened so that *all* arguments
can be parsed before we try to actualy open the display? Add a
real parsing routine to be called before XtInitialize() and
XtOpenDisplay(), so we can properly parse the command line before
trying to do anything?