diff options
-rw-r--r-- | get_load.c | 18 | ||||
-rw-r--r-- | xload.c | 34 |
2 files changed, 26 insertions, 26 deletions
@@ -67,7 +67,7 @@ static long (__stdcall *pdhopen)(LPCSTR, DWORD, HANDLE); static long (__stdcall *pdhaddcounter)(HANDLE, LPCSTR, DWORD, HANDLE*); static long (__stdcall *pdhcollectquerydata)(HANDLE); static long (__stdcall *pdhgetformattedcountervalue)(HANDLE, DWORD, LPDWORD, COUNTER*); -#define CYGWIN_PERF +#define CYGWIN_PERF void InitLoadPoint(void) { long ret; @@ -84,7 +84,7 @@ void InitLoadPoint(void) ret = pdhopen( NULL , 0, &query ); if (ret!=0) exit(-1); ret = pdhaddcounter(query, "\\Processor(_Total)\\% Processor Time", 0, &counter); - if (ret!=0) exit(-1); + if (ret!=0) exit(-1); } void GetLoadPoint( Widget w, /* unused */ @@ -198,7 +198,7 @@ void InitLoadPoint() /* SYSV386 version */ nlist( KERNEL_FILE, namelist); - for (i=0; namelist[i].n_name; i++) + for (i=0; namelist[i].n_name; i++) if (namelist[i].n_value == 0) xload_error("cannot get name list from", KERNEL_FILE); @@ -213,11 +213,11 @@ void InitLoadPoint() /* SYSV386 version */ if ((p=(struct proc *)malloc(v.v_proc*sizeof(*p))) == NULL) xload_error("cannot allocat space for", PROC_NAME); - + first_buf = (XtPointer) namelist[2].n_value; last_buf = (char *)first_buf + v.v_buf * sizeof(struct buf); } - + /* ARGSUSED */ void GetLoadPoint( w, closure, call_data ) /* SYSV386 version */ Widget w; /* unused */ @@ -227,7 +227,7 @@ XtPointer call_data; /* pointer to (double) return value */ double *loadavg = (double *)call_data; static double avenrun = 0.0; int i, nproc, size; - + (void) lseek(kmem, namelist[0].n_value, 0); (void) read(kmem, &v, sizeof(v)); @@ -236,7 +236,7 @@ XtPointer call_data; /* pointer to (double) return value */ (void) lseek(kmem, namelist[1].n_value, 0); (void) read(kmem, p, size * sizeof(struct proc)); - for (nproc = 0, i=0; i<size; i++) + for (nproc = 0, i=0; i<size; i++) if ((p[i].p_stat == SRUN) || (p[i].p_stat == SIDL) || (p[i].p_stat == SXBRK) || @@ -295,12 +295,12 @@ void GetLoadPoint( while ((dp = memchr(buf,'.',sizeof(buf)-1)) != NULL) { *(char *)dp = ldp; } - + #endif if (sscanf(buf, "%lf", (double *)call_data) == 1) return; } - + *(double *)call_data = 0.0; /* temporary hiccup */ @@ -60,7 +60,7 @@ from the X Consortium. #endif #include <errno.h> -#include <stdio.h> +#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <X11/Intrinsic.h> @@ -93,7 +93,7 @@ static void SetLights(XtPointer data, XtIntervalId *timer); /* * Command line options table. Only resources are entered here...there is a - * pass over the remaining options after XtParseCommand is let loose. + * pass over the remaining options after XtParseCommand is let loose. */ static XrmOptionDescRec options[] = { @@ -205,10 +205,10 @@ main(int argc, char **argv) if (argc != 1) usage(); - XtGetApplicationResources( toplevel, (XtPointer) &resources, + XtGetApplicationResources( toplevel, (XtPointer) &resources, my_resources, XtNumber(my_resources), NULL, (Cardinal) 0); - + if (resources.use_lights) { char name[1024]; @@ -240,47 +240,47 @@ main(int argc, char **argv) XtAppAddActions (app_con, xload_actions, XtNumber(xload_actions)); XtOverrideTranslations(toplevel, XtParseTranslationTable ("<Message>WM_PROTOCOLS: quit()")); - + XtSetArg (args[0], XtNiconPixmap, &icon_pixmap); XtGetValues(toplevel, args, ONE); if (icon_pixmap == None) { - XtSetArg(args[0], XtNiconPixmap, + XtSetArg(args[0], XtNiconPixmap, XCreateBitmapFromData(XtDisplay(toplevel), XtScreen(toplevel)->root, (char *)xload_bits, xload_width, xload_height)); XtSetValues (toplevel, args, ONE); } - + if (resources.show_label) { pane = XtCreateManagedWidget ("paned", panedWidgetClass, toplevel, NULL, ZERO); - + label_wid = XtCreateManagedWidget ("label", labelWidgetClass, pane, NULL, ZERO); - + XtSetArg (args[0], XtNlabel, &label); XtGetValues(label_wid, args, ONE); - + if ( strcmp("label", label) == 0 ) { (void) XmuGetHostname (host, 255); XtSetArg (args[0], XtNlabel, host); XtSetValues (label_wid, args, ONE); } - + load_parent = pane; } else load_parent = toplevel; - + load = XtCreateManagedWidget ("load", stripChartWidgetClass, - load_parent, NULL, ZERO); - + load_parent, NULL, ZERO); + if (resources.remote) XtAddCallback(load, XtNgetValue, GetRLoadPoint, NULL); - else + else XtAddCallback(load, XtNgetValue, GetLoadPoint, NULL); - + XtRealizeWidget (toplevel); wm_delete_window = XInternAtom (XtDisplay(toplevel), "WM_DELETE_WINDOW", False); @@ -316,7 +316,7 @@ SetLights (XtPointer data, XtIntervalId *timer) toplevel = (Widget) data; dpy = XtDisplay (toplevel); - if (resources.remote) + if (resources.remote) GetRLoadPoint (toplevel, (XtPointer) 0, (XtPointer) &value); else GetLoadPoint (toplevel, (XtPointer) 0, (XtPointer) &value); |