xtbload ver0.1
Posted in 1993
Hi, This is toy program about Informix Online monitor on X. I'd like to know Online up or down to easy, so I bit modified xload.c on MIT X11R5. I use on SunOS 4.1.1 and Sequent/ptx with Online 4.1. Any commant/suggtion will welcom. Sorry, no manual page. But same of xload. thanks everything. Takeshi Hojo (take-h@ascii.co.jp) #!/bin/sh # shar: Shell Archiver (v1.22) # # Run the following text with /bin/sh to create: # Imakefile # XTbLoad.ad # xtbload.bit # xtbload.c # sed 's/^X//' << 'SHAR_EOF' > Imakefile && X DEPLIBS = XawClientDepLibs XLOCAL_LIBRARIES = XawClientLibs X SRCS = xtbload.c X OBJS = xtbload.o X OSMAJORVERSION = OSMajorVersion X OSMINORVERSION = OSMinorVersion X DEFINES = -DOSMAJORVERSION=$(OSMAJORVERSION) -DOSMINORVERSION=$(OSMINORVERSION) X XAllTarget(xtbload) XNormalProgramTarget(xtbload,$(OBJS),$(DEPLIBS),$(LOCAL_LIBRARIES), /**/) XInstallProgramWithFlags(xtbload, $(BINDIR), $(INSTKMEMFLAGS)) X XInstallAppDefaults(XTbLoad) X XDependTarget() SHAR_EOF chmod 0662 Imakefile || echo "restore of Imakefile fails" sed 's/^X//' << 'SHAR_EOF' > XTbLoad.ad && XXTbLoad.input: false XXTbLoad*Label*Justify: left XXTbLoad*JumpScroll: 1 XXTbLoad*internalBorderWidth: 0 XXTbLoad*showGrip: FALSE X SHAR_EOF chmod 0662 XTbLoad.ad || echo "restore of XTbLoad.ad fails" sed 's/^X//' << 'SHAR_EOF' > xtbload.bit && X#define xtbload_width 32 X#define xtbload_height 32 X#define xtbload_x_hot 15 X#define xtbload_y_hot 16 Xstatic char xtbload_bits[] = { X 0x00, 0x00, 0xc0, 0x03, 0x1e, 0x00, 0xf0, 0x03, 0x00, 0x00, 0xf8, 0x03, X 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0xfc, 0x03, 0x00, 0x00, 0xfe, 0x03, X 0xff, 0xff, 0xff, 0xff, 0x00, 0x80, 0xff, 0x03, 0x00, 0xc0, 0xff, 0x03, X 0xff, 0xff, 0xff, 0xff, 0x00, 0xe0, 0xff, 0x03, 0x00, 0xf0, 0xff, 0x03, X 0xff, 0xff, 0xff, 0xff, 0x00, 0xf8, 0xff, 0x03, 0x00, 0xf8, 0xff, 0x03, X 0xff, 0xff, 0xff, 0xff, 0x00, 0xfc, 0xff, 0x03, 0x00, 0xfc, 0xff, 0x03, X 0xff, 0xff, 0xff, 0xff, 0x00, 0xfe, 0xff, 0x03, 0x00, 0xfe, 0xff, 0x03, X 0xff, 0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0x03, 0x00, 0xff, 0xff, 0x03, X 0xff, 0xff, 0xff, 0xff, 0x80, 0xff, 0xff, 0x03, 0xc0, 0xff, 0xff, 0x03, X 0xcf, 0xaf, 0xff, 0xff, 0xb0, 0xee, 0x8e, 0x03, 0xb7, 0xa8, 0x88, 0x03, X 0xb7, 0xaa, 0xea, 0xff, 0xcf, 0xaa, 0x8a, 0x03}; SHAR_EOF chmod 0662 xtbload.bit || echo "restore of xtbload.bit fails" sed 's/^X//' << 'SHAR_EOF' > xtbload.c && X#ifndef lint Xstatic char rcsid[] = "$XConsortium: xload.c,v 1.26 89/12/11 15:53:27 kit Exp $"; X#endif /* lint */ X X#include <stdio.h> X#include <sys/types.h> X#include <sys/time.h> X#include <X11/Intrinsic.h> X#include <X11/Xatom.h> X#include <X11/StringDefs.h> X#include <X11/Shell.h> X X#include <X11/Xaw/Cardinals.h> X#include <X11/Xaw/Label.h> X#include <X11/Xaw/Paned.h> X#include <X11/Xaw/StripChart.h> X#include <X11/Xmu/SysUtil.h> X X#include "xtbload.bit" X Xchar *ProgramName; X Xvoid GetLoadPoint(); Xstatic void quit(); X X/* X* Definition of the Application resources structure. X*/ X Xtypedef struct _XLoadResources { XBoolean show_label; X} XLoadResources; X Xchar tbconfig[64], * label; Xchar tbstat[80]; XWidget toplevel, load, pane, label_wid, load_parent; XArg args[1]; XXLoadResources resources; Xint bef = 0; Xtime_t beft = 0; Xint laststatus; X X#define ONLDOWN -1 X#define ONLUP 0 X#define ONLUNKN -2 X X/* X* Command line options table. Only resources are entered here...there is a X* pass over the remaining options after XtParseCommand is let loose. X*/ X Xstatic XrmOptionDescRec options[] = { X{"-scale", "*load.minScale", XrmoptionSepArg, NULL}, X{"-update", "*load.update", XrmoptionSepArg, NULL}, X{"-hl", "*load.highlight", XrmoptionSepArg, NULL}, X{"-highlight", "*load.highlight", XrmoptionSepArg, NULL}, X{"-label", "*label.label", XrmoptionSepArg, NULL}, X{"-nolabel", "*showLabel", XrmoptionNoArg, "False"}, X{"-jumpscroll", "*load.jumpScroll", XrmoptionSepArg, NULL}, X}; X X/* X* The structure containing the resource information for the X* Xload application resources. X*/ X X#define Offset(field) (XtOffset(XLoadResources *, field)) X Xstatic XtResource my_resources[] = { X{"showLabel", XtCBoolean, XtRBoolean, sizeof(Boolean), XOffset(show_label), XtRImmediate, (caddr_t) TRUE}, X}; X X#undef Offset X Xstatic XtActionsRec xload_actions[] = { X{ "quit", quit }, X}; Xstatic Atom wm_delete_window; X X X/* X* Exit with message describing command line format. X*/ X Xvoid usage() X{ Xfprintf (stderr, "usage: %s [-options ...]\\n\\n", ProgramName); Xfprintf (stderr, "where options include:\\n"); Xfprintf (stderr, X" -display dpy X server on which to display\\n"); Xfprintf (stderr, X" -geometry geom size and location of window\\n"); Xfprintf (stderr, X" -fn font font to use in label\\n"); Xfprintf (stderr, X" -scale number minimum number of scale lines\\n"); Xfprintf (stderr, X" -update seconds interval between updates\\n"); Xfprintf (stderr, X" -label string annotation text\\n"); Xfprintf (stderr, X" -bg color background color\\n"); Xfprintf (stderr, X" -fg color graph color\\n"); Xfprintf (stderr, X" -hl color scale and text color\\n"); Xfprintf (stderr, X" -nolabel removes the label from above the chart.\\n"); Xfprintf (stderr, X" -jumpscroll value number of pixels to scroll on overflow\\n"); Xfprintf (stderr, "\\n"); Xexit(1); X} X Xvoid main(argc, argv) Xint argc; Xchar **argv; X{ XPixmap icon_pixmap = None; X XProgramName = argv[0]; Xtoplevel = XtInitialize(NULL, "XTbLoad", X options, XtNumber(options), &argc, argv); X XXtGetApplicationResources( toplevel, (caddr_t) &resources, X my_resources, XtNumber(my_resources), X NULL, (Cardinal) 0); Xif (argc != 1) usage(); X X/* X* This is a hack so that f.delete will do something useful in this X* single-window application. X*/ XXtAppAddActions (XtWidgetToApplicationContext(toplevel), X xload_actions, XtNumber(xload_actions)); XXtOverrideTranslations(toplevel, X XtParseTranslationTable ("<Message>WM_PROTOCOLS: quit()")); X XXtSetArg (args[0], XtNiconPixmap, &icon_pixmap); XXtGetValues(toplevel, args, ONE); Xif (icon_pixmap == None) { XXtSetArg(args[0], XtNiconPixmap, X XCreateBitmapFromData(XtDisplay(toplevel), X XtScreen(toplevel)->root, X