home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Usenet 1994 October
/
usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso
/
x
/
volume16
/
xcmdpanel-1.1
/
part01
next >
Wrap
Text File
|
1992-03-04
|
40KB
|
1,457 lines
Newsgroups: comp.sources.x
Path: uunet!zaphod.mps.ohio-state.edu!mips!msi!dcmartin
From: erlkonig@gnu.ai.mit.edu (Christopher Alex. North-Keys)
Subject: v16i098: xcmdpanel - command panel interface for X, Part01/02
Message-ID: <csx-16i098-xcmdpanel-1.1@uunet.UU.NET>
Originator: dcmartin@fascet
Sender: dcmartin@msi.com (David C. Martin - Moderator)
Organization: Molecular Simulations, Inc.
Date: Wed, 4 Mar 1992 16:25:59 GMT
Approved: dcmartin@msi.com
Submitted-by: erlkonig@gnu.ai.mit.edu (Christopher Alex. North-Keys)
Posting-number: Volume 16, Issue 98
Archive-name: xcmdpanel-1.1/part01
# This is a shell archive (produced by shar 3.49)
# To extract the files from this archive, save it to a file, remove
# everything above the "!/bin/sh" line above, and type "sh file_name".
#
# made 03/04/1992 16:18 UTC by dcmartin@fascet
# Source directory /home/fascet/csx/todo/src/xcmdpanel-1.1
#
# existing files will NOT be overwritten unless -c is specified
#
# This shar contains:
# length mode name
# ------ ---------- ------------------------------------------
# 0 -rw-r--r-- Part.01
# 1070 -rw-r--r-- README
# 275 -rw-r--r-- patchlevel.h
# 184 -rw-r--r-- Imakefile
# 9597 -rw-r--r-- xcmdpanel.c
# 12810 -rw-r--r-- xcmdpanel.man
# 10447 -rw-r--r-- Makefile
# 16364 -rw-r--r-- xcmdpanel.txt
# 8988 -rw-r--r-- Makefile.std
#
# ============= Part.01 ==============
if test -f 'Part.01' -a X"$1" != X"-c"; then
echo 'x - skipping Part.01 (File already exists)'
else
echo 'x - extracting Part.01 (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'Part.01' &&
SHAR_EOF
chmod 0644 Part.01 ||
echo 'restore of Part.01 failed'
Wc_c="`wc -c < 'Part.01'`"
test 0 -eq "$Wc_c" ||
echo 'Part.01: original size 0, current size' "$Wc_c"
fi
# ============= README ==============
if test -f 'README' -a X"$1" != X"-c"; then
echo 'x - skipping README (File already exists)'
else
echo 'x - extracting README (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'README' &&
PROGRAM
X xcmdpanel
X
DESCRIPTION
X The xcmdpanel program allows the user to run a user-
X configured command panel on a workstation display running X.
X Each xcmdpanel is composed of buttons, each of which may be
X configured to run a shell command using the Bourne shell
X sh(1). Buttons without associated commands are merely used
X as labels.
X
COMPILATION
X Assuming a good X installation at your site, simply:
X
X xmkmf ; make
X
X otherwise try:
X
X make -f Makefile.dist
X
X or perhaps
X
X make -f Makefile.dist Makefile
X
CONFIGURATION
X Defaults to the file .xcmdpanel in the current directory, or more
X specifically, to the file ./.<programname> , where <programname>
X is the name by which xcmdpanel is invoked.
X
X See the manual page or .txt file for detail.
X
___________________________________________________________________________
Christopher Alex. North-Keys Unix Systems Analyst
erlkonig@gnu.ai.mit.edu Group Talisman
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SHAR_EOF
chmod 0644 README ||
echo 'restore of README failed'
Wc_c="`wc -c < 'README'`"
test 1070 -eq "$Wc_c" ||
echo 'README: original size 1070, current size' "$Wc_c"
fi
# ============= patchlevel.h ==============
if test -f 'patchlevel.h' -a X"$1" != X"-c"; then
echo 'x - skipping patchlevel.h (File already exists)'
else
echo 'x - extracting patchlevel.h (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'patchlevel.h' &&
/*
X * Copyright (c) 1989 (Christoph. Alex. North-Keys)
X */
X
#ifndef _patchlevel_h
#define _patchlevel_h
X
/*
X * patchlevel.h version started Sat d.28.09.1991
X */
X
int VersionMajor = 1
int VersionMinor = 1
X
/* Add nothing after the following endif line */
#endif _patchlevel_h
SHAR_EOF
chmod 0644 patchlevel.h ||
echo 'restore of patchlevel.h failed'
Wc_c="`wc -c < 'patchlevel.h'`"
test 275 -eq "$Wc_c" ||
echo 'patchlevel.h: original size 275, current size' "$Wc_c"
fi
# ============= Imakefile ==============
if test -f 'Imakefile' -a X"$1" != X"-c"; then
echo 'x - skipping Imakefile (File already exists)'
else
echo 'x - extracting Imakefile (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'Imakefile' &&
#define PassCDebugFlags 'CDEBUGFLAGS=$(CDEBUGFLAGS)'
X
LOCAL_LIBRARIES = XawClientLibs
X DEPLIBS = XawClientDepLibs
X SRCS = xcmdpanel.c
X
SimpleProgramTarget(xcmdpanel)
X
SHAR_EOF
chmod 0644 Imakefile ||
echo 'restore of Imakefile failed'
Wc_c="`wc -c < 'Imakefile'`"
test 184 -eq "$Wc_c" ||
echo 'Imakefile: original size 184, current size' "$Wc_c"
fi
# ============= xcmdpanel.c ==============
if test -f 'xcmdpanel.c' -a X"$1" != X"-c"; then
echo 'x - skipping xcmdpanel.c (File already exists)'
else
echo 'x - extracting xcmdpanel.c (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'xcmdpanel.c' &&
/* XCmdPanel: Jan 1990, Christoph. Alex. North-Keys, M.C.C.
X * sample X menu / command interface from file data.
X */
X
#ifndef lint
static char Version[]="Code xcmdpanel.c d.29.1.1990 C. A. North-Keys";
#endif
X
/* CAVEAT: This code is not yet polished.
X * First compiled 29 January around 9:00 (and naturally core-dumped)
X * Compilation at 13:25 ran successfully without coredump.
X * Comprehensive rewrite of the X section Thu Jul 12 01:17:48 CDT 1990.
X */
X
#include <X11/Xlib.h>
#include <X11/Intrinsic.h>
#include <X11/StringDefs.h>
#include <X11/Xaw/Cardinals.h>
#include <X11/Xaw/Command.h>
#include <X11/Xaw/Paned.h>
#include <X11/Xaw/Box.h>
#include <X11/Xaw/Text.h>
#include <stdio.h>
#include <strings.h>
#include <sys/file.h>
#include <sys/types.h>
#include <sys/stat.h>
X
/* Q-Bools and Functions from stdelf.c */
/* Quasi-Booleans */
#define bool int
#ifndef TRUE
#define TRUE (1)
#endif
#ifndef FALSE
#define FALSE (0)
#endif
#define SUCC (0)
#define FAIL (-1)
#ifndef NULL
#define NULL (0)
#endif
X
/* Functions */
char Ismep();
void Fatal();
long SwallowFile();
X
typedef struct _Datum
{
X String tag;
X String text;
X struct _Datum *next;
} Datum;
X
Datum *ConvertFileToData();
X
typedef struct _FlagsStruct {
X Boolean paned;
X Boolean ghost;
X Boolean debug;
} FlagsStruct;
X
static XtResource resources[] = { /* XtPointer only to make lint quiet */
X {"paned", "Paned", XtRBoolean, sizeof(Boolean),
X XtOffset(FlagsStruct *, paned), XtRImmediate, (XtPointer)True},
X {"ghost", "Ghost", XtRBoolean, sizeof(Boolean),
X XtOffset(FlagsStruct *, ghost), XtRImmediate, (XtPointer)False},
X {"debug", "Debug", XtRBoolean, sizeof(Boolean),
X XtOffset(FlagsStruct *, debug), XtRImmediate, (XtPointer)False},
};
X
static XrmOptionDescRec options[] = {
X {"-paned", "paned", XrmoptionNoArg, "True"},
X {"-boxed", "paned", XrmoptionNoArg, "False"},
X {"-ghost", "ghost", XrmoptionNoArg, "True"},
X {"-noghost", "ghost", XrmoptionNoArg, "False"},
X {"-debug", "debug", XrmoptionNoArg, "True"},
};
X
static Arg space_args[] = {
X {XtNhSpace, (XtArgVal)4},
X {XtNvSpace, (XtArgVal)4},
};
X
static Arg null_args[] = {
X { NULL, NULL},
};
X
String fallback_resources[] = {
X "*input: True",
X "*showGrip: False",
X "*exit*label: Exit",
X "*execute*label: Execute",
X NULL,
};
X
void Exit();
void Execute();
Datum *ConvertFileToData( /*buffer length*/ );
char *ExtractEscapedString( /*escape, string*/ );
int FindClosure( /*open, close, escape, start, limit, start_ret, end_ret*/ );
void ConvertDataToWidgets( /*items, box*/ );
void Syntax();
X
FlagsStruct flags;
X
int
main (argc, argv)
Cardinal argc;
String *argv;
{
X Cardinal i;
X Widget toplevel, box;
X Arg c_args[2];
X String filename;
X char *buffer; /* for file read */
X long length; /* length of read file */
X Datum *items;
X XtAppContext app_con;
X
X filename = (char *)calloc(strlen(argv[0]) + 4, sizeof(char *));
X (void)strcpy(filename, "./.");
X (void)strcat(filename, argv[0]);
X
X toplevel = XtAppInitialize(&app_con, "XCmdPanel",
X options, XtNumber(options),
X &argc, argv,
X fallback_resources,
X NULL,
X ZERO);
X
X if (argc == 2) filename = argv[1];
X
X if(filename)
X {
X if(FAIL == (length = SwallowFile(&buffer, filename)))
X {
X fprintf(stderr, "Error involving file %s, aborting.\n", argv[i]);
X Syntax(argv[0]);
X }
X }
X
X XtGetApplicationResources(toplevel,
X (XtPointer) &flags,
X resources, XtNumber(resources),
X NULL,
X ZERO );
X
X box = XtCreateManagedWidget(argv[0],
X flags.paned ? panedWidgetClass : boxWidgetClass,
X toplevel,
X space_args,
X XtNumber(space_args));
X
X if(NULL == (items = ConvertFileToData(buffer, length)))
X {
X fprintf(stderr,
X "Error in data conversion from file [ %s ], aborting.\n",
X filename);
X Exit();
X }
X
X ConvertDataToWidgets(items, box);
X
X XtAddCallback(XtCreateManagedWidget("Exit", commandWidgetClass,
X box,
X null_args,
X XtNumber(null_args)),
X XtNcallback,
X Exit,
X NULL);
X
X XtRealizeWidget(toplevel);
X XtAppMainLoop(app_con);
}
X
void
Exit(widget, clientData, callData)
Widget widget;
caddr_t clientData, callData;
{
X XtDestroyApplicationContext(XtWidgetToApplicationContext(widget));
X exit(0);
}
X
void
Execute(widget, clientData, callData)
Widget widget;
String *clientData;
XXtPointer callData;
{
X if(strlen(clientData)) system(clientData);
X if(flags.ghost) XtSetSensitive(widget, 0);
X return;
}
X
Datum *ConvertFileToData(buffer, length)
String buffer;
long length;
{
X Datum *items, *item;
X char *ind, *lim, StrBeg='(', StrEnd=')', StrEsc='\\';
X short state;
#define S_Tag (0)
#define S_Text (1)
X extern char *strchr(), *strcpy();
X
X lim = (char *)(&(buffer[length]));
X ind = (char *)(&(buffer[0]));
X if(NULL == (item = items = (Datum *)calloc(1, sizeof(Datum) + 1)))
X Fatal("ConvertFileToData", "calloc");
X
X for(state = S_Tag ; /*no-exit*/ ; /*internal*/ )
X {
X char *end;
X int status;
X
X status = FindClosure(StrBeg, StrEnd, StrEsc, ind, lim, &ind, &end);
X switch (status)
X {
X case FAIL: return NULL; break;
X case FALSE: return items; break;
X case TRUE:
X default: *end = '\0'; break;
X }
X
X switch (state)
X {
X case S_Tag:
X item->tag = ExtractEscapedString(StrEsc, ++ind);
X ind = end + 1;
X state = S_Text;
X break;
X case S_Text:
X item->text = ExtractEscapedString(StrEsc, ++ind);
X item->next = (Datum *)calloc(1, sizeof(Datum));
X if(flags.debug)
X (void)fprintf(stderr, "`%s' `%s'\n", item->tag,
X item->text ? item->text : "<NULL>");
X item = item->next;
X ind = end + 1;
X state = S_Tag;
X break;
X default:
X return NULL;
X break;
X }
X }
}
X
char *ExtractEscapedString(escape, string)
char escape, *string;
{
X char *new;
X char *n_i, *s_i, *lim;
X
X if(NULL == (new = (char *)calloc(strlen(string), sizeof(char))))
X Fatal("ExtractEscapedString", "calloc");
X
X lim = &string[strlen(string)];
X
X /* Upon hitting the escape char, drop it and forcecopy the next */
X for(n_i = new, s_i = string; s_i <= lim; n_i++, s_i++)
X {
X if(*s_i == escape) s_i++;
X *n_i = *s_i;
X }
X return new;
}
X
int FindClosure(open, close, escape, start, limit, start_return, end_return)
char open, close, escape, *start, *limit, **start_return, **end_return;
{
X unsigned int level = 0;
X char *index;
X /* escape causes the next character to be skipped, period */
X
X if(start == NULL)
X {
X (void)fprintf(stderr, "FindClosure: illegal value.\n");
X return FAIL;
X }
X
X /* NOTE: incoming start/end are COPIES, thus returns are safe to NULL.
X * Such will be the return values if the start/end points are unfound.
X */
X *start_return = NULL;
X *end_return = NULL;
X
X for(index=start; index<=limit; index++)
X {
X if(*index == escape)
X if(index >= limit)
X return FAIL;
X else
X index++;
X else
X if(*index == open)
X {
X level++;
X /* be clever and only set on the first instance. */
X if (*start_return == NULL) *start_return = index;
X }
X else
X if(*index == close)
X if(--level == 0)
X {
X *end_return = index;
X return TRUE;
X }
X }
X return FALSE;
}
X
X
void ConvertDataToWidgets(items, box)
Datum *items;
Widget box;
{
X Datum *item;
X Widget cur;
X
X for(item = items; item->next ; item = item->next)
X {
X if(flags.debug)
X {
X (void)fprintf(stderr,
X "ConvertDataToWidgets: tag %s, \ttextlength %d\n",
X item->tag,
X strlen(item->text));
X }
X XtAddCallback(cur = XtCreateManagedWidget(item->tag,
X commandWidgetClass,
X box,
X null_args,
X XtNumber(null_args)),
X XtNcallback,
X Execute,
X item->text);
X if(!strlen(item->text)) XtSetSensitive(cur, 0);
X }
X return;
}
X
void Syntax(prog)
char *prog;
{
X fprintf(stderr, "[-ghost] [-noghost] (default noghost)\n");
X fprintf(stderr, "[-boxed] [-paned] (default paned)\n");
X fprintf(stderr, "[<config_filename>] (default is ./.%s)\n", prog);
X fprintf(stderr, "[-debug]\n");
X exit(1);
}
X
/*
X * stdelf.c Copyright (c) 1989 Christoph. Alex. North-Keys
X * These functions may be used, copied, modified, and redistributed freely
X * so long as this notice remains intact.
X */
X
/*
X * stdelf.c : Begun 14 mar 89 : Library of simple routines
X */
X
#ifndef lint
static char SVersion[]="Code stdelf.c d.14.03.1989 (C. A. North-Keys)";
#endif
X
char
Ismep(c)
char c;
{
X if( ((c) == '-')||((c) == '=')||((c) == '+') )
X return(c);
X else
X return('\0');
X /*NOTREACHED*/
}
X
void
Fatal(loc, s)
char *loc, *s;
{
X fprintf(stderr, "%s: ", loc);
X perror(s);
X exit(-1);
}
X
long
SwallowFile(addr_buffer, path)
char **addr_buffer, *path;
{
X struct stat statbuf;
X int in_count;
X int fd = -1;
X
X /* Attempt to open desired file */
X if(((fd)=open(path, O_RDONLY))==-1)
X {
X (void)fprintf(stderr, "SwallowFile: %s not opened\n", path);
X return (FAIL);
X }
X
X if(fstat(fd, &statbuf)==-1)
X {
X (void)fprintf(stderr, "SwallowFile: error on fstat file %s\n", path);
X return (FAIL);
X }
X
X /* Get a buffer to fit */
X if((*addr_buffer=(char *)calloc(1, statbuf.st_size+1))==NULL)
X {
X (void)fprintf(stderr, "SwallowFile: no space for calloc\n");
X return (FAIL);
X }
X
X /* Read in the file */
X if((in_count = read(fd, *addr_buffer, statbuf.st_size)) != statbuf.st_size)
X {
X (void)fprintf(stdout,
X "SwallowFile: error(?) %d/%d bytes read from %s\n",
X in_count, statbuf.st_size, path);
X (void)free(*addr_buffer);
X return (FAIL);
X }
X return (in_count);
}
X
/* end of excerpt from stdelf.c */
X
SHAR_EOF
chmod 0644 xcmdpanel.c ||
echo 'restore of xcmdpanel.c failed'
Wc_c="`wc -c < 'xcmdpanel.c'`"
test 9597 -eq "$Wc_c" ||
echo 'xcmdpanel.c: original size 9597, current size' "$Wc_c"
fi
# ============= xcmdpanel.man ==============
if test -f 'xcmdpanel.man' -a X"$1" != X"-c"; then
echo 'x - skipping xcmdpanel.man (File already exists)'
else
echo 'x - extracting xcmdpanel.man (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'xcmdpanel.man' &&
.TH XCMDPANEL 1 "Release 5" "X Version 11"
.ds p xcmdpanel
.ds c .\*p
.ds t \fBGroup Talisman\fP
.SH NAME
\*p \- command panel utility for X
.SH SYNOPSIS
.B \*p
[\-help]
[\-debug]
[\-ghost|\-noghost]
[\-boxed|\-paned]
[\fIfilename\fP]
.SH DESCRIPTION
The
.I \*p
program allows the user to run a user-configured command panel on a
workstation display running X.
Each \*p is composed of buttons, each of which may be configured to
run a shell command using the Bourne shell sh(1).
Buttons without associated commands are merely used as labels.
.SH OPTIONS
.PP
The various options may appear in any order:
.IP \fIfilename\f"
A file containing the label/command pairs and comments
used to configure an invocation of \*p. Defaults to \*c in the current
directory or ~/\*c in the home directory if \*c is unavailable.
.IP \fB-help\fP
Print a usage message and exit.
.IP \fB-ghost\fP
Allow each button to be activated only once, whereafter that button will
be \fIghosted\fP to indicate that it is no longer valid.
.IP \fB-noghost\fP
Don't use ghosting, instead allow multiple use of all command buttons
(the default).
.IP \fB-boxed\fP
Use the boxedWidget to manage the buttons. This causes the
buttons to appear in a tray-style arrangement.
.IP \fB-paned\fP
Use the panedWidget to manage the buttons (the default). This
causes the buttons to appear in a single column.
.PP
\*p will also accept the standard X Toolkit options; see the
.B xterm(1)
manual page, subsection
.B RESOURCES.
.SH USAGE
.PP
The \*p has been used to ease project management, to pop up automatically
generated menus, and to handle menu hierarchies. It is characterized by
small, project- and directory-specific menus, generally run at need rather
than from
.B xinit(1)
or the like.
.PP
Output from a particular invocation of \*p will generally show up in the
.B xterm(1)
from which it was invoked. Hence the parent terminal is often used as
a display window for
.B ls(1)
and
.B make(1)
output.
.PP
The configuration file is composed of labels and commands in parentheses,
and comments (any not in parentheses). Nesting of parentheses is observed
unless a parenthesis is escaped with a backslash, which itself may be so
escaped (see \fBSCRIPTS\fP).
.PP
All text outside of parentheses is ignored.
.PP
Parenthesized strings are automatically paired, ignoring newlines. Any
.I label
associated with an empty
.I command
string is considered to be a text button rather than a title button,
and is automatically ghosted. \fILabel\fPs may also be empty strings,
and will produce blank text boxes in the resulting menu.
.SH EXAMPLES
.PP
To use the underlying X Toolkit options to select a particular font:
.IP
\*p -fn '*sony*24*'
.PP
Another example using explicit resources:
.IP
\*p -xrm '*font: *sony*24*'
.PP
To get the same effect through an
.B "X RESOURCES"
file, include the following line in your resources file:
.IP
\*p*font: *sony*24*
.SH SCRIPTS
.PP
A project menu:
.IP
.nf
X Label Command
X
(Title) ()
( ( \\) ) ) () a test label showing parens
() ()
(Clear) (clear &)
(Make) (make &)
(Edit File) (${EDITOR} `ifc .` &) InterViews only
(Run a.out) (a.out &) execute
(List) (echo listing ; ls -Flasg &)
(Du) (du . &)
(Update Menu) (xcmdpanel -debug &)
(Time Test) (sleep 5)
.fi
.PP
Generating an audio menu on a Sun SPARC in csh(1):
.IP
.nf
rm \*c
foreach file ( *.au )
X echo -n "(`expr $file : '\\(.*\\).au'`)" >> \*c
X echo "(cat $file > /dev/audio)" >> \*c
end
\*p -boxed &
.fi
.PP
Generating an audio menu on a Sun SPARC in sh(1):
.IP
.nf
for file in *.au
do
X echo -n "(`expr $file : '\\(.*\\).au'`)"
X echo "(cat $file > /dev/audio)"
done > \*c
\*p -boxed &
.fi
.SH "X RESOURCES"
.PP
\*p uses the following X resources:
.PP
.TP 14
.B paned (class Paned)
Indicates whether to use the \fBpanedWidget\fP. Defaults to \fBtrue\fP.
If \fBfalse\fP, the \fBboxedWidget\fP is used instead.
.PP
.TP 14
.B ghost (class Ghost)
Indicates whether buttons are to be ghosted after selection.
Defaults to \fBfalse\fP.
.PP
.TP 14
.B debug (class Debug)
Whether or not to do debugging. Defaults to \fBfalse\fP.
.PP
\*p also uses the resources of its subwidgets, including the
.BR commandWidget,
.BR panedWidget,
.BR boxWidget,
and
.BR textWidget.
.SH FILES
.PD 0
.TP 20
.B \*c
The usual configuration file (in the current dir) for an invocation of \*p.
.TP
.B ~/\*c
Default configuration file to be read by \*p when no other appropriate
file is available.
.PD
.SH "SEE ALSO"
.BR X(1),
.BR xinit(1),
.BR sh(1),
.BR system(3)
.SH BUGS
Probably.
.SH COPYRIGHT
.IP "Copyright (c) 1990, Christopher Alexander North-Keys"
.PP
Author's credit must be retained in binaries, manual entries, sources, and
derived code.
.PP
This software may be freely copied, distributed, compiled, altered, and sold,
provided the above restrictions are observed.
.PP
This software is provided "as is", with no warranty, guarantee, support,
maintenance, update schedule, claims to fitness for any purpose, or
anything else from the author or the author's employer(s).
See the source code for additional copyright and limitation information.
.SH AUTHOR
Christopher Alexander North-Keys
.br
<erlkonig@gnu.ai.mit.edu>
.PP
Director/Instructor of OS and Software Design
.br
RDA Computer Training
.br
.SH NOTES
The \*p program was produced under the auspices of \*t.
I'd also like to thank Mic Kaczmarczik for his aid in documentation.
.brEND_OF_FILE
if test 5490 -ne `wc -c <'xcmdpanel.man'`; then
X echo shar: \"'xcmdpanel.man'\" unpacked with wrong size!
fi
# end of 'xcmdpanel.man'
fi
if test -f 'xcmdpanel.txt' -a "${1}" != "-c" ; then
X echo shar: Will not clobber existing file \"'xcmdpanel.txt'\"
else
echo shar: Extracting \"'xcmdpanel.txt'\" \(6938 characters\)
sed "s/^X//" >'xcmdpanel.txt' <<'END_OF_FILE'
X
X
X
XXCMDPANEL(1) USER COMMANDS XCMDPANEL(1)
X
X
X
NAME
X xcmdpanel - command panel utility for X
X
SYNOPSIS
X xcmdpanel [-help] [-debug] [-ghost|-noghost] [-boxed|-paned]
X [filename]
X
DESCRIPTION
X The xcmdpanel program allows the user to run a user-
X configured command panel on a workstation display running X.
X Each xcmdpanel is composed of buttons, each of which may be
X configured to run a shell command using the Bourne shell
X sh(1). Buttons without associated commands are merely used
X as labels.
X
OPTIONS
X The various options may appear in any order:
X
X filename
X A file containing the label/command pairs and comments
X used to configure an invocation of xcmdpanel. Defaults
X to .xcmdpanel in the current directory or ~/.xcmdpanel
X in the home directory if .xcmdpanel is unavailable.
X
X -help
X Print a usage message and exit.
X
X -ghost
X Allow each button to be activated only once, whereafter
X that button will be ghosted to indicate that it is no
X longer valid.
X
X -noghost
X Don't use ghosting, instead allow multiple use of all
X command buttons (the default).
X
X -boxed
X Use the boxedWidget to manage the buttons. This causes
X the buttons to appear in a tray-style arrangement.
X
X -paned
X Use the panedWidget to manage the buttons (the
X default). This causes the buttons to appear in a sin-
X gle column.
X
X xcmdpanel will also accept the standard X Toolkit options;
X see the xterm(1) manual page, subsection RESOURCES.
X
USAGE
X The xcmdpanel has been used to ease project management, to
X pop up automatically generated menus, and to handle menu
X hierarchies. It is characterized by small, project- and
X
X
X
XX Version 11 Last change: Release 5 1
X
X
X
X
X
X
XXCMDPANEL(1) USER COMMANDS XCMDPANEL(1)
X
X
X
X directory-specific menus, generally run at need rather than
X from xinit(1) or the like.
X
X Output from a particular invocation of xcmdpanel will gen-
X erally show up in the xterm(1) from which it was invoked.
X Hence the parent terminal is often used as a display window
X for ls(1) and make(1) output.
X
X The configuration file is composed of labels and commands in
X parentheses, and comments (any not in parentheses). Nesting
X of parentheses is observed unless a parenthesis is escaped
X with a backslash, which itself may be so escaped (see
X SCRIPTS).
X
X All text outside of parentheses is ignored.
X
X Parenthesized strings are automatically paired, ignoring
X newlines. Any label associated with an empty command string
X is considered to be a text button rather than a title but-
X ton, and is automatically ghosted. Labels may also be empty
X strings, and will produce blank text boxes in the resulting
X menu.
X
EXAMPLES
X To use the underlying X Toolkit options to select a particu-
X lar font:
X
X xcmdpanel -fn '*sony*24*'
X
X Another example using explicit resources:
X
X xcmdpanel -xrm '*font: *sony*24*'
X
X To get the same effect through an X RESOURCES file, include
X the following line in your resources file:
X
X xcmdpanel*font: *sony*24*
X
SCRIPTS
X A project menu:
X
X
X Label Command
X
X (Title) ()
X ( ( \) ) ) () a test label showing parens
X () ()
X (Clear) (clear &)
X (Make) (make &)
X (Edit File) (${EDITOR} `ifc .` &) InterViews only
X (Run a.out) (a.out &) execute
X (List) (echo listing ; ls -Flasg &)
X
X
X
XX Version 11 Last change: Release 5 2
X
X
X
X
X
X
XXCMDPANEL(1) USER COMMANDS XCMDPANEL(1)
X
X
X
X (Du) (du . &)
X (Update Menu) (xcmdpanel -debug &)
X (Time Test) (sleep 5)
X
X Generating an audio menu on a Sun SPARC in csh(1):
X
X
X rm .xcmdpanel
X foreach file ( *.au )
X echo -n "(`expr $file : '\(.*\).au'`)" >> .xcmdpanel
X echo "(cat $file > /dev/audio)" >> .xcmdpanel
X end
X xcmdpanel -boxed &
X
X Generating an audio menu on a Sun SPARC in sh(1):
X
X
X for file in *.au
X do
X echo -n "(`expr $file : '\(.*\).au'`)"
X echo "(cat $file > /dev/audio)"
X done > .xcmdpanel
X xcmdpanel -boxed &
X
XX RESOURCES
X xcmdpanel uses the following X resources:
X
X paned (class Paned)
X Indicates whether to use the panedWidget.
X Defaults to true. If false, the boxedWidget
X is used instead.
X
X ghost (class Ghost)
X Indicates whether buttons are to be ghosted
X after selection. Defaults to false.
X
X debug (class Debug)
X Whether or not to do debugging. Defaults to
X false.
X
X xcmdpanel also uses the resources of its subwidgets, includ-
X ing the commandWidget, panedWidget, boxWidget, and
X textWidget.
X
FILES
X .xcmdpanel The usual configuration file (in the
X current dir) for an invocation of
X xcmdpanel.
X ~/.xcmdpanel Default configuration file to be read by
X xcmdpanel when no other appropriate file
X is available.
X
X
X
X
XX Version 11 Last change: Release 5 3
X
X
X
X
X
X
XXCMDPANEL(1) USER COMMANDS XCMDPANEL(1)
X
X
X
SEE ALSO
X X(1), xinit(1), sh(1), system(3)
X
BUGS
X Probably.
X
COPYRIGHT
X Copyright (c) 1990, Christopher Alexander North-Keys
X
X Author's credit must be retained in binaries, manual
X entries, sources, and derived code.
X
X This software may be freely copied, distributed, compiled,
X altered, and sold, provided the above restrictions are
X observed.
X
X This software is provided "as is", with no warranty, guaran-
X tee, support, maintenance, update schedule, claims to fit-
X ness for any purpose, or anything else from the author or
X the author's employer(s). See the source code for addi-
X tional copyright and limitation information.
X
AUTHOR
X Christopher Alexander North-Keys
X <erlkonig@gnu.ai.mit.edu>
X
X Director/Instructor of OS and Software Design
X RDA Computer Training
X
NOTES
X The xcmdpanel program was produced under the auspices of
X Group Talisman. I'd also like to thank Mic Kaczmarczik for
X his aid in documentation.
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
XX Version 11 Last change: Release 5 4
X
X
X
SHAR_EOF
chmod 0644 xcmdpanel.man ||
echo 'restore of xcmdpanel.man failed'
Wc_c="`wc -c < 'xcmdpanel.man'`"
test 12810 -eq "$Wc_c" ||
echo 'xcmdpanel.man: original size 12810, current size' "$Wc_c"
fi
# ============= Makefile ==============
if test -f 'Makefile' -a X"$1" != X"-c"; then
echo 'x - skipping Makefile (File already exists)'
else
echo 'x - extracting Makefile (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'Makefile' &&
# Makefile generated by imake - do not edit!
# $XConsortium: imake.c,v 1.65 91/07/25 17:50:17 rws Exp $
#
# The cpp used on this machine replaces all newlines and multiple tabs and
# spaces in a macro expansion with a single space. Imake tries to compensate
# for this, but is not always successful.
#
X
# -------------------------------------------------------------------------
# Makefile generated from "Imake.tmpl" and <Imakefile>
# $XConsortium: Imake.tmpl,v 1.139 91/09/16 08:52:48 rws Exp $
#
# Platform-specific parameters may be set in the appropriate <vendor>.cf
# configuration files. Site-specific parameters should be set in the file
# site.def. Full rebuilds are recommended if any parameters are changed.
#
# If your C preprocessor does not define any unique symbols, you will need
# to set BOOTSTRAPCFLAGS when rebuilding imake (usually when doing
# "make World" the first time).
#
X
# -------------------------------------------------------------------------
# site-specific configuration parameters that need to come before
# the platform-specific parameters - edit site.def to change
X
# site: $XConsortium: site.def,v 1.2 91/07/30 20:26:44 rws Exp $
X
# -------------------------------------------------------------------------
# platform-specific configuration parameters - edit sun.cf to change
X
# platform: $XConsortium: sun.cf,v 1.68 91/07/30 11:34:39 rws Exp $
X
# operating system: SunOS 4.1.1
X
# $XConsortium: sunLib.rules,v 1.6 91/03/24 17:55:58 rws Exp $
X
# -------------------------------------------------------------------------
# site-specific configuration parameters that go after
# the platform-specific parameters - edit site.def to change
X
# site: $XConsortium: site.def,v 1.2 91/07/30 20:26:44 rws Exp $
X
X SHELL = /bin/sh
X
X TOP = .
X CURRENT_DIR = .
X
X AR = ar clq
X BOOTSTRAPCFLAGS =
X CC = cc
X AS = as
X
X COMPRESS = compress
X CPP = /lib/cpp $(STD_CPP_DEFINES)
X PREPROCESSCMD = cc -E $(STD_CPP_DEFINES)
X INSTALL = install
X LD = ld
X LINT = lint
X LINTLIBFLAG = -C
X LINTOPTS = -axz
X LN = ln -s
X MAKE = make
X MV = mv
X CP = cp
X
X RANLIB = ranlib
X RANLIBINSTFLAGS =
X
X RM = rm -f
X TROFF = psroff
X MSMACROS = -ms
X TBL = tbl
X EQN = eqn
X STD_INCLUDES =
X STD_CPP_DEFINES =
X STD_DEFINES =
X EXTRA_LOAD_FLAGS =
X EXTRA_LIBRARIES =
X TAGS = ctags
X
X SHAREDCODEDEF = -DSHAREDCODE
X SHLIBDEF = -DSUNSHLIB
X
X PROTO_DEFINES =
X
X INSTPGMFLAGS =
X
X INSTBINFLAGS = -m 0755
X INSTUIDFLAGS = -m 4755
X INSTLIBFLAGS = -m 0644
X INSTINCFLAGS = -m 0444
X INSTMANFLAGS = -m 0444
X INSTDATFLAGS = -m 0444
X INSTKMEMFLAGS = -m 4755
X
X PROJECTROOT = /usr/X11/R5
X
X TOP_INCLUDES = -I$(INCROOT)
X
X CDEBUGFLAGS = -O
X CCOPTIONS = -pipe
X
X ALLINCLUDES = $(INCLUDES) $(EXTRA_INCLUDES) $(TOP_INCLUDES) $(STD_INCLUDES)
X ALLDEFINES = $(ALLINCLUDES) $(STD_DEFINES) $(EXTRA_DEFINES) $(PROTO_DEFINES) $(DEFINES)
X CFLAGS = $(CDEBUGFLAGS) $(CCOPTIONS) $(ALLDEFINES)
X LINTFLAGS = $(LINTOPTS) -DLINT $(ALLDEFINES)
X
X LDLIBS = $(SYS_LIBRARIES) $(EXTRA_LIBRARIES)
X
X LDOPTIONS = $(CDEBUGFLAGS) $(CCOPTIONS) $(LOCAL_LDFLAGS) -L$(USRLIBDIR)
X
X LDCOMBINEFLAGS = -X -r
X DEPENDFLAGS =
X
X MACROFILE = sun.cf
X RM_CMD = $(RM) *.CKP *.ln *.BAK *.bak *.o core errs ,* *~ *.a .emacs_* tags TAGS make.log MakeOut
X
X IMAKE_DEFINES =
X
X IRULESRC = $(CONFIGDIR)
X IMAKE_CMD = $(IMAKE) -DUseInstalled -I$(IRULESRC) $(IMAKE_DEFINES)
X
X ICONFIGFILES = $(IRULESRC)/Imake.tmpl $(IRULESRC)/Imake.rules \
X $(IRULESRC)/Project.tmpl $(IRULESRC)/site.def \
X $(IRULESRC)/$(MACROFILE) $(EXTRA_ICONFIGFILES)
X
# -------------------------------------------------------------------------
# X Window System Build Parameters
# $XConsortium: Project.tmpl,v 1.138 91/09/10 09:02:12 rws Exp $
X
# -------------------------------------------------------------------------
# X Window System make variables; this need to be coordinated with rules
X
X PATHSEP = /
X USRLIBDIR = /usr/X11/R5/lib
X BINDIR = /usr/X11/R5/bin
X INCROOT = /usr/X11/R5/include
X BUILDINCROOT = $(TOP)
X BUILDINCDIR = $(BUILDINCROOT)/X11
X BUILDINCTOP = ..
X INCDIR = $(INCROOT)/X11
X ADMDIR = /usr/adm
X LIBDIR = $(USRLIBDIR)/X11
X CONFIGDIR = $(LIBDIR)/config
X LINTLIBDIR = $(USRLIBDIR)/lint
X
X FONTDIR = $(LIBDIR)/fonts
X XINITDIR = $(LIBDIR)/xinit
X XDMDIR = $(LIBDIR)/xdm
X TWMDIR = $(LIBDIR)/twm
X MANPATH = /usr/X11/R5/man
X MANSOURCEPATH = $(MANPATH)/man
X MANSUFFIX = n
X LIBMANSUFFIX = 3
X MANDIR = $(MANSOURCEPATH)$(MANSUFFIX)
X LIBMANDIR = $(MANSOURCEPATH)$(LIBMANSUFFIX)
X NLSDIR = $(LIBDIR)/nls
X PEXAPIDIR = $(LIBDIR)/PEX
X XAPPLOADDIR = $(LIBDIR)/app-defaults
X FONTCFLAGS = -t
X
X INSTAPPFLAGS = $(INSTDATFLAGS)
X
X IMAKE = imake
X DEPEND = makedepend
X RGB = rgb
X
X FONTC = bdftopcf
X
X MKFONTDIR = mkfontdir
X MKDIRHIER = /bin/sh $(BINDIR)/mkdirhier
X
X CONFIGSRC = $(TOP)/config
X DOCUTILSRC = $(TOP)/doc/util
X CLIENTSRC = $(TOP)/clients
X DEMOSRC = $(TOP)/demos
X LIBSRC = $(TOP)/lib
X FONTSRC = $(TOP)/fonts
X INCLUDESRC = $(TOP)/X11
X SERVERSRC = $(TOP)/server
X UTILSRC = $(TOP)/util
X SCRIPTSRC = $(UTILSRC)/scripts
X EXAMPLESRC = $(TOP)/examples
X CONTRIBSRC = $(TOP)/../contrib
X DOCSRC = $(TOP)/doc
X RGBSRC = $(TOP)/rgb
X DEPENDSRC = $(UTILSRC)/makedepend
X IMAKESRC = $(CONFIGSRC)
X XAUTHSRC = $(LIBSRC)/Xau
X XLIBSRC = $(LIBSRC)/X
X XMUSRC = $(LIBSRC)/Xmu
X TOOLKITSRC = $(LIBSRC)/Xt
X AWIDGETSRC = $(LIBSRC)/Xaw
X OLDXLIBSRC = $(LIBSRC)/oldX
X XDMCPLIBSRC = $(LIBSRC)/Xdmcp
X BDFTOSNFSRC = $(FONTSRC)/bdftosnf
X BDFTOSNFSRC = $(FONTSRC)/clients/bdftosnf
X BDFTOPCFSRC = $(FONTSRC)/clients/bdftopcf
X MKFONTDIRSRC = $(FONTSRC)/clients/mkfontdir
X FSLIBSRC = $(FONTSRC)/lib/fs
X FONTSERVERSRC = $(FONTSRC)/server
X EXTENSIONSRC = $(TOP)/extensions
X XILIBSRC = $(EXTENSIONSRC)/lib/xinput
X PHIGSLIBSRC = $(EXTENSIONSRC)/lib/PEX
X
# $XConsortium: sunLib.tmpl,v 1.11 91/07/31 11:32:08 rws Exp $
X
SHLIBLDFLAGS = -assert pure-text
PICFLAGS = -pic
X
X DEPEXTENSIONLIB =
X EXTENSIONLIB = -lXext
X
X DEPXLIB = $(DEPEXTENSIONLIB)
X XLIB = $(EXTENSIONLIB) -lX11
X
X DEPXMULIB = $(USRLIBDIR)/libXmu.sa.$(SOXMUREV)
X XMULIB = -lXmu
X
X DEPOLDXLIB =
X OLDXLIB = -loldX
X
X DEPXTOOLLIB = $(USRLIBDIR)/libXt.sa.$(SOXTREV)
X XTOOLLIB = -lXt
X
X DEPXAWLIB = $(USRLIBDIR)/libXaw.sa.$(SOXAWREV)
X XAWLIB = -lXaw
X
X DEPXILIB =
X XILIB = -lXi
X
X SOXLIBREV = 4.10
X SOXTREV = 4.10
X SOXAWREV = 5.0
X SOOLDXREV = 4.10
X SOXMUREV = 4.10
X SOXEXTREV = 4.10
X SOXINPUTREV = 4.10
X
X DEPXAUTHLIB = $(USRLIBDIR)/libXau.a
X XAUTHLIB = -lXau
X DEPXDMCPLIB = $(USRLIBDIR)/libXdmcp.a
X XDMCPLIB = -lXdmcp
X
X DEPPHIGSLIB = $(USRLIBDIR)/libphigs.a
X PHIGSLIB = -lphigs
X
X DEPXBSDLIB = $(USRLIBDIR)/libXbsd.a
X XBSDLIB = -lXbsd
X
X LINTEXTENSIONLIB = $(LINTLIBDIR)/llib-lXext.ln
X LINTXLIB = $(LINTLIBDIR)/llib-lX11.ln
X LINTXMU = $(LINTLIBDIR)/llib-lXmu.ln
X LINTXTOOL = $(LINTLIBDIR)/llib-lXt.ln
X LINTXAW = $(LINTLIBDIR)/llib-lXaw.ln
X LINTXI = $(LINTLIBDIR)/llib-lXi.ln
X LINTPHIGS = $(LINTLIBDIR)/llib-lphigs.ln
X
X DEPLIBS = $(DEPXAWLIB) $(DEPXMULIB) $(DEPXTOOLLIB) $(DEPXLIB)
X
X DEPLIBS1 = $(DEPLIBS)
X DEPLIBS2 = $(DEPLIBS)
X DEPLIBS3 = $(DEPLIBS)
X
# -------------------------------------------------------------------------
# Imake rules for building libraries, programs, scripts, and data files
# rules: $XConsortium: Imake.rules,v 1.123 91/09/16 20:12:16 rws Exp $
X
# -------------------------------------------------------------------------
# start of Imakefile
X
LOCAL_LIBRARIES = $(XAWLIB) $(XMULIB) $(XTOOLLIB) $(XLIB)
X DEPLIBS = $(DEPXAWLIB) $(DEPXMULIB) $(DEPXTOOLLIB) $(DEPXLIB)
X SRCS = xcmdpanel.c
X
X OBJS = xcmdpanel.o
X SRCS = xcmdpanel.c
X
X PROGRAM = xcmdpanel
X
all:: xcmdpanel
X
xcmdpanel: $(OBJS) $(DEPLIBS)
X $(RM) $@
X $(CC) -o $@ $(OBJS) $(LDOPTIONS) $(LOCAL_LIBRARIES) $(LDLIBS) $(EXTRA_LOAD_FLAGS)
X
saber_xcmdpanel:: $(SRCS)
X # load $(ALLDEFINES) $(SRCS) $(LOCAL_LIBRARIES) $(SYS_LIBRARIES) $(EXTRA_LIBRARIES)
X
osaber_xcmdpanel:: $(OBJS)
X # load $(ALLDEFINES) $(OBJS) $(LOCAL_LIBRARIES) $(SYS_LIBRARIES) $(EXTRA_LIBRARIES)
X
install:: xcmdpanel
X @if [ -d $(DESTDIR)$(BINDIR) ]; then set +x; \
X else (set -x; $(MKDIRHIER) $(DESTDIR)$(BINDIR)); fi
X $(INSTALL) -c $(INSTPGMFLAGS) xcmdpanel $(DESTDIR)$(BINDIR)
X
install.man:: xcmdpanel.man
X @if [ -d $(DESTDIR)$(MANDIR) ]; then set +x; \
X else (set -x; $(MKDIRHIER) $(DESTDIR)$(MANDIR)); fi
X $(INSTALL) -c $(INSTMANFLAGS) xcmdpanel.man $(DESTDIR)$(MANDIR)/xcmdpanel.$(MANSUFFIX)
X
depend::
X $(DEPEND) $(DEPENDFLAGS) -s "# DO NOT DELETE" -- $(ALLDEFINES) -- $(SRCS)
X
lint:
X $(LINT) $(LINTFLAGS) $(SRCS) $(LINTLIBS)
lint1:
X $(LINT) $(LINTFLAGS) $(FILE) $(LINTLIBS)
X
clean::
X $(RM) $(PROGRAM)
X
# -------------------------------------------------------------------------
# common rules for all Makefiles - do not edit
X
emptyrule::
X
clean::
X $(RM_CMD) "#"*
X
Makefile::
X -@if [ -f Makefile ]; then set -x; \
X $(RM) Makefile.bak; $(MV) Makefile Makefile.bak; \
X else exit 0; fi
X $(IMAKE_CMD) -DTOPDIR=$(TOP) -DCURDIR=$(CURRENT_DIR)
X
tags::
X $(TAGS) -w *.[ch]
X $(TAGS) -xw *.[ch] > TAGS
X
saber:
X # load $(ALLDEFINES) $(SRCS)
X
osaber:
X # load $(ALLDEFINES) $(OBJS)
X
# -------------------------------------------------------------------------
# empty rules for directories that do not have SUBDIRS - do not edit
X
install::
X @echo "install in $(CURRENT_DIR) done"
X
install.man::
X @echo "install.man in $(CURRENT_DIR) done"
X
Makefiles::
X
includes::
X
# -------------------------------------------------------------------------
# dependencies generated by makedepend
X
SHAR_EOF
chmod 0644 Makefile ||
echo 'restore of Makefile failed'
Wc_c="`wc -c < 'Makefile'`"
test 10447 -eq "$Wc_c" ||
echo 'Makefile: original size 10447, current size' "$Wc_c"
fi
true || echo 'restore of xcmdpanel.txt failed'
echo End of part 1, continue with part 2
exit 0
--
--
Molecular Simulations, Inc. mail: dcmartin@msi.com
796 N. Pastoria Avenue uucp: uunet!dcmartin
Sunnyvale, California 94086 at&t: 408/522-9236