home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Usenet 1994 October
/
usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso
/
x
/
volume10
/
xt-examples
/
part02
/
fragments
/
appgoodbye.c
next >
Wrap
C/C++ Source or Header
|
1990-11-04
|
2KB
|
64 lines
/***********************************************************
Copyright 1990 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute these examples for any
purpose and without fee is hereby granted, provided that the above
copyright notice appear in all copies and that both that copyright
notice and this permission notice appear in supporting documentation,
and that the name of Digital not be used in advertising or publicity
pertaining to distribution of the software without specific, written
prior permission.
DIGITAL AND THE AUTHORS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
OR PERFORMANCE OF THIS SOFTWARE.
******************************************************************/
int main(argc, argv)
unsigned int argc;
char **argv;
{
Widget toplevel, label, button, box;
XtAppContext app;
Display *dpy;
Arg args[2];
int n;
unsigned_int saved_argc;
char **saved_argv;
XtToolkitInitialize(); /* Initialize the toolkit */
app = XtCreateApplicationContext(); /* Create an app context */
/* Copy argc and argv */
saved_argc = argc;
saved_argv = XtMalloc(argc * sizeof(char *));
bcopy(argv, saved_argv, argc * sizeof(char *));
/* Open the default display */
dpy = XtOpenDisplay(app, NULL, NULL, "Goodbye",
NULL, 0, &argc, argv);
if (dpy == NULL) {
fprintf(stderr, "Couldn't open display connection\n");
exit(1);
}
/* Create a shell */
n = 0;
XtSetArg(args[n], XtNargc, saved_argc); n++;
XtSetArg(args[n], XtNargv, saved_argv); n++;
toplevel = XtAppCreateShell(NULL, "Goodbye",
applicationShellWidgetClass, dpy, args, n);
/* The rest of the code is identical */
}