/* xclock -- * Hacked from Tony Della Fera's much hacked clock program. */ #ifndef lint static char rcsid[] = "$XConsortium: xclock.c,v 1.24 89/06/19 13:55:24 jim Exp $"; #endif /* lint */ #include #include #include #include #include #include #include "clock.bit" #include "clmask.bit" extern void exit(); /* Command line options table. Only resources are entered here...there is a pass over the remaining options after XtParseCommand is let loose. */ static XrmOptionDescRec options[] = { {"-chime", "*clock.chime", XrmoptionNoArg, "TRUE"}, {"-hd", "*clock.hands", XrmoptionSepArg, NULL}, {"-hands", "*clock.hands", XrmoptionSepArg, NULL}, {"-hl", "*clock.highlight", XrmoptionSepArg, NULL}, {"-highlight", "*clock.highlight", XrmoptionSepArg, NULL}, {"-update", "*clock.update", XrmoptionSepArg, NULL}, {"-padding", "*clock.padding", XrmoptionSepArg, NULL}, {"-d", "*clock.analog", XrmoptionNoArg, "FALSE"}, {"-digital", "*clock.analog", XrmoptionNoArg, "FALSE"}, {"-analog", "*clock.analog", XrmoptionNoArg, "TRUE"}, }; /* * Report the syntax for calling xclock. */ Syntax(call) char *call; { (void) printf ("Usage: %s [-analog] [-bw ] [-digital]\n", call); (void) printf (" [-fg ] [-bg ] [-hd ]\n"); (void) printf (" [-hl ] [-bd ]\n"); (void) printf (" [-fn ] [-help] [-padding ]\n"); (void) printf (" [-rv] [-update ] [-display displayname]\n"); (void) printf (" [-geometry geom]\n\n"); exit(1); } void main(argc, argv) int argc; char **argv; { Widget toplevel; Arg arg; Pixmap icon_pixmap = None; toplevel = XtInitialize("main", "XClock", options, XtNumber(options), &argc, argv); if (argc != 1) Syntax(argv[0]); XtSetArg(arg, XtNiconPixmap, &icon_pixmap); XtGetValues(toplevel, &arg, ONE); if (icon_pixmap == None) { arg.value = (XtArgVal)XCreateBitmapFromData(XtDisplay(toplevel), XtScreen(toplevel)->root, clock_bits, clock_width, clock_height); XtSetValues (toplevel, &arg, ONE); } XtSetArg(arg, XtNiconMask, &icon_pixmap); XtGetValues(toplevel, &arg, ONE); if (icon_pixmap == None) { arg.value = (XtArgVal)XCreateBitmapFromData(XtDisplay(toplevel), XtScreen(toplevel)->root, clock_mask_bits, clock_mask_width, clock_mask_height); XtSetValues (toplevel, &arg, ONE); } XtCreateManagedWidget ("clock", clockWidgetClass, toplevel, NULL, ZERO); XtRealizeWidget (toplevel); XtMainLoop(); }