mikew@wyse.wyse.com (Mike Wexler) (01/04/89)
Submitted-by: Schlichter.Wbst@Xerox.COM (Hans Schlichter) Posting-number: Volume 2, Issue 71 Archive-name: xbrowser/part03 #! /bin/sh # This is a shell archive. Remove anything before this line, then unpack # it by saving it into a file and typing "sh file". To overwrite existing # files, type "sh file -c". You can also feed this as standard input via # unshar, or by typing "sh <file", e.g.. If this archive is complete, you # will see the following message at the end: # "End of archive 3 (of 3)." # Contents: AUTHOR Imakefile Makefile ap.c list.c option.h optionP.h # toggle.h toggleP.h xbrowser.icon xfilebrowser.h # Wrapped by mikew@wyse on Tue Jan 3 12:03:49 1989 PATH=/bin:/usr/bin:/usr/ucb ; export PATH if test -f 'AUTHOR' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'AUTHOR'\" else echo shar: Extracting \"'AUTHOR'\" \(491 characters\) sed "s/^X//" >'AUTHOR' <<'END_OF_FILE' XReturn-Path: Schlichter.Wbst@Xerox.COM XReceived: by wyse.wyse.com (5.58/Wyse master/5-13-88) X id AA13290; Tue, 3 Jan 89 11:13:22 PST XFrom: Schlichter.Wbst@Xerox.COM XReceived: from Xerox.COM by uunet.UU.NET (5.59/1.14) X id AA11840; Tue, 3 Jan 89 13:01:45 EST XReceived: from Catawba.ms by ArpaGateway.ms ; 03 JAN 89 09:58:01 PST XDate: 3 Jan 89 12:57:28 EST (Tuesday) XSubject: xbrowser.shar.part1.Z XTo: x-sources@wyse.com XCc: Schlichter.Wbst@Xerox.COM XMessage-Id: <890103-095801-1304@Xerox> X END_OF_FILE if test 491 -ne `wc -c <'AUTHOR'`; then echo shar: \"'AUTHOR'\" unpacked with wrong size! fi # end of 'AUTHOR' fi if test -f 'Imakefile' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'Imakefile'\" else echo shar: Extracting \"'Imakefile'\" \(434 characters\) sed "s/^X//" >'Imakefile' <<'END_OF_FILE' X#ifdef BandAidCompiler X#include BandAidCompiler X#endif X XLOCAL_LIBRARIES = $(XAWLIB) $(XMULIB) $(XTOOLLIB) $(XLIB) X X SRCS = ap.c commands.c list.c modcommand.c option.c \ X popup.c scandir.c search.c toggle.c util.c \ X xfilebrowser.c X OBJS = ap.o commands.o list.o modcommand.o option.o \ X popup.o scandir.o search.o toggle.o util.o \ X xfilebrowser.o X XComplexProgramTarget(xbrowser) XInstallAppDefaults(Xbrowser) END_OF_FILE if test 434 -ne `wc -c <'Imakefile'`; then echo shar: \"'Imakefile'\" unpacked with wrong size! fi # end of 'Imakefile' fi if test -f 'Makefile' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'Makefile'\" else echo shar: Extracting \"'Makefile'\" \(6752 characters\) sed "s/^X//" >'Makefile' <<'END_OF_FILE' X# Makefile generated by imake - do not edit! X# $XConsortium: imake.c,v 1.37 88/10/08 20:08:30 jim Exp $ X# X# The cpp used on this machine replaces all newlines and multiple tabs and X# spaces in a macro expansion with a single space. Imake tries to compensate X# for this, but is not always successful. X# X X########################################################################### X# X Window System Makefile generated from template file Imake.tmpl X# $XConsortium: Imake.tmpl,v 1.91 88/10/23 22:37:10 jim Exp $ X# X# Do not change the body of the imake template file. Server-specific X# parameters may be set in the appropriate .macros file; site-specific X# parameters (but shared by all servers) may be set in site.def. If you X# make any changes, you'll need to rebuild the makefiles using X# "make World" (at best) or "make Makefile; make Makefiles" (at least) in X# the top level directory. X# X# If your C preprocessor doesn't define any unique symbols, you'll need X# to set BOOTSTRAPCFLAGS when rebuilding imake (usually when doing X# "make Makefile", "make Makefiles", or "make World"). X# X# If you absolutely can't get imake to work, you'll need to set the X# variables at the top of each Makefile as well as the dependencies at the X# bottom (makedepend will do this automatically). X# X X########################################################################### X# platform-specific configuration parameters - edit Sun.macros to change X X# platform: $XConsortium: Sun.macros,v 1.52 88/10/23 11:00:55 jim Exp $ X# operating system: SunOS 3.4 X XBOOTSTRAPCFLAGS = X AS = as X CC = cc X CPP = /lib/cpp X LD = ld X LINT = lint X INSTALL = install X TAGS = ctags X RM = rm -f X MV = mv X LN = ln -s X RANLIB = ranlib XRANLIBINSTFLAGS = -t X AR = ar clq X LS = ls X LINTOPTS = -axz X LINTLIBFLAG = -C X MAKE = make XSTD_CPP_DEFINES = X STD_DEFINES = X X########################################################################### X# site-specific configuration parameters - edit site.def to change X X# site: $XConsortium: site.def,v 1.16 88/10/12 10:30:24 jim Exp $ X X########################################################################### X# definitions common to all Makefiles - do not edit X X SHELL = /bin/sh X X DESTDIR = /global X USRLIBDIR = $(DESTDIR)/lib X BINDIR = $(DESTDIR)/bin/X11 X INCDIR = $(DESTDIR)/include X ADMDIR = $(DESTDIR)/usr/adm X LIBDIR = $(USRLIBDIR)/X11 X LINTLIBDIR = $(USRLIBDIR)/lint X FONTDIR = $(LIBDIR)/fonts X XINITDIR = $(LIBDIR)/xinit X XDMDIR = $(LIBDIR)/xdm X UWMDIR = $(LIBDIR)/uwm X AWMDIR = $(LIBDIR)/awm X TWMDIR = $(LIBDIR)/twm X DTDIR = $(LIBDIR)/dt X MANPATH = /usr/man X MANSOURCEPATH = $(MANPATH)/man X MANDIR = $(MANSOURCEPATH)n X LIBMANDIR = $(MANSOURCEPATH)n3 X XAPPLOADDIR = $(LIBDIR)/app-defaults X X INSTBINFLAGS = -m 0755 X INSTUIDFLAGS = -m 4755 X INSTLIBFLAGS = -m 0664 X INSTINCFLAGS = -m 0444 X INSTMANFLAGS = -m 0444 X INSTAPPFLAGS = -m 0444 X INSTKMEMFLAGS = -m 4755 X FCFLAGS = -t X CDEBUGFLAGS = -O X X PATHSEP = / X DEPEND = $(BINDIR)/makedepend X IMAKE = $(BINDIR)/imake X RGB = $(LIBDIR)/rgb X FC = $(BINDIR)/bdftosnf X MKFONTDIR = $(BINDIR)/mkfontdir X MKDIRHIER = $(BINDIR)/mkdirhier.sh X X CFLAGS = $(CDEBUGFLAGS) $(INCLUDES) $(STD_DEFINES) $(DEFINES) X LINTFLAGS = $(LINTOPTS) $(INCLUDES) $(STD_DEFINES) $(DEFINES) -DLINT X LDFLAGS = $(CDEBUGFLAGS) -L$(USRLIBDIR) $(SYS_LIBRARIES) $(SYSAUX_LIBRARIES) X X IRULESRC = $(LIBDIR)/imake.includes X X EXTENSIONLIB = $(USRLIBDIR)/libext.a X XLIB = $(USRLIBDIR)/libX11.a X XMULIB = $(USRLIBDIR)/libXmu.a X OLDXLIB = $(USRLIBDIR)/liboldX.a X XTOOLLIB = $(USRLIBDIR)/libXt.a X XAWLIB = $(USRLIBDIR)/libXaw.a X LINTXLIB = $(USRLIBDIR)/llib-lX11.ln X LINTXMU = $(USRLIBDIR)/llib-lXmu.ln X LINTXTOOL = $(USRLIBDIR)/llib-lXt.ln X LINTXAW = $(USRLIBDIR)/llib-lXaw.ln X INCLUDES = -I$(INCDIR) X MACROFILE = Sun.macros X ICONFIGFILES = $(IRULESRC)/Imake.tmpl \ X $(IRULESRC)/$(MACROFILE) $(IRULESRC)/site.def X IMAKE_DEFINES = X IMAKE_CMD = $(NEWTOP)$(IMAKE) -TImake.tmpl -I$(NEWTOP)$(IRULESRC) \ X -s Makefile $(IMAKE_DEFINES) X RM_CMD = $(RM) *.CKP *.ln *.BAK *.bak *.o core errs ,* *~ *.a \ X .emacs_* tags TAGS make.log MakeOut X X########################################################################### X# rules: $XConsortium: Imake.rules,v 1.71 88/10/23 22:46:34 jim Exp $ X X########################################################################### X# start of Imakefile X XLOCAL_LIBRARIES = $(XAWLIB) $(XMULIB) $(XTOOLLIB) $(XLIB) X X SRCS = ap.c commands.c list.c modcommand.c option.c \ X popup.c scandir.c search.c toggle.c util.c \ X xfilebrowser.c X OBJS = ap.o commands.o list.o modcommand.o option.o \ X popup.o scandir.o search.o toggle.o util.o \ X xfilebrowser.o X X PROGRAM = xbrowser X Xall:: xbrowser X Xxbrowser: $(OBJS) $(LOCAL_LIBRARIES) X $(RM) $@ X $(CC) -o $@ $(OBJS) $(LOCAL_LIBRARIES) $(LDFLAGS) $(SYSLAST_LIBRARIES) X Xrelink:: X $(RM) $(PROGRAM) X $(MAKE) $(MFLAGS) $(PROGRAM) X Xinstall:: xbrowser X $(INSTALL) -c $(INSTALLFLAGS) xbrowser $(BINDIR) X Xinstall.man:: xbrowser.man X $(INSTALL) -c $(INSTMANFLAGS) xbrowser.man $(MANDIR)/xbrowser.n X Xdepend:: $(DEPEND) X Xdepend:: X $(DEPEND) -s "# DO NOT DELETE" -- $(CFLAGS) -- $(SRCS) X X$(DEPEND): X @echo "making $@"; \ X cd $(DEPENDSRC); $(MAKE) X Xclean:: X $(RM) $(PROGRAM) X Xinstall:: Xbrowser.ad X $(INSTALL) -c $(INSTAPPFLAGS) Xbrowser.ad $(XAPPLOADDIR)/Xbrowser X X########################################################################### X# Imake.tmpl common rules for all Makefiles - do not edit X Xemptyrule:: X Xclean:: X $(RM_CMD) \#* X XMakefile:: $(IMAKE) X XMakefile:: Imakefile \ X $(IRULESRC)/Imake.tmpl \ X $(IRULESRC)/Imake.rules \ X $(IRULESRC)/site.def \ X $(IRULESRC)/$(MACROFILE) X -@if [ -f Makefile ]; then \ X echo "$(RM) Makefile.bak; $(MV) Makefile Makefile.bak"; \ X $(RM) Makefile.bak; $(MV) Makefile Makefile.bak; \ X else exit 0; fi X $(IMAKE_CMD) -DTOPDIR=$(TOP) X X$(IMAKE): X @echo "making $@"; \ X cd $(IMAKESRC); $(MAKE) BOOTSTRAPCFLAGS=$(BOOTSTRAPCFLAGS) X Xtags:: X $(TAGS) -w *.[ch] X $(TAGS) -xw *.[ch] > TAGS X X########################################################################### X# empty rules for directories that do not have SUBDIRS - do not edit X Xinstall:: X @echo "install done" X Xinstall.man:: X @echo "install.man done" X XMakefiles:: X X########################################################################### X# dependencies generated by makedepend X END_OF_FILE if test 6752 -ne `wc -c <'Makefile'`; then echo shar: \"'Makefile'\" unpacked with wrong size! fi # end of 'Makefile' fi if test -f 'ap.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'ap.c'\" else echo shar: Extracting \"'ap.c'\" \(3558 characters\) sed "s/^X//" >'ap.c' <<'END_OF_FILE' X/* Systems Sciences Laboratory, Webster Research Center */ X Xstatic char *PROGRAM_information[] = X{ X "Copyright (c) 1988 Xerox Corporation. All rights reserved.", X "$Header$", X "$Locker$" X} X; X X/* X * Copyright protection claimed includes all forms and matters of copyrightable X * material and information now allowed by statutory or judicial lay or X * herinafter granted, including without limitation, material generated from X * the software programs which are displayed on the screen such as icons, X * screen display looks, etc. X */ X X X#include "xfilebrowser.h" X X#define chunk 2048 X Xtypedef struct { X char *buf; X int size; X XtTextPosition pos; X XtTextSource strSrc; X} ApAsSourceData; X X/* Private Routines */ X X Xstatic XtTextPosition ApAsGetLastPos(src) X XtTextSource src; X{ X ApAsSourceData *data; X data = (ApAsSourceData *)src->data; X return (XtTextPosition)(*data->strSrc->GetLastPos)(data->strSrc); X} X Xstatic ApAsSetLastPos(src, lastPos) X XtTextSource src; X XtTextPosition lastPos; X{ X} X Xstatic int ApAsRead(src, pos, text, maxRead) X XtTextSource src; X int pos; X XtTextBlock *text; X int maxRead; X{ X ApAsSourceData *data; X data = (ApAsSourceData *)src->data; X return ((*data->strSrc->Read)(data->strSrc, pos, text, maxRead)); X} X X Xstatic Arg stringargs[] = { X {XtNstring, (XtArgVal) NULL}, X {XtNlength, (XtArgVal) NULL}, X {XtNeditType, (XtArgVal) XttextEdit}, X }; X Xstatic int ApAsReplace(src, startPos, endPos, text) X XtTextSource src; X XtTextPosition startPos, endPos; X XtTextBlock *text; X{ X ApAsSourceData *data; X int i; X X if (!allowedit) return 0; X data = (ApAsSourceData *)src->data; X X if((data->pos + text->length) >= data->size){ X while((data->pos + text->length) >= data->size){ X data->size += chunk; X data->buf = XtRealloc(data->buf, data->size); /* optimize this!!! */ X } X XtStringSourceDestroy(data->strSrc); X stringargs[0].value = (XtArgVal)data->buf ; X stringargs[1].value = (XtArgVal)data->size ; X data->strSrc = (XtTextSource) X XtStringSourceCreate(toplevel,stringargs,XtNumber(stringargs)); X } X i = (*data->strSrc->Replace)(data->strSrc, startPos, endPos, text); X data->pos += text->length; X return (i); X} X Xstatic XtTextPosition ApAsScan (src, pos, sType, dir, count, include) X XtTextSource src; X XtTextPosition pos; X XtTextScanType sType; X XtTextScanDirection dir; X int count, include; X{ X ApAsSourceData *data; X data = (ApAsSourceData *)src->data; X return X ((*data->strSrc->Scan)(data->strSrc, pos, sType, dir, count, include)); X} X X X/* Public routines */ X XXtTextSource TCreateApAsSource () X{ X XtTextSource src; X ApAsSourceData *data; X src = (XtTextSource) XtMalloc(sizeof(XtTextSourceRec)); X src->Read = ApAsRead; X src->Replace = ApAsReplace; X src->GetLastPos = ApAsGetLastPos; X src->SetLastPos = ApAsSetLastPos; X src->Scan = ApAsScan; X src->edit_mode = XttextEdit; X data = (ApAsSourceData *)(XtMalloc(sizeof(ApAsSourceData))); X data->buf = XtCalloc(chunk,1); X data->pos = 0; X data->size = chunk; X stringargs[0].value = (XtArgVal)data->buf ; X stringargs[1].value = (XtArgVal)data->size ; X data->strSrc = (XtTextSource) XtStringSourceCreate (toplevel,stringargs, X XtNumber(stringargs)); X src->data = (caddr_t)data; X return src; X} X XTDestroyApAsSource(src) X XtTextSource src; X{ X ApAsSourceData *data; X data = (ApAsSourceData *)src->data; X XtStringSourceDestroy(data->strSrc); X XtFree(data->buf); X XtFree(data); X XtFree(src); X} END_OF_FILE if test 3558 -ne `wc -c <'ap.c'`; then echo shar: \"'ap.c'\" unpacked with wrong size! fi # end of 'ap.c' fi if test -f 'list.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'list.c'\" else echo shar: Extracting \"'list.c'\" \(5872 characters\) sed "s/^X//" >'list.c' <<'END_OF_FILE' X/* Systems Sciences Laboratory, Webster Research Center */ X Xstatic char *PROGRAM_information[] = X{ X "Copyright (c) 1988 Xerox Corporation. All rights reserved.", X "$Header$", X "$Locker$" X} X; X X/* X * Copyright protection claimed includes all forms and matters of copyrightable X * material and information now allowed by statutory or judicial lay or X * herinafter granted, including without limitation, material generated from X * the software programs which are displayed on the screen such as icons, X * screen display looks, etc. X */ X X#include <ctype.h> X#include <pwd.h> X#include <grp.h> X X#include <sys/file.h> X X#include "xfilebrowser.h" X Xextern char *getenv(); Xextern struct passwd *getpwuid(); Xextern struct passwd *getpwnam(); Xextern struct group *getgrgid(); Xextern struct tm *localtime(); X X#define HALFYEAR 15000000L X Xstatic char *months[] = { X "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", X "Nov", "Dec", (char *)NULL }; X Xstatic struct _pwcache { X u_short id; /* owner or group id */ X char name[32]; X} ownercache; X Xreset_ownercache() X{ X ownercache.name[0] = '\0'; X} X X/* ARGSUSED */ Xint format_file(i, s, curtime) Xint i; Xchar *s; Xlong curtime; X{ X char tmp[64]; X struct passwd *passname; X struct group *groupname; X struct tm *actime; X struct afile *fp = files[i]; X X switch (currentid) { X case 2: X if (ownercache.name[0] == '\0' || fp->d_gid != ownercache.id) { X if ( (groupname = getgrgid(fp->d_gid)) == NULL) { X disp_message("\nList: Group of %s not registered", X fp->d_name); X return(-1); X } X strcpy(ownercache.name, groupname->gr_name); X ownercache.id = fp->d_gid; X } X break; X X default: X if (ownercache.name[0] == '\0' || fp->d_uid != ownercache.id) { X if ( (passname = getpwuid(fp->d_uid)) == NULL) { X disp_message("\nList: Owner of %s not registered", X fp->d_name); X return(-1); X } X strcpy(ownercache.name, passname->pw_name); X ownercache.id = fp->d_uid; X } X break; X } X X sprintf(s, "%c%s %2d %-8s %8d", X fp->d_type, fp->d_access, fp->d_nlink, ownercache.name, X fp->d_size); X actime = localtime(&(fp->d_ctime)); X if ( (curtime - fp->d_ctime) > HALFYEAR) X sprintf(tmp, " %-3s %-2d %5d %s\n", X months[actime->tm_mon], actime->tm_mday, X 1900+actime->tm_year, fp->d_name); X else sprintf(tmp, " %-3s %-2d %02d:%02d %s\n", X months[actime->tm_mon], actime->tm_mday, X actime->tm_hour, actime->tm_min, X fp->d_name); X strcat(s, tmp); X return 0; X} X X#define BUFSIZE 64 /* assume this as normal length of a file format */ X Xint display_files(position) Xint position; X{ X int i, length, buflength, curlength = 0; X long curtime; X XtTextBlock text; X XtTextPosition start, end, oldend; X char *buf; X char tmpbuf[2*MAXNAME]; X X if (numfiles == 0) { X disp_message("\nList: no files found"); X clear_widget(listwidget, listsource); X return(-1); X } X X curtime = time(0); X oldend = X (*listsource->Scan)(listsource, 0, XtstAll, XtsdRight, 1, 0); X XtTextUnsetSelection(listwidget); X X start = 0; X buflength = BUFSIZE * numfiles; X buf = XtMalloc(buflength); X *buf = '\0'; X X for (i = 0; i < numfiles; i++) { X format_file(i, tmpbuf, curtime); X curlength += length = strlen(tmpbuf); X if ( (curlength) >= buflength) { X buflength += 1096; X buf = XtRealloc(buf, buflength); X } X X strcat(buf, tmpbuf); X files[i]->d_pos1 = start; X start = end = start + length; X files[i]->d_pos2 = end; X } X X allowedit = 1; X XtTextDisableRedisplay(listwidget); X X text.length = curlength; X text.ptr = buf; X text.firstPos = 0; X XtTextReplace(listwidget, 0, oldend, &text); X allowedit = 0; X X XtFree(buf); X XtTextSetInsertionPoint(listwidget, position); X XtTextEnableRedisplay(listwidget); X return(0); X} X X X/* ARGSUSED */ Xchar *get_userdir(user) Xchar *user; X{ X struct passwd *object; X X if ( (object = getpwnam(user)) == NULL) { X disp_message("\n: user name not found"); X return(NULL); X } X else X return(object->pw_dir); X} X X/* ARGSUSED */ Xint separate_dirpat(s, dir, pattern) Xchar *s, *dir, *pattern; X{ X /* if no pattern is found a "*" pattern is returned */ X int cc; X char *p; X struct stat statbuf; X X cc = stat(s, &statbuf); X if (cc != -1 && ( (statbuf.st_mode & S_IFMT) == S_IFDIR) ) X strcpy(pattern, "*"); X else { X p = rindex(s, '/'); X strcpy(pattern, p+1); X /* check if we are at the root directory */ X if (p != s) *p = '\0'; else *(p+1) = '\0'; X } X if (access(s, X_OK)) { *pattern = '\0'; return(-1); } X else { strcpy(dir, s); return(0); } X} X X X/* ARGSUSED */ Xint get_dirpat(s, dir, pattern) Xchar *s, *dir, *pattern; X{ X char *cwd, *p; X char directory[255]; X X if (s == NULL || !(*s) ) { X if ( (cwd = getcwd((char *)NULL, 255)) == (char *)NULL) { X disp_message("\ncannot get working directory"); X return(-1); X } X else { strcpy(dir, cwd); strcpy(pattern, "*"); return(0); } X } X X if (s[0] == '~') { X /* expand tilde with the user directory as defined in password X file */ X if ( (p = expand_tilde(s)) == (char *) NULL) return(-1); X strcpy(directory, p); X XtFree(p); X } X else if (s[0] == '/') { X /* full pathname specified */ X strcpy(directory, s); X } X else { X /* use the current directory setting */ X if (strlen(curdirectory) == 1) X sprintf(directory, "/%s", s); X else sprintf(directory, "%s/%s", curdirectory, s); X } X return(separate_dirpat(directory, dir, pattern)); X} X X X/* ARGSUSED */ Xint select_file(start, end) Xint start, end; X{ X int i = 0; X X while (i < numfiles && files[i]->d_pos1 <= start) i++; X if ( (files[i-1]->d_pos2 + 1) < end) return(-1); X else return(i-1); X} X X/* ARGSUSED */ Xint select_files(start, end, fstart, fend) Xint start, end; Xint *fstart, *fend; X{ X int i = 0; X X while (i < numfiles && files[i]->d_pos1 < start) i++; X if (i == numfiles) return(-1); else *fstart = i; X X while ( (i < numfiles - 1) && (files[i]->d_pos2 + 1 < end) ) i++; X X *fend = i; X return(0); X} END_OF_FILE if test 5872 -ne `wc -c <'list.c'`; then echo shar: \"'list.c'\" unpacked with wrong size! fi # end of 'list.c' fi if test -f 'option.h' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'option.h'\" else echo shar: Extracting \"'option.h'\" \(1919 characters\) sed "s/^X//" >'option.h' <<'END_OF_FILE' X/* X * Systems Sciences Laboratory, Webster Research Center X * X * Copyright (c) 1988 Xerox Corporation. All rights reserved. X * X * Copyright protection claimed includes all forms and matters of copyrightable X * material and information now allowed by statutory or judicial lay or X * herinafter granted, including without limitation, material generated from X * the software programs which are displayed on the screen such as icons, X * screen display looks, etc. X */ X X X#ifndef _option_h X#define _option_h X X/*********************************************************************** X * X * Option Widget (subclassed of Forms widget) X * X ***********************************************************************/ X X/* Parameters: X X Name Class RepType Default Value X ---- ----- ------- ------------- X background Background pixel White X border BorderColor pixel Black X borderWidth BorderWidth int 1 X destroyCallback Callback Pointer NULL X height Height int 0 X label Label String NULL X mappedWhenManaged MappedWhenManaged Boolean True X maximumLength Max int 256 X sensitive Sensitive Boolean True X orientation orientation orientation XtorientVertical X width Width int 0 X x Position int 0 X y Position int 0 X X*/ X X X#include <X11/Form.h> X X X#define XtNorientation "orientation" X Xtypedef struct _OptionClassRec *OptionWidgetClass; Xtypedef struct _OptionRec *OptionWidget; X Xextern WidgetClass optionWidgetClass; X Xextern void XtOptionAddOption(); /* parent, name, set */ X /* Wiget parent; */ X /* char *name; */ X /* Boolean set; */ X /* of all possible options only one may be selected X at a time */ X Xextern int XtOptionGetSelection(); /* widget */ X /* Widget w; */ X /* returns the index of the currently selected X option; numbered from 1 and in the sequence X of creation */ X X#endif _option_h X/* DON'T ADD STUFF AFTER THIS #endif */ END_OF_FILE if test 1919 -ne `wc -c <'option.h'`; then echo shar: \"'option.h'\" unpacked with wrong size! fi # end of 'option.h' fi if test -f 'optionP.h' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'optionP.h'\" else echo shar: Extracting \"'optionP.h'\" \(1635 characters\) sed "s/^X//" >'optionP.h' <<'END_OF_FILE' X/* X * Systems Sciences Laboratory, Webster Research Center X * X * Copyright (c) 1988 Xerox Corporation. All rights reserved. X * X * Copyright protection claimed includes all forms and matters of copyrightable X * material and information now allowed by statutory or judicial lay or X * herinafter granted, including without limitation, material generated from X * the software programs which are displayed on the screen such as icons, X * screen display looks, etc. X */ X X X/* Private definitions for option widget */ X X#ifndef _optiongP_h X#define _optionP_h X X#include "option.h" X#include "toggle.h" X#include <X11/FormP.h> X Xtypedef struct {int empty;} OptionClassPart; X Xtypedef struct _OptionClassRec { X CoreClassPart core_class; X CompositeClassPart composite_class; X ConstraintClassPart constraint_class; X FormClassPart form_class; X OptionClassPart option_class; X} OptionClassRec; X Xextern OptionClassRec optionClassRec; X Xtypedef struct _OptionPart { X /* resources */ X String label; /* title of option */ X XtOrientation orientation; /* orientation of options */ X /* private data */ X Widget labelW; /* widget to display description*/ X int select; /* index of currently selected X toggle widget */ X} OptionPart; X Xtypedef struct _OptionRec { X CorePart core; X CompositePart composite; X ConstraintPart constraint; X FormPart form; X OptionPart option; X} OptionRec; X Xtypedef struct {int empty;} OptionConstraintsPart; X Xtypedef struct _OptionConstraintsRec { X FormConstraintsPart form; X OptionConstraintsPart option; X} OptionConstraintsRec, *OptionConstraints; X X#endif _optionP_h END_OF_FILE if test 1635 -ne `wc -c <'optionP.h'`; then echo shar: \"'optionP.h'\" unpacked with wrong size! fi # end of 'optionP.h' fi if test -f 'toggle.h' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'toggle.h'\" else echo shar: Extracting \"'toggle.h'\" \(2032 characters\) sed "s/^X//" >'toggle.h' <<'END_OF_FILE' X/* X * Systems Sciences Laboratory, Webster Research Center X * X * Copyright (c) 1988 Xerox Corporation. All rights reserved. X * X * Copyright protection claimed includes all forms and matters of copyrightable X * material and information now allowed by statutory or judicial lay or X * herinafter granted, including without limitation, material generated from X * the software programs which are displayed on the screen such as icons, X * screen display looks, etc. X */ X X#ifndef _XtToggle_h X#define _XtToggle_h X X/*********************************************************************** X * X * Toggle Widget (subclassed from the Command widget); callback is X * ignored X * X ***********************************************************************/ X X#include <X11/CommandP.h> X X/* Resources: X X Name Class RepType Default Value X ---- ----- ------- ------------- X background Background pixel White X border BorderColor pixel Black X borderWidth BorderWidth int 0 X cursor Cursor Cursor hand2 X destroyCallback Callback Pointer NULL X font Font FontStruct fixed X foreground Foreground pixel Black X height Height int text height X highlightThickness Thickness int 2 X insensitiveBorder Insensitive Pixmap Gray X internalHeight Height int 2 X internalWidth Width int 4 X justify Justify Justify Center X label Label String NULL X state State State ToggleOn X mappedWhenManaged MappedWhenManaged Boolean True X sensitive Sensitive Boolean True X width Width int text width X x Position int 0 X y Position int 0 X X*/ X X#ifndef _XtState_e X#define _XtState_e X Xtypedef enum { X XtToggleOff = 0, /* toggle button is off & unset */ X XtToggleOn /* toggle button is on & set */ X} XtState; X#endif _XtState_e X X#define XtNstate "state" X Xextern WidgetClass toggleWidgetClass; X Xtypedef struct _ToggleClassRec *ToggleWidgetClass; Xtypedef struct _ToggleRec *ToggleWidget; X X#endif _XtToggle_h X/* DON'T ADD STUFF AFTER THIS */ END_OF_FILE if test 2032 -ne `wc -c <'toggle.h'`; then echo shar: \"'toggle.h'\" unpacked with wrong size! fi # end of 'toggle.h' fi if test -f 'toggleP.h' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'toggleP.h'\" else echo shar: Extracting \"'toggleP.h'\" \(1868 characters\) sed "s/^X//" >'toggleP.h' <<'END_OF_FILE' X/* X * Systems Sciences Laboratory, Webster Research Center X * X * Copyright (c) 1988 Xerox Corporation. All rights reserved. X * X * Copyright protection claimed includes all forms and matters of copyrightable X * material and information now allowed by statutory or judicial lay or X * herinafter granted, including without limitation, material generated from X * the software programs which are displayed on the screen such as icons, X * screen display looks, etc. X */ X X/* X * ToggleP.h - Private definitions for Toggle widget X * X */ X X#ifndef _XtToggleP_h X#define _XtToggleP_h X X#include "toggle.h" X#include <X11/CommandP.h> X X/*********************************************************************** X * X * Toggle Widget Private Data X * X ***********************************************************************/ X X/************************************ X * X * Class structure X * X ***********************************/ X X X /* New fields for the Command widget class record */ Xtypedef struct _ToggleClass X { X int makes_compiler_happy; /* not used */ X } ToggleClassPart; X X /* Full class record declaration */ Xtypedef struct _ToggleClassRec { X CoreClassPart core_class; X SimpleClassPart simple_class; X LabelClassPart label_class; X CommandClassPart command_class; X ToggleClassPart toggle_class; X} ToggleClassRec; X Xextern ToggleClassRec toggleClassRec; X X/*************************************** X * X * Instance (widget) structure X * X **************************************/ X X /* New fields for the Command widget record */ Xtypedef struct { X /* resources */ X XtState state; X} TogglePart; X X X /* Full widget declaration */ Xtypedef struct _ToggleRec { X CorePart core; X SimplePart simple; X LabelPart label; X CommandPart command; X TogglePart toggle; X} ToggleRec; X X#define XtCState "State" X#define XtRState "State" X X#endif _XtToggleP_h X X END_OF_FILE if test 1868 -ne `wc -c <'toggleP.h'`; then echo shar: \"'toggleP.h'\" unpacked with wrong size! fi # end of 'toggleP.h' fi if test -f 'xbrowser.icon' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'xbrowser.icon'\" else echo shar: Extracting \"'xbrowser.icon'\" \(2276 characters\) sed "s/^X//" >'xbrowser.icon' <<'END_OF_FILE' X#define xbrowser_width 50 X#define xbrowser_height 50 Xstatic char xbrowser_bits[] = { X 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, X 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, X 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x18, 0x00, 0x00, 0xc0, X 0xff, 0x03, 0x00, 0x0c, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0xec, 0x00, X 0x00, 0x18, 0x0c, 0x04, 0x00, 0x37, 0x00, 0x00, 0xc6, 0x83, 0x87, 0xff, X 0x19, 0x07, 0x00, 0x20, 0x78, 0xfc, 0x60, 0xff, 0x01, 0x00, 0x18, 0xcf, X 0x03, 0x90, 0xd9, 0x79, 0x00, 0x8c, 0x31, 0xf8, 0xff, 0x0f, 0x0f, 0x00, X 0x66, 0x0c, 0xfe, 0xff, 0xdf, 0x07, 0x00, 0x32, 0xc7, 0xff, 0xff, 0x7f, X 0x18, 0x00, 0xd9, 0xf1, 0xff, 0xff, 0xff, 0x10, 0x00, 0x64, 0xf8, 0x7f, X 0xbf, 0xf6, 0x60, 0x00, 0x10, 0xfe, 0xd7, 0x55, 0xc5, 0x41, 0x00, 0x08, X 0x7f, 0xb6, 0xaf, 0xaa, 0x03, 0x00, 0x84, 0x87, 0xea, 0x5f, 0x3d, 0x0f, X 0x00, 0xc2, 0x29, 0xbe, 0xbf, 0xca, 0x1f, 0x00, 0xe2, 0xa2, 0xd6, 0x7f, X 0x2d, 0x3e, 0x00, 0x7f, 0x08, 0xba, 0xbf, 0xda, 0x7d, 0x00, 0x3f, 0x81, X 0x5a, 0x1f, 0x0d, 0xe2, 0x03, 0x3f, 0x2c, 0xbe, 0x4e, 0xca, 0xb9, 0x03, X 0x9f, 0x82, 0x54, 0x65, 0x05, 0xe9, 0x00, 0x34, 0x2a, 0xac, 0xaa, 0x86, X 0x6c, 0x03, 0xb4, 0x40, 0x59, 0x55, 0x03, 0xae, 0x00, 0x5c, 0x2c, 0xb4, X 0xaa, 0x01, 0x53, 0x00, 0xf8, 0x51, 0x61, 0xd5, 0x80, 0x3d, 0x00, 0x50, X 0x0f, 0x94, 0x3f, 0x80, 0x68, 0x00, 0x60, 0x9d, 0x15, 0x00, 0x60, 0x8c, X 0x00, 0xc0, 0xf2, 0x01, 0x00, 0xbc, 0x87, 0x00, 0x00, 0xaf, 0xff, 0xff, X 0x03, 0x0e, 0x00, 0x00, 0x7c, 0x01, 0x00, 0xf0, 0x19, 0x00, 0x04, 0xc0, X 0x03, 0x00, 0xfc, 0x30, 0x00, 0x64, 0x00, 0x1e, 0x00, 0x97, 0x01, 0x00, X 0x2e, 0x00, 0xe0, 0xff, 0x11, 0x03, 0x00, 0x26, 0x02, 0x00, 0x00, 0x20, X 0x06, 0x00, 0x90, 0x02, 0x00, 0x00, 0x20, 0x04, 0x00, 0xf2, 0x0e, 0x02, X 0x00, 0x20, 0x00, 0x00, 0x12, 0x18, 0x34, 0x00, 0x00, 0x00, 0x00, 0x47, X 0x1b, 0xc0, 0xbe, 0x06, 0x40, 0x00, 0xc4, 0x73, 0x06, 0x00, 0x00, 0x7c, X 0x00, 0xb4, 0x43, 0xa8, 0xbe, 0xdb, 0x07, 0x00, 0x04, 0x01, 0x00, 0x00, X 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x0f, 0x00, 0x00, 0x00, 0x00, X 0xbf, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, X 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, X 0x00, 0x00}; END_OF_FILE if test 2276 -ne `wc -c <'xbrowser.icon'`; then echo shar: \"'xbrowser.icon'\" unpacked with wrong size! fi # end of 'xbrowser.icon' fi if test -f 'xfilebrowser.h' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'xfilebrowser.h'\" else echo shar: Extracting \"'xfilebrowser.h'\" \(5581 characters\) sed "s/^X//" >'xfilebrowser.h' <<'END_OF_FILE' X/* X * Systems Sciences Laboratory, Webster Research Center X * X * Copyright (c) 1988 Xerox Corporation. All rights reserved. X * X * Copyright protection claimed includes all forms and matters of copyrightable X * material and information now allowed by statutory or judicial lay or X * herinafter granted, including without limitation, material generated from X * the software programs which are displayed on the screen such as icons, X * screen display looks, etc. X */ X X X#include <stdio.h> X#include <sys/types.h> X#include <sys/dir.h> X#include <sys/stat.h> X X#include <X11/Xlib.h> X#include <X11/IntrinsicP.h> X X#include <X11/cursorfont.h> X#include <X11/Box.h> X#include <X11/Label.h> X#include <X11/StringDefs.h> X#include <X11/Command.h> X#include <X11/VPaned.h> X#include <X11/Viewport.h> X#include <X11/AsciiTextP.h> X#include <X11/Shell.h> X#include <X11/Dialog.h> X#include "toggle.h" X#include "option.h" X X X X X#define max(a,b) (((a) > (b)) ? (a) : (b)) X#define min(a,b) (((a) < (b)) ? (a) : (b)) X X#define Feep() XBell(curdisplay, 20) X X#define MakeArg(n, v){ args[numargs].name = n; \ X args[numargs].value = v; \ X numargs++; \ X } X#define MAXNAME 255 X X X/* data structures */ Xtypedef struct _lineelement { X XtTextPosition pa; /* specifies start position of line */ X XtTextPosition pe; /* specifies end position of line */ X int linenumber; /* line number in text file */ X struct _lineelement *next; X} LineElement; X Xtypedef struct _searchelement { X XtTextPosition pos1; /* specifies start position in widget */ X XtTextPosition pos2; /* specifies end position in widget */ X LineElement *lines; /* list of linenumbers */ X char name[MAXNAME + 1]; /* file name */ X} SearchElement; X Xstruct afile { X u_short d_marked; /* file marked for deletion */ X char d_type; /* file type, e.g. 'd', 'c', 'f' */ X u_short d_nl; /* number of links */ X u_short d_uid; /* owner id */ X u_short d_gid; /* group id */ X u_short d_nlink; /* number of hard links */ X char d_access[12]; /* access rights */ X u_long d_size; /* file size */ X u_long d_ctime; /* last modification time */ X XtTextPosition d_pos1; /* start position of display */ X XtTextPosition d_pos2; /* end position of display */ X u_long d_ino; /* inode number of entry */ X u_short d_reclen; /* length of this record */ X u_short d_namlen; /* length of string in d_name */ X char d_name[MAXNAME + 1]; /* name must be no longer than this */ X}; X Xtypedef struct _dialogdata { X Widget w; /* widget which requested dialog */ X int start; /* index to first selected file in files[] */ X int end; /* index to last selected file in files[] */ X int current; /* index to currently handled file in files[] */ X char *answer; /* dialog provided by user */ X Boolean diag; /* save standard diagnostics */ X Boolean out; /* save standard output */ X int (*yes)(); /* yes function */ X int (*no)(); /* no function */ X int (*cancel)(); /* cancel function */ X} DialogData; X X/* X * The DIRSIZ macro gives the minimum record length which will hold X * the directory entry. This requires the amount of space in struct direct X * without the d_name field, plus enough space for the name with a terminating X * null byte (dp->d_namlen+1), rounded up to a 4 byte boundary. X */ X X#define MYDIRSIZ(dp, length) \ X ((sizeof (struct afile) - (MAXNAME+1)) + \ X (((dp)->d_namlen+1 + 3 + length) &~ 3)) X X X/* misc externs */ Xextern char *XtMalloc(); Xextern char *XtRealloc(); Xextern char *XtCalloc(); Xextern char *index(); Xextern char *rindex(); Xextern char *getcwd(); X X X/* externs in xfilebrowser.c */ Xextern char *filepattern; Xextern char *searchpattern; Xextern char *curdirectory; Xextern char *oldpattern; Xextern char *cmdline; Xextern int viewEdit; X Xextern struct afile **files; Xextern int numfiles; Xextern SearchElement **hitfiles; Xextern int numhitfiles; Xextern int allowedit; X Xextern Widget toplevel; Xextern Widget outer; Xextern Widget messwidget; Xextern Widget listwidget; Xextern Widget dirwidget; Xextern Widget fpatwindow; Xextern Widget grepwidget; X XWidget quitbutton; /* command button for quit */ XWidget listbutton; /* command button for list */ XWidget editbutton; /* command button for edit file selected X in directory listing */ XWidget parentdirbutton; /* command button for selecting X parent directory */ XWidget shellbutton; /* command button for invoking shell */ XWidget copybutton; /* command button for invoking copy */ XWidget renamebutton; /* command button for invoking rename */ XWidget deletebutton; /* command button for invoking delete on files */ X XWidget grepbutton; /* command button for invoking grep on files */ XWidget grepwindow; /* string box to specify the grep search pattern */ XWidget grepeditbutton; /* command button for edit file selected X in list of searched files */ X Xextern Display *curdisplay; Xextern XtTextSource messsource, listsource, grepsource; X X/* externals in util.c */ Xextern Widget makeCommandButton(); Xextern Widget makeBooleanButton(); Xextern Widget makeStringBox(); Xextern int select_file(); Xextern char *expand_tilde(); X X/* externs in commands.c */ Xextern DoQuit(); Xextern DoList(); Xextern DoEdit(); Xextern DoGrep(); Xextern DoChangeDir(); Xextern DoShell(); Xextern DoParent(); Xextern DoGrepEdit(); Xextern DoCopy(); Xextern DoRename(); Xextern DoDelete(); X X/* externs in ap.c */ Xextern XtTextSource TCreateApAsSource(); X X/* externs in popup.c */ Xextern int create_confirm(); Xextern int confirm_prompt(); Xextern int check_confirm(); Xextern int check_prompt(); X X/* externs in scandir.c */ Xextern int check_option(); Xextern int currentid; X END_OF_FILE if test 5581 -ne `wc -c <'xfilebrowser.h'`; then echo shar: \"'xfilebrowser.h'\" unpacked with wrong size! fi # end of 'xfilebrowser.h' 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 need to unpack the following archives: echo " " ${MISSING} fi ## End of shell archive. exit 0 -- Mike Wexler(wyse!mikew) Phone: (408)433-1000 x1330 Moderator of comp.sources.x