12 Commits

Author SHA1 Message Date
bch
fbedd2a351 install copyright file 2017-02-26 18:53:55 +00:00
bch
fb1974ef9b Summary: some copyright things added/changed 2017-02-26 18:47:28 +00:00
bch
00ce2bed2a wrong filename 2017-02-26 17:22:13 +00:00
bch
a1d643c4ca Summary: remove object file 2017-02-26 16:07:03 +00:00
bch
3d431ec0b6 Summary: remove variables that are not used 2017-02-26 16:05:52 +00:00
bch
38f147b166 Summary: fix warning 2017-02-26 16:03:48 +00:00
bch
9484298c47 Summary: update function definitions 2017-02-26 16:02:48 +00:00
bch
a63975b5f9 Summary: simplify makefile 2017-02-26 16:02:24 +00:00
bch
1cbabd26de Summary: remove comments 2017-02-26 15:36:52 +00:00
bch
3e0ff42f52 updated makefile 2017-02-19 10:44:11 +00:00
bch
f5ebd29a7c Summary: renamed 2017-02-18 21:44:46 +00:00
bch
d9b4a0be07 Summary: renamed manual file 2017-02-18 21:44:12 +00:00
7 changed files with 78 additions and 70 deletions

View File

@@ -1,21 +1,29 @@
CFLAGS += -I/usr/X11R6/include/
CFLAGS += -Wall -I/usr/X11R6/include/
BINDIR=/usr/local/bin
MANDIR=/usr/local/man/man1
LDFLAGS=-L/usr/X11R6/lib -lX11 -lXt -lXaw -lXmu
xmem: xmem.o get_mem.o MemStripChart.o
gcc $(CFLAGS) -o xmem xmem.o get_mem.o MemStripChart.o -L/usr/X11R6/lib -lX11 -lXt -lXaw -lXmu
$(CC) -o xmem xmem.o get_mem.o MemStripChart.o $(LDFLAGS)
xmem.o: xmem.c
gcc $(CFLAGS) -c xmem.c
$(CC) $(CFLAGS) -c xmem.c
get_mem.o: get_mem.c
gcc $(CFLAGS) -c get_mem.c
$(CC) $(CFLAGS) -c get_mem.c
MemStripChart.o: MemStripChart.c
gcc $(CFLAGS) -c MemStripChart.c
$(CC) $(CFLAGS) -c MemStripChart.c
clean:
-rm xmem *.o *~
install: xmem
install -d -m 755 $(DESTDIR)/usr/local/bin/
install -d -m 755 $(DESTDIR)/etc/X11/app-defaults/
install -m 755 xmem $(DESTDIR)/usr/local/bin/
install -m 644 XMem.ad $(DESTDIR)/etc/X11/app-defaults/XMem
all: xmem
install: all
/usr/bin/install -c -m 0555 xmem $(DESTDIR)$(BINDIR)
/usr/bin/install -c -m 0444 xmem.0 $(DESTDIR)$(MANDIR)
/usr/bin/install -c -m 0644 XMem.ad $(DESTDIR)/usr/local/lib/X11/app-defaults/XMem
/usr/bin/install -d -m 0755 $(DESTDIR)/usr/local/share/xmem/
/usr/bin/install -c -m 0644 xmem.bit $(DESTDIR)/usr/local/share/xmem/
/usr/bin/install -c -m 0644 copyright $(DESTDIR)/usr/local/share/xmem/

View File

@@ -51,7 +51,7 @@ static XtResource resources[] = {
#undef offset
static void Initialize(), Destroy(), Redisplay(), MoveChart(), SetPoints();
static void Initialize(), Destroy(), Redisplay(), MoveChart(MemStripChartWidget w, Boolean blit), SetPoints();
static Boolean SetValues();
static int repaint_window();
@@ -114,9 +114,7 @@ static void draw_it();
*/
static void
CreateGC(w, which)
MemStripChartWidget w;
unsigned int which;
CreateGC(MemStripChartWidget w, unsigned int which)
{
XGCValues myXGCV;
@@ -165,9 +163,7 @@ CreateGC(w, which)
*/
static void
DestroyGC(w, which)
MemStripChartWidget w;
unsigned int which;
DestroyGC(MemStripChartWidget w, unsigned int which)
{
if (which & FOREGROUND)
XtReleaseGC((Widget) w, w->mem_strip_chart.fgGC);
@@ -205,9 +201,7 @@ DestroyGC(w, which)
*/
static void
DrawMemStrip(w, x)
MemStripChartWidget w;
unsigned int x;
DrawMemStrip(MemStripChartWidget w, unsigned int x)
{
int top, bottom;
@@ -260,10 +254,7 @@ DrawMemStrip(w, x)
}
/* ARGSUSED */
static void Initialize (greq, gnew, args, num_args)
Widget greq, gnew;
ArgList args;
Cardinal *num_args;
static void Initialize (Widget greq, Widget gnew, ArgList args, Cardinal *num_args)
{
MemStripChartWidget w = (MemStripChartWidget)gnew;
@@ -281,8 +272,7 @@ static void Initialize (greq, gnew, args, num_args)
SetPoints(w);
}
static void Destroy (gw)
Widget gw;
static void Destroy (Widget gw)
{
MemStripChartWidget w = (MemStripChartWidget)gw;
@@ -300,10 +290,7 @@ static void Destroy (gw)
*/
/* ARGSUSED */
static void Redisplay(w, event, region)
Widget w;
XEvent *event;
Region region;
static void Redisplay(Widget w, XEvent *event, Region region)
{
if (event->type == GraphicsExpose)
(void) repaint_window ((MemStripChartWidget)w, event->xgraphicsexpose.x,
@@ -315,9 +302,7 @@ static void Redisplay(w, event, region)
/* ARGSUSED */
static void
draw_it(client_data, id)
XtPointer client_data;
XtIntervalId *id; /* unused */
draw_it(XtPointer client_data, XtIntervalId *id)
{
MemStripChartWidget w = (MemStripChartWidget)client_data;
MemStripChartCallbackData value;
@@ -356,7 +341,8 @@ draw_it(client_data, id)
w->mem_strip_chart.valuedata[w->mem_strip_chart.interval] = value;
if (XtIsRealized((Widget)w)) {
DrawMemStrip(w, w->mem_strip_chart.interval, value);
/* XXX DrawMemStrip(w, w->mem_strip_chart.interval, value); */
DrawMemStrip(w, w->mem_strip_chart.interval);
/*
* Fill in the graph lines we just painted over.
@@ -385,9 +371,7 @@ draw_it(client_data, id)
*/
static int
repaint_window(w, left, width)
MemStripChartWidget w;
int left, width;
repaint_window(MemStripChartWidget w, int left, int width)
{
int i, j;
int next = w->mem_strip_chart.interval;
@@ -425,7 +409,7 @@ repaint_window(w, left, width)
/* Draw data point lines. */
for (i = left; i < width; i++) {
DrawMemStrip(w, i, w->mem_strip_chart.valuedata[i]);
DrawMemStrip(w, i);
}
/* Draw graph reference lines */
@@ -445,9 +429,7 @@ repaint_window(w, left, width)
*/
static void
MoveChart(w, blit)
MemStripChartWidget w;
Boolean blit;
MoveChart(MemStripChartWidget w, Boolean blit)
{
double old_max;
int left, i, j;
@@ -509,10 +491,7 @@ MoveChart(w, blit)
}
/* ARGSUSED */
static Boolean SetValues (current, request, new, args, num_args)
Widget current, request, new;
ArgList args;
Cardinal *num_args;
static Boolean SetValues (Widget current, Widget request, Widget new, ArgList args, Cardinal *num_args)
{
MemStripChartWidget old = (MemStripChartWidget)current;
MemStripChartWidget w = (MemStripChartWidget)new;
@@ -583,8 +562,7 @@ static Boolean SetValues (current, request, new, args, num_args)
#define HEIGHT ( (unsigned int) w->core.height)
static void
SetPoints(widget)
Widget widget;
SetPoints(Widget widget)
{
MemStripChartWidget w = (MemStripChartWidget) widget;
XPoint * points;

Binary file not shown.

37
copyright Normal file
View File

@@ -0,0 +1,37 @@
This package was debianized by Daniel Baumann <daniel@debian.org> on
Sun, 22 Jan 2006 14:26:00 +0100.
This xmem was resurrected from the xfree86 sources of the bo release.
Copyright Holder: X Consortium
License:
Copyright (C) 1987 X Consortium
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of the X Consortium shall
not be used in advertising or otherwise to promote the sale, use or
other dealings in this Software without prior written authorization from
the X Consortium.
The Debian packaging is (C) 2006-2007, Daniel Baumann <daniel@debian.org> and
is licensed under the GPL, see `/usr/share/common-licenses/GPL'.

View File

@@ -1,4 +1,4 @@
/* $Id: get_mem.c,v 1.3 2017/02/18 21:14:12 bch Exp $
/* $Id: get_mem.c,v 1.4 2017/02/26 16:03:48 bch Exp $
* Adapted: get memory usage on OpenBSD
* Author: Christian Barthel <bch@vcs.onfire.org>
*
@@ -14,11 +14,14 @@
#include <sys/swap.h>
#include <sys/mount.h>
#include <sys/proc.h>
#include <unistd.h>
#include <X11/Xos.h>
#include <X11/Intrinsic.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <err.h>
#include "MemStripChart.h"
static int pageshift = -1;

View File

24
xmem.c
View File

@@ -1,7 +1,8 @@
/*
* xmem - display memory/swap usage utility for X
*
* Copyright 2017 Christian Barthel <bch@onfire.org>
* Updated by Christian Barthel <bch@onfire.org>
*
* Copyright 1989 Massachusetts Institute of Technology
*
* $XConsortium: xload.c,v 1.36 91/05/24 16:57:46 converse Exp $
@@ -45,17 +46,6 @@ typedef struct _XLoadResources {
* pass over the remaining options after XtParseCommand is let loose.
*/
static XrmOptionDescRec options[] = {
{"-scale", "*load.minScale", XrmoptionSepArg, NULL},
{"-update", "*load.update", XrmoptionSepArg, NULL},
{"-hl", "*load.highlight", XrmoptionSepArg, NULL},
{"-highlight", "*load.highlight", XrmoptionSepArg, NULL},
{"-jumpscroll", "*load.jumpScroll", XrmoptionSepArg, NULL},
{"-label", "*label.label", XrmoptionSepArg, NULL},
{"-nolabel", "*showLabel", XrmoptionNoArg, "False"},
{"-lights", "*useLights", XrmoptionNoArg, "True"},
};
static XrmOptionDescRec options_mem[] = {
{"-scale", "*mem.minScale", XrmoptionSepArg, NULL},
{"-update", "*mem.update", XrmoptionSepArg, NULL},
@@ -79,13 +69,6 @@ static XrmOptionDescRec options_mem[] = {
#define Offset(field) (XtOffsetOf(XLoadResources, field))
static XtResource my_resources[] = {
{"showLabel", XtCBoolean, XtRBoolean, sizeof(Boolean),
Offset(show_label), XtRImmediate, (XtPointer) TRUE},
{"useLights", XtCBoolean, XtRBoolean, sizeof(Boolean),
Offset(use_lights), XtRImmediate, (XtPointer) FALSE},
};
static XtResource my_resources_mem[] = {
{"showLabel", XtCBoolean, XtRBoolean, sizeof(Boolean),
Offset(show_label), XtRImmediate, (XtPointer) TRUE},
@@ -99,7 +82,6 @@ static XtActionsRec xload_actions[] = {
{ "quit", quit },
};
static Atom wm_delete_window;
static int light_update = 10 * 1000;
/*
* Exit with message describing command line format.
@@ -154,7 +136,6 @@ int main(int argc, char **argv)
Arg args[1];
Pixmap icon_pixmap = None;
char *label, host[256];
char *lastslash;
/* For security reasons, we reset our uid/gid after doing the necessary
system initialization and before calling any X routines. */
@@ -227,6 +208,7 @@ int main(int argc, char **argv)
errx(1, "pledge failed: %s", strerror(errno));
XtAppMainLoop(app_con);
return 0;
}