/* 01 */ #include /* 02 */ #include /* 03 */ #include /* 04 */ #include /* 05 */ #include /* 06 */ /* 07 */ int main(int argc, char **argv) /* 08 */ { /* 09 */ XtAppContext app; /* 10 */ Widget top,label; /* 11 */ Display *disp; /* 12 */ Window root; /* 13 */ Pixmap pix; /* 14 */ int err; /* 15 */ /* 16 */ top = XtVaAppInitialize(&app,"Sample",NULL,0,&argc,argv,NULL,NULL); /* 17 */ disp = XtDisplay(top); /* 18 */ root = DefaultRootWindow(disp); /* 19 */ /* 20 */ if( argc < 2 ){ /* 21 */ fprintf(stderr,"usage: %s \n",argv[0]); /* 22 */ return 1; /* 23 */ } /* 24 */ /* 25 */ err = XpmReadFileToPixmap(disp,root,argv[1],&pix,NULL,NULL); /* 26 */ if( err ){ /* 27 */ fprintf(stderr,"%s: %s\n",argv[0],XpmGetErrorString(err)); /* 28 */ return 1; /* 29 */ } /* 30 */ /* 31 */ label = XtVaCreateManagedWidget("label",labelWidgetClass,top, /* 32 */ XtNlabel,"", /* 33 */ NULL); /* 34 */ XtVaSetValues(label,XtNbitmap,pix,NULL); /* 35 */ XtRealizeWidget(top); /* 36 */ XtAppMainLoop(app); /* 37 */ return 0; /* 38 */ }