Skip to Main Content
Volume 7A: XView Programming Manual
book

Volume 7A: XView Programming Manual

by Dan Heller
October 1994
Intermediate to advanced content levelIntermediate to advanced
770 pages
22h 58m
English
O'Reilly Media, Inc.
Content preview from Volume 7A: XView Programming Manual
3.2.1 Using xv_init( )
Initialization should be done before the application attempts to parse its own command-line
options. Since many programs tend to have command-line parameters, a program tends to
report unknown parameters as illegal arguments. Because XView parameters can also be
specified on the command line to the application, the program must be able to distinguish
between the application’s parameters and XView’s parameters.
xv_init() accepts the attributes XV_INIT_ARGS and XV_INIT_ARGC_PTR_ARGV for pur-
poses of parsing command-line arguments. These attributes both take two parameters as val-
ues: argc and argv. These are typically the same ones passed into main(). Using the
XV_INIT_ARGC_PTR_ARGV attribute, the xv_init() function can be told to modify argc
and argv by removing parameters that are XView-specific, like so:
xv_init(XV_INIT_ARGC_PTR_ARGV, &argc, argv, NULL);
When xv_init returns, argv contains only those parameters that are not specific to
XView, and the application can now assume that all remaining arguments are specific to the
application. So a hypothetical command line might look like this:
% program –display maui:0
The command line is first parsed by xv_init(), and in this case, all arguments are stripped
from the argv variable, leaving just argv[0], whose value is program. argc is modi-
fied to have the value 1 (it was originally 3). The example command-line parameters change
the default server to be the X server running on the machine named maui.
The macro XV_INIT_ARGS is ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Volume 6A: Motif Programming Manual

Volume 6A: Motif Programming Manual

David Brennan, Dan Heller, Paula Ferguson
Java™ Media APIs: Cross-Platform Imaging, Media, and Visualization

Java™ Media APIs: Cross-Platform Imaging, Media, and Visualization

Alejandro Terrazas, John Ostuni, Michael Barlow

Publisher Resources

ISBN: 9780937175873