home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sources.x
- From: jjm@hplb.hpl.hp.com (Jean-Jacques Moreau)
- Subject: v20i028: xmps - Motif process monitor, Part03/03
- Message-ID: <1993Jun15.140937.17117@sparky.imd.sterling.com>
- X-Md4-Signature: 61b1c64b20828928881a15fd32b4e875
- Sender: chris@sparky.imd.sterling.com (Chris Olson)
- Organization: Sterling Software
- Date: Tue, 15 Jun 1993 14:09:37 GMT
- Approved: chris@sparky.imd.sterling.com
-
- Submitted-by: jjm@hplb.hpl.hp.com (Jean-Jacques Moreau)
- Posting-number: Volume 20, Issue 28
- Archive-name: xmps/part03
- Environment: HP-UX, X11. OSF/Motif
-
- #! /bin/sh
- # This is a shell archive. Remove anything before this line, then feed it
- # into a shell via "sh file" or similar. To overwrite existing files,
- # type "sh file -c".
- # Contents: Makefile.std TODO XmPs.ad cursor.c error.c exit.c option.c
- # options.h patchlevel.h print.c timer.c util.c xutil.c
- # Wrapped by chris@sparky on Tue Jun 15 08:52:05 1993
- PATH=/bin:/usr/bin:/usr/ucb:/usr/local/bin:/usr/lbin ; export PATH
- echo If this archive is complete, you will see the following message:
- echo ' "shar: End of archive 3 (of 3)."'
- if test -f 'Makefile.std' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'Makefile.std'\"
- else
- echo shar: Extracting \"'Makefile.std'\" \(1298 characters\)
- sed "s/^X//" >'Makefile.std' <<'END_OF_FILE'
- X#
- X# Define rules
- X#
- X
- X
- X.c.o:
- X -$(RM) $@
- X $(CC) -c $(CFLAGS) $< -o $@
- X
- X#
- X
- X.c:
- X -$(RM) $@
- X $(CC) $(CFLAGS) $(LDFLAGS) $< $(LIBS) -o $@
- X
- X#
- X# Define objects needed to build this program
- X#
- XCC= cc
- XOBJS= xmps.o process.o search.o snapshot.o print.o status.o format.o \
- X option.o cursor.o timer.o error.o exit.o command.o xutil.o util.o
- XPROGRAM= xmps
- X
- X#
- X# Define build flags
- X#
- XINCLUDES= -I/usr/include/X11R5 -I/usr/include/Motif1.2
- XCFLAGS = -O -DSYSV $(INCLUDES)
- XLDFLAGS= -L /usr/lib/X11R5 -L /usr/lib/Motif1.2
- XLIBS= -lXm -lXt -lX11
- X
- X#
- X# Define installation flags
- X#
- XRM= rm -f
- XRMDIR= rmdir
- X
- XINSTALL_BIN_DIR= /usr/local/bin/X11
- XINSTALL_MAN_DIR= /usr/local/man/man1
- XINSTALL_XDEFAULT_DIR= /usr/lib/X11/app-defaults
- X
- X
- Xall:: $(PROGRAM)
- Xclean:: clean.local
- Xinstall:: do.install
- Xuninstall:: clean.install
- X
- X
- Xxmps: $(OBJS)
- X -$(RM) $@
- X $(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) $(LIBS) -o $@
- X
- X
- Xclean.local:
- X -$(RM) a.out core *.o $(PROGRAMS)
- X
- Xclean.install:
- X -$(RM) $(INSTALL_BIN_DIR)/$(PROGRAM)
- X -$(RM) $(INSTALL_MAN_DIR)/$(PROGRAM).1
- X -$(RM) $(INSTALL_XDEFAULT_DIR)/XmPs
- X
- X
- Xdo.install::
- X install -f $(INSTALL_BIN_DIR) $(PROGRAM) `pwd`
- X -cp $(PROGRAM).man $(PROGRAM).1
- X install -f $(INSTALL_MAN_DIR) $(PROGRAM).man `pwd`
- X -$(RM) $(PROGRAM).1
- X -cp XmPs.ad XmPs
- X install -f $(INSTALL_XDEFAULT_DIR) XmPs `pwd`
- X -$(RM) XmPs
- END_OF_FILE
- if test 1298 -ne `wc -c <'Makefile.std'`; then
- echo shar: \"'Makefile.std'\" unpacked with wrong size!
- fi
- # end of 'Makefile.std'
- fi
- if test -f 'TODO' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'TODO'\"
- else
- echo shar: Extracting \"'TODO'\" \(415 characters\)
- sed "s/^X//" >'TODO' <<'END_OF_FILE'
- X
- X XMPS TODO LIST
- X ----------------
- X
- X
- XTo do
- X-----
- XThe following things could be done to enhance XmPs :
- X
- X * add the ability to create a new process view without having to run XmPs
- X twice (i.e. store all global variables in a single, per application
- X context, structure);
- X
- X * add a SaveToFile button to the snapshot windows;
- X
- X * disable completely the selection capacity of the snapshot windows;
- END_OF_FILE
- if test 415 -ne `wc -c <'TODO'`; then
- echo shar: \"'TODO'\" unpacked with wrong size!
- fi
- # end of 'TODO'
- fi
- if test -f 'XmPs.ad' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'XmPs.ad'\"
- else
- echo shar: Extracting \"'XmPs.ad'\" \(329 characters\)
- sed "s/^X//" >'XmPs.ad' <<'END_OF_FILE'
- X!XmPs*hosts: localhost,anotherhost
- X!XmPs*actions: kill,kill -TERM,kill -KILL
- X
- XXmPs*geometry: =620x420
- XXmPs*processArea*fontList: -*-prestige-medium-r-normal-*-120-*
- X
- XXmPs*snapshotTopWindow.snapshotButtonArea*height: 100
- X
- X!XmPs*psCommand: /bin/ps
- X!XmPs*beautifyCommand: /usr/local/bin/pspp
- X!XmPs*rshCommand: remsh
- END_OF_FILE
- if test 329 -ne `wc -c <'XmPs.ad'`; then
- echo shar: \"'XmPs.ad'\" unpacked with wrong size!
- fi
- # end of 'XmPs.ad'
- fi
- if test -f 'cursor.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'cursor.c'\"
- else
- echo shar: Extracting \"'cursor.c'\" \(423 characters\)
- sed "s/^X//" >'cursor.c' <<'END_OF_FILE'
- X#include <X11/Xlib.h>
- X#include <X11/cursorfont.h>
- X#include <Xm/Xm.h>
- X
- X#include "xmps.h"
- X
- X
- Xvoid setCursor (widget, newCursor)
- X Widget widget;
- X Cursor newCursor;
- X{
- X XDefineCursor (XtDisplay (widget), XtWindow (widget), newCursor);
- X XFlush (XtDisplay(widget));
- X}
- X
- X
- Xvoid setBusyIndicator ()
- X{
- X setCursor (topLevel, busyCursor);
- X}
- X
- X
- Xvoid unsetBusyIndicator ()
- X{
- X setCursor (topLevel, (Cursor) NULL);
- X}
- X
- X
- END_OF_FILE
- if test 423 -ne `wc -c <'cursor.c'`; then
- echo shar: \"'cursor.c'\" unpacked with wrong size!
- fi
- # end of 'cursor.c'
- fi
- if test -f 'error.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'error.c'\"
- else
- echo shar: Extracting \"'error.c'\" \(1885 characters\)
- sed "s/^X//" >'error.c' <<'END_OF_FILE'
- X#include <Xm/Xm.h>
- X#include <Xm/XmStrDefs.h>
- X
- X#include <stdio.h>
- X#include <stdlib.h>
- X#include <string.h>
- X#include <varargs.h>
- X
- X#include "xmps.h"
- X
- X
- Xint destroyErrorDialog (widget, unused, callData)
- X Widget widget;
- X int unused;
- X caddr_t callData;
- X{
- X XtDestroyWidget (widget);
- X}
- X
- X
- Xvoid error (va_alist)
- X va_dcl
- X{
- X Widget errorDialog;
- X
- X va_list args;
- X char *format;
- X char s[512];
- X XmString title;
- X XmString message;
- X
- X Arg arglist[2];
- X Cardinal i;
- X
- X
- X /*
- X * We need to create a new dialog widget each time this
- X * function is called, because a function may return
- X * more than one error message during a single call.
- X */
- X title = XmStringCreateLtoR ("Error Dialog",
- X XmSTRING_DEFAULT_CHARSET);
- X
- X i = 0;
- X XtSetArg (arglist[i], XmNdialogTitle, title); i++;
- X XtSetArg (arglist[i], XmNdialogStyle, XmDIALOG_MODELESS); i++;
- X errorDialog = (Widget) XmCreateErrorDialog (topLevel, "errorDialog",
- X arglist, i);
- X
- X XtAddCallback (errorDialog,
- X XmNokCallback,
- X (XtCallbackProc) destroyErrorDialog, NULL);
- X
- X /*
- X * Get rid of the Cancel and Help button.
- X */
- X XtUnmanageChild ((Widget) XmMessageBoxGetChild (errorDialog,
- X XmDIALOG_CANCEL_BUTTON));
- X XtUnmanageChild ((Widget) XmMessageBoxGetChild (errorDialog,
- X XmDIALOG_HELP_BUTTON));
- X
- X XmStringFree (title);
- X
- X /*
- X * Format the message.
- X */
- X va_start (args);
- X
- X format = (char *) va_arg (args, char *);
- X vsprintf (s, format, args);
- X
- X va_end (args);
- X
- X /*
- X * Display it.
- X */
- X message = XmStringCreateLtoR (s, XmSTRING_DEFAULT_CHARSET);
- X
- X i = 0;
- X XtSetArg (arglist[i], XmNmessageString, message); i++;
- X XtSetValues (errorDialog, arglist, i);
- X
- X XmStringFree (message);
- X
- X XtManageChild (errorDialog);
- X}
- END_OF_FILE
- if test 1885 -ne `wc -c <'error.c'`; then
- echo shar: \"'error.c'\" unpacked with wrong size!
- fi
- # end of 'error.c'
- fi
- if test -f 'exit.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'exit.c'\"
- else
- echo shar: Extracting \"'exit.c'\" \(194 characters\)
- sed "s/^X//" >'exit.c' <<'END_OF_FILE'
- X#include <Xm/Xm.h>
- X
- X#include <stdlib.h>
- X
- X#include "xmps.h"
- X
- X
- Xint exitXmPs (widget, clientData, callData)
- X Widget widget;
- X caddr_t clientData;
- X caddr_t callData;
- X{
- X exit (0);
- X}
- X
- X
- END_OF_FILE
- if test 194 -ne `wc -c <'exit.c'`; then
- echo shar: \"'exit.c'\" unpacked with wrong size!
- fi
- # end of 'exit.c'
- fi
- if test -f 'option.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'option.c'\"
- else
- echo shar: Extracting \"'option.c'\" \(5298 characters\)
- sed "s/^X//" >'option.c' <<'END_OF_FILE'
- X#include <Xm/Xm.h>
- X#include <Xm/XmStrDefs.h>
- X#include <Xm/ToggleBG.h>
- X
- X#include <stdio.h>
- X#include <stdlib.h>
- X#include <sys/types.h>
- X#include <sys/stat.h>
- X
- X#include "xmps.h"
- X
- X
- Xvoid verifyOptions ()
- X{
- X struct stat ps;
- X
- X if (stat (resources.psCommand, &ps) == -1) {
- X error ("No such ps command :\n%s",
- X resources.psCommand, (char *) 0);
- X exit (-1);
- X }
- X
- X if (resources.beautify) {
- X if (strlen (resources.beautifyCommand)) {
- X struct stat pspp;
- X
- X if (stat (resources.beautifyCommand, &pspp) == -1) {
- X error ("No such beautifier :\n%s",
- X resources.beautifyCommand, (char *) 0);
- X resources.beautify = False;
- X }
- X } else
- X internalBeautifier = True;
- X }
- X
- X if (resources.fullListing && resources.longListing)
- X resources.fullListing = False;
- X
- X if (resources.noNonTerminal && ! resources.noGroupLeader)
- X resources.noGroupLeader = True;
- X
- X if (resources.allProcesses && resources.noNonTerminal) {
- X resources.noNonTerminal = False;
- X resources.noGroupLeader = False;
- X }
- X
- X if (resources.allProcesses && resources.noGroupLeader)
- X resources.noGroupLeader = False;
- X
- X if (resources.periodicRefresh)
- X setTimer (True);
- X}
- X
- X
- Xint changeOption (widget, menuSelected, buttonInfo)
- X Widget widget;
- X int menuSelected;
- X XmToggleButtonCallbackStruct *buttonInfo;
- X{
- X switch (menuSelected) {
- X case MENU_AUTOMATIC_REFRESH:
- X resources.automaticRefresh = buttonInfo->set;
- X break;
- X
- X case MENU_PERIODIC_REFRESH:
- X resources.periodicRefresh = buttonInfo->set;
- X setTimer (buttonInfo->set);
- X break;
- X
- X case MENU_AUTOMATIC_MEMORY:
- X resources.automaticMemory = buttonInfo->set;
- X break;
- X
- X case MENU_BEAUTIFY:
- X if (buttonInfo->set == True) {
- X if (!internalBeautifier) {
- X struct stat pspp;
- X
- X if (stat (resources.beautifyCommand, &pspp) == -1) {
- X error ("No beautify command :\n%s",
- X resources.beautifyCommand, (char *) 0);
- X } else
- X resources.beautify = True;
- X } else
- X resources.beautify = True;
- X } else
- X resources.beautify = False;
- X
- X reDisplayProcessesIfNecessary ();
- X break;
- X
- X case MENU_MULTIPLE_OCCURRENCES:
- X resources.multipleOccurrences = buttonInfo->set;
- X break;
- X
- X case MENU_IGNORE_CASE:
- X resources.ignoreCase = buttonInfo->set;
- X break;
- X
- X case MENU_PRINT_SELECTED:
- X resources.printSelected = buttonInfo->set;
- X break;
- X
- X case MENU_FULL_LISTING:
- X if (buttonInfo->set == True) {
- X resources.fullListing = True;
- X resources.longListing = False;
- X XmToggleButtonSetState (XtNameToWidget (viewPane,
- X "longListing"),
- X False, False);
- X } else
- X resources.fullListing = False;
- X
- X reDisplayProcessesIfNecessary ();
- X break;
- X
- X case MENU_LONG_LISTING:
- X if (buttonInfo->set == True) {
- X resources.fullListing = False;
- X resources.longListing = True;
- X XmToggleButtonSetState (XtNameToWidget (viewPane,
- X "fullListing"),
- X False, False);
- X } else
- X resources.longListing = False;
- X
- X reDisplayProcessesIfNecessary ();
- X break;
- X
- X case MENU_ALL_PROCESSES:
- X if (buttonInfo->set == True) {
- X resources.allProcesses = True;
- X resources.noGroupLeader = False;
- X resources.noNonTerminal = False;
- X XmToggleButtonSetState (XtNameToWidget (viewPane,
- X "noGroupLeader"),
- X False, False);
- X XmToggleButtonSetState (XtNameToWidget (viewPane,
- X "noNonTerminal"),
- X False, False);
- X disableUser ();
- X disableGroup ();
- X disableTerminal ();
- X } else {
- X resources.allProcesses = False;
- X enableUser ();
- X enableGroup ();
- X enableTerminal ();
- X }
- X
- X reDisplayProcessesIfNecessary ();
- X break;
- X
- X case MENU_NO_GROUP_LEADER:
- X if (buttonInfo->set == True) {
- X resources.allProcesses = False;
- X resources.noGroupLeader = True;
- X XmToggleButtonSetState (XtNameToWidget (viewPane,
- X "allProcesses"),
- X False, False);
- X disableUser ();
- X disableGroup ();
- X disableTerminal ();
- X } else {
- X resources.noGroupLeader = False;
- X if (resources.noNonTerminal == True) {
- X resources.noNonTerminal = False;
- X XmToggleButtonSetState (XtNameToWidget (viewPane,
- X "noNonTerminal"),
- X False, False);
- X }
- X enableUser ();
- X enableGroup ();
- X enableTerminal ();
- X }
- X
- X reDisplayProcessesIfNecessary ();
- X break;
- X
- X case MENU_NO_NON_TERMINAL:
- X if (buttonInfo->set == True) {
- X resources.allProcesses = False;
- X resources.noGroupLeader = True;
- X resources.noNonTerminal = True;
- X XmToggleButtonSetState (XtNameToWidget (viewPane,
- X "allProcesses"),
- X False, False);
- X XmToggleButtonSetState (XtNameToWidget (viewPane,
- X "noGroupLeader"),
- X True, False);
- X disableUser ();
- X disableGroup ();
- X disableTerminal ();
- X } else {
- X resources.noNonTerminal = False;
- X if (! resources.noGroupLeader) {
- X enableUser ();
- X enableGroup ();
- X enableTerminal ();
- X }
- X }
- X
- X reDisplayProcessesIfNecessary ();
- X break;
- X
- X
- X default:
- X error ("Invalid menu selection :\ninternal error", (char *) 0);
- X break;
- X }
- X}
- X
- X
- END_OF_FILE
- if test 5298 -ne `wc -c <'option.c'`; then
- echo shar: \"'option.c'\" unpacked with wrong size!
- fi
- # end of 'option.c'
- fi
- if test -f 'options.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'options.h'\"
- else
- echo shar: Extracting \"'options.h'\" \(5135 characters\)
- sed "s/^X//" >'options.h' <<'END_OF_FILE'
- XXrmOptionDescRec xmPsOptions[] = {
- X { "-hosts", "*hosts", XrmoptionSepArg, (caddr_t) "localhost" },
- X { "-actions", "*actions", XrmoptionSepArg, (caddr_t) "kill" },
- X { "-users", "*users", XrmoptionSepArg, (caddr_t) "all" },
- X { "-groups", "*groups", XrmoptionSepArg, (caddr_t) "all" },
- X { "-terminals", "*terminals", XrmoptionSepArg, (caddr_t) "" },
- X { "-ps", "*psCommand", XrmoptionSepArg, (caddr_t) "/bin/ps" },
- X { "-pspp", "*beautifyCommand", XrmoptionSepArg, (caddr_t) "" },
- X { "-rsh", "*rshCommand", XrmoptionSepArg, (caddr_t) "remsh" },
- X};
- X
- XXtResource xmPsResources[] = {
- X { "hosts", "Hosts", XtRString,
- X sizeof (String), XtOffset (ResourceRec, hosts),
- X XtRString, (caddr_t) "localhost" },
- X { "actions", "Actions", XtRString,
- X sizeof (String), XtOffset (ResourceRec, actions),
- X XtRString, (caddr_t) "kill" },
- X
- X { "users", "Users", XtRString,
- X sizeof (String), XtOffset (ResourceRec, users),
- X XtRString, (caddr_t) "all" },
- X { "usersOption", "UsersOption", XtRString,
- X sizeof (String), XtOffset (ResourceRec, usersOption),
- X XtRString, (caddr_t) "u" },
- X { "groups", "groups", XtRString,
- X sizeof (String), XtOffset (ResourceRec, groups),
- X XtRString, (caddr_t) "all" },
- X { "groupsOption", "GroupsOption", XtRString,
- X sizeof (String), XtOffset (ResourceRec, groupsOption),
- X XtRString, (caddr_t) "g" },
- X { "terminals", "terminals", XtRString,
- X sizeof (String), XtOffset (ResourceRec, terminals),
- X XtRString, (caddr_t) "" },
- X { "terminalsOption", "TerminalsOption", XtRString,
- X sizeof (String), XtOffset (ResourceRec, terminalsOption),
- X XtRString, (caddr_t) "t" },
- X
- X { "psCommand", "PsCommand", XtRString,
- X sizeof (String), XtOffset (ResourceRec, psCommand),
- X XtRString, (caddr_t) "/bin/ps" },
- X { "rshCommand", "RshCommand", XtRString,
- X sizeof (String), XtOffset (ResourceRec, rshCommand),
- X XtRString, (caddr_t) "remsh" },
- X { "printCommand", "PrintCommand", XtRString,
- X sizeof (String), XtOffset (ResourceRec, printCommand),
- X XtRString, (caddr_t) "lp %s" },
- X { "beautifyCommand", "BeautifyCommand", XtRString,
- X sizeof (String), XtOffset (ResourceRec, beautifyCommand),
- X XtRString, (caddr_t) "" },
- X
- X { "refreshPeriod", "RefreshPeriod", XtRInt,
- X sizeof (int), XtOffset (ResourceRec, refreshPeriod),
- X XtRString, (caddr_t) "600" },
- X
- X { "automaticRefresh", "AutomaticRefresh", XtRBoolean,
- X sizeof (Boolean), XtOffset (ResourceRec, automaticRefresh),
- X XtRString, (caddr_t) "True" },
- X { "periodicRefresh", "PeriodicRefresh", XtRBoolean,
- X sizeof (Boolean), XtOffset (ResourceRec, periodicRefresh),
- X XtRString, (caddr_t) "False" },
- X { "automaticMemory", "AutomaticMemory", XtRBoolean,
- X sizeof (Boolean), XtOffset (ResourceRec, automaticMemory),
- X XtRString, (caddr_t) "True" },
- X { "beautify", "Beautify", XtRBoolean,
- X sizeof (Boolean), XtOffset (ResourceRec, beautify),
- X XtRString, (caddr_t) "True" },
- X { "multipleOccurrences", "MultipleOccurrences", XtRBoolean,
- X sizeof (Boolean), XtOffset (ResourceRec, multipleOccurrences),
- X XtRString, (caddr_t) "False" },
- X { "ignoreCase", "IgnoreCase", XtRBoolean,
- X sizeof (Boolean), XtOffset (ResourceRec, ignoreCase),
- X XtRString, (caddr_t) "True" },
- X { "printSelected", "PrintSelected", XtRBoolean,
- X sizeof (Boolean), XtOffset (ResourceRec, printSelected),
- X XtRString, (caddr_t) "False" },
- X
- X { "allProcesses", "AllProcesses", XtRBoolean,
- X sizeof (Boolean), XtOffset (ResourceRec, allProcesses),
- X XtRString, (caddr_t) "True" },
- X { "noGroupLeader", "NoGroupLeader", XtRBoolean,
- X sizeof (Boolean), XtOffset (ResourceRec, noGroupLeader),
- X XtRString, (caddr_t) "False" },
- X { "noNonTerminal", "NoNonTerminal", XtRBoolean,
- X sizeof (Boolean), XtOffset (ResourceRec, noNonTerminal),
- X XtRString, (caddr_t) "False" },
- X
- X { "allProcessesOption", "AllProcessesOption", XtRString,
- X sizeof (String), XtOffset (ResourceRec, allProcessesOption),
- X XtRString, (caddr_t) "e" },
- X { "noGroupLeaderOption", "NoGroupLeaderOption", XtRString,
- X sizeof (String), XtOffset (ResourceRec, noGroupLeaderOption),
- X XtRString, (caddr_t) "d" },
- X { "noNonTerminalOption", "NoNonTerminalOption", XtRString,
- X sizeof (String), XtOffset (ResourceRec, noNonTerminalOption),
- X XtRString, (caddr_t) "a" },
- X
- X { "fullListing", "FullListing", XtRBoolean,
- X sizeof (Boolean), XtOffset (ResourceRec, fullListing),
- X XtRString, (caddr_t) "True" },
- X { "longListing", "LongListing", XtRBoolean,
- X sizeof (Boolean), XtOffset (ResourceRec, longListing),
- X XtRString, (caddr_t) "False" },
- X
- X { "fullListingOption", "FullListingOption", XtRString,
- X sizeof (String), XtOffset (ResourceRec, fullListingOption),
- X XtRString, (caddr_t) "f" },
- X { "longListingOption", "LongListingOption", XtRString,
- X sizeof (String), XtOffset (ResourceRec, longListingOption),
- X XtRString, (caddr_t) "l" },
- X};
- X
- X
- END_OF_FILE
- if test 5135 -ne `wc -c <'options.h'`; then
- echo shar: \"'options.h'\" unpacked with wrong size!
- fi
- # end of 'options.h'
- fi
- if test -f 'patchlevel.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'patchlevel.h'\"
- else
- echo shar: Extracting \"'patchlevel.h'\" \(21 characters\)
- sed "s/^X//" >'patchlevel.h' <<'END_OF_FILE'
- X#define PATCHLEVEL 0
- END_OF_FILE
- if test 21 -ne `wc -c <'patchlevel.h'`; then
- echo shar: \"'patchlevel.h'\" unpacked with wrong size!
- fi
- # end of 'patchlevel.h'
- fi
- if test -f 'print.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'print.c'\"
- else
- echo shar: Extracting \"'print.c'\" \(1649 characters\)
- sed "s/^X//" >'print.c' <<'END_OF_FILE'
- X#include <Xm/Xm.h>
- X#include <Xm/XmStrDefs.h>
- X#include <Xm/List.h>
- X
- X#include <stdio.h>
- X#include <stdlib.h>
- X
- X#include "xmps.h"
- X
- X
- Xint printProcesses () {
- X printProcessesFrom (listArea);
- X}
- X
- X
- Xvoid printProcessesFrom (listArea)
- X Widget listArea;
- X{
- X XmStringTable items;
- X int itemCount;
- X String line;
- X int current;
- X
- X String tempname;
- X FILE *tempfile;
- X char command[512];
- X
- X Arg arglist[4];
- X Cardinal i;
- X
- X /*
- X * Open a temporary file.
- X */
- X tempname = tmpnam (NULL);
- X if ((tempfile = fopen (tempname, "w")) == NULL)
- X error ("Cannot open temporary file :\n%s",
- X tempname, (char *) 0);
- X
- X /*
- X * Print the process information into the temp file.
- X */
- X i = 0;
- X if (resources.printSelected) {
- X XtSetArg (arglist[i], XmNselectedItems, &items); i++;
- X XtSetArg (arglist[i], XmNselectedItemCount, &itemCount); i++;
- X } else {
- X XtSetArg (arglist[i], XmNitems, &items); i++;
- X XtSetArg (arglist[i], XmNitemCount, &itemCount); i++;
- X }
- X XtGetValues (listArea, arglist, i);
- X
- X for (current = 0; current <= itemCount-1; current++) {
- X XmStringGetLtoR (items[current],
- X XmSTRING_DEFAULT_CHARSET,
- X &line);
- X fprintf (tempfile, "%s\n", line);
- X XtFree (line);
- X }
- X
- X /*
- X * Print the temp file.
- X */
- X if (fflush (tempfile) != NULL)
- X error ("Cannot flush temporary file :\n%s",
- X tempname, (char *) 0);
- X
- X if (fclose (tempfile) != NULL)
- X error ("Cannot close temporary file :\n%s",
- X tempname, (char *) 0);
- X
- X sprintf (command, resources.printCommand, tempname);
- X system (command);
- X
- X (void) unlink (tempname);
- X}
- X
- X
- END_OF_FILE
- if test 1649 -ne `wc -c <'print.c'`; then
- echo shar: \"'print.c'\" unpacked with wrong size!
- fi
- # end of 'print.c'
- fi
- if test -f 'timer.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'timer.c'\"
- else
- echo shar: Extracting \"'timer.c'\" \(310 characters\)
- sed "s/^X//" >'timer.c' <<'END_OF_FILE'
- X#include <Xm/Xm.h>
- X
- X#include "xmps.h"
- X
- X
- Xvoid setTimer (set)
- X Boolean set;
- X{
- X static XtIntervalId timer;
- X
- X if (set) {
- X timer = XtAddTimeOut ((long) (resources.refreshPeriod * 1000),
- X (XtTimerCallbackProc) reDisplayProcesses,
- X NULL);
- X } else {
- X XtRemoveTimeOut (timer);
- X }
- X}
- X
- X
- END_OF_FILE
- if test 310 -ne `wc -c <'timer.c'`; then
- echo shar: \"'timer.c'\" unpacked with wrong size!
- fi
- # end of 'timer.c'
- fi
- if test -f 'util.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'util.c'\"
- else
- echo shar: Extracting \"'util.c'\" \(472 characters\)
- sed "s/^X//" >'util.c' <<'END_OF_FILE'
- X#include <Xm/Xm.h>
- X#include <Xm/XmStrDefs.h>
- X
- X#include <stdio.h>
- X#include <stdlib.h>
- X#include <string.h>
- X
- X#include "xmps.h"
- X
- XString concat (string1, string2)
- X String string1;
- X String string2;
- X{
- X String buffer;
- X
- X buffer = (String) XtMalloc ((strlen (string1) + strlen (string2) + 1)
- X * sizeof (char));
- X strcpy (buffer, string1);
- X if (buffer[0] < 'a')
- X buffer[0] = buffer[0] - 'A' + 'a';
- X strcat (buffer, string2);
- X
- X return (buffer);
- X}
- END_OF_FILE
- if test 472 -ne `wc -c <'util.c'`; then
- echo shar: \"'util.c'\" unpacked with wrong size!
- fi
- # end of 'util.c'
- fi
- if test -f 'xutil.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'xutil.c'\"
- else
- echo shar: Extracting \"'xutil.c'\" \(1594 characters\)
- sed "s/^X//" >'xutil.c' <<'END_OF_FILE'
- X#include <Xm/Xm.h>
- X#include <Xm/XmStrDefs.h>
- X#include <Xm/RowColumn.h>
- X#include <Xm/Text.h>
- X
- X#include <stdio.h>
- X
- X#include "xmps.h"
- X
- X
- Xvoid toggleSetState (widget, newState)
- X Widget widget;
- X Boolean newState;
- X{
- X Arg arglist[2];
- X Cardinal i;
- X
- X if (XmIsRowColumn (widget)) {
- X unsigned char widgetType;
- X
- X i = 0;
- X XtSetArg (arglist[i], XmNrowColumnType, &widgetType); i++;
- X XtGetValues (widget, arglist, i);
- X
- X if (widgetType == XmMENU_OPTION)
- X widget = XmOptionButtonGadget (widget);
- X }
- X
- X if (XmIsText (widget)) {
- X XmTextSetEditable (widget, newState);
- X if (newState == True)
- X XtMapWidget (widget);
- X else
- X XtUnmapWidget (widget);
- X } else {
- X i = 0;
- X XtSetArg (arglist[i], XmNsensitive, newState); i++;
- X XtSetValues (widget, arglist, i);
- X }
- X}
- X
- X
- Xvoid enableUser ()
- X{
- X toggleSetState
- X (XtNameToWidget (topLevel,
- X "topWindow.menuArea.userMenu"),
- X True);
- X}
- X
- X
- Xvoid disableUser ()
- X{
- X toggleSetState
- X (XtNameToWidget (topLevel,
- X "topWindow.menuArea.userMenu"),
- X False);
- X}
- X
- X
- Xvoid enableGroup ()
- X{
- X toggleSetState
- X (XtNameToWidget (topLevel,
- X "topWindow.menuArea.groupMenu"),
- X True);
- X}
- X
- X
- Xvoid disableGroup ()
- X{
- X toggleSetState
- X (XtNameToWidget (topLevel,
- X "topWindow.menuArea.groupMenu"),
- X False);
- X}
- X
- X
- Xvoid enableTerminal ()
- X{
- X toggleSetState
- X (XtNameToWidget (topLevel,
- X "topWindow.menuArea.terminalMenu"),
- X True);
- X}
- X
- X
- Xvoid disableTerminal ()
- X{
- X toggleSetState
- X (XtNameToWidget (topLevel,
- X "topWindow.menuArea.terminalMenu"),
- X False);
- X}
- X
- X
- END_OF_FILE
- if test 1594 -ne `wc -c <'xutil.c'`; then
- echo shar: \"'xutil.c'\" unpacked with wrong size!
- fi
- # end of 'xutil.c'
- fi
- echo shar: End of archive 3 \(of 3\).
- cp /dev/null ark3isdone
- MISSING=""
- for I in 1 2 3 ; do
- if test ! -f ark${I}isdone ; then
- MISSING="${MISSING} ${I}"
- fi
- done
- if test "${MISSING}" = "" ; then
- echo You have unpacked all 3 archives.
- rm -f ark[1-9]isdone
- else
- echo You still must unpack the following archives:
- echo " " ${MISSING}
- fi
- exit 0
- exit 0 # Just in case...
- --
- // chris@IMD.Sterling.COM | Send comp.sources.x submissions to:
- \X/ Amiga - The only way to fly! | sources-x@imd.sterling.com
- "It's intuitively obvious to the |
- most casual observer..." | GCS d+/-- p+ c++ l+ m+ s++/+ g+ w+ t+ r+ x+
-