home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!cs.utexas.edu!rutgers!netnews.upenn.edu!netnews.cc.lehigh.edu!ns1.cc.lehigh.edu!dlj0
- From: dlj0@ns1.cc.lehigh.edu (DAVID L. JOHNSON)
- Newsgroups: comp.os.linux
- Subject: Patch for aXe-3.0.1
- Message-ID: <1992Sep4.042833.259149@ns1.cc.lehigh.edu>
- Date: 4 Sep 92 04:28:33 GMT
- Organization: Lehigh University
- Lines: 536
-
- After several attempts, and with much help, I got aXe up and running, but had
- to sweep up core dumps all the time. A shame, 'cause it's a nice, quick,
- easy editor.
-
- I took my problem to the source, who provided a fix: I don't understand why
- it works, but the core dumps are gone, and it seems stable! Here it is, in his
- own words:
-
- Subject: Re: aXe-3.0.1
- Reply-To: J.K.Wight@newcastle.ac.uk
-
- > If you can come up with a fix for linux, I'd love to hear about it.
-
- This is just an empirical shot in the dark, but it might be worth a try.
-
- In Destroy in FileNom.c try moving the line
-
- XtDestroyWidget(Child(fnw,filename));
-
- to the top of the list of similar calls.
-
- Aside from this rather mystical fix, you will need to find scandir.c and
- alphasort.c. Here are the versions I used:
-
- -----8<-----8<-----8<-----8<-----8<-----8<-----8<-----8<
-
- scandir.c:
-
- /*
- ** SCANDIR
- ** Scan a directory, collecting all (selected) items into a an array.
- */
- #ifndef MAXHOSTNAMELEN
- #define MAXHOSTNAMELEN 64
- #endif
- #include <sys/types.h>
- #include <dirent.h>
-
-
- /* Initial guess at directory size. */
- #define INITIAL_SIZE 20
-
- extern char *malloc();
- extern char *realloc();
- extern char *strcpy();
-
- int
- scandir(name, list, selector, sorter)
- char *name;
- struct dirent ***list;
- int (*selector)();
- int (*sorter)();
- {
- register struct dirent **names;
- register struct dirent *entp;
- register DIR *dirp;
- register int i;
- register int size;
-
- /* Get initial list space and open directory. */
- size = INITIAL_SIZE;
- names = (struct dirent **)malloc(size * sizeof names[0]);
- if (names == NULL)
- return -1;
- dirp = opendir(name);
- if (dirp == NULL)
- return -1;
-
- /* Read entries in the directory. */
- for (i = 0; entp = readdir(dirp); )
- if (selector == NULL || (*selector)(entp)) {
- /* User wants them all, or he wants this one. */
- if (++i >= size) {
- size <<= 1;
- names = (struct dirent **)
- realloc((char *)names, size * sizeof names[0]);
- if (names == NULL) {
- closedir(dirp);
- return -1;
- }
- }
-
- /* Copy the entry. */
- #ifdef DIRSIZ
- names[i - 1] = (struct dirent *)malloc(DIRSIZ(entp));
- #else
- names[i - 1] = (struct dirent *)malloc(sizeof(struct dirent)
- + strlen(entp->d_name)+1);
- #endif
- if (names[i - 1] == NULL) {
- closedir(dirp);
- return -1;
- }
- names[i - 1]->d_ino = entp->d_ino;
- names[i - 1]->d_reclen = entp->d_reclen;
- (void)strcpy(names[i - 1]->d_name, entp->d_name);
- }
-
- /* Close things off. */
- names[i] = NULL;
- *list = names;
- closedir(dirp);
-
- /* Sort? */
- if (i && sorter)
- qsort((char *)names, i, sizeof names[0], sorter);
-
- return i;
- }
- -----8<-----8<-----8<-----8<-----8<-----8<-----8<-----8<-----8<
-
- alphasort.c
-
- /*
- ** ALPHASORT
- ** Trivial sorting predicate for scandir; puts entries in alphabetical order.
- */
-
- #include <sys/types.h>
- #include <dirent.h>
-
- int
- alphasort(d1, d2)
- struct diret **d1;
- struct dirent **d2;
- {
- return strcmp(d1[0]->d_name, d2[0]->d_name);
- }
-
- -----8<-----8<-----8<-----8<-----8<-----8<-----8<-----8<
-
-
- You might also get some help from my Makefile:
-
-
- # Makefile generated by imake - do not edit!
- # $XConsortium: imake.c,v 1.65 91/07/25 17:50:17 rws Exp $
-
- # -------------------------------------------------------------------------
- # 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 parametes 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).
- #
-
- # -------------------------------------------------------------------------
- # site-specific configuration parameters that need to come before
- # the platform-specific parameters - edit site.def to change
-
- # site: $XConsortium: site.def,v 1.2 91/07/30 20:26:44 rws Exp $
-
- # -------------------------------------------------------------------------
- # platform-specific configuration parameters - edit linux.cf to change
-
- # platform: $XConsortium: linux.cf,v 1.16 91/08/26 11:23:34 rws Exp $
-
- # operating system: Linux
-
- # -------------------------------------------------------------------------
- # site-specific configuration parameters that go after
- # the platform-specific parameters - edit site.def to change
-
- # site: $XConsortium: site.def,v 1.2 91/07/30 20:26:44 rws Exp $
-
- SHELL = /bin/sh
-
- TOP = .
- CURRENT_DIR = .
-
- AR = ar clq
- BOOTSTRAPCFLAGS =
- CC = gcc -m486 -DUSG -Dcfree=free
- AS = as
-
- FC = f77
- FDEBUGFLAGS =
- FCFLAGS = $(FDEBUGFLAGS)
-
- COMPRESS = compress
- CPP = /lib/cpp $(STD_CPP_DEFINES)
- PREPROCESSCMD = gcc -m486 -DUSG -Dcfree=free -E $(STD_CPP_DEFINES)
- INSTALL = install
- LD = ld
- LINT = lint
- LINTLIBFLAG = 0
- LINTOPTS = -axz
- LN = ln -s
- MAKE = make
- MV = mv
- CP = cp
-
- RANLIB = ranlib
- RANLIBINSTFLAGS =
-
- RM = rm -f
- TROFF = psroff
- MSMACROS = -ms
- TBL = tbl
- EQN = eqn
- STD_INCLUDES = </usr/include/stdlib.h>
- STD_CPP_DEFINES =
- STD_DEFINES =
- EXTRA_LOAD_FLAGS =
- EXTRA_LIBRARIES =
- TAGS = ctags
-
- PROTO_DEFINES = -DFUNCPROTO=11 -DNARROWPROTO
-
- INSTPGMFLAGS = -s
-
- INSTBINFLAGS = -m 0755
- INSTUIDFLAGS = -m 4755
- INSTLIBFLAGS = -m 0644
- INSTINCFLAGS = -m 0444
- INSTMANFLAGS = -m 0444
- INSTDATFLAGS = -m 0444
- INSTKMEMFLAGS = -m 4755
-
-
- CDEBUGFLAGS =
- CCOPTIONS =
-
- ALLINCLUDES = $(INCLUDES) $(EXTRA_INCLUDES) $(TOP_INCLUDES) $(STD_INCLUDES)
- ALLDEFINES = $(ALLINCLUDES) $(STD_DEFINES) $(EXTRA_DEFINES) $(PROTO_DEFINES) $(DEFINES)
- CFLAGS = $(CDEBUGFLAGS) $(CCOPTIONS) $(ALLDEFINES)
- LINTFLAGS = $(LINTOPTS) -DLINT $(ALLDEFINES)
-
- LDLIBS = $(SYS_LIBRARIES) $(EXTRA_LIBRARIES)
-
- LDOPTIONS = $(CDEBUGFLAGS) $(CCOPTIONS) $(LOCAL_LDFLAGS)
-
- LDCOMBINEFLAGS = -X -r
- DEPENDFLAGS =
-
- MACROFILE = linux.cf
- RM_CMD = $(RM) *.CKP *.ln *.BAK *.bak *.o core errs ,* *~ *.a .emacs_* tags TAGS make.log MakeOut
-
- IMAKE_DEFINES =
- IMAKE_DEFINES =
-
- IRULESRC = $(CONFIGDIR)
- IMAKE_CMD = $(IMAKE) -DUseInstalled -I$(IRULESRC) $(IMAKE_DEFINES)
-
- ICONFIGFILES = $(IRULESRC)/Imake.tmpl $(IRULESRC)/Imake.rules $(IRULESRC)/Project.tmpl $(IRULESRC)/site.def $(IRULESRC)/$(MACROFILE) $(EXTRA_ICONFIGFILES)
-
- # -------------------------------------------------------------------------
- # X Window System Build Parameters
- # $XConsortium: Project.tmpl,v 1.138 91/09/10 09:02:12 rws Exp $
-
- # -------------------------------------------------------------------------
- # X Window System make variables; this need to be coordinated with rules
-
- PATHSEP = /
- USRLIBDIR = /usr/lib
- BINDIR = /usr/bin/X11
- INCROOT = /usr/include
- BUILDINCROOT = $(TOP)
- BUILDINCDIR = $(BUILDINCROO)/X11
- BUILDINCTOP = ..
- INCDIR = $(INCROOT)/X11
- ADMDIR = /usr/adm
- LIBDIR = $(USRLIBDIR)/X11
- CONFIGDIR = $(LIBDIR)/config
- LINTLIBDIR = $(USRLIBDIR)/lint
-
- FONTDIR = $(LIBDIR)/fonts
- XINITDIR = $(LIBDIR)/xinit
- XDMDIR = $(LIBDIR)/xdm
- TWMDIR = $(LIBDIR)/twm
- MANPATH = /usr/man
- MANSOURCEPATH = $(MANPATH)/man
- MANSUFFIX = n
- LIBMANSUFFIX = 3
- MANDIR = $(MANSOURCEPATH)$(MANSUFFIX)
- LIBMANDIR = $(MANSOURCEPATH)$(LIBMANSUFFIX)
- NLSDIR = $(LIBDIR)/nls
- PEXAPIDIR = $(LIBDIR)/PEX
- XAPPLOADDIR = $(LIBDIR)/app-defaults
- FONTCFLAGS = -t
-
-
- INSTAPPFLAGS = $(INSTDATFLAGS)
-
- IMAKE = imake
- DEPEND = makedepend
- RGB = rgb
-
- FONTC = bdftopcf
-
- MKFONTDIR = mkfontdir
- MKDIRHIER = /bin/sh $(BINDIR)/mkdirhier
-
- CONFIGSRC = $(TOP)/config
- DOCUTILSRC = $(TOP)/doc/util
- CLIENTSRC = $(TOP)/clients
- DEMOSRC = $(TOP)/demos
- LIBSRC = $(TOP)/lib
- FONTSRC = $(TOP)/fonts
- INCLUDESRC = $(TOP)/X11
- SERVERSRC = $(OP)/server
- UTILSRC = $(TOP)/util
- SCRIPTSRC = $(UTILSRC)/scripts
- EXAMPLESRC = $(TOP)/examples
- CONTRIBSRC = $(TOP)/../contrib
- DOCSRC = $(TOP)/doc
- RGBSRC = $(TOP)/rgb
- DEPENDSRC = $(UTILSRC)/makedepend
- IMAKESRC = $(CONFIGSRC)
- XAUTHSRC = $(LIBSRC)/Xau
- XLIBSRC = $(LIBSRC)/X
- XMUSRC = $(LIBSRC)/Xmu
- TOOLKITSRC = $(LIBSRC)/Xt
- AWIDGETSRC = $(LIBSRC)/Xaw
- OLDXLIBSRC = $(LIBSRC)/oldX
- XDMCPLIBSRC = $(LIBSRC)/Xdmcp
- BDFTOSNFSRC = $(FONTSRC)/bdftosnf
- BDFTOSNFSRC = $(FONTSRC)/clients/bdftosnf
- BDFTOPCFSRC = $(FONTSRC)/clients/bdftopcf
- MKFONTDIRSRC = $(FONTSRC)/clients/mkfontdir
- FSLIBSRC = $(FONTSRC)/lib/fs
- FONTSERVERSRC = $(FONTSRC)/server
- EXTENSIONSRC = $(TOP)/extensions
- XILIBSRC = $(EXTENSIONSRC)/lib/xinput
- PHIGSLIBSRC = $(EXTENSIONSRC)/lib/PEX
-
-
- DEPEXTENSIONLIB = $(USRLIBDIR)/libXext.a
- EXTENSIONLIB = -lXext
-
- DEPXLIB = $(DEPEXTENSIONLIB) $(USRLIBDIR)/libX11.a
- XLIB = $(EXTENSIONLIB) -lX11
-
- DEPXAUTHLIB = $(USRLIBDIR)/libXau.a
- XAUTHLIB = -lXau
- DEPXDMCPLIB = $(USRLIBDIR)/libXdmcp.a
- XDMCPLIB = -lXdmcp
-
- DEPXMULIB = $(USRLIBDIR)/libXmu.a
- XMULIB = -lXmu
-
- DEPOLDXLIB = $(USRLIBDIR)/liboldX.a
- OLDXLIB = -loldX
-
- DEPXTOOLLIB = $(USRLIBDIR)/libXt.a
- XTOOLLIB = -lXt
-
- DEPXAWLIB = $(USRLIBDIR)/libXaw.a
- XAWLIB = -lXaw
-
- DEPXILIB = $(USRLIBDIR)/libXi.a
- XILIB = -lXi
-
- DEPPHIGSLIB = $(USRLIBDIR)/libphigs.a
- PHIGSLIB = -lphigs
-
- DEPXBSDLIB = $(USRLIBDIR)/libXbsd.a
- XBSDLIB = -lXbsd
-
- LINTEXTENSIONLIB = $(LINTLIBDIR)/llib-lXext.ln
- LINTXLIB = $(LINTLIBDIR)/llib-lX11.ln
- LINTXMU = $(LINTLIBDIR)/llib-lXmu.ln
- LINTXTOOL = $(LINTLIBDIR)/llib-lXt.ln
- LINTXAW = $(LINTLIBDIR)/llib-lXaw.ln
- LINTXI = $(LINTLIBDIR)/llib-lXi.n
- LINTPHIGS = $(LINTLIBDIR)/llib-lphigs.ln
-
- DEPLIBS = $(DEPXAWLIB) $(DEPXMULIB) $(DEPXTOOLLIB) $(DEPXLIB)
-
- DEPLIBS1 = $(DEPLIBS)
- DEPLIBS2 = $(DEPLIBS)
- DEPLIBS3 = $(DEPLIBS)
-
- # -------------------------------------------------------------------------
- # 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 $
-
- # ------------------------------------------------------------------------
- # start of Imakefile
-
- Bindir = /usr/local/bin
-
- Appdir = /usr/lib/X11/app-defaults
-
- Mandir = /usr/man/man1
-
- Helpdir = /usr/lib/X11
-
- R5ONLY_SRCS = Viewlist.c
- R5ONLY_OBJS = Viewlist.o
-
- TABLE_SRCS = Table.c TableVec.c TableLoc.c
- TABLE_OBJS = Table.o TableVec.o TableLoc.o
-
-
- SRCS = ${TABLE_SRCS} AxeWindow.c AxeEditor.c AxeMenuBtn.c AxeSimMenu.c AxeSmeBSB.c AxeCommand.c AxeTextDeck.c AxeText.c AxeiiText.c FileNomWin.c FileNom.c alphasort.c scandir.c ${R5ONLY_SRCS} ${R4ONLY_SRCS} ScrollText.c NumericPad.c CtrlCodeSel.c Preference.c Confirmer.c insertfile.c match.c axe.c
-
- OBJS = ${TABLE_OBJS} AxeWindow.o AxeEditor.o AxeMenuBtn.o AxeSimMenu.o AxeSmeBSB.o AxeTextDeck.o AxeCommand.o AxeText.o AxeiiText.o FileNomWin.o FileNom.o alphasort.o scandir.o ${R5ONLY_OBJS} ${R4ONLY_OBJS} ScrollText.o NumericPad.o CtrlCodeSel.o Preference.o Confirmer.o insertfile.o match.o axe.o
-
- EXTRA_INCLUDES = -I.
- LOCAL_LIBRARIES = $(XAWLIB) $(XMULIB) $(XTOOLLIB) $(XLIB)
-
- DEPLIBS = $(DEPXAWLIB) $(DEPXMULIB) $(DEPXTOOLLIB) $(DEPXLIB)
-
- PROGRAM = axe
-
- all::
- @echo Making in .
-
- all:: axe
-
- axe: $(OBJS) $(DEPLIBS)
- $(RM) $@
- $(CC) -o $@ $(OBJS) $(LDOPTIONS) $(LOCAL_LIBRARIES) $(LDLIBS) $(EXTRA_LOAD_FLAGS)
-
- \
- install::
- @if [ -d $(DESTDIR)${Bindir} ]; then set +x; \
- else (set -x; $(MKDIRHIER) $(DESTDIR)${Bindir}); fi
- @if [ -d $(DESTDIR)${Appdir} ]; then set +x; \
- else (set -x; $(MKDIRHIER) $(DESTDIR)${Appdir}); fi
- @if [ -d $(DESTDIR)${Mandir} ]; then set +x; \
- else (set -x; $(MKDIRHIER) $(DESTDIR)${Mandir}); fi
- @if [ -d $(DESTDIR)${Helpdir} ]; then set +x; \
- else (set -x; $(MKDIRHIER) $(DESTDIR)${Helpdir}); fi
-
- install:: axe
- @if [ -d $(DESTDIR)${Bindir} ]; then set +x; \
- else (set -x; $(MKDIRHIR) $(DESTDIR)${Bindir}); fi
- $(INSTALL) -c $(INSTPGMFLAGS) axe $(DESTDIR)${Bindir}
-
- install.man:: axe.man
- @if [ -d $(DESTDIR)${Mandir} ]; then set +x; \
- else (set -x; $(MKDIRHIER) $(DESTDIR)${Mandir}); fi
- $(INSTALL) -c $(INSTMANFLAGS) axe.man $(DESTDIR)${Mandir}/axe.$(MANSUFFIX)
-
- depend::
- $(DEPEND) $(DEPENDFLAGS) -s "# DO NOT DELETE" -- $(ALLDEFINES) -- $(SRCS)
-
- lint:
- $(LINT) $(LINTFLAGS) $(SRCS) $(LINTLIBS)
- lint1:
- $(LINT) $(LINTFLAGS) $(FILE) $(LINTLIBS)
-
- clean::
- $(RM) $(PROGRAM)
-
- install:: Axe.ad
- @if [ -d $(DESTDIR)${Appdir} ]; then set +x; \
- else (set -x; $(MKDIRHIER) $(DESTDIR)${Appdir}); fi
- $(INSTALL) -c $(INSTAPPFLAGS) Axe.ad $(DESTDIR)${Appdir}/Axe
-
- install:: axe.help.gnrl axe.help.bind axe.help.cust axe.help.pops axe.help.chng
- @if [ -d $(DESTDIR)${Helpdir} ]; then set +x; \
- else (set -x; $(MKDIRHIER) $(DESTDIR)${Helpdir}); fi
- @case '${MFLAGS}' in *[i]*) set +e;; esac; \
- for i in axe.help.gnrl axe.help.bind axe.help.cust axe.help.pops axe.help.chng; do \
- (set -x; $(INSTALL) -c $(INSTALLFLAGS) $$i $(DESTDIR)${Helpdir}); \
- done
-
- AxeEditor.o:
- $(RM) $@
- $(CC) -c $(CFLAGS) -DHELPDIR=\"${Helpdir}\" $*.c
-
- all:: coaxe
-
- coaxe: coaxe.o
- $(RM) $@
- $(CC) -o $@ coaxe.o $(LDOPTIONS) -lX11 $(LDLIBS) $(EXTRA_LOAD_FLAGS)
-
-
- clean::
- $(RM) coaxe
-
- install:: coaxe
- @if [ -d $(DESTDIR)${Bindir} ]; then set +x; \
- else (set -x; $(MKDIRHIER) $(DESTDIR)${Bindir}); fi
- $(INSTALL) -c $(INSTPGMFLAGS) coaxe $(DESTDIR)${Bindir}
- install::
- if [ -f ${Bindir}/faxe ]; then set +x; \
- else (set -x; ln ${Bindir}/coaxe ${Bindir}/faxe); fi
- if [ -f ${Bindir}/poleaxe ]; then set +x; \
- else (set -x; ln ${Bindir}/coaxe ${Bindir}/poleaxe); fi
-
- # -------------------------------------------------------------------------
- # common rules for all Makefiles - do not edit
-
- emptyrule::
-
- clean::
- $(RM_CMD) "#"*
-
- Makefile::
- -@if [ -f Makefile ]; then set -x; \
- $(RM) Makefile.bak; $(MV) Makefile Makefile.bak; \
- else exit 0; fi
- $(IMAKE_CMD) -DTOPDIR=$(TOP) -DCURDIR=$(CURRENT_DIR)
-
- tags::
- $(TAGS) -w *.[ch]
- $(TAGS) -xw *.[ch] > TAGS
-
- # -------------------------------------------------------------------------
- # empty rules for directories that do not have SUBDIRS - do not edit
-
- install::
- @echo "install in $(CURRENT_DIR) done"
-
- install.man::
- @echo "install.man in $(CURRENT_DIR) done"
-
- Makefiles::
-
- includes::
-
- # -------------------------------------------------------------------------
- # dependencies generated by makedepend
-
-
-
- Just use the Makefile as a template; it was cut-and-pasted in. Run xmkmf
- and then make any of these changes you feel might be needed. Obviously
- the additions of scandir and alphasort are needed.
- --
- Sincerely,
-
- David L. Johnson ID: dlj0@ns1.cc.lehigh.edu
- Christmas-Saucon Hall #14, rm 211
- Department of Mathematics
-
- Lehigh University Telephone: 215-758-3759 (office)
-