pgd@bbt.se (01/25/91)
This is my package to make shared libraries on the Xenix/386 operating system. It is specially geared toward the X-Windows user, and included is a makefile to make X11R4 shared libraries. ---- Cut Here and unpack ---- #!/bin/sh # This is Xenixshlib, a shell archive (shar 3.32) # made 01/25/1991 10:47 UTC by pgd@compuram.bbt.se # Source directory /u/pgd/coff # # existing files WILL be overwritten # # This shar contains: # length mode name # ------ ---------- ------------------------------------------ # 7205 -rw-r----- README # 7778 -rw-r--r-- Makefile # 10959 -rw-rw---- makestub.c # 13743 -rw-rw---- convcoff.c # 6906 -r--r--r-- hash.c # 1686 -r--r--r-- hash.h # 1049 -rw-rw---- libX11_start.c # 2479 -rw-rw---- libc_jump.s # 10793 -rw-rw---- libX11_jump.s # 2027 -rw-rw---- libXmu_jump.s # 8376 -rw-rw---- libXt_jump.s # 2653 -rw-rw---- libXaw_jump.s # 1475 -rw-rw---- libXext_jump.s # 296 -rw-rw---- Scrt0.s # 418 -rw-rw---- libX11_s.c # 99 -rw-rw---- hello.c # 4277 -rw-rw---- coffhdr.c # 1516 -rw-rw---- xcc.c # 993 -rw-rw---- coffstrip.c # 10837 -rw------- malloc.c # 30 -rw-rw---- libX11_ver.c # 323 -rw-rw---- libXaw_s.c # 4678 -rw-rw---- xenix.cf # 2158 -rw-rw---- Project.example # if touch 2>&1 | fgrep 'amc' > /dev/null then TOUCH=touch else TOUCH=true fi # ============= README ============== echo "x - extracting README (Text)" sed 's/^X//' << 'SHAR_EOF' > README && X SHARED LIBRARY PACKAGE FOR XENIX X -------------------------------- X XAuthor: P.Garbha (pgd@compuram.bbt.se) 22-Jan-91 X X XHere is my shared library package for xenix. XIt allows you to build your own shared libraries, and build Xprograms that use them. X XIn the package are the following programs: X X convcoff - convert a x.out file to a coff file X coffhdr - Prints out the coff header (like hdr) X coffstrip - strip for coff files X xcc - cc command for building X-windows X makestub - Make the stub sources for a library. X Normally only used by the Makefile X libX11_s - Shared library for X11 (created) X libX11_s.a - Stub library using libX11_s (created) X libXaw_s - Shared library for Xaw including Xt (created) X libXaw_s.a - Stub library for libXaw_s X libXc.a - Special version of the libc.a library due to X problems with the Xenix ld program. X hello - A test program with example build in the Makefile X Scrt0.o - Run-time startup to be used when the shared library X hash.* - hash routines written by ??? X malloc.c - malloc routine from bsd-reno, since the Xenix one X does not work when put in a library. X xenix.cf - Example X11R4 configuration file for using X shared libraries. X Project.example - Example of patches to Project.tmpl X XYou really need gcc and gas. (and masm to build a library until Xsomeone fixes the bug in gas). X XThe implementation is using a double jump table, because i was not Xable to make ld link properly when linking directly with the shared Xlibrary. Therefore all the junk which is coming from libX11_s.a X X XInstallation: X------------- XUnpack the sharchive in an empty directory and type "make". That will Xautomatically produce the libX11 shared library and stub archive. XIgnore the warning messages, from makestub, given during build. XA "make install" will install the libraries. But check out the makefile Xfirst, it might not do what you want. X XFiles created (installed): X libX11_s (/shlib/libX11_s) X libXaw_s (/shlib/libXaw_s) X libX11_s.a (/lib/386/libX11_s.a) X libXaw_s.a (/lib/386/libXaw_s.a) X libXc.a (/lib/386/libXc.a) X XNote that the Xt library is included in the libXaw_s library. This is Xbecause there is a limitation of two shared libraries for Xenix, and Xprobably some program would load Xaw anyway, so that way Xt is "free". XBy building a separate Xt shared library, more system memory would be Xused. X XThe Xenix (microsoft) linker will include the wrong object modules if Xit has two modules with the same symbols to choose from. (arrggh), so Xtherefore it has to be presented with a pre-digested library for X"libc.a". That library is called "libXc.a", and include all parts of Xlibc that is not included in libX11. So in all programs using the XlibX11_s library, -lXc has to be specified instead of -lc. Whenever XSCO fixes this bug, the libXc library can be removed. X X XWhat is the Makefile doing? X--------------------------- X XThe Makefile builds a shared library for X-windows, called "libX11_s", Xand one for Xt and Xaw, called libXaw_s. The library files should be Xput somewhere, for example in /shlib, the stub libraries "libX11_s.a" Xand "libXaw_s.a" are most convenient to put in /lib/386. "Make Xinstall" will put them there. After that Xyou just include the stub library in your program builds. XUnfortunately the Scrt0.o file has to be replaced with the one in the Xpackage, which means you have to type in the ld command directly, and Xcannot depend on cc. You can also use the -nostdlib option to gcc. X XYou also have to convert the executable file to a coff file, and tell Xit which library to use. This is done with the convcoff program. X XExample: XLet's say your program is called hello.c (it is in the package) XTo compile you type: X X gcc -nostdlib Scrt0.o /lib/386/Sseg.o hello.o libX11_s.a -lXc X convcoff -l`pwd`/libX11_s a.out hello X XThe `pwd` is because you have to give the absolute path to the -l Xswitch. If the library is installed in /shlib, you instead type: X convcoff -l /shlib/libX11_s a.out hello X XThe convcoff program has two options: X -l libname - Tell it to load the given shared X library. You have to give the whole X path from root. X -s - Strip symbols X XThe convcoff now automatically includes the correct shared libraries Xif you specify the stub library with the -L switch. To be able to make XX-windows, without massiv editing of the Imakefiles, I finally created Xthe "xcc" command, which does this automatically. XSo you can compile a program with: X X xcc hello.c -LX11_s -lXc -o hello X X XHow to make another shared library X---------------------------------- XThe Makefile is setup to build a X-windows library. to build Xsomething else, the easiest is just to modify the Makefile, to fit the Xnew library. There are comments in it. Mainly you have to change the Xlibrary name, the list of jump-tables, and the list of libraries to Xinclude. To make a jump-table, do a "nm -S" on the library, sort the Xoutput, edit it with a text editor so that only the text definitions Xare left. (Those starting with 0001:xxxxx) After that do a X"delete-rectangle" (if you are using emacs), so only the names are Xleft, and putin a "\tjmp\t" before each. You might also have to Xexamine the list by hand to see if you really want to include all Xsymbols. You might also want to include the symbols from referenced Xlibraries. That is a little bit tougher. The easiest is probably to Xcapture the warning messages for "makestub" about "missing jump table Xentries", and include them in the jump table. You have to judge Xyourself which should be included, and which should be missing. XIn general, symbol that is never referenced outside the library, does Xnot need to be in the jump table. X X XBuilding X-windows for shared libraries X--------------------------------------- XLook in the supplied xenix.cf file for hints on what to define for Xshared libraries. Don't try to use this file directly, since it will Xfor sure not fit your x-windows port. XYou also need some patches to Project.tmpl. Look in "Project.example" Xfor what what to do. (You can actually paste in this file directly Xinto Project.tmpl). X XYou now cannot do a "make World", since the building of the shared Xlibraries are not incorporated into the X11 build process. I suggest Xthat you first defined "#define HasSharedLibraries NO" in xenix.cf, Xand do the "make World". When X-windows works nicely, you can do a X"make install" on the shared library package, after which you go back Xand edit xenix.cf to "HasSharedLibraries YES", go to mit/clients. Do a X"make clean", "make Makefiles" and finally "make". After this you go Xto "mit" and do a "make install". X XThis is just a general outline of the process. This since the posted XX11 port does not use shared libraries, and until someone incorporates Xthem, you have to do it yourself. I am using another X11 port (color Xvga), and since I don't have disk space for two, i have never tried to Xposted one. X XI have successfully built all libraries and clients from "core". I Xhave also built some contributed clients, and the shared library Xconfiguration seems to work without a glitch. The core clients + Xserver occupy less than 3MB in the /usr/lib/X11 library. X X XP Garbha (pgd@compuram.bbt.se) SHAR_EOF $TOUCH -am 0125114691 README && chmod 0640 README || echo "restore of README failed" set `wc -c README`;Wc_c=$1 if test "$Wc_c" != "7205"; then echo original size 7205, current size $Wc_c fi # ============= Makefile ============== echo "x - extracting Makefile (Text)" sed 's/^X//' << 'SHAR_EOF' > Makefile && X# X# Build file for X-windows shared libraries for Xenix X# X# This file will build libX11_s, libXt_s and libXaw_s X# where libXt and libXaw also needs libX11 X# X# Author: P.Garbha (pgd@compuram.bbt.se), 22-Jan-91 X# X X# X# Name of the libraries X# XLIBX11 = libX11 XLIBXT = libXt XLIBXAW = libXaw X X# X# Path of the system libraries. X# XLIBPATH=/lib/386/S X X# X# Path of the X11 tree root X# XX11ROOT=/X X X# X# Jump tables to be used for build of library X# The order in this list is significant. X# XLIBX11_JUMPS = libc_jump.o libX11_jump.o XLIBXT_JUMPS = libXt_jump.o XLIBXAW_JUMPS = libXaw_jump.o libXt_jump.o libXmu_jump.o X X# X# versions of the shared libraries X# XLIBX11_VERSION=0x00010001 X X# X# libraries to search for symbols when building library X# If you get any undefined symbols you can add your favourite library X# here, without making any incompabilites in the library. X# If you don't use any socket (emulation) code, you definitively need X# to replace libsocket.a with something else. X# XLIBX11_LIBS = $(X11ROOT)/mit/lib/X11.o malloc.o \ X $(LIBPATH)libcfp.a $(LIBPATH)libc.a \ X $(LIBPATH)libm.a $(LIBPATH)libsocket.a $(LIBPATH)libgnu.a X XLIBXT_LIBS = $(X11ROOT)/mit/lib/Xt.o $(LIBX11)_s.a $(LIBPATH)libgnu.a X XLIBXAW_LIBS = $(X11ROOT)/mit/lib/Xaw.o $(LIBX11)_s.a \ X $(X11ROOT)/mit/lib/Xmu/libXmu.a \ X $(X11ROOT)/mit/extensions/lib/libXext.a \ X $(X11ROOT)/mit/lib/Xt/libXt.a $(LIBPATH)libgnu.a X X# X# Define text and data address for the library (in hex) X# X# Xenix kernel restrictions on addresses: X# X# text segment address range: a000000 .. c000000 X# data segment address range: 8000000 .. c000000 X# X# Actually the data segment can start of 20000000, but there is X# a bug in xenix so that such a file is not loaded properly. X# XLIBX11_TEXTADDR = B0000000 XLIBX11_DATAADDR = B0800000 XLIBXT_TEXTADDR = B1000000 XLIBXT_DATAADDR = B1800000 XLIBXAW_TEXTADDR = B2000000 XLIBXAW_DATAADDR = B2800000 X X# X# You will need the gnu c-compiler, gas, and also masm. X# This is because there is a bug in gas so that you cannot X# assemble the stub libraries with it. X# XCC = gcc XCFLAGS = XAS = gas XMASM = masm X X# X# The rest are the rules for building the library X# X X# X# List of all source files X# XALLSOURCES = makestub.c convcoff.c hash.c hash.h libX11_start.c \ X libc_jump.s libX11_jump.s libXmu_jump.s libXt_jump.s libXaw_jump.s \ X libXext_jump.s Scrt0.s libX11_s.c hello.c coffhdr.c xcc.c coffstrip.c \ X malloc.c libX11_ver.c libXaw_s.c xenix.cf Project.example X XALLPROGRAMS = makestub convcoff coffhdr xcc coffstrip X Xall : $(ALLPROGRAMS) $(LIBX11)_s.a $(LIBXAW)_s.a X X# libXt left out, since it is now included in libXaw X# $(LIBXT)_s.a X X# X# Rules for libX11_s X# X$(LIBX11) : $(LIBX11)_s.o $(LIBX11_JUMPS) $(LIBX11_LIBS) $(LIBX11)_ver.o X ld -Rt $(LIBX11_TEXTADDR) -Rd $(LIBX11_DATAADDR) -m $(LIBX11).map \ X -o $(LIBX11) $(LIBX11_JUMPS) $(LIBX11)_s.o $(LIBX11)_ver.o $(LIBX11_LIBS) X X$(LIBX11)_s : $(LIBX11) convcoff X convcoff -s $(LIBX11) $(LIBX11)_s X X$(LIBX11).nm : $(LIBX11)_s X nm -go $(LIBX11_LIBS) | egrep " A | C " >$(LIBX11).nm X X$(LIBX11)_s.a : $(LIBX11)_s $(LIBX11)_start.o $(LIBX11).nm makestub X -mkdir tmp X (cd tmp && ls | xargs rm) X echo "Processing stub library. This will take a while..." X for fi in `(cd tmp ; ../makestub -m ../$(LIBX11).nm ../$(LIBX11))` ;\ X do \ X (cd tmp ; $(MASM) $$fi ; rm $$fi ); \ X done X -rm $(LIBX11)_s.a X ar cu $(LIBX11)_s.a $(LIBX11)_start.o X ( cd tmp ; ls | xargs ar u ../$(LIBX11)_s.a ) X ( cd tmp && ls | xargs rm ) X ranlib $(LIBX11)_s.a X X$(LIBX11)_start.o : $(LIBX11)_start.c X $(CC) -c -DVERSION=$(LIBX11_VERSION) $(LIBX11)_start.c X X$(LIBX11)_ver.o : $(LIBX11)_ver.c X $(CC) -c -DVERSION=$(LIBX11_VERSION) $(LIBX11)_ver.c X Xinstall_$(LIBX11) : $(LIBX11)_s $(LIBX11)_s.a X cp $(LIBX11)_s /shlib && chmod 755 /shlib/$(LIBX11)_s X cp $(LIBX11)_s.a $(LIBPATH)$(LIBX11)_s.a && chmod 755 $(LIBPATH)$(LIBX11)_s.a X X$(X11ROOT)/mit/lib/X11.o : X (cd $(X11ROOT)/mit/lib/X ; \ X ld -r *.o -o ../X11.o ) X X$(X11ROOT)/mit/lib/Xmu.o : X (cd $(X11ROOT)/mit/lib/Xmu ; \ X ld -r *.o -o ../Xmu.o ) X X# X# Rules for LIBXT_s X# X$(LIBXT) : $(LIBXT)_s.o $(LIBXT_JUMPS) $(LIBXT_LIBS) X ld -Rt $(LIBXT_TEXTADDR) -Rd $(LIBXT_DATAADDR) -m $(LIBXT).map \ X -o $(LIBXT) $(LIBXT_JUMPS) $(LIBXT)_s.o $(LIBXT_LIBS) X X$(LIBXT)_s : $(LIBXT) convcoff X convcoff -s $(LIBXT) $(LIBXT)_s X X$(LIBXT).nm : $(LIBXT)_s X nm -go $(LIBXT_LIBS) | egrep " A | C " >$(LIBXT).nm X X$(LIBXT)_s.a : $(LIBXT)_s $(LIBXT).nm makestub X -mkdir tmp X (cd tmp && ls | xargs rm) X echo "Processing stub library. This will take a while..." X for fi in `(cd tmp ; ../makestub -m ../$(LIBXT).nm ../$(LIBXT))` ;\ X do \ X (cd tmp ; $(MASM) $$fi ; rm $$fi ); \ X done X -rm $(LIBXT)_s.a X ( cd tmp ; ls | xargs ar u ../$(LIBXT)_s.a ) X ( cd tmp && ls | xargs rm ) X ranlib $(LIBXT)_s.a X Xinstall_$(LIBXT) : $(LIBXT)_s $(LIBXT)_s.a X cp $(LIBXT)_s /shlib && chmod 755 /shlib/$(LIBXT)_s X cp $(LIBXT)_s.a $(LIBPATH)$(LIBXT)_s.a && chmod 755 $(LIBPATH)$(LIBXT)_s.a X X$(X11ROOT)/mit/lib/Xt.o : X (cd $(X11ROOT)/mit/lib/Xt ; \ X ld -r *.o -o ../Xt.o ) X X X# X# Rules for LIBXAW_s X# X$(LIBXAW) : $(LIBXAW)_s.o $(LIBXAW_JUMPS) $(LIBXAW_LIBS) X ld -Rt $(LIBXAW_TEXTADDR) -Rd $(LIBXAW_DATAADDR) -m $(LIBXAW).map \ X -o $(LIBXAW) $(LIBXAW_JUMPS) $(LIBXAW)_s.o $(LIBXAW_LIBS) X X$(LIBXAW)_s : $(LIBXAW) convcoff X convcoff -s $(LIBXAW) $(LIBXAW)_s X X$(LIBXAW).nm : $(LIBXAW)_s X nm -go $(LIBXAW_LIBS) | egrep " A | C " >$(LIBXAW).nm X X$(LIBXAW)_s.a : $(LIBXAW)_s $(LIBXAW).nm makestub X -mkdir tmp X (cd tmp && ls | xargs rm) X echo "Processing stub library. This will take a while..." X for fi in `(cd tmp ; ../makestub -m ../$(LIBXAW).nm ../$(LIBXAW))` ;\ X do \ X (cd tmp ; $(MASM) $$fi ; rm $$fi ); \ X done X -rm $(LIBXAW)_s.a X ( cd tmp ; ls | xargs ar u ../$(LIBXAW)_s.a ) X ( cd tmp && ls | xargs rm ) X ranlib $(LIBXAW)_s.a X Xinstall_$(LIBXAW) : $(LIBXAW)_s $(LIBXAW)_s.a X cp $(LIBXAW)_s /shlib && chmod 755 /shlib/$(LIBXAW)_s X cp $(LIBXAW)_s.a $(LIBPATH)$(LIBXAW)_s.a && chmod 755 $(LIBPATH)$(LIBXAW)_s.a X X$(X11ROOT)/mit/lib/Xaw.o: X (cd $(X11ROOT)/mit/lib/Xaw ; \ X ld -r *.o -o ../Xaw.o ) X X# X# A small test program. X# Xhello : hello.x libX11_s convcoff X convcoff -l `pwd`/libX11_s hello.x hello X Xhello.x : hello.o libX11_s.a Scrt0.o X gcc -nostdlib Scrt0.o /lib/386/Sseg.o hello.o libX11_s.a -lc -o hello.x X XScrt0.o: Scrt0.s X gas Scrt0.s -o Scrt0.o X Xmakestub : makestub.o hash.o X $(CC) -g -o makestub makestub.o hash.o X Xconvcoff : convcoff.c X $(CC) -g -o convcoff convcoff.c X Xinstall_programs: convcoff coffhdr coffstrip xcc X cp convcoff /usr/local/convcoff && chmod 755 /usr/local/convcoff X cp coffhdr /usr/local/coffhdr && chmod 755 /usr/local/coffhdr X cp coffstrip /usr/local/coffstrip && chmod 755 /usr/local/coffstrip X cp xcc /usr/local/xcc && chmod 755 /usr/local/xcc X Xclean:: X -rm *.o *.map *.nm $(LIBX11) hello a.out hello.x $(LIBXT) $(LIBXAW) X -rm -fr tmp X Xremove:: X -rm /shlib/libX11_s /shlib/libXt_s /shlib/libXaw_s X -rm $(LIBPATH)libX11_s.a $(LIBPATH)libXt_s.a $(LIBPATH)libXaw_s.a X -rm libX11 libXt libXaw libX11_s libXt_s libXaw_s X -rm libX11_s.a libXt_s.a libXaw_s.a X Xshar:: X shar -a -f -n Xenixshlib -l50 -o Xenixshlib -c -f README Makefile $(ALLSOURCES) X Xinstall:: install_$(LIBX11) install_$(LIBXT) install_$(LIBXAW) install_programs install_libXc X X# X# junk X# X X$(LIBX11)_s.nm : $(LIBX11)_s.a X nm -go $(LIBX11)_s.a >$(LIBX11)_s.nm X X# X# This library is needed since the microsoft linker is brain-damaged and X# loads the wrong object files. The libXc library is a copy of libc, but X# with all modules includes in libX11_s deleted X# XlibXc.a : $(LIBPATH)libc.a $(LIBX11)_s.nm X cp $(LIBPATH)libc.a libXc.a X nm -go $(LIBX11)_s.a | egrep " A | C " | awk "{print \$$2;}" | tr -d ":" | sort | uniq | xargs ar d libXc.a X ranlib libXc.a X Xinstall_libXc : libXc.a X cp libXc.a $(LIBPATH)libXc.a X chmod 544 $(LIBPATH)libXc.a X Xcoffstrip : coffstrip.c X $(CC) coffstrip.c -lx -o coffstrip SHAR_EOF $TOUCH -am 0122180791 Makefile && chmod 0644 Makefile || echo "restore of Makefile failed" set `wc -c Makefile`;Wc_c=$1 if test "$Wc_c" != "7778"; then echo original size 7778, current size $Wc_c fi # ============= makestub.c ============== echo "x - extracting makestub.c (Text)" sed 's/^X//' << 'SHAR_EOF' > makestub.c && X/* X * Make stub files from a nm listing of a library X * X * Author: P.Garbha pgd@compuram.bbt.se 9-Jan-91 X */ X X#include <stdio.h> X#include <string.h> X#include <sys/types.h> X#include <sys/a.out.h> X#include <sys/relsym.h> X#include <fcntl.h> X#include "hash.h" X X#define SYMMAX 2000 X#define MSYMMAX 2000 X#define MAXSEG 10 X Xstruct hashtab *symhash; Xstruct hashtab *mastab; Xstruct hashtab *filetab; Xstruct hashtab *addrhash; X Xstruct symbol { X char *name; X char type; X int addr; /* Real routine address */ X int jaddr; /* Jump table index */ X} symtab[SYMMAX]; X Xint symcount; X X#define DONE 0200 X Xstruct master { X char *fname; /* File name */ X char *name; /* Symbol name */ X char type; /* Symbol type */ X} master[MSYMMAX]; Xint mastcount; X X/* X * x.out header structure X */ Xstruct xexec xhdr; Xstruct xext ehdr; Xstruct xseg xsegs[MAXSEG]; /* */ Xint xsegcount, xtextseg, xdataseg, textbase, database; X Xchar *libname; Xchar *progname = "makestub"; XFILE *sfp; X Xchar filedef[] = " TITLE %s\n\n .386\n\ XDGROUP GROUP _DSTUB\n"; Xchar pubdef[] = " PUBLIC %s\nL%d DD 0%xH\n"; Xchar datadef[] = " PUBLIC %s\n%s EQU 0%xH\n"; Xchar textstart1[] = "_TEXT SEGMENT DWORD USE32 PUBLIC 'CODE'\n"; Xchar textstart2[] = "_TEXT SEGMENT\n"; Xchar textend[] = "_TEXT ENDS\n"; Xchar datastart1[] = "_DSTUB SEGMENT DWORD USE32 PUBLIC 'DSTUB'\n"; Xchar datastart2[] = "_DSTUB SEGMENT\n"; Xchar dataend[] = "_DSTUB ENDS\n"; Xchar fileend[] = "END\n"; Xchar jumpdef[] = "%s EQU $\n jmp L%d\n"; X X X Xmain(argc, argv) X int argc; X char **argv; X{ X int seg, addr, type; X char name[80]; X char sfname[20]; X char *ofname = NULL; X char fname[40]; X int i; X int six; X int intext, indata; X int tsflag, dsflag; X int seq; X char *cp; X X symhash = ht_new("symhash"); X mastab = ht_new("master"); X filetab = ht_new("filetab"); X addrhash = ht_new("addrhash"); X X while (argc > 1 && argv[1][0] == '-') { X switch (argv[1][1]) { X case 'm': X loadmaster(argv[2]); X argc--; X argv++; X break; X default: X fprintf(stderr, "Illegal option: %s\n", argv[1]); X } X argv++; X argc--; X } X if (argc != 2) { X fprintf(stderr, "Usage: makestub {-m masterfile} libname\n"); X exit(1); X } X cp = strrchr(argv[1], '/'); X if (cp) X libname = cp+1; X else X libname = argv[1]; X X loadlibdata(argv[1]); X X if (mastcount) { X /* X * Split into different files X */ X intext = indata = tsflag = dsflag = seq = 0; X for (i = 0; i < mastcount; i++) { X six = (int)ht_nget(symhash, master[i].name) - 1; X if (six == -1) X continue; X if (symtab[six].type != 'T' || (symtab[six].type & DONE)) X continue; X if (symtab[six].jaddr == 0) X continue; X if (ofname == NULL || strcmp(ofname, master[i].fname)) { X if (ofname) { X fprintf(sfp, fileend); X fclose(sfp); X } X ofname = master[i].fname; X strcpy(sfname, ofname); X sfname[strlen(sfname)-1] = 's'; X if (ht_nins(filetab, sfname, (char *)1)) { X int cntr = 'A'; X fprintf(stderr, "Duplicate file: %s", X sfname); X do { X sfname[0] = cntr; X } while (ht_nins(filetab, sfname, (char *)1)); X fprintf(stderr, " new name: %s\n", X sfname); X } X sfp = fopen(sfname, "w"); X if (sfp == NULL) { X perror(sfname); X exit(1); X } X puts(sfname); X fprintf(sfp, filedef, sfname); X intext = indata = tsflag = dsflag = seq = 0; X } X fprintf(sfp, dsflag ? datastart2 : datastart1); X dsflag = 1; X seq++; X fprintf(sfp, pubdef, X symtab[six].name, seq, symtab[six].jaddr); X fprintf(sfp, dataend); X fprintf(sfp, tsflag ? textstart2 : textstart1); X tsflag = 1; X fprintf(sfp, jumpdef, symtab[six].name, seq); X fprintf(sfp, textend); X symtab[six].type |= DONE; X symtab[six].addr = seq; X } X if (ofname) { X fprintf(sfp, fileend); X fclose(sfp); X } X } X /* X * Now emit global symbols, and symbols not found X * in the master index X */ X sprintf(sfname, "%s_stub.s", libname); X sfp = fopen(sfname, "w"); X if (sfp == NULL) { X perror(sfname); X exit(1); X } X puts(sfname); X fprintf(sfp, filedef, libname); X fprintf(sfp, datastart1); X seq = 0; X for (i = 0; i < symcount; i++) { X switch (symtab[i].type) { X case 'T': X if (symtab[i].jaddr) { X fprintf(sfp, pubdef, X symtab[i].name, i, symtab[i].jaddr); X symtab[i].addr = ++seq; X } else if (strcmp(symtab[i].name, "___JumpTabEnd")) X fprintf(stderr, "Warning: Symbol %s not in jump table\n", symtab[i].name); X break; X X case 'D': X case 'B': X fprintf(sfp, datadef, X symtab[i].name, symtab[i].name, X symtab[i].addr); X break; X } X } X fprintf(sfp, dataend); X fprintf(sfp, textstart1); X for (i = 0; i < symcount; i++) X if (symtab[i].type == 'T' && symtab[i].jaddr) X fprintf(sfp, jumpdef, symtab[i].name, symtab[i].addr); X fprintf(sfp, textend); X fprintf(sfp, fileend); X fclose(sfp); X exit(0); X} X X/* X * load master index X */ Xloadmaster(mfname) X char *mfname; X{ X FILE *fp; X char line[100]; X char *cp; X char fname[20], *fnp; X int addr, type; X char name[40]; X X fnp = NULL; X fp = fopen(mfname, "r"); X if (fp == NULL) { X perror(mfname); exit(1); X } X while (fgets(line, sizeof(line) - 1, fp) != NULL) { X cp = strchr(line, ':'); X if (strchr(cp+1, ':')) X cp++; X else X cp = line; X while (*cp == ' ') X cp++; X if (sscanf(cp, "%s %x %c %s\n", &fname, &addr, &type, &name) !=4) { X fprintf(stderr, "Malformed line in %s:\n%s", X mfname, line); X exit(1); X } X cp = &fname[strlen(fname)-1]; X if (*cp != ':') { X fprintf(stderr, "Malformed filename: %s\n", fname); X exit(1); X } X *cp = '\0'; X if (mastcount == MSYMMAX) { X fprintf(stderr, "Master symbol table overflow\n"); X exit(1); X } X if (fnp == NULL || strcmp(fname, fnp) != 0) X fnp = strdup(fname); X master[mastcount].fname = fnp; X master[mastcount].name = strdup(name); X master[mastcount].type = type; X if (ht_nins(mastab, master[mastcount].name, (char *)(mastcount+1))) X fprintf(stderr, "Warning: Cannot enter master symbol: %s\n", name); X mastcount++; X } X} X X X/* X * Load data from library file (in x.out format) X */ Xloadlibdata(xfname) X char *xfname; X{ X register int i; X short magic; X int xfd; X X xfd = open(xfname, O_RDONLY); X if (xfd == -1) { X perror(xfname); exit(1); X } X loadxhdr(xfd, xfname); X loadxsyms(xfd, xfname); X fixjumptab(xfd, xfname); X close(xfd); X} X X/* X * Read library x.out header X */ Xloadxhdr(xfd, xfname) X int xfd; X char *xfname; X{ X int seg; X X if (read(xfd, (char *)&xhdr, sizeof xhdr) != sizeof xhdr) { X perror(xfname); X return 0; X } X if (xhdr.x_magic != X_MAGIC) { X fprintf(stderr, "Not a x.out file: %s\n", xfname); X return 0; X } X if (read(xfd, (char *)&ehdr, sizeof ehdr) != sizeof ehdr) { X perror(xfname); X return 0; X } X if ((xhdr.x_cpu & XC_CPU) != XC_386) { X fprintf(stderr, "Not a 80386 executable file:%s\n", xfname); X return 0; X } X if ((xhdr.x_renv & XE_SEG) == 0) { X fprintf(stderr, "Not a Xenix segmented file: %s\n", xfname); X return 0; X } X lseek(xfd, ehdr.xe_segpos, 0); X xsegcount = ehdr.xe_segsize / sizeof(struct xseg); X if (xsegcount > MAXSEG) { X fprintf(stderr, "Too many segments: %d\n", xsegcount); X return -1; X } X if (read(xfd, (char *)xsegs, xsegcount * sizeof(struct xseg)) != xsegcount * sizeof(struct xseg)) { X perror(xfname); X return 0; X } X X /* X * Locate the segments X */ X for (seg = 0; seg < xsegcount; seg++) X if (xsegs[seg].xs_type == XS_TTEXT) X break; X if (seg == xsegcount) { X fprintf(stderr, "library file has no text segment\n"); X return 0; X } X xtextseg = seg; X textbase = xsegs[seg].xs_rbase; X X for (seg = 0; seg < xsegcount; seg++) X if (xsegs[seg].xs_type == XS_TDATA) X break; X if (seg == xsegcount) { X fprintf(stderr, "library file has no data segment\n"); X return 0; X } X xdataseg = seg; X database = xsegs[seg].xs_rbase; X return 1; X} X X/* X * Read the x.out symbol table into memory X */ Xloadxsyms(xfd, xfname) X int xfd; X char *xfname; X{ X struct sym *xsymtab, *symp; X int type, seg, value; X char *name; X int i; X char *p; X X for (seg = 0; seg < xsegcount; seg++) X if (xsegs[seg].xs_type == XS_TSYMS && xsegs[seg].xs_attr == XS_SXSEG) X break; X if (seg == xsegcount) { X fprintf(stderr, "Library %s has no symbol table segment\n", xfname); X exit(1); X } X xsymtab = (struct sym *)malloc(xsegs[seg].xs_psize); X if (xsymtab == NULL) { X fprintf(stderr, "Out of memory"); exit(1); X } X lseek(xfd, xsegs[seg].xs_filpos, 0); X if (read(xfd, (char *)xsymtab, xsegs[seg].xs_psize) != xsegs[seg].xs_psize) { X perror("symbol"); exit(1); X } X X /* X * Enter the symbols into the symbol table X */ X symcount = 0; X for (p = (char *)xsymtab; p < (char *)xsymtab+xhdr.x_syms; ) { X symp = (struct sym *)p; X p += sizeof(struct sym); X name = (char *)p; X switch (symp->s_type & S_TYPE) { X case S_TEXT: /* A routine address */ X symtab[symcount].type = 'T'; X goto enter; X case S_DATA: X symtab[symcount].type = 'D'; X goto enter; X case S_BSS: X symtab[symcount].type = 'B'; X goto enter; X enter: X/* if (strcmp(name, "__nd_") == 0) X name = "_shlib__nd_"; */ X symtab[symcount].name = strdup(name); X symtab[symcount].addr = symp->s_value; X symtab[symcount].jaddr = 0; X if (ht_nins(symhash, symtab[symcount].name, (char *)(symcount+1))) X fprintf(stderr, "Error entering symbol %s\n", X name); X if (ht_iins(addrhash, symtab[symcount].addr, (char *)(symcount+1))) X fprintf(stderr, "Error inserting address %x (%s)\n", symtab[symcount].addr, symtab[symcount].name); X symcount++; X break; X } X p += strlen(p) + 1; X } X free(xsymtab); X return 1; X} X X X/* X * Fixup all symbol values for jumptable offset X */ Xfixjumptab(xfd, xfname) X int xfd; X char *xfname; X{ X register int i; X int jumptabend, jumptabsize, noentries, six; X char *jumpaddr; X unsigned char *jumptab; X int cc; X unsigned int off; X X /* X * Locate the end of the jump table X */ X six = (int)ht_nget(symhash, "___JumpTabEnd") - 1; X if (six == -1) { X fprintf(stderr, "Library does not have a valid jump table\n"); X fprintf(stderr, "(Jump table end symbol missing)\n"); X exit(1); X } X jumptabend = symtab[six].addr; X jumptabsize = jumptabend - textbase; X jumptab = (unsigned char *)malloc(sizeof(char *) * jumptabsize); X if (jumptab == NULL) { X perror("Allocating jump table"); X exit(1); X } X /* X * Read jump table into memory X */ X lseek(xfd, xsegs[xtextseg].xs_filpos, 0); X cc = read(xfd, jumptab, jumptabsize); X if (cc != jumptabsize) { X fprintf(stderr, "Something wrong with library file\n"); X exit(1); X } X X /* X * Go through all entries in the jump table, and X * insert the jump table index into the symbol table X */ X for (i = 0; i < jumptabsize; ) { X if (jumptab[i] == 0) { X i++; X continue; X } X if (jumptab[i] != 0xe9) { X fprintf(stderr, "Illegal jump table (no jump)\n"); X exit(1); X } X jumpaddr = *(char **)&jumptab[i+1] + i+5 + textbase; X six = (int)ht_iget(addrhash, jumpaddr) - 1; X if (six == -1) { X fprintf(stderr, "Cannot find symbol for jump table entry %d (addr = %x)\n", i, jumpaddr); X } else if (symtab[six].jaddr) { X fprintf(stderr, "Symbol %s has multiple jump table entries\n", symtab[six].name); X } else X symtab[six].jaddr = i + textbase; X i += 5; X } X} SHAR_EOF $TOUCH -am 0110080491 makestub.c && chmod 0660 makestub.c || echo "restore of makestub.c failed" set `wc -c makestub.c`;Wc_c=$1 if test "$Wc_c" != "10959"; then echo original size 10959, current size $Wc_c fi # ============= convcoff.c ============== echo "x - extracting convcoff.c (Text)" sed 's/^X//' << 'SHAR_EOF' > convcoff.c && X/* X * Program to convert a Xenix x-out file to a coff file X * X * Author: P.Garbha pgd@compuram.bbt.se X */ X X#include <stdio.h> X#include <sys/types.h> X#include <sys/fcntl.h> X#include <sys/coff.h> X#include <sys/a.out.h> X#include <string.h> X#include <memory.h> X#include <time.h> X#include <malloc.h> X#include <sys/relsym.h> X X/* X * COFF symbol entry X */ X#pragma pack(1) Xstruct symbol { X char n_name[8]; /* symbol name */ X unsigned long n_value; /* symbol value */ X unsigned short n_scnum; /* section number */ X unsigned short n_type; X unsigned char n_sclass; X unsigned char n_numaux; /* no of aux entries */ X}; X#pragma pack() X Xstruct symbol *symtab; Xint symcount; X Xchar *fname; X X#define MAXSEG 10 X#define PAGESIZE 0x1000 X X#define TEXT_SEGMENT 0x3f X#define DATA_SEGMENT 0x47 X/* X * Max number of shared libraries. (kernel restriction. see user.h) X */ X#define SHLBMAX 2 X X/* X * Coff header structure X */ X#define TEXT 0 X#define DATA 1 X#define BSS 2 X#define LIB 3 X Xstruct filehdr fhdr; /* coff file header */ Xstruct aouthdr ahdr; /* a.out header */ Xstruct scnhdr shdr[MAXSEG]; /* section headers */ X Xstruct { X long size; /* size of lib section in words */ X long hdrsize; /* no of words in header */ X char path[80]; /* Path of library */ X} libsect1, libsect2; X Xint cfd; /* coff file id */ Xint tseg, dseg, bseg; Xint coffscns; Xint xtextfilpos, xdatafilpos; /* file position for text and data */ Xchar *textp, *datap; Xint textsize, datasize; Xint sflag; /* Stripping flag */ X X/* X * x.out header structure X */ Xstruct xexec xhdr; Xstruct xext ehdr; Xstruct xseg xsegs[MAXSEG]; /* */ Xint xfd, cfd; Xint xsegcount; Xint xtextseg, xdataseg; X Xchar *xfname, *cfname; X Xint nshlibs; /* Number of shared libraries */ Xchar *shlibpaths[SHLBMAX]; /* Name of shared libraries */ X Xmain(argc, argv) X int argc; X char **argv; X{ X while (argc > 1 && argv[1][0] == '-') { X switch (argv[1][1]) { X case 's': X sflag = 1; X break; X case 'l': /* Use shared library */ X addshlib(argv[2]); X argc--; X argv++; X break; X X default: X fprintf(stderr, "Illegal option: %s\n", argv[1]); X } X argv++; X argc--; X } X if (argc != 3) { X fprintf(stderr, "Usage: convcoff infile outfile\n"); X exit(1); X } X xfname = argv[1]; X cfname = argv[2]; X xfd = open(xfname, O_RDONLY); X if (xfd == -1) { X perror(xfname); exit(1); X } X if (!loadxhdr()) X exit(1); X (void)loadxsyms(); X if (!cvtcoffhdr()) X exit(1); X if (!loadximage()) X exit(1); X cfd = open(cfname, O_WRONLY|O_CREAT|O_TRUNC, 0700); X if (cfd == -1) { X perror(cfname); exit(1); X } X if (!dumpcoff()) { X close(cfd); unlink(cfname); X exit(1); X } X close(xfd); X close(cfd); X exit(0); X} X X/* X * Load a x.out header X */ Xloadxhdr() X{ X register int i; X short magic; X X if (read(xfd, (char *)&xhdr, sizeof xhdr) != sizeof xhdr) { X perror(xfname); X return 0; X } X if (xhdr.x_magic != X_MAGIC) { X fprintf(stderr, "Not a x.out file: %s\n", xfname); X return 0; X } X if (read(xfd, (char *)&ehdr, sizeof ehdr) != sizeof ehdr) { X perror(fname); X return 0; X } X if ((xhdr.x_cpu & XC_CPU) != XC_386) { X fprintf(stderr, "Not a 80386 executable file:%s\n", xfname); X return 0; X } X if ((xhdr.x_renv & XE_SEG) == 0) { X fprintf(stderr, "Not a Xenix segmented file: %s\n", xfname); X return 0; X } X lseek(xfd, ehdr.xe_segpos, 0); X xsegcount = ehdr.xe_segsize / sizeof(struct xseg); X if (xsegcount > MAXSEG) { X fprintf(stderr, "Too many segments: %d\n", xsegcount); X return -1; X } X if (read(xfd, (char *)xsegs, xsegcount * sizeof(struct xseg)) != xsegcount * sizeof(struct xseg)) { X perror(xfname); X return 0; X } X return 1; X} X X/* X * Load coff header X */ Xint Xloadcoffhdr(fname, fhdr, ahdr, shdrs) X char *fname; X struct filehdr *fhdr; X struct aouthdr *ahdr; X struct scnhdr **shdrs; X{ X int fd; X X fd = open(fname, O_RDONLY); X if (fd == -1) { X perror(fname); return 0; X } X if (read(fd, fhdr, sizeof fhdr) != sizeof fhdr) { X perror(fname); close(fd); return 0; X } X if (fhdr->f_magic == X_MAGIC) { X fprintf(stderr, "file %s is not of coff type\n", fname); X close(fd); X return 0; X } X if (fhdr->f_magic != I386MAGIC) { X fprintf(stderr, "File %s is not a coff exec file\n", fname); X close(fd); return 0; X } X if (read(fd, ahdr, sizeof ahdr) != sizeof ahdr) { X perror("aouthdr"); close(fd); return 0; X } X if (fhdr->f_nscns) { X *shdrs = (struct scnhdr *)calloc(sizeof(struct scnhdr), fhdr->f_nscns); X if (*shdrs == NULL) { X perror(fname); close(fd); X return 0; X } X if (read(fd, (char *)*shdrs, fhdr->f_nscns * sizeof(struct scnhdr)) == -1) { X perror(fname); close(fd); X return 0; X } X } else X *shdrs = NULL; X close(fd); X return 1; X} X X X X/* X * Convert a x.out header structure, to coff header X */ Xint Xcvtcoffhdr() X{ X int filpos = 0; X int seg; X X /* X * Make filehdr X */ X fhdr.f_magic = I386MAGIC; X fhdr.f_nscns = 0; /* Number of sections */ X fhdr.f_timdat = time(NULL); /* Current date and time */ X fhdr.f_symptr = 0; /* Symbol table pointer */ X fhdr.f_nsyms = symcount; /* Symbol count */ X fhdr.f_opthdr = sizeof(ahdr); X fhdr.f_flags = F_RELFLG|F_EXEC|F_LNNO|F_AR32WR; X X /* X * Make aout header extension X */ X ahdr.magic = 0; /* magic */ X ahdr.vstamp = 0; /* version stamp */ X ahdr.tsize = xhdr.x_text; /* Text segment size */ X ahdr.dsize = xhdr.x_data; /* Data segment size */ X ahdr.bsize = xhdr.x_bss; /* bss segment size */ X ahdr.entry = xhdr.x_entry; /* entry address */ X ahdr.text_start = 0; /* text relcoation */ X ahdr.data_start = 0; /* data relocation */ X X tseg = dseg = bseg = 0; X X /* X * Make coff text segment X */ X for (seg = 0; seg < xsegcount; seg++) X if (xsegs[seg].xs_type == XS_TTEXT) X break; X if (seg == xsegcount) { X fprintf(stderr, "x.out file has no text segment\n"); X return 0; X } X if (xsegs[seg].xs_seg != TEXT_SEGMENT) { X fprintf(stderr, "Text segment must be %#02x\n", TEXT_SEGMENT); X return 0; X } X xtextseg = seg; X memset((char *)&shdr[TEXT].s_name, 0, sizeof(shdr[TEXT].s_name)); X strcpy(shdr[TEXT].s_name, ".text"); X ahdr.text_start = shdr[TEXT].s_paddr = shdr[TEXT].s_vaddr = xsegs[seg].xs_rbase; X shdr[TEXT].s_size = xsegs[seg].xs_psize; X shdr[TEXT].s_scnptr = PAGESIZE; X shdr[TEXT].s_relptr = 0; X shdr[TEXT].s_lnnoptr = 0; X shdr[TEXT].s_nreloc = 0; X shdr[TEXT].s_nlnno = 0; X shdr[TEXT].s_flags = STYP_TEXT; X xtextfilpos = xsegs[seg].xs_filpos; X filpos = (PAGESIZE + xsegs[seg].xs_psize + (PAGESIZE-1)) & ~(PAGESIZE-1); X X /* X * Make coff data segment X */ X for (seg = 0; seg < xsegcount; seg++) X if (xsegs[seg].xs_type == XS_TDATA) X break; X if (seg == xsegcount) { X fprintf(stderr, "x.out file has no data segment\n"); X return 0; X } X xdataseg = seg; X if (xsegs[seg].xs_seg != DATA_SEGMENT) { X fprintf(stderr, "Data segment must be %#02x\n", DATA_SEGMENT); X return 0; X } X memset((char *)&shdr[DATA].s_name, 0, sizeof(shdr[DATA].s_name)); X strcpy(shdr[DATA].s_name, ".data"); X ahdr.data_start = shdr[DATA].s_paddr = shdr[DATA].s_vaddr = xsegs[seg].xs_rbase; X shdr[DATA].s_size = xsegs[seg].xs_psize; X shdr[DATA].s_scnptr = filpos; X shdr[DATA].s_relptr = 0; X shdr[DATA].s_lnnoptr = 0; X shdr[DATA].s_nreloc = 0; X shdr[DATA].s_nlnno = 0; X shdr[DATA].s_flags = STYP_DATA; X xdatafilpos = xsegs[seg].xs_filpos; X filpos += shdr[DATA].s_size; X X /* X * Make coff bss segment X */ X memset((char *)&shdr[BSS].s_name, 0, sizeof(shdr[BSS].s_name)); X strcpy(shdr[BSS].s_name, ".bss"); X shdr[BSS].s_paddr = shdr[BSS].s_vaddr = shdr[DATA].s_paddr + shdr[DATA].s_size; X shdr[BSS].s_size = xhdr.x_bss; X shdr[BSS].s_scnptr = 0; X shdr[BSS].s_relptr = 0; X shdr[BSS].s_lnnoptr = 0; X shdr[BSS].s_nreloc = 0; X shdr[BSS].s_nlnno = 0; X shdr[BSS].s_flags = STYP_BSS; X coffscns = 3; X X /* X * Make library segment X */ X if (nshlibs) { X strcpy(shdr[LIB].s_name, ".lib"); X shdr[LIB].s_nlib = nshlibs; X shdr[LIB].s_vaddr = 0; X shdr[LIB].s_size = 0; X shdr[LIB].s_scnptr = filpos; X shdr[LIB].s_relptr = 0; X shdr[LIB].s_lnnoptr = 0; X shdr[LIB].s_nreloc = 0; X shdr[LIB].s_nlnno = 0; X shdr[LIB].s_flags = STYP_LIB; X coffscns++; X X memset((char *)&libsect1, 0, sizeof(libsect1)); X libsect1.size = 2 + ((strlen(shlibpaths[0]) + 1 + 3) >> 2); X libsect1.hdrsize = 2; X strcpy(libsect1.path, shlibpaths[0]); X shdr[LIB].s_size += libsect1.size << 2; X if (nshlibs > 1) { X memset((char *)&libsect2, 0, sizeof(libsect2)); X libsect2.size = 2 + ((strlen(shlibpaths[1])+1+3) >> 2); X libsect2.hdrsize = 2; X strcpy(libsect2.path, shlibpaths[1]); X shdr[LIB].s_size += libsect2.size << 2; X } X filpos += shdr[LIB].s_size; X } X X /* X * Fix up the last pointers X */ X fhdr.f_symptr = filpos; X fhdr.f_nscns = coffscns; X return 1; X} X X X/* X * Read the x.out symbol table into memory X */ Xloadxsyms() X{ X struct sym *xsymtab; X int type, seg, value; X char *name; X int i, xsymcount; X char *p; X X for (seg = 0; seg < xsegcount; seg++) X if (xsegs[seg].xs_type == XS_TSYMS && xsegs[seg].xs_attr == XS_SXSEG) X break; X if (seg == xsegcount) { X fprintf(stderr, "warning: %s has no symbol table segment\n", xfname); X return 0; X } X xsymtab = (struct sym *)malloc(xsegs[seg].xs_psize); X if (xsymtab == NULL) { X fprintf(stderr, "Out of memory"); exit(1); X } X lseek(xfd, xsegs[seg].xs_filpos, 0); X if (read(xfd, (char *)xsymtab, xsegs[seg].xs_psize) != xsegs[seg].xs_psize) { X perror("symbol"); exit(1); X } X X /* X * Count the symbols X */ X xsymcount = 0; X for (p = (char *)xsymtab; p < (char *)xsymtab+xhdr.x_syms; ) { X p += sizeof(struct sym); X if (p[0] == '_' && p[1] == '_' && p[2] == '_' X && strncmp(p, "___SHLIB__", 10) == 0) { X char path[40]; X /* X * An autoload symbol X */ X sprintf(path, "/shlib/%s", p+10); X addshlib(path); X } X p += strlen(p) + 1; X xsymcount++; X } X X /* X * Merge it in with the coff symbol table X * unless stripping flag is on. X */ X if (sflag) X return 1; X X if (symcount == 0) X symtab = (struct symbol *)malloc(symcount + xsymcount * sizeof(struct symbol)); X else X symtab = (struct symbol *)realloc((char *)symtab, symcount + xsymcount * sizeof(struct symbol)); X if (symtab == NULL) { X perror("Out of memory"); exit(1); X } X for (p = (char *)xsymtab; p < (char *)xsymtab+xhdr.x_syms; ) { X if (((struct sym *)p)->s_seg == TEXT_SEGMENT) { X symtab[symcount].n_scnum = TEXT+1; X symtab[symcount].n_sclass = 2; X } else if (((struct sym *)p)->s_seg == DATA_SEGMENT) { X if (((struct sym *)p)->s_value >= xsegs[xdataseg].xs_rbase X + xsegs[xdataseg].xs_vsize) X symtab[symcount].n_scnum = BSS+1; X else X symtab[symcount].n_scnum = DATA+1; X symtab[symcount].n_sclass = 3; X } else { X p += sizeof(struct sym); X p += strlen(p) + 1; X continue; X } X symtab[symcount].n_value = ((struct sym *)p)->s_value; X symtab[symcount].n_type = 0; X symtab[symcount].n_numaux = 0; X p += sizeof(struct sym); X strncpy(symtab[symcount].n_name, p, 8); X p += strlen(p) + 1; X symcount++; X } X free(xsymtab); X return 1; X} X X/* X * Read a coff symbol table X */ Xloadcoffsyms(fd) X int fd; X{ X int cc; X X if (lseek(fd, fhdr.f_symptr, 0) == -1) { X perror("loadsyms"); exit(1); X } X if (symtab == NULL) X symtab = (struct symbol *)malloc(sizeof(struct symbol) * fhdr.f_nsyms); X else X symtab = (struct symbol *)realloc((char *)symtab, sizeof(struct symbol) * (fhdr.f_nsyms + symcount)); X if (symtab == NULL) { X perror("loadsyms"); exit(1); X } X cc = read(fd, (char *)&symtab[symcount], fhdr.f_nsyms * sizeof(struct symbol)); X if (cc == -1) { X perror("loadsyms"); exit(1); X } X if (cc != fhdr.f_nsyms * sizeof(struct symbol)) { X fprintf(stderr, "File too short\n"); X exit(1); X } X symcount += fhdr.f_nsyms; X} X X/* X * Load the image of a x.out file into memory X */ Xloadximage() X{ X int cc; X X textsize = xsegs[xtextseg].xs_psize; X textp = malloc(textsize); X if (textp == NULL) { X perror("convcoff"); return 0; X } X datasize = xsegs[xdataseg].xs_psize; X datap = malloc(datasize); X if (datap == NULL) { X perror("convcoff"); return 0; X } X lseek(xfd, xsegs[xtextseg].xs_filpos, 0); X cc = read(xfd, textp, textsize); X if (cc != textsize) { X if (cc == -1) X perror(xfname); X else X fprintf(stderr, "Invalid exec file: %s\n", xfname); X return 0; X } X lseek(xfd, xsegs[xdataseg].xs_filpos, 0); X cc = read(xfd, datap, datasize); X if (cc != datasize) { X if (cc == -1) X perror(xfname); X else X fprintf(stderr, "Invalid exec file: %s\n", xfname); X return 0; X } X return 1; X} X X/* X * Dump coff header X */ Xdumpcoff() X{ X int cc, j, padding; X char block[PAGESIZE]; X X memset(block, 0, PAGESIZE); X memcpy(block, (char *)&fhdr, sizeof(fhdr)); X memcpy(block+sizeof(fhdr), (char *)&ahdr, sizeof(ahdr)); X memcpy(block+sizeof(fhdr)+sizeof(ahdr), (char *)shdr, sizeof(struct scnhdr)*coffscns); X lseek(cfd, 0L, 0); X cc = write(cfd, block, PAGESIZE); X if (cc != PAGESIZE) { X perror(cfname); return 0; X } X memset(block, 0, PAGESIZE); X cc = write(cfd, textp, textsize); X if (cc != textsize) { X perror(cfname); return 0; X } X padding = shdr[DATA].s_scnptr - (PAGESIZE + textsize); X cc = write(cfd, block, padding); X if (cc != padding) { X perror(cfname); return 0; X } X cc = write(cfd, datap, datasize); X if (cc != datasize) { X perror(cfname); return 0; X } X if (nshlibs) { X cc = write(cfd, (char *)&libsect1, libsect1.size << 2); X if (cc == -1) { X perror(cfname); return 0; X } X if (nshlibs > 1) { X cc = write(cfd, (char *)&libsect2, libsect2.size << 2); X if (cc == -1) { X perror(cfname); return 0; X } X } X } X cc = write(cfd, (char *)symtab, symcount * sizeof(struct symbol)); X if (cc == -1) { X perror(cfname); return 0; X } X return 1; X} X Xaddshlib(path) X char *path; X{ X int i; X char *basep, *cp; X X if (basep = strrchr(path, '/')) X basep++; X else X basep = path; X for (i = 0; i < nshlibs; i++) { X cp = strrchr(shlibpaths[i], '/'); X if (cp) X cp++; X else X cp = shlibpaths[i]; X if (strcmp(basep, cp) == 0) X return; X } X if (nshlibs == SHLBMAX) { X fprintf(stderr, "Xenix only allows %d shared libraries\n", SHLBMAX); X exit(1); X } X shlibpaths[nshlibs++] = strdup(path); X} SHAR_EOF $TOUCH -am 0118105591 convcoff.c && chmod 0660 convcoff.c || echo "restore of convcoff.c failed" set `wc -c convcoff.c`;Wc_c=$1 if test "$Wc_c" != "13743"; then echo original size 13743, current size $Wc_c fi echo "End of part 1, continue with part 2" exit 0
pgd@bbt.se (01/25/91)
---- Cut Here and unpack ---- #!/bin/sh # This is part 02 of Xenixshlib if touch 2>&1 | fgrep 'amc' > /dev/null then TOUCH=touch else TOUCH=true fi # ============= hash.c ============== echo "x - extracting hash.c (Text)" sed 's/^X//' << 'SHAR_EOF' > hash.c && X#ifndef lint Xstatic char rcsid[] = "$Id: hash.c,v 1.2 90/10/02 13:32:23 chris Exp $"; X#endif X X/* X * Hash table routines. X */ X X#include <stdio.h> X#include <stdlib.h> X#include <string.h> X#include "hash.h" X X/* X * Hash table entries keep track of name=value pairs. X * The names may be numeric IDs instead (by having a null name). X */ Xstruct hashent { X struct hashent *h_next;/* next in chain */ X int h_hash; /* hash value or ID */ X char *h_name; /* name (null if from numeric ID) */ X char *h_value; /* value */ X}; X Xstruct hashtab { X int ht_size; /* size (power of 2) */ X int ht_mask; /* == ht_size - 1 */ X int ht_used; /* number of entries used */ X int ht_lim; /* when to expand */ X struct hashent **ht_tab;/* base of table */ X char ht_name[1]; /* table name; actually larger */ X}; X Xextern char *progname; X X#define bcopy(S, D, L) memcpy((D), (S), (L)) X Xchar * Xemalloc(n) X size_t n; X{ X register char *p = malloc(n); X X if (p == NULL) { X (void) fprintf(stderr, "%s: out of memory\n", progname); X exit(1); X } X return (p); X} X X/* round up to next multiple of y, where y is a power of 2 */ X#define ROUND(x, y) (((x) + (y) - 1) & ~((y) - 1)) X X/* compute a `good' number of objects to allocate via malloc */ Xint Xgoodnumber(n, s) X int n; X size_t s; X{ X X /* 16384 is a guess at a good page size for malloc */ X /* 32 is a guess at malloc's overhead */ X return ((int)((ROUND(n * s + 32, 16384) - 32) / s)); X} X X/* X * Make a new hash table. X */ Xstruct hashtab * Xht_new(name) X char *name; X{ X register struct hashtab *ht; X register struct hashent **h; X register int n; X X ht = (struct hashtab *)emalloc(sizeof *ht + strlen(name)); X ht->ht_tab = h = (struct hashent **)emalloc(128 * sizeof *h); X ht->ht_size = 128; X ht->ht_mask = 127; X for (n = 128; --n >= 0;) X *h++ = NULL; X ht->ht_used = 0; X ht->ht_lim = (128 * 2) / 3; X (void) strcpy(ht->ht_name, name); X return (ht); X} X X/* X * Expand an existing hash table. X */ Xstatic void Xht_expand(ht) X register struct hashtab *ht; X{ X register int n = ht->ht_size * 2, i; X register struct hashent *p, **h, **oldh, *q; X X h = (struct hashent **)emalloc(n * sizeof *h); X for (i = n; --i >= 0;) X *h++ = NULL; X h -= n; X oldh = ht->ht_tab; X n--; X for (i = ht->ht_size; --i >= 0;) { X for (p = *oldh++; p != NULL; p = q) { X q = p->h_next; X p->h_next = h[p->h_hash & n]; X h[p->h_hash & n] = p; X } X } X free((char *)ht->ht_tab); X ht->ht_tab = h; X ht->ht_mask = n; X ht->ht_size = ++n; X ht->ht_lim = (n * 2) / 3; X} X X/* X * Make a new hash entry. Its h_next will be NULL. X */ Xstatic struct hashent * Xnewhashent(hash, name, value) X int hash; X char *name, *value; X{ X static struct hashent *hfree; X register struct hashent *h; X register int n, nalloc; X X if ((h = hfree) != NULL) X hfree = h->h_next; X else { X nalloc = goodnumber(2, sizeof *h); /* need at least 2 */ X hfree = h = (struct hashent *)emalloc(nalloc * sizeof *h) + 1; X for (n = nalloc - 2; --n >= 0; h++) X h->h_next = h + 1; X h->h_next = NULL; X h -= nalloc - 1; X } X h->h_next = NULL; X h->h_hash = hash; X h->h_name = name; X h->h_value = value; X return (h); X} X X#define HASH(str, h, p) \ X for (p = str, h = 0; *p;) h = (h << 5) - h + *p++ X X/* X * Look up a name=value. X */ Xchar * Xht_nget(ht, name) X register struct hashtab *ht; X char *name; X{ X register char *p; X register int hash; X register struct hashent *h; X X HASH(name, hash, p); X p = name; X for (h = ht->ht_tab[hash & ht->ht_mask]; h != NULL; h = h->h_next) X if (h->h_hash == hash && h->h_name != NULL && X strcmp(h->h_name, p) == 0) X return (h->h_value); X return (NULL); X} X X/* X * Look up an ID=value. X */ Xchar * Xht_iget(ht, id) X register struct hashtab *ht; X register int id; X{ X register struct hashent *h; X X for (h = ht->ht_tab[id & ht->ht_mask]; h != NULL; h = h->h_next) X if (h->h_hash == id && h->h_name == NULL) X return (h->h_value); X return (NULL); X} X X/* X * Insert (do not clobber) a name=value. X * Return zero on success. X */ Xint Xht_nins(ht, name, value) X register struct hashtab *ht; X char *name, *value; X{ X register char *p; X register int hash; X register struct hashent *h, **hp; X X HASH(name, hash, p); X p = name; X for (hp = &ht->ht_tab[hash & ht->ht_mask]; (h = *hp) != NULL; X hp = &h->h_next) X if (h->h_hash == hash && h->h_name != NULL && X strcmp(h->h_name, p) == 0) X return (-1); X *hp = newhashent(hash, name, value); X if (++ht->ht_used > ht->ht_lim) X ht_expand(ht); X return (0); X} X X/* X * Insert (do clobber) a name=value. X * Return zero on success. X */ Xvoid Xht_nput(ht, name, value) X register struct hashtab *ht; X char *name, *value; X{ X register char *p; X register int hash; X register struct hashent *h, **hp; X X HASH(name, hash, p); X p = name; X for (hp = &ht->ht_tab[hash & ht->ht_mask]; (h = *hp) != NULL; X hp = &h->h_next) X if (h->h_hash == hash && h->h_name != NULL && X strcmp(h->h_name, p) == 0) { X h->h_value = value; X return; X } X *hp = newhashent(hash, name, value); X if (++ht->ht_used > ht->ht_lim) X ht_expand(ht); X return; X} X X/* X * Insert (do not clobber) an ID=value. X * Return zero on success. X */ Xint Xht_iins(ht, id, value) X register struct hashtab *ht; X register int id; X char *value; X{ X register struct hashent *h, **hp; X X for (hp = &ht->ht_tab[id & ht->ht_mask]; (h = *hp) != NULL; X hp = &h->h_next) X if (h->h_hash == id && h->h_name == NULL) X return (-1); X *hp = newhashent(id, (char *)NULL, value); X if (++ht->ht_used > ht->ht_lim) X ht_expand(ht); X return (0); X} X X/* X * Stash a copy of a string away; it will never be freed. X */ Xstatic char * Xpoolstr(s) X char *s; X{ X register char *p; X register size_t l = strlen(s) + 1; X static char *poolp; X static size_t nleft; X X if (nleft < l) X poolp = emalloc(nleft = goodnumber(l, 1)); X bcopy(s, p = poolp, l); X poolp += l; X return (p); X} X X/* X * Generate a single unique copy of the given string. X */ Xchar * Xstring(s) X char *s; X{ X register char *p; X register int hash; X register struct hashent *h, **hp; X static struct hashtab *ht; X X if (ht == NULL) X ht = ht_new("strings"); X HASH(s, hash, p); X p = s; X for (hp = &ht->ht_tab[hash & ht->ht_mask]; (h = *hp) != NULL; X hp = &h->h_next) X if (h->h_hash == hash && strcmp(h->h_name, p) == 0) X return (h->h_name); X *hp = h = newhashent(hash, poolstr(s), (char *)NULL); X if (++ht->ht_used > ht->ht_lim) X ht_expand(ht); X return (h->h_name); X} X X/* X * Call fn on all the name=value pairs. X */ Xvoid Xht_niterate(ht, fn) X struct hashtab *ht; X register void (*fn)(); X{ X register struct hashent *h, **hp; X register int n; X X for (n = ht->ht_size, hp = ht->ht_tab; --n >= 0;) X for (h = *hp++; h != NULL; h = h->h_next) X if (h->h_name != NULL) X (*fn)(h->h_name, h->h_value); X} X X/* X * Call fn on all the id=value pairs. X */ Xvoid Xht_iiterate(ht, fn) X struct hashtab *ht; X register void (*fn)(); X{ X register struct hashent *h, **hp; X register int n; X X for (n = ht->ht_size, hp = ht->ht_tab; --n >= 0;) X for (h = *hp++; h != NULL; h = h->h_next) X if (h->h_name == NULL) X (*fn)(h->h_hash, h->h_value); X} SHAR_EOF $TOUCH -am 1231154290 hash.c && chmod 0444 hash.c || echo "restore of hash.c failed" set `wc -c hash.c`;Wc_c=$1 if test "$Wc_c" != "6906"; then echo original size 6906, current size $Wc_c fi # ============= hash.h ============== echo "x - extracting hash.h (Text)" sed 's/^X//' << 'SHAR_EOF' > hash.h && X/* X * $Id: hash.h,v 1.1 90/09/24 23:58:38 chris Exp $ X * X * Hash table entries keep track of name (or id) = value pairs. X * Values are simply pointers. Hash tables themselves are named X * (for debugging). X */ X Xstruct hashtab; X X/* X * The `ins' functions return nonzero if the old value existed, X * without changing the value. X * The iterate functions calls a given function with name,value X * or id,value pairs. X */ Xstruct hashtab *ht_new(char *name); /* given name, create new hash table */ Xchar *ht_nget(struct hashtab *ht, char *name); /* given table and name, get value */ Xchar *ht_iget(struct hashtab *ht, int id); /* given table and ID, get value */ Xint ht_nins(struct hashtab *ht, char *name, char *value); /* given table and name, insert new value */ Xvoid ht_nput(struct hashtab *ht, char *name, char *value); Xint ht_iins(struct hashtab *ht, int id, char *value); /* given table and id, insert new value */ Xvoid ht_niterate(struct hashtab *ht, void (*fn)()); /* given table and function, iterate */ Xvoid ht_iiterate(struct hashtab *ht, void (*fn)()); /* given table and function, iterate */ X X/* X * Some things that ought not to be here, but are anyway. X * goodnumber() takes a number of objects and a size and returns X * a new number of objects, such that malloc(goodnumber(n,size)*size) X * calls malloc with a `good' size value (resulting in less wasted X * memory). emalloc is malloc with program-abort on out-of-memory. X * string() makes a `read-only' copy of a string, reusing the previous X * copy if any. X */ Xint goodnumber(); /* given n & sizeof, return new n */ Xchar *emalloc(); /* malloc, exit on error */ Xchar *string(char *s); /* make an `ideal' copy of a string */ SHAR_EOF $TOUCH -am 1231154690 hash.h && chmod 0444 hash.h || echo "restore of hash.h failed" set `wc -c hash.h`;Wc_c=$1 if test "$Wc_c" != "1686"; then echo original size 1686, current size $Wc_c fi # ============= libX11_start.c ============== echo "x - extracting libX11_start.c (Text)" sed 's/^X//' << 'SHAR_EOF' > libX11_start.c && X/* X * Startup routine for xenix with gcc using shared libraries X * This routine is called from assembler routine "crt0" X */ X#include <stdio.h> X Xchar **_argv; Xint _argc; Xstatic char **find_environ(); Xextern char **environ; Xextern void (*_xcstart)(), (*_xcend)(); Xextern int libX11_version; Xextern int (*_shlib_exit)(); Xextern exit(); X X_start(argc, sargv) X int argc; X char *sargv; X{ X char **vargv; X int valsave; X register char **argv = &sargv; X static char errtxt[] = "\nVersion of libX11_s does not fit executable\n"; X X if (libX11_version < VERSION) { X write(2, errtxt, sizeof(errtxt)); X _exit(-1); X } X _argv = argv; X _argc = argc; X environ = find_environ(argv); X _shlib_exit = exit; X valsave = main(argc, argv, environ); X _xcleanup(); X return valsave; X} X Xstatic char ** Xfind_environ(fargv) X register char **fargv; X{ X register char *cp; X X cp = *fargv; X do { X fargv++; X } while (fargv[-1]); X if ((char *)fargv == cp) X fargv--; X return fargv; X} X X X_xcleanup() X{ X register void (*xcp)(); X X for (xcp = _xcstart; xcp != _xcend; xcp++) X (*xcp)(); X} X SHAR_EOF $TOUCH -am 0116101391 libX11_start.c && chmod 0660 libX11_start.c || echo "restore of libX11_start.c failed" set `wc -c libX11_start.c`;Wc_c=$1 if test "$Wc_c" != "1049"; then echo original size 1049, current size $Wc_c fi # ============= libc_jump.s ============== echo "x - extracting libc_jump.s (Text)" sed 's/^X//' << 'SHAR_EOF' > libc_jump.s && X/ X/ Prefix file and jump table for libc shared library X/ X/ Included in this table str (all) symbols used by most X/ X libraries, except for the socket/network symbols, since X/ there are different incompatible libraries for that. X/ All gnulib symbols are also excluded, since the double jump X/ might be seen as a slowdown. X/ libc symbols which are not used by X-windows are not included. X/ X/ Created by: pgd@compuram.bbt.se on 9-jan-91 X/ X.text X jmp __bufsync X jmp __cleanup X jmp __doprnt X jmp __doscan X jmp __exit X jmp __fcmp X jmp __fcntl X jmp __filbuf X jmp __findbuf X jmp __findiop X jmp __flsbuf X jmp __ftime X jmp __ftol X jmp __gdup X jmp __rlatof X jmp __rlprint X jmp __sigcomm X jmp __time X jmp __wait X jmp __wrtchk X jmp __xflsbuf X jmp _abs X jmp _access X jmp _alarm X jmp _asctime X jmp _atof X jmp _atoi X jmp _brk X jmp _calloc X jmp _ceil X jmp _cfree X jmp _close X jmp _cos X jmp _ctime X jmp _creat X jmp _dup X jmp _dup2 X jmp _dysize X jmp _ecvt X jmp _endpwent X/ jmp _exit X jmp _execl X jmp _execve X jmp _exp X jmp _fclose X jmp _fcntl X jmp _fcvt X jmp _fflush X jmp _fgets X jmp _floor X jmp _fltrd X jmp _fopen X jmp _fork X jmp _fprintf X jmp _fputs X jmp _fread X jmp _free X jmp _freopen X jmp _frexp X jmp _fscanf X jmp _fseek X jmp _fstat X jmp _ftell X jmp _ftime X jmp _fwrite X jmp _getenv X jmp _getlogin X jmp _getpid X jmp _getpwent X jmp _getpwnam X jmp _getpwuid X jmp _gettzname X jmp _getuid X jmp _gmtime X jmp _ioctl X jmp _isatty X jmp _labs X jmp _ldexp X jmp _localtime X jmp _log X jmp _log10 X jmp _lseek X jmp _malloc X jmp _matherr X jmp _memccpy X jmp _memchr X jmp _memcmp X jmp _memcpy X jmp _memset X jmp _mknod X jmp _mktemp X jmp _modf X jmp _open X jmp _pow X jmp _printf X jmp _qsort X jmp _rand X jmp _read X jmp _realloc X jmp _rewind X jmp _sbrk X jmp _scanf X jmp _select X jmp _setpwent X jmp _sighold X jmp _signal X jmp _sigpause X jmp _sigset X jmp _sin X jmp _sleep X jmp _sprintf X jmp _srand X jmp _sscanf X jmp _stat X jmp _strcat X jmp _strchr X jmp _strcmp X jmp _strcpy X jmp _strdup X jmp _strlen X jmp _strncmp X jmp _strncpy X jmp _strrchr X jmp _strtol X jmp _system X jmp _tmpnam X jmp _time X jmp _toupper X jmp _ttyname X jmp _ttyslot X jmp _tzset X jmp _uname X jmp _ungetc X jmp _unlink X jmp _wait X jmp _weekday X jmp _write X jmp _xexp X jmp _xldexp X jmp _xlocking X jmp _xlog X jmp _xlog10 X/ X/ Placeholder for other libc routines that might be needed X/ X .byte 0,0,0,0,0 X .byte 0,0,0,0,0 X .byte 0,0,0,0,0 X .byte 0,0,0,0,0 X .byte 0,0,0,0,0 X .byte 0,0,0,0,0 X .byte 0,0,0,0,0 X .byte 0,0,0,0,0 X .byte 0,0,0,0,0 X .byte 0,0,0,0,0 SHAR_EOF $TOUCH -am 0116190391 libc_jump.s && chmod 0660 libc_jump.s || echo "restore of libc_jump.s failed" set `wc -c libc_jump.s`;Wc_c=$1 if test "$Wc_c" != "2479"; then echo original size 2479, current size $Wc_c fi # ============= libX11_jump.s ============== echo "x - extracting libX11_jump.s (Text)" sed 's/^X//' << 'SHAR_EOF' > libX11_jump.s && X/ X/ Prefix file and jump table for libX11 shared library X/ X X.text X jmp _ReadInteger X jmp _XActivateScreenSaver X jmp _XAddExtension X jmp _XAddHost X jmp _XAddHosts X jmp _XAddPixel X jmp _XAddToExtensionList X jmp _XAddToSaveSet X jmp _XAllPlanes X jmp _XAllocClassHint X jmp _XAllocColor X jmp _XAllocColorCells X jmp _XAllocColorPlanes X jmp _XAllocIconSize X jmp _XAllocNamedColor X jmp _XAllocSizeHints X jmp _XAllocStandardColormap X jmp _XAllocWMHints X jmp _XAllowEvents X jmp _XAutoRepeatOff X jmp _XAutoRepeatOn X jmp _XBell X jmp _XBitmapBitOrder X jmp _XBitmapPad X jmp _XBitmapUnit X jmp _XBlackPixel X jmp _XBlackPixelOfScreen X jmp _XCellsOfScreen X jmp _XChangeActivePointerGrab X jmp _XChangeGC X jmp _XChangeKeyboardControl X jmp _XChangeKeyboardMapping X jmp _XChangePointerControl X jmp _XChangeProperty X jmp _XChangeSaveSet X jmp _XChangeWindowAttributes X jmp _XCheckIfEvent X jmp _XCheckMaskEvent X jmp _XCheckTypedEvent X jmp _XCheckTypedWindowEvent X jmp _XCheckWindowEvent X jmp _XCirculateSubwindows X jmp _XCirculateSubwindowsDown X jmp _XCirculateSubwindowsUp X jmp _XClearArea X jmp _XClearWindow X jmp _XClipBox X jmp _XCloseDisplay X jmp _XConfigureWindow X jmp _XConnectionNumber X jmp _XConvertSelection X jmp _XCopyArea X jmp _XCopyColormapAndFree X jmp _XCopyGC X jmp _XCopyPlane X jmp _XCreateBitmapFromData X jmp _XCreateColormap X jmp _XCreateFontCursor X jmp _XCreateGC X jmp _XCreateGlyphCursor X jmp _XCreateImage X jmp _XCreatePixmap X jmp _XCreatePixmapCursor X jmp _XCreatePixmapFromBitmapData X jmp _XCreateRegion X jmp _XCreateSimpleWindow X jmp _XCreateWindow X jmp _XDefaultColormap X jmp _XDefaultColormapOfScreen X jmp _XDefaultDepth X jmp _XDefaultDepthOfScreen X jmp _XDefaultGC X jmp _XDefaultGCOfScreen X jmp _XDefaultRootWindow X jmp _XDefaultScreen X jmp _XDefaultScreenOfDisplay X jmp _XDefaultVisual X jmp _XDefaultVisualOfScreen X jmp _XDefineCursor X jmp _XDeleteContext X jmp _XDeleteModifiermapEntry X jmp _XDeleteProperty X jmp _XDestroyImage X jmp _XDestroyRegion X jmp _XDestroySubwindows X jmp _XDestroyWindow X jmp _XDisableAccessControl X jmp _XDisplayCells X jmp _XDisplayHeight X jmp _XDisplayHeightMM X jmp _XDisplayKeycodes X jmp _XDisplayMotionBufferSize X jmp _XDisplayName X jmp _XDisplayOfScreen X jmp _XDisplayPlanes X jmp _XDisplayString X jmp _XDisplayWidth X jmp _XDisplayWidthMM X jmp _XDoesBackingStore X jmp _XDoesSaveUnders X jmp _XDrawArc X jmp _XDrawArcs X jmp _XDrawImageString X jmp _XDrawImageString16 X jmp _XDrawLine X jmp _XDrawLines X jmp _XDrawPoint X jmp _XDrawPoints X jmp _XDrawRectangle X jmp _XDrawRectangles X jmp _XDrawSegments X jmp _XDrawString X jmp _XDrawString16 X jmp _XDrawText X jmp _XDrawText16 X jmp _XEHeadOfExtensionList X jmp _XESetCloseDisplay X jmp _XESetCopyGC X jmp _XESetCreateFont X jmp _XESetCreateGC X jmp _XESetError X jmp _XESetErrorString X jmp _XESetEventToWire X jmp _XESetFlushGC X jmp _XESetFreeFont X jmp _XESetFreeGC X jmp _XESetWireToEvent X jmp _XEmptyRegion X jmp _XEnableAccessControl X jmp _XEqualRegion X jmp _XEventMaskOfScreen X jmp _XEventsQueued X jmp _XFetchBuffer X jmp _XFetchBytes X jmp _XFetchName X jmp _XFillArc X jmp _XFillArcs X jmp _XFillPolygon X jmp _XFillRectangle X jmp _XFillRectangles X jmp _XFindContext X jmp _XFindOnExtensionList X jmp _XFlush X jmp _XForceScreenSaver X jmp _XFree X jmp _XFreeColormap X jmp _XFreeColors X jmp _XFreeCursor X jmp _XFreeExtensionList X jmp _XFreeFont X jmp _XFreeFontInfo X jmp _XFreeFontNames X jmp _XFreeFontPath X jmp _XFreeGC X jmp _XFreeModifiermap X jmp _XFreePixmap X jmp _XFreeStringList X jmp _XGContextFromGC X jmp _XGeometry X jmp _XGetAtomName X jmp _XGetClassHint X jmp _XGetCommand X jmp _XGetDefault X jmp _XGetErrorDatabaseText X jmp _XGetErrorText X jmp _XGetFontPath X jmp _XGetFontProperty X jmp _XGetGCValues X jmp _XGetGeometry X jmp _XGetIconName X jmp _XGetIconSizes X jmp _XGetImage X jmp _XGetInputFocus X jmp _XGetKeyboardControl X jmp _XGetKeyboardMapping X jmp _XGetModifierMapping X jmp _XGetMotionEvents X jmp _XGetNormalHints X jmp _XGetPixel X jmp _XGetPointerControl X jmp _XGetPointerMapping X jmp _XGetRGBColormaps X jmp _XGetScreenSaver X jmp _XGetSelectionOwner X jmp _XGetSizeHints X jmp _XGetStandardColormap X jmp _XGetSubImage X jmp _XGetTextProperty X jmp _XGetTransientForHint X jmp _XGetVisualInfo X jmp _XGetWMClientMachine X jmp _XGetWMColormapWindows X jmp _XGetWMHints X jmp _XGetWMIconName X jmp _XGetWMName X jmp _XGetWMNormalHints X jmp _XGetWMProtocols X jmp _XGetWMSizeHints X jmp _XGetWindowAttributes X jmp _XGetWindowProperty X jmp _XGetZoomHints X jmp _XGrabButton X jmp _XGrabKey X jmp _XGrabKeyboard X jmp _XGrabPointer X jmp _XGrabServer X jmp _XHeightMMOfScreen X jmp _XHeightOfScreen X jmp _XIconifyWindow X jmp _XIfEvent X jmp _XImageByteOrder X jmp _XInitExtension X jmp _XInsertModifiermapEntry X jmp _XInstallColormap X jmp _XInternAtom X jmp _XIntersectRegion X jmp _XKeycodeToKeysym X jmp _XKeysymToKeycode X jmp _XKeysymToString X jmp _XKillClient X jmp _XLastKnownRequestProcessed X jmp _XListDepths X jmp _XListExtensions X jmp _XListFonts X jmp _XListFontsWithInfo X jmp _XListHosts X jmp _XListInstalledColormaps X jmp _XListPixmapFormats X jmp _XListProperties X jmp _XLoadFont X jmp _XLoadQueryFont X jmp _XLookupColor X jmp _XLookupKeysym X jmp _XLookupString X jmp _XLowerWindow X jmp _XMapRaised X jmp _XMapSubwindows X jmp _XMapWindow X jmp _XMaskEvent X jmp _XMatchVisualInfo X jmp _XMaxCmapsOfScreen X jmp _XMaxRequestSize X jmp _XMinCmapsOfScreen X jmp _XMoveResizeWindow X jmp _XMoveWindow X jmp _XNewModifiermap X jmp _XNextEvent X jmp _XNextRequest X jmp _XNoOp X jmp _XOffsetRegion X jmp _XOpenDisplay X jmp _XParseColor X jmp _XParseGeometry X jmp _XPeekEvent X jmp _XPeekIfEvent X jmp _XPending X jmp _XPlanesOfScreen X jmp _XPointInRegion X jmp _XPolygonRegion X jmp _XProtocolRevision X jmp _XProtocolVersion X jmp _XPutBackEvent X jmp _XPutImage X jmp _XPutPixel X jmp _XQLength X jmp _XQueryBestCursor X jmp _XQueryBestSize X jmp _XQueryBestStipple X jmp _XQueryBestTile X jmp _XQueryColor X jmp _XQueryColors X jmp _XQueryExtension X jmp _XQueryFont X jmp _XQueryKeymap X jmp _XQueryPointer X jmp _XQueryTextExtents X jmp _XQueryTextExtents16 X jmp _XQueryTree X jmp _XRaiseWindow X jmp _XReadBitmapFile X jmp _XRebindKeysym X jmp _XRecolorCursor X jmp _XReconfigureWMWindow X jmp _XRectInRegion X jmp _XRefreshKeyboardMapping X jmp _XRemoveFromSaveSet X jmp _XRemoveHost X jmp _XRemoveHosts X jmp _XReparentWindow X jmp _XResetScreenSaver X jmp _XResizeWindow X jmp _XResourceManagerString X jmp _XRestackWindows X jmp _XRootWindow X jmp _XRootWindowOfScreen X jmp _XRotateBuffers X jmp _XRotateWindowProperties X jmp _XSaveContext X jmp _XScreenCount X jmp _XScreenNumberOfScreen X jmp _XScreenOfDisplay X jmp _XSelectInput X jmp _XSendEvent X jmp _XServerVendor X jmp _XSetAccessControl X jmp _XSetAfterFunction X jmp _XSetArcMode X jmp _XSetAuthorization X jmp _XSetBackground X jmp _XSetClassHint X jmp _XSetClipMask X jmp _XSetClipOrigin X jmp _XSetClipRectangles X jmp _XSetCloseDownMode X jmp _XSetCommand X jmp _XSetDashes X jmp _XSetErrorHandler X jmp _XSetFillRule X jmp _XSetFillStyle X jmp _XSetFont X jmp _XSetFontPath X jmp _XSetForeground X jmp _XSetFunction X jmp _XSetGraphicsExposures X jmp _XSetIOErrorHandler X jmp _XSetIconName X jmp _XSetIconSizes X jmp _XSetInputFocus X jmp _XSetLineAttributes X jmp _XSetModifierMapping X jmp _XSetNormalHints X jmp _XSetPlaneMask X jmp _XSetPointerMapping X jmp _XSetRGBColormaps X jmp _XSetRegion X jmp _XSetScreenSaver X jmp _XSetSelectionOwner X jmp _XSetSizeHints X jmp _XSetStandardColormap X jmp _XSetStandardProperties X jmp _XSetState X jmp _XSetStipple X jmp _XSetSubwindowMode X jmp _XSetTSOrigin X jmp _XSetTextProperty X jmp _XSetTile X jmp _XSetTransientForHint X jmp _XSetWMClientMachine X jmp _XSetWMColormapWindows X jmp _XSetWMHints X jmp _XSetWMIconName X jmp _XSetWMName X jmp _XSetWMNormalHints X jmp _XSetWMProperties X jmp _XSetWMProtocols X jmp _XSetWMSizeHints X jmp _XSetWindowBackground X jmp _XSetWindowBackgroundPixmap X jmp _XSetWindowBorder X jmp _XSetWindowBorderPixmap X jmp _XSetWindowBorderWidth X jmp _XSetWindowColormap X jmp _XSetZoomHints X jmp _XShrinkRegion X jmp _XStoreBuffer X jmp _XStoreBytes X jmp _XStoreColor X jmp _XStoreColors X jmp _XStoreName X jmp _XStoreNamedColor X jmp _XStringListToTextProperty X jmp _XStringToKeysym X jmp _XSubImage X jmp _XSubtractRegion X jmp _XSync X jmp _XSynchronize X jmp _XTextExtents X jmp _XTextExtents16 X jmp _XTextPropertyToStringList X jmp _XTextWidth X jmp _XTextWidth16 X jmp _XTranslateCoordinates X jmp _XUndefineCursor X jmp _XUngrabButton X jmp _XUngrabKey X jmp _XUngrabKeyboard X jmp _XUngrabPointer X jmp _XUngrabServer X jmp _XUninstallColormap X jmp _XUnionRectWithRegion X jmp _XUnionRegion X jmp _XUnloadFont X jmp _XUnmapSubwindows X jmp _XUnmapWindow X jmp _XVendorRelease X jmp _XVisualIDFromVisual X jmp _XWMGeometry X jmp _XWarpPointer X jmp _XWhitePixel X jmp _XWhitePixelOfScreen X jmp _XWidthMMOfScreen X jmp _XWidthOfScreen X jmp _XWindowEvent X jmp _XWithdrawWindow X jmp _XWriteBitmapFile X jmp _XXorRegion X jmp _XauDisposeAuth X jmp _XauFileName X jmp _XauGetAuthByAddr X jmp _XauReadAuth X jmp _Xpermalloc X jmp _XrmDestroyDatabase X jmp _XrmGetFileDatabase X jmp _XrmGetResource X jmp _XrmGetStringDatabase X jmp _XrmInitialize X jmp _XrmMergeDatabases X jmp _XrmParseCommand X jmp _XrmPutFileDatabase X jmp _XrmPutLineResource X jmp _XrmPutResource X jmp _XrmPutStringResource X jmp _XrmQGetResource X jmp _XrmQGetSearchList X jmp _XrmQGetSearchResource X jmp _XrmQPutResource X jmp _XrmQPutStringResource X jmp _XrmQuarkToString X jmp _XrmStringToBindingQuarkList X jmp _XrmStringToQuark X jmp _XrmStringToQuarkList X jmp _XrmUniqueQuark X jmp __Reverse_Bytes X jmp __XAllocID X jmp __XAllocScratch X jmp __XConnectDisplay X jmp __XDefaultError X jmp __XDefaultIOError X jmp __XDisconnectDisplay X jmp __XEatData X jmp __XEnq X jmp __XError X jmp __XEventToWire X jmp __XEventsQueued X jmp __XFlush X jmp __XFlushGCCache X jmp __XFreeDisplayStructure X jmp __XFreeExtData X jmp __XFreeKeyBindings X jmp __XFreeQ X jmp __XGenerateGCList X jmp __XGetBitsPerPixel X jmp __XGetHostname X jmp __XGetScanlinePad X jmp __XIOError X jmp __XInitImageFuncPtrs X jmp __XInitKeysymDB X jmp __XPrintDefaultError X jmp __XProcessWindowAttributes X jmp __XRead X jmp __XReadEvents X jmp __XReadPad X jmp __XReply X jmp __XScreenOfWindow X jmp __XSend X jmp __XSendClientPrefix X jmp __XSetClipRectangles X jmp __XSetImage X jmp __XSetLastRequestRead X jmp __XSyncFunction X jmp __XUnknownNativeEvent X jmp __XUnknownWireEvent X jmp __XUpdateGCCache X jmp __XVIDtoVisual X jmp __XWaitForReadable X jmp __XWaitForWritable X jmp __XWireToEvent X jmp __XXlibGlobalLoadDummyProcedure X jmp __XrmGetResourceName X jmp _bcmp X jmp _bcopy X jmp _bzero X jmp _combineRegs X jmp _ffs X jmp _gettimeofday X jmp _index X jmp _insque X jmp _random X jmp _readv X jmp _remque X jmp _rindex X jmp _srandom X jmp _writev X/ X/ Placeholder for other routines that might be needed X/ X .byte 0,0,0,0,0 X .byte 0,0,0,0,0 X .byte 0,0,0,0,0 X .byte 0,0,0,0,0 X .byte 0,0,0,0,0 X .byte 0,0,0,0,0 X .byte 0,0,0,0,0 X .byte 0,0,0,0,0 X .byte 0,0,0,0,0 X .byte 0,0,0,0,0 SHAR_EOF $TOUCH -am 0112132791 libX11_jump.s && chmod 0660 libX11_jump.s || echo "restore of libX11_jump.s failed" set `wc -c libX11_jump.s`;Wc_c=$1 if test "$Wc_c" != "10793"; then echo original size 10793, current size $Wc_c fi # ============= libXmu_jump.s ============== echo "x - extracting libXmu_jump.s (Text)" sed 's/^X//' << 'SHAR_EOF' > libXmu_jump.s && X/ X/ Prefix file and jump table for libXmu shared library X/ X X.text X jmp _XctCreate X jmp _XctFree X jmp _XctNextItem X jmp _XctReset X jmp _XmuAddCloseDisplayHook X jmp _XmuAddInitializer X jmp _XmuAllStandardColormaps X jmp _XmuCallInitializers X jmp _XmuClientWindow X jmp _XmuCompareISOLatin1 X jmp _XmuConvertStandardSelection X jmp _XmuCopyISOLatin1Lowered X jmp _XmuCopyISOLatin1Uppered X jmp _XmuCreateColormap X jmp _XmuCreatePixmapFromBitmap X jmp _XmuCreateStippledPixmap X jmp _XmuCursorNameToIndex X jmp _XmuCvtFunctionToCallback X jmp _XmuCvtStringToBackingStore X jmp _XmuCvtStringToBitmap X jmp _XmuCvtStringToCursor X jmp _XmuCvtStringToJustify X jmp _XmuCvtStringToLong X jmp _XmuCvtStringToOrientation X jmp _XmuCvtStringToShapeStyle X jmp _XmuCvtStringToWidget X jmp _XmuDQAddDisplay X jmp _XmuDQCreate X jmp _XmuDQDestroy X jmp _XmuDQLookupDisplay X jmp _XmuDQRemoveDisplay X jmp _XmuDeleteStandardColormap X jmp _XmuDrawLogo X jmp _XmuDrawRoundedRectangle X jmp _XmuFillRoundedRectangle X jmp _XmuGetAtomName X jmp _XmuGetColormapAllocation X jmp _XmuGetHostname X jmp _XmuInternAtom X jmp _XmuInternStrings X jmp _XmuLocateBitmapFile X jmp _XmuLookupAPL X jmp _XmuLookupArabic X jmp _XmuLookupCloseDisplayHook X jmp _XmuLookupCyrillic X jmp _XmuLookupGreek X jmp _XmuLookupHebrew X jmp _XmuLookupJISX0201 X jmp _XmuLookupKana X jmp _XmuLookupLatin1 X jmp _XmuLookupLatin2 X jmp _XmuLookupLatin3 X jmp _XmuLookupLatin4 X jmp _XmuLookupStandardColormap X jmp _XmuLookupString X jmp _XmuMakeAtom X jmp _XmuNameOfAtom X jmp _XmuPrintDefaultErrorMessage X jmp _XmuReadBitmapData X jmp _XmuReadBitmapDataFromFile X jmp _XmuReleaseStippledPixmap X jmp _XmuRemoveCloseDisplayHook X jmp _XmuReshapeWidget X jmp _XmuScreenOfWindow X jmp _XmuSimpleErrorHandler X jmp _XmuStandardColormap X jmp _XmuUpdateMapHints X jmp _XmuVisualStandardColormaps X jmp __XmuCCLookupDisplay X jmp __XmuStringToBitmapFreeCache X jmp __XmuStringToBitmapInitCache X/ X/ Placeholder for other routines that might be needed X/ X .byte 0,0,0,0,0 X .byte 0,0,0,0,0 X .byte 0,0,0,0,0 X .byte 0,0,0,0,0 X .byte 0,0,0,0,0 SHAR_EOF $TOUCH -am 0112132891 libXmu_jump.s && chmod 0660 libXmu_jump.s || echo "restore of libXmu_jump.s failed" set `wc -c libXmu_jump.s`;Wc_c=$1 if test "$Wc_c" != "2027"; then echo original size 2027, current size $Wc_c fi # ============= libXt_jump.s ============== echo "x - extracting libXt_jump.s (Text)" sed 's/^X//' << 'SHAR_EOF' > libXt_jump.s && X/ X/ Prefix file and jump table for libXt shared library X/ X X.text X jmp _CompositeClassPartInitialize X jmp _CompositeDeleteChild X jmp _CompositeDestroy X jmp _CompositeInitialize X jmp _CompositeInsertChild X jmp _LowerCase X jmp _PeekOtherSources X jmp _XrmCompileResourceList X jmp _XtAddActions X jmp _XtAddCallback X jmp _XtAddCallbacks X jmp _XtAddConverter X jmp _XtAddEventHandler X jmp _XtAddExposureToRegion X jmp _XtAddGrab X jmp _XtAddInput X jmp _XtAddRawEventHandler X jmp _XtAddTimeOut X jmp _XtAddWorkProc X jmp _XtAppAddActionHook X jmp _XtAppAddActions X jmp _XtAppAddConverter X jmp _XtAppAddInput X jmp _XtAppAddTimeOut X jmp _XtAppAddWorkProc X jmp _XtAppCreateShell X jmp _XtAppError X jmp _XtAppErrorMsg X jmp _XtAppGetErrorDatabase X jmp _XtAppGetErrorDatabaseText X jmp _XtAppGetSelectionTimeout X jmp _XtAppInitialize X jmp _XtAppMainLoop X jmp _XtAppNextEvent X jmp _XtAppPeekEvent X jmp _XtAppPending X jmp _XtAppProcessEvent X jmp _XtAppReleaseCacheRefs X jmp _XtAppSetErrorHandler X jmp _XtAppSetErrorMsgHandler X jmp _XtAppSetFallbackResources X jmp _XtAppSetSelectionTimeout X jmp _XtAppSetTypeConverter X jmp _XtAppSetWarningHandler X jmp _XtAppSetWarningMsgHandler X jmp _XtAppWarning X jmp _XtAppWarningMsg X jmp _XtAugmentTranslations X jmp _XtBuildEventMask X jmp _XtCallAcceptFocus X jmp _XtCallActionProc X jmp _XtCallCallbackList X jmp _XtCallCallbacks X jmp _XtCallConverter X jmp _XtCallbackExclusive X jmp _XtCallbackNone X jmp _XtCallbackNonexclusive X jmp _XtCallbackPopdown X jmp _XtCallbackReleaseCacheRef X jmp _XtCallbackReleaseCacheRefList X jmp _XtCalloc X jmp _XtClass X jmp _XtCloseDisplay X jmp _XtConfigureWidget X jmp _XtConvert X jmp _XtConvertAndStore X jmp _XtConvertCase X jmp _XtCopyAncestorSensitive X jmp _XtCopyDefaultColormap X jmp _XtCopyDefaultDepth X jmp _XtCopyFromParent X jmp _XtCopyScreen X jmp _XtCreateApplicationContext X jmp _XtCreateApplicationShell X jmp _XtCreateManagedWidget X jmp _XtCreatePopupShell X jmp _XtCreateWidget X jmp _XtCreateWindow X jmp _XtDatabase X jmp _XtDestroyApplicationContext X jmp _XtDestroyGC X jmp _XtDestroyWidget X jmp _XtDirectConvert X jmp _XtDisownSelection X jmp _XtDispatchEvent X jmp _XtDisplay X jmp _XtDisplayInitialize X jmp _XtDisplayOfObject X jmp _XtDisplayStringConversionWarning X jmp _XtDisplayToApplicationContext X jmp _XtError X jmp _XtErrorMsg X jmp _XtFindFile X jmp _XtFree X jmp _XtGetActionKeysym X jmp _XtGetApplicationNameAndClass X jmp _XtGetApplicationResources X jmp _XtGetConstraintResourceList X jmp _XtGetErrorDatabase X jmp _XtGetErrorDatabaseText X jmp _XtGetGC X jmp _XtGetKeysymTable X jmp _XtGetMultiClickTime X jmp _XtGetResourceList X jmp _XtGetSelectionRequest X jmp _XtGetSelectionTimeout X jmp _XtGetSelectionValue X jmp _XtGetSelectionValueIncremental X jmp _XtGetSelectionValues X jmp _XtGetSelectionValuesIncremental X jmp _XtGetSubresources X jmp _XtGetSubvalues X jmp _XtGetValues X jmp _XtGrabButton X jmp _XtGrabKey X jmp _XtGrabKeyboard X jmp _XtGrabPointer X jmp _XtHasCallbacks X jmp _XtInitialize X jmp _XtInitializeWidgetClass X jmp _XtInsertEventHandler X jmp _XtInsertRawEventHandler X jmp _XtInstallAccelerators X jmp _XtInstallAllAccelerators X jmp _XtIsApplicationShell X jmp _XtIsComposite X jmp _XtIsConstraint X jmp _XtIsManaged X jmp _XtIsObject X jmp _XtIsOverrideShell X jmp _XtIsRealized X jmp _XtIsRectObj X jmp _XtIsSensitive X jmp _XtIsShell X jmp _XtIsSubclass X jmp _XtIsTopLevelShell X jmp _XtIsTransientShell X jmp _XtIsVendorShell X jmp _XtIsWMShell X jmp _XtIsWidget X jmp _XtKeysymToKeycodeList X jmp _XtLastTimestampProcessed X jmp _XtMainLoop X jmp _XtMakeGeometryRequest X jmp _XtMakeResizeRequest X jmp _XtMalloc X jmp _XtManageChild X jmp _XtManageChildren X jmp _XtMapWidget X jmp _XtMenuPopupAction X jmp _XtMergeArgLists X jmp _XtMoveWidget X jmp _XtName X jmp _XtNameToWidget X jmp _XtNewString X jmp _XtNextEvent X jmp _XtOpenDisplay X jmp _XtOverrideTranslations X jmp _XtOwnSelection X jmp _XtOwnSelectionIncremental X jmp _XtParent X jmp _XtParseAcceleratorTable X jmp _XtParseTranslationTable X jmp _XtPeekEvent X jmp _XtPending X jmp _XtPopdown X jmp _XtPopup X jmp _XtPopupSpringLoaded X jmp _XtProcessEvent X jmp _XtQueryGeometry X jmp _XtRealizeWidget X jmp _XtRealloc X jmp _XtRegisterCaseConverter X jmp _XtRegisterGrabAction X jmp _XtReleaseGC X jmp _XtRemoveActionHook X jmp _XtRemoveAllCallbacks X jmp _XtRemoveCallback X jmp _XtRemoveCallbacks X jmp _XtRemoveEventHandler X jmp _XtRemoveGrab X jmp _XtRemoveInput X jmp _XtRemoveRawEventHandler X jmp _XtRemoveTimeOut X jmp _XtRemoveWorkProc X jmp _XtResizeWidget X jmp _XtResizeWindow X jmp _XtResolvePathname X jmp _XtScreen X jmp _XtScreenOfObject X jmp _XtSetErrorHandler X jmp _XtSetErrorMsgHandler X jmp _XtSetKeyTranslator X jmp _XtSetKeyboardFocus X jmp _XtSetMappedWhenManaged X jmp _XtSetMultiClickTime X jmp _XtSetSelectionTimeout X jmp _XtSetSensitive X jmp _XtSetSubvalues X jmp _XtSetTypeConverter X jmp _XtSetValues X jmp _XtSetWMColormapWindows X jmp _XtSetWarningHandler X jmp _XtSetWarningMsgHandler X jmp _XtStringConversionWarning X jmp _XtSuperclass X jmp _XtToolkitInitialize X jmp _XtTranslateCoords X jmp _XtTranslateKey X jmp _XtTranslateKeycode X jmp _XtUngrabButton X jmp _XtUngrabKey X jmp _XtUngrabKeyboard X jmp _XtUngrabPointer X jmp _XtUninstallTranslations X jmp _XtUnmanageChild X jmp _XtUnmanageChildren X jmp _XtUnmapWidget X jmp _XtUnrealizeWidget X jmp _XtVaAppCreateShell X jmp _XtVaAppInitialize X jmp _XtVaCreateArgsList X jmp _XtVaCreateManagedWidget X jmp _XtVaCreatePopupShell X jmp _XtVaCreateWidget X jmp _XtVaGetApplicationResources X jmp _XtVaGetSubresources X jmp _XtVaGetSubvalues X jmp _XtVaGetValues X jmp _XtVaSetSubvalues X jmp _XtVaSetValues X jmp _XtWarning X jmp _XtWarningMsg X jmp _XtWidgetToApplicationContext X jmp _XtWindow X jmp _XtWindowOfObject X jmp _XtWindowToWidget X jmp __CompileActionTable X jmp __XtAddCallback X jmp __XtAddCallbackOnce X jmp __XtAddDefaultConverters X jmp __XtAddEventSeqToStateTable X jmp __XtAddTMConverters X jmp __XtAllocError X jmp __XtAppCreateShell X jmp __XtBindActions X jmp __XtBuildKeysymTables X jmp __XtCacheFlushTag X jmp __XtCallCallbacks X jmp __XtCallConverter X jmp __XtCallbackList X jmp __XtCheckServerGrabsOnWidget X jmp __XtCheckSubclassFlag X jmp __XtCloseDisplays X jmp __XtCompileCallbackList X jmp __XtCondCopyTranslations X jmp __XtConstraintResDependencies X jmp __XtConvert X jmp __XtConvertCase X jmp __XtConvertInitialize X jmp __XtCopyFromArg X jmp __XtCopyToArg X jmp __XtCountVaList X jmp __XtCreateIndirectionTable X jmp __XtCreatePopupShell X jmp __XtCreateWidget X jmp __XtCvtMergeTranslations X jmp __XtDefaultAppContext X jmp __XtDefaultError X jmp __XtDefaultErrorMsg X jmp __XtDefaultWarning X jmp __XtDefaultWarningMsg X jmp __XtDependencies X jmp __XtDestroyAppContexts X jmp __XtDestroyServerGrabs X jmp __XtDisplayInitialize X jmp __XtDoPhase2Destroy X jmp __XtEventInitialize X jmp __XtFillAncestorList X jmp __XtFindRemapWidget X jmp __XtFreeActions X jmp __XtFreeCacheRec X jmp __XtFreeCallbackList X jmp __XtFreeConverterTable X jmp __XtFreeEventTable X jmp __XtFreePerWidgetInput X jmp __XtFreeTranslations X jmp __XtGClistFree X jmp __XtGetCallbackList X jmp __XtGetPerWidgetInput X jmp __XtGetProcessContext X jmp __XtGetResources X jmp __XtHandleFocus X jmp __XtHeapAlloc X jmp __XtInherit X jmp __XtInitErrorHandling X jmp __XtInitializeStateTable X jmp __XtInstallTranslations X jmp __XtIsSubclassOf X jmp __XtMakeGeometryRequest X jmp __XtMatchAtom X jmp __XtMatchUsingDontCareMods X jmp __XtMatchUsingStandardMods X jmp __XtOnGrabList X jmp __XtPopup X jmp __XtPopupInitialize X jmp __XtProcessKeyboardEvent X jmp __XtProcessPointerEvent X jmp __XtRegisterAccRemoveCallbacks X jmp __XtRegisterGrabs X jmp __XtRegisterWindow X jmp __XtRegularMatch X jmp __XtRemoveAllCallbacks X jmp __XtRemoveAllInputs X jmp __XtRemoveCallback X jmp __XtRemoveTranslations X jmp __XtResourceDependencies X jmp __XtResourceListInitialize X jmp __XtSendFocusEvent X jmp __XtSetDefaultConverterTable X jmp __XtSetDefaultErrorHandlers X jmp __XtSetDefaultSelectionTimeout X jmp __XtShellGetCoordinates X jmp __XtSortPerDisplayList X jmp __XtTableAddConverter X jmp __XtTranslateEvent X jmp __XtTranslateInitialize X jmp __XtTranslateTablePrint X jmp __XtUngrabBadGrabs X jmp __XtUninstallAccelerators X jmp __XtUnregisterWindow X jmp __XtVaAppInitialize X jmp __XtVaCreateTypedArgList X jmp __XtVaToArgList X jmp __XtVaToTypedArgList X jmp __XtWindowedAncestor X jmp __XtwaitForSomething X/ X/ Placeholder for other routines that might be needed X/ X .byte 0,0,0,0,0 X .byte 0,0,0,0,0 X .byte 0,0,0,0,0 X .byte 0,0,0,0,0 X .byte 0,0,0,0,0 SHAR_EOF $TOUCH -am 0112132891 libXt_jump.s && chmod 0660 libXt_jump.s || echo "restore of libXt_jump.s failed" set `wc -c libXt_jump.s`;Wc_c=$1 if test "$Wc_c" != "8376"; then echo original size 8376, current size $Wc_c fi # ============= libXaw_jump.s ============== echo "x - extracting libXaw_jump.s (Text)" sed 's/^X//' << 'SHAR_EOF' > libXaw_jump.s && X/ X/ Prefix file and jump table for libXaw shared library X/ X X.text X jmp _CommitGripAdjustment X jmp _FindCornerItems X jmp _HighlightBackground X jmp _ItemInRectangle X jmp _PaintItemName X jmp _XawAsciiSave X jmp _XawAsciiSaveAsFile X jmp _XawAsciiSourceChanged X jmp _XawAsciiSourceFreeString X jmp _XawDialogAddButton X jmp _XawDialogGetValueString X jmp _XawDiskSourceCreate X jmp _XawFormDoLayout X jmp _XawInitializeWidgetSet X jmp _XawListChange X jmp _XawListHighlight X jmp _XawListShowCurrent X jmp _XawListUnhighlight X jmp _XawPanedAllowResize X jmp _XawPanedGetMinMax X jmp _XawPanedGetNumSub X jmp _XawPanedSetMinMax X jmp _XawPanedSetRefigureMode X jmp _XawScrollbarSetThumb X jmp _XawSimpleMenuAddGlobalActions X jmp _XawSimpleMenuClearActiveEntry X jmp _XawSimpleMenuGetActiveEntry X jmp _XawStringSourceCreate X jmp _XawTextChangeOptions X jmp _XawTextDisableRedisplay X jmp _XawTextDisplay X jmp _XawTextDisplayCaret X jmp _XawTextEnableRedisplay X jmp _XawTextGetInsertionPoint X jmp _XawTextGetOptions X jmp _XawTextGetSelectionPos X jmp _XawTextGetSource X jmp _XawTextInvalidate X jmp _XawTextReplace X jmp _XawTextSearch X jmp _XawTextSetInsertionPoint X jmp _XawTextSetLastPos X jmp _XawTextSetSelection X jmp _XawTextSetSelectionArray X jmp _XawTextSetSource X jmp _XawTextSinkClearToBackground X jmp _XawTextSinkDisplayText X jmp _XawTextSinkFindDistance X jmp _XawTextSinkFindPosition X jmp _XawTextSinkGetCursorBounds X jmp _XawTextSinkInsertCursor X jmp _XawTextSinkMaxHeight X jmp _XawTextSinkMaxLines X jmp _XawTextSinkResolve X jmp _XawTextSinkSetTabs X jmp _XawTextSourceConvertSelection X jmp _XawTextSourceRead X jmp _XawTextSourceReplace X jmp _XawTextSourceScan X jmp _XawTextSourceSearch X jmp _XawTextSourceSetSelection X jmp _XawTextTopPosition X jmp _XawTextUnsetSelection X jmp _XawToggleChangeRadioGroup X jmp _XawToggleGetCurrent X jmp _XawToggleSetCurrent X jmp _XawToggleUnsetCurrent X jmp __SetSelection X jmp __XawTextAlterSelection X jmp __XawTextBuildLineTable X jmp __XawTextCheckResize X jmp __XawTextClearAndCenterDisplay X jmp __XawTextDoReplaceAction X jmp __XawTextDoSearchAction X jmp __XawTextExecuteUpdate X jmp __XawTextGetSTRING X jmp __XawTextGetText X jmp __XawTextInsertFile X jmp __XawTextInsertFileAction X jmp __XawTextNeedsUpdating X jmp __XawTextPopdownSearchAction X jmp __XawTextPrepareToUpdate X jmp __XawTextReplace X jmp __XawTextSearch X jmp __XawTextSelectionList X jmp __XawTextSetField X jmp __XawTextSetScrollBars X jmp __XawTextSetSelection X jmp __XawTextShowPosition X jmp __XawTextVScroll X jmp __XawTextZapSelection X/ X/ Placeholder for other routines that might be needed X/ X .byte 0,0,0,0,0 X .byte 0,0,0,0,0 X .byte 0,0,0,0,0 X .byte 0,0,0,0,0 X .byte 0,0,0,0,0 SHAR_EOF $TOUCH -am 0112132891 libXaw_jump.s && chmod 0660 libXaw_jump.s || echo "restore of libXaw_jump.s failed" set `wc -c libXaw_jump.s`;Wc_c=$1 if test "$Wc_c" != "2653"; then echo original size 2653, current size $Wc_c fi # ============= libXext_jump.s ============== echo "x - extracting libXext_jump.s (Text)" sed 's/^X//' << 'SHAR_EOF' > libXext_jump.s && X/ X/ Prefix file and jump table for libXext shared library X/ X X.text X jmp _XMITMiscGetBugMode X jmp _XMITMiscQueryExtension X jmp _XMITMiscSetBugMode X jmp _XMissingExtension X jmp _XSetExtensionErrorHandler X jmp _XShapeCombineMask X jmp _XShapeCombineRectangles X jmp _XShapeCombineRegion X jmp _XShapeCombineShape X jmp _XShapeGetRectangles X jmp _XShapeInputSelected X jmp _XShapeOffsetShape X jmp _XShapeQueryExtension X jmp _XShapeQueryExtents X jmp _XShapeQueryVersion X jmp _XShapeSelectInput X jmp _XShmAttach X jmp _XShmCreateImage X jmp _XShmCreatePixmap X jmp _XShmDetach X jmp _XShmGetEventBase X jmp _XShmGetImage X jmp _XShmPutImage X jmp _XShmQueryExtension X jmp _XShmQueryVersion X jmp _XTestFakeInput X jmp _XTestFlush X jmp _XTestGetInput X jmp _XTestMovePointer X jmp _XTestPressButton X jmp _XTestPressKey X jmp _XTestQueryInputSize X jmp _XTestReset X jmp _XTestStopInput X jmp _XextAddDisplay X jmp _XextCreateExtension X jmp _XextDestroyExtension X jmp _XextFindDisplay X jmp _XextRemoveDisplay X jmp _XmbufChangeBufferAttributes X jmp _XmbufChangeWindowAttributes X jmp _XmbufCreateBuffers X jmp _XmbufCreateStereoWindow X jmp _XmbufDestroyBuffers X jmp _XmbufDisplayBuffers X jmp _XmbufGetBufferAttributes X jmp _XmbufGetScreenInfo X jmp _XmbufGetVersion X jmp _XmbufGetWindowAttributes X jmp _XmbufQueryExtension X jmp __XExtensionGlobalLoadDummyProcedure X/ X/ Placeholder for other routines that might be needed X/ X .byte 0,0,0,0,0 X .byte 0,0,0,0,0 X .byte 0,0,0,0,0 X .byte 0,0,0,0,0 X .byte 0,0,0,0,0 SHAR_EOF $TOUCH -am 0112132891 libXext_jump.s && chmod 0660 libXext_jump.s || echo "restore of libXext_jump.s failed" set `wc -c libXext_jump.s`;Wc_c=$1 if test "$Wc_c" != "1475"; then echo original size 1475, current size $Wc_c fi # ============= Scrt0.s ============== echo "x - extracting Scrt0.s (Text)" sed 's/^X//' << 'SHAR_EOF' > Scrt0.s && X/ X/ Replacement startup file neede when using shared libraries X/ X/ Author: pgd@compuram.bbt.se X/ X .file "Scrt0.s" X .text X .globl start0, __nd_ X X jmp start0 Xstart0: X movl %eax,__nd_ / Fill in top of memory address X xor %ebp,%ebp X call __start X push %eax / Exit status X call __exit X1: X jmp 1b X SHAR_EOF $TOUCH -am 0109171091 Scrt0.s && chmod 0660 Scrt0.s || echo "restore of Scrt0.s failed" set `wc -c Scrt0.s`;Wc_c=$1 if test "$Wc_c" != "296"; then echo original size 296, current size $Wc_c fi # ============= libX11_s.c ============== echo "x - extracting libX11_s.c (Text)" sed 's/^X//' << 'SHAR_EOF' > libX11_s.c && X/* X * Prefix file and jump table for Xlib shared library X * X * Author: P.Garbha pgd@compuram.bbt.se X */ X Xchar **environ; Xchar *_nd_; Xint _fac; Xint _acrtused; X X/* X * Identifier to autload library X */ Xchar __SHLIB__libX11_s; X X__JumpTabEnd() X{ X} X Xvoid (*_shlib_exit)(); X X/* X * exit routine to use from within library X */ Xexit(status) X int status; X{ X _shlib_exit(status); X} X XlibX11_exit(status) X{ X _shlib_exit(status); X} X SHAR_EOF $TOUCH -am 0116154691 libX11_s.c && chmod 0660 libX11_s.c || echo "restore of libX11_s.c failed" set `wc -c libX11_s.c`;Wc_c=$1 if test "$Wc_c" != "418"; then echo original size 418, current size $Wc_c fi # ============= hello.c ============== echo "x - extracting hello.c (Text)" sed 's/^X//' << 'SHAR_EOF' > hello.c && X#include <stdio.h> X Xmain() X{ X/* write(1, "Haribol!\n", 8); */ X printf("Haribol!!!\n"); X exit(0); X} SHAR_EOF $TOUCH -am 1225114590 hello.c && chmod 0660 hello.c || echo "restore of hello.c failed" set `wc -c hello.c`;Wc_c=$1 if test "$Wc_c" != "99"; then echo original size 99, current size $Wc_c fi # ============= coffhdr.c ============== echo "x - extracting coffhdr.c (Text)" sed 's/^X//' << 'SHAR_EOF' > coffhdr.c && X/* X * Program to display coff headers X */ X X#include <stdio.h> X#include <sys/types.h> X#include <sys/fcntl.h> X#include <sys/coff.h> X#include <sys/a.out.h> X#include <time.h> X Xchar *fname; X Xstruct filehdr fhdr; /* coff file header */ Xstruct aouthdr ahdr; /* a.out header */ Xstruct scnhdr *shdr; /* section headers */ X Xmain(argc, argv) X int argc; X char **argv; X{ X int fd; X X if (argc < 2) X fname = "a.out"; X else X fname = argv[1]; X fd = open(fname, O_RDONLY); X if (fd == -1) { X perror(fname); X exit(1); X } X loadheaders(fd); X showheaders(); X/* dumplibs(); */ X exit(0); X} X Xloadheaders(fd) X int fd; X{ X if (read(fd, &fhdr, sizeof fhdr) != sizeof fhdr) { X perror("coffhdr"); exit(1); X } X if (fhdr.f_magic == X_MAGIC) { X fprintf(stderr, "file is an x.out type file\n"); X exit(1); X } X if (fhdr.f_magic != I386MAGIC) { X fprintf(stderr, "Not a coff exec file\n"); X exit(1); X } X if (read(fd, &ahdr, sizeof ahdr) != sizeof ahdr) { X perror("aouthdr"); exit(1); X } X if (fhdr.f_nscns) { X shdr = (struct scnhdr *)calloc(sizeof(struct scnhdr), fhdr.f_nscns); X if (shdr == NULL) { X perror("coffhdr"); exit(1); X } X if (read(fd, (char *)shdr, fhdr.f_nscns * sizeof(struct scnhdr)) == -1) { X perror("scnhdr"); exit(1); X } X } else X shdr = NULL; X} X Xshowheaders() X{ X int i; X X printf("File: %s\n", fname); X printf("Created: %s\n", asctime(localtime(&fhdr.f_timdat))); X printf("Symbol table addr: %06x\n", fhdr.f_symptr); X printf("Number of symbols: %d\n", fhdr.f_nsyms); X printf("Flags: \n"); X if (fhdr.f_flags & F_RELFLG) X printf("\trelocation info stripped from file\n"); X if (fhdr.f_flags & F_EXEC) X printf("\tfile is executable\n"); X if (fhdr.f_flags & F_LNNO) X printf("\tline numbers stripped from file\n"); X if (fhdr.f_flags & F_LSYMS) X printf("\tlocal symbols stripped from file\n"); X if (fhdr.f_flags & F_MINMAL) X printf("\tthis is a minimal object file ('.m') output of fextract\n"); X if (fhdr.f_flags & F_UPDATE) X printf("\tthis is a fully bound update file, output of ogen\n"); X if (fhdr.f_flags & F_SWABD) X printf("\tthis file has had its bytes swabbed (in names)\n"); X if (fhdr.f_flags & F_AR16WR) X printf("\tthis file has the byte ordering of an AR16WR\n"); X if (fhdr.f_flags & F_AR32WR) X printf("\tthis file has the byte ordering of an AR32WR machine\n"); X if (fhdr.f_flags & F_AR32W) X printf("\tthis file has the byte ordering of an AR32W machine\n"); X if (fhdr.f_flags & F_PATCH) X printf("\tfile contains 'patch' list in optional header\n"); X if (fhdr.f_flags & F_NODF) X printf("\t(minimal file only) no decision functions for replaced functions\n"); X putchar('\n'); X printf("version: %d\n", (int)ahdr.vstamp); X printf("Text size: %x\n", ahdr.tsize); X printf("Data size: %x\n", ahdr.dsize); X printf("BSS size: %x\n", ahdr.bsize); X printf("Entry address: %x\n", ahdr.entry); X printf("Text base: %x\n", ahdr.text_start); X printf("Data base: %x\n", ahdr.data_start); X putchar('\n'); X X/* X "nn ssssssss xxxxxxxx xxxxxxxx xxxxxx xxxxxx xxxxxx xxxxxx ddddd ddddd */ Xprintf("seg name p.addr v.addr size data reloc lnos # rel # lno flags\n"); X for (i = 0; i < fhdr.f_nscns; i++) { X printf("%2d %8s %08x %08x %06x %5x %5x %5x %5x %5d %5d ", X i, shdr[i].s_name, X shdr[i].s_paddr, shdr[i].s_vaddr, shdr[i].s_size, X shdr[i].s_scnptr, shdr[i].s_relptr, shdr[i].s_lnnoptr, X shdr[i].s_nreloc, shdr[i].s_nlnno); X if (shdr[i].s_flags & STYP_REG) X printf("regular"); X if (shdr[i].s_flags & STYP_DSECT) X printf("dummy"); X if (shdr[i].s_flags & STYP_NOLOAD) X printf("noload"); X if (shdr[i].s_flags & STYP_GROUP) X printf("grouped"); X if (shdr[i].s_flags & STYP_PAD) X printf("padding"); X if (shdr[i].s_flags & STYP_COPY) X printf("copy"); X if (shdr[i].s_flags & STYP_INFO) X printf("comment"); X if (shdr[i].s_flags & STYP_LIB) X printf("lib"); X if (shdr[i].s_flags & STYP_OVER) X printf("overlay"); X if (shdr[i].s_flags & STYP_TEXT) X printf("text"); X if (shdr[i].s_flags & STYP_DATA) X printf("data"); X if (shdr[i].s_flags & STYP_BSS) X printf("bss"); X putchar('\n'); X X } X} X Xdumplibs() X{ X int i; X X for (i = 0; i < fhdr.f_nscns; i++) { X if ((shdr[i].s_flags & STYP_LIB) == 0) X continue; X } X} SHAR_EOF $TOUCH -am 1224131090 coffhdr.c && chmod 0660 coffhdr.c || echo "restore of coffhdr.c failed" set `wc -c coffhdr.c`;Wc_c=$1 if test "$Wc_c" != "4277"; then echo original size 4277, current size $Wc_c fi echo "End of part 2, continue with part 3" exit 0
pgd@bbt.se (01/25/91)
---- Cut Here and unpack ---- #!/bin/sh # This is part 03 of Xenixshlib if touch 2>&1 | fgrep 'amc' > /dev/null then TOUCH=touch else TOUCH=true fi # ============= xcc.c ============== echo "x - extracting xcc.c (Text)" sed 's/^X//' << 'SHAR_EOF' > xcc.c && X#include <stdio.h> X X#define MAXARGS 100 X Xchar *output, **outp; Xint coffflag; Xint vflag; Xint sflag; X Xchar *args[MAXARGS]; Xint argcnt; X X X Xmain(argc, argv) X int argc; X char **argv; X{ X int i, s; X X for (i = 0; i < argc; i++) { X if (argv[i][0] == '-') { X switch (argv[i][1]) { X case 'o': X output = argv[++i]; X outp = &argv[i]; X break; X case 'L': X argv[i][1] = 'l'; X coffflag = 1; X break; X case 'v': X vflag = 1; X break; X case 's': X sflag = 1; X break; X } X } X } X if (coffflag) { X *outp = "a.out"; X args[0] = "gcc"; X args[1] = "-nostdlib"; X args[2] = "/lib/386/Scrt0_s.o"; X args[3] = "/lib/386/Sseg.o"; X argcnt = 4; X for (i = 1; i < argc; i++) { X if (argv[i][0] == '-') { X switch (argv[i][1]) { X case 's': X continue; X } X } X args[argcnt++] = argv[i]; X } X args[argcnt++] = NULL; X if (vflag) { X for (i = 0; args[i]; i++) X printf("%s ", args[i]); X putchar('\n'); X fflush(stdout); X } X if (fork() == 0) { X execvp("gcc", args); X perror("exec error"); X exit(1); X } X if (wait(&s) == -1 || s != 0) X exit(s); X if (vflag) { X printf("convcoff a.out %s\n", output); X fflush(stdout); X } X if (sflag) X s = execlp("convcoff", "convcoff", "-s", "a.out", output, NULL); X else X s = execlp("convcoff", "convcoff", "a.out", output, NULL); X } else { X argv[0] = "gcc"; X if (vflag) { X for (i = 0; argv[i]; i++) X printf("%s ", argv[i]); X putchar('\n'); X fflush(stdout); X } X execvp("gcc", argv); X perror("exec error"); X } X exit(s); X} SHAR_EOF $TOUCH -am 0118092191 xcc.c && chmod 0660 xcc.c || echo "restore of xcc.c failed" set `wc -c xcc.c`;Wc_c=$1 if test "$Wc_c" != "1516"; then echo original size 1516, current size $Wc_c fi # ============= coffstrip.c ============== echo "x - extracting coffstrip.c (Text)" sed 's/^X//' << 'SHAR_EOF' > coffstrip.c && X/* X * coff strip utility X */ X X#include <stdio.h> X#include <sys/types.h> X#include <sys/fcntl.h> X#include <sys/coff.h> X Xstruct filehdr fhdr; Xstruct scnhdr shdr; Xint nsyms; Xlong symptr; X X Xmain(argc, argv) X int argc; X char **argv; X{ X char *fname, **argp; X int fd, n; X char buf[80]; X X for (argp = argv; fname = *++argp; ) { X fd = open(fname, O_RDWR); X if (fd == -1) { X perror(fname); continue; X } X n = read(fd, (char *)&fhdr, sizeof fhdr); X if (fhdr.f_magic != I386MAGIC || n != sizeof fhdr) { X close(fd); X sprintf(buf, "strip %s\n", fname); X if (system(buf) == -1) X perror(fname); X continue; X } X if (fhdr.f_nsyms == 0) { X fprintf(stderr, "%s: already stripped\n", fname); X close(fd); X continue; X } X if (chsize(fd, (long)fhdr.f_symptr) == -1) X perror(fname); X else { X fhdr.f_nsyms = 0; X fhdr.f_flags |= F_LNNO|F_LSYMS; X lseek(fd, 0L, 0); X n = write(fd, (char *)&fhdr, sizeof fhdr); X if (n != sizeof fhdr) X perror(fname); X } X close(fd); X } X exit(0); X} X SHAR_EOF $TOUCH -am 0118145291 coffstrip.c && chmod 0660 coffstrip.c || echo "restore of coffstrip.c failed" set `wc -c coffstrip.c`;Wc_c=$1 if test "$Wc_c" != "993"; then echo original size 993, current size $Wc_c fi # ============= malloc.c ============== echo "x - extracting malloc.c (Text)" sed 's/^X//' << 'SHAR_EOF' > malloc.c && X/* X * Copyright (c) 1983 Regents of the University of California. X * All rights reserved. X * X * Redistribution and use in source and binary forms are permitted X * provided that: (1) source distributions retain this entire copyright X * notice and comment, and (2) distributions including binaries display X * the following acknowledgement: ``This product includes software X * developed by the University of California, Berkeley and its contributors'' X * in the documentation or other materials provided with the distribution X * and in all advertising materials mentioning features or use of this X * software. Neither the name of the University nor the names of its X * contributors may be used to endorse or promote products derived X * from this software without specific prior written permission. X * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR X * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED X * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. X */ X X#if defined(LIBC_SCCS) && !defined(lint) Xstatic char sccsid[] = "@(#)malloc.c 5.9 (Berkeley) 6/1/90"; X#endif /* LIBC_SCCS and not lint */ X X/* X * malloc.c (Caltech) 2/21/82 X * Chris Kingsley, kingsley@cit-20. X * X * This is a very fast storage allocator. It allocates blocks of a small X * number of different sizes, and keeps free lists of each size. Blocks that X * don't exactly fit are passed up to the next larger size. In this X * implementation, the available sizes are 2^n-4 (or 2^n-10) bytes long. X * This is designed for use in a virtual memory environment. X */ X X#include <sys/types.h> X#ifdef M_XENIX X#include <sys/param.h> X#include <sys/sysmacros.h> X#include <sys/page.h> X#define u_char uchar_t X#define u_int uint X#define getpagesize() PGSIZE X#define bcopy(S, D, L) memcpy(D, S, L) X#endif X X#define NULL 0 X X/* X * The overhead on a block is at least 4 bytes. When free, this space X * contains a pointer to the next free block, and the bottom two bits must X * be zero. When in use, the first byte is set to MAGIC, and the second X * byte is the size index. The remaining bytes are for alignment. X * If range checking is enabled then a second word holds the size of the X * requested block, less 1, rounded up to a multiple of sizeof(RMAGIC). X * The order of elements is critical: ov_magic must overlay the low order X * bits of ov_next, and ov_magic can not be a valid ov_next bit pattern. X */ Xunion overhead { X union overhead *ov_next; /* when free */ X struct { X u_char ovu_magic; /* magic number */ X u_char ovu_index; /* bucket # */ X#ifdef RCHECK X u_short ovu_rmagic; /* range magic number */ X u_int ovu_size; /* actual block size */ X#endif X } ovu; X#define ov_magic ovu.ovu_magic X#define ov_index ovu.ovu_index X#define ov_rmagic ovu.ovu_rmagic X#define ov_size ovu.ovu_size X}; X X#define MAGIC 0xef /* magic # on accounting info */ X#define RMAGIC 0x5555 /* magic # on range info */ X X#ifdef RCHECK X#define RSLOP sizeof (u_short) X#else X#define RSLOP 0 X#endif X X/* X * nextf[i] is the pointer to the next free block of size 2^(i+3). The X * smallest allocatable block is 8 bytes. The overhead information X * precedes the data area returned to the user. X */ X#define NBUCKETS 30 Xstatic union overhead *nextf[NBUCKETS]; Xextern char *sbrk(); X Xstatic int pagesz; /* page size */ Xstatic int pagebucket; /* page size bucket */ X X#ifdef MSTATS X/* X * nmalloc[i] is the difference between the number of mallocs and frees X * for a given block size. X */ Xstatic u_int nmalloc[NBUCKETS]; X#include <stdio.h> X#endif X X#if defined(DEBUG) || defined(RCHECK) X#define ASSERT(p) if (!(p)) botch("p") X#include <stdio.h> Xstatic Xbotch(s) X char *s; X{ X fprintf(stderr, "\r\nassertion botched: %s\r\n", s); X (void) fflush(stderr); /* just in case user buffered it */ X abort(); X} X#else X#define ASSERT(p) X#endif X Xchar * Xmalloc(nbytes) X unsigned nbytes; X{ X register union overhead *op; X register int bucket, n; X register unsigned amt; X X /* X * First time malloc is called, setup page size and X * align break pointer so all data will be page aligned. X */ X if (pagesz == 0) { X pagesz = n = getpagesize(); X op = (union overhead *)sbrk(0); X n = n - sizeof (*op) - ((int)op & (n - 1)); X if (n < 0) X n += pagesz; X if (n) { X if (sbrk(n) == (char *)-1) X return (NULL); X } X bucket = 0; X amt = 8; X while (pagesz > amt) { X amt <<= 1; X bucket++; X } X pagebucket = bucket; X } X /* X * Convert amount of memory requested into closest block size X * stored in hash buckets which satisfies request. X * Account for space used per block for accounting. X */ X if (nbytes <= (n = pagesz - sizeof (*op) - RSLOP)) { X#ifndef RCHECK X amt = 8; /* size of first bucket */ X bucket = 0; X#else X amt = 16; /* size of first bucket */ X bucket = 1; X#endif X n = -(sizeof (*op) + RSLOP); X } else { X amt = pagesz; X bucket = pagebucket; X } X while (nbytes > amt + n) { X amt <<= 1; X if (amt == 0) X return (NULL); X bucket++; X } X /* X * If nothing in hash bucket right now, X * request more memory from the system. X */ X if ((op = nextf[bucket]) == NULL) { X morecore(bucket); X if ((op = nextf[bucket]) == NULL) X return (NULL); X } X /* remove from linked list */ X nextf[bucket] = op->ov_next; X op->ov_magic = MAGIC; X op->ov_index = bucket; X#ifdef MSTATS X nmalloc[bucket]++; X#endif X#ifdef RCHECK X /* X * Record allocated size of block and X * bound space with magic numbers. X */ X op->ov_size = (nbytes + RSLOP - 1) & ~(RSLOP - 1); X op->ov_rmagic = RMAGIC; X *(u_short *)((caddr_t)(op + 1) + op->ov_size) = RMAGIC; X#endif X return ((char *)(op + 1)); X} X X/* X * Allocate more memory to the indicated bucket. X */ Xmorecore(bucket) X int bucket; X{ X register union overhead *op; X register int sz; /* size of desired block */ X int amt; /* amount to allocate */ X int nblks; /* how many blocks we get */ X X /* X * sbrk_size <= 0 only for big, FLUFFY, requests (about X * 2^30 bytes on a VAX, I think) or for a negative arg. X */ X sz = 1 << (bucket + 3); X#ifdef DEBUG X ASSERT(sz > 0); X#else X if (sz <= 0) X return; X#endif X if (sz < pagesz) { X amt = pagesz; X nblks = amt / sz; X } else { X amt = sz + pagesz; X nblks = 1; X } X op = (union overhead *)sbrk(amt); X /* no more room! */ X if ((int)op == -1) X return; X /* X * Add new memory allocated to that on X * free list for this hash bucket. X */ X nextf[bucket] = op; X while (--nblks > 0) { X op->ov_next = (union overhead *)((caddr_t)op + sz); X op = (union overhead *)((caddr_t)op + sz); X } X} X Xfree(cp) X char *cp; X{ X register int size; X register union overhead *op; X X if (cp == NULL) X return; X op = (union overhead *)((caddr_t)cp - sizeof (union overhead)); X#ifdef DEBUG X ASSERT(op->ov_magic == MAGIC); /* make sure it was in use */ X#else X if (op->ov_magic != MAGIC) X return; /* sanity */ X#endif X#ifdef RCHECK X ASSERT(op->ov_rmagic == RMAGIC); X ASSERT(*(u_short *)((caddr_t)(op + 1) + op->ov_size) == RMAGIC); X#endif X size = op->ov_index; X ASSERT(size < NBUCKETS); X op->ov_next = nextf[size]; /* also clobbers ov_magic */ X nextf[size] = op; X#ifdef MSTATS X nmalloc[size]--; X#endif X} X X/* X * When a program attempts "storage compaction" as mentioned in the X * old malloc man page, it realloc's an already freed block. Usually X * this is the last block it freed; occasionally it might be farther X * back. We have to search all the free lists for the block in order X * to determine its bucket: 1st we make one pass thru the lists X * checking only the first block in each; if that fails we search X * ``realloc_srchlen'' blocks in each list for a match (the variable X * is extern so the caller can modify it). If that fails we just copy X * however many bytes was given to realloc() and hope it's not huge. X */ Xint realloc_srchlen = 4; /* 4 should be plenty, -1 =>'s whole list */ X Xchar * Xrealloc(cp, nbytes) X char *cp; X unsigned nbytes; X{ X register u_int onb; X register int i; X union overhead *op; X char *res; X int was_alloced = 0; X X if (cp == NULL) X return (malloc(nbytes)); X op = (union overhead *)((caddr_t)cp - sizeof (union overhead)); X if (op->ov_magic == MAGIC) { X was_alloced++; X i = op->ov_index; X } else { X /* X * Already free, doing "compaction". X * X * Search for the old block of memory on the X * free list. First, check the most common X * case (last element free'd), then (this failing) X * the last ``realloc_srchlen'' items free'd. X * If all lookups fail, then assume the size of X * the memory block being realloc'd is the X * largest possible (so that all "nbytes" of new X * memory are copied into). Note that this could cause X * a memory fault if the old area was tiny, and the moon X * is gibbous. However, that is very unlikely. X */ X if ((i = findbucket(op, 1)) < 0 && X (i = findbucket(op, realloc_srchlen)) < 0) X i = NBUCKETS; X } X onb = 1 << (i + 3); X if (onb < pagesz) X onb -= sizeof (*op) + RSLOP; X else X onb += pagesz - sizeof (*op) - RSLOP; X /* avoid the copy if same size block */ X if (was_alloced) { X if (i) { X i = 1 << (i + 2); X if (i < pagesz) X i -= sizeof (*op) + RSLOP; X else X i += pagesz - sizeof (*op) - RSLOP; X } X if (nbytes <= onb && nbytes > i) { X#ifdef RCHECK X op->ov_size = (nbytes + RSLOP - 1) & ~(RSLOP - 1); X *(u_short *)((caddr_t)(op + 1) + op->ov_size) = RMAGIC; X#endif X return(cp); X } else X free(cp); X } X if ((res = malloc(nbytes)) == NULL) X return (NULL); X if (cp != res) /* common optimization if "compacting" */ X bcopy(cp, res, (nbytes < onb) ? nbytes : onb); X return (res); X} X X/* X * Search ``srchlen'' elements of each free list for a block whose X * header starts at ``freep''. If srchlen is -1 search the whole list. X * Return bucket number, or -1 if not found. X */ Xstatic Xfindbucket(freep, srchlen) X union overhead *freep; X int srchlen; X{ X register union overhead *p; X register int i, j; X X for (i = 0; i < NBUCKETS; i++) { X j = 0; X for (p = nextf[i]; p && j != srchlen; p = p->ov_next) { X if (p == freep) X return (i); X j++; X } X } X return (-1); X} X X#ifdef MSTATS X/* X * mstats - print out statistics about malloc X * X * Prints two lines of numbers, one showing the length of the free list X * for each size category, the second showing the number of mallocs - X * frees for each size category. X */ Xmstats(s) X char *s; X{ X register int i, j; X register union overhead *p; X int totfree = 0, X totused = 0; X X fprintf(stderr, "Memory allocation statistics %s\nfree:\t", s); X for (i = 0; i < NBUCKETS; i++) { X for (j = 0, p = nextf[i]; p; p = p->ov_next, j++) X ; X fprintf(stderr, " %d", j); X totfree += j * (1 << (i + 3)); X } X fprintf(stderr, "\nused:\t"); X for (i = 0; i < NBUCKETS; i++) { X fprintf(stderr, " %d", nmalloc[i]); X totused += nmalloc[i] * (1 << (i + 3)); X } X fprintf(stderr, "\n\tTotal in use: %d, total free: %d\n", X totused, totfree); X} X#endif X SHAR_EOF $TOUCH -am 0113162191 malloc.c && chmod 0600 malloc.c || echo "restore of malloc.c failed" set `wc -c malloc.c`;Wc_c=$1 if test "$Wc_c" != "10837"; then echo original size 10837, current size $Wc_c fi # ============= libX11_ver.c ============== echo "x - extracting libX11_ver.c (Text)" sed 's/^X//' << 'SHAR_EOF' > libX11_ver.c && Xint libX11_version = VERSION; SHAR_EOF $TOUCH -am 0112133391 libX11_ver.c && chmod 0660 libX11_ver.c || echo "restore of libX11_ver.c failed" set `wc -c libX11_ver.c`;Wc_c=$1 if test "$Wc_c" != "30"; then echo original size 30, current size $Wc_c fi # ============= libXaw_s.c ============== echo "x - extracting libXaw_s.c (Text)" sed 's/^X//' << 'SHAR_EOF' > libXaw_s.c && X/* X * Prefix file and jump table for Xaw shared library X * X * Author: P.Garbha pgd@compuram.bbt.se X */ X X/* X * Identifier to autload library X */ Xchar __SHLIB__libXaw_s; X X__JumpTabEnd() X{ X} X Xextern void (*_shlib_exit)(); X X/* X * exit routine to use from within library X */ Xexit(status) X int status; X{ X _shlib_exit(status); X} X SHAR_EOF $TOUCH -am 0116154591 libXaw_s.c && chmod 0660 libXaw_s.c || echo "restore of libXaw_s.c failed" set `wc -c libXaw_s.c`;Wc_c=$1 if test "$Wc_c" != "323"; then echo original size 323, current size $Wc_c fi # ============= xenix.cf ============== echo "x - extracting xenix.cf (Text)" sed 's/^X//' << 'SHAR_EOF' > xenix.cf && X/* X * SET VERSION NUMBERS BEFORE MAKING MAKEFILES; also, you'll need to install X * util/scripts/bsdinstall.sh before doing a "make install" X */ X#define SystemV YES X#define OSName Xenix/386 System V Release 2.3.3 X#define OSMajorVersion 3 X#define OSMinorVersion 2 X#define OPERATING_SYSTEM sysV X/**/# platform: $XConsortium: xenix.cf,v 1.0 90/03/10 15:39:46 jim Exp $ X/**/# operating system: OSName X/***************************************************************************** X * Platform-specfic parameters * X *****************************************************************************/ X#define RemoveTargetProgramByMoving YES X#define BootstrapCFlags -Dxenix -DSYSV X#define StandardDefines /* -Datt */ -Dxenix -DSYSV -DUSG /* -DUSE_ASM */ X#define StandardCppDefines /* -Datt */ -Dxenix -DSYSV -DUSG /* -DUSE_ASM */ X#define ExecableScripts NO X#define ExtraLibraries -lcfp -lgnu -lx -lXc X#define Server_Extra_Libraries -levent -lsocket -lcfp -lgnu -lx X#define ExtraLoadFlags -g X#define Server_Extra_Load_Flags -g X#define HasVoidSignalReturn YES X#define NeedBerklibInXlib YES X#define ConnectionFlags -DUNIXCONN -DLOCALCONN X#define HasNdbm NO X#define HasSdbm YES X#define HasGcc YES X#define HasRcc NO X#define CcCmd xcc X#define CppCmd /lib/cpp X#define LdCombineFlags -r X#define ManDir /usr/man/man.X X#define ManDirectoryRoot /usr/man X#define ManSuffix X X#define UNCOMPRESSPATH /usr/bin/uncompress X#define DefaultUserPath .:/bin:/usr/bin:/usr/bin/X11:/usr/local X#define DefaultSystemPath .:/bin:/usr/bin:/usr/bin/X11:/usr/local:/etc X#define StripInstalledPrograms YES X/* #define LibraryCCOptions -DATTSHLIB */ X#define LibraryCCOptions X#define RanlibCmd ranlib X#define FontDefines -DFONT_SNF -DFONT_BDF -DCOMPRESSED_FONTS StandardDefines X#define BuildExamples NO X#define XibmServer Xibm X#define ibmIncludeVGA YES X#define BuildServer YES X#define ServerCDebugFlags -DTRACE_X -DDEBUG X#define ServerDefines StandardDefines ExtensionDefines -DNO_FUNCTION_PROTOTYPES X#define InstallCmd $(SCRIPTSRC)/install.sh X#define AsCmd gas X#define DefaultFontPath $(FONTDIR)/misc/,$(FONTDIR)/75dpi/ X#define UsrLibDir /lib/386 X#define LibDir /usr/lib/X11 X#define LintlibDir /usr/lib/lint X#define InstallLibrary(libname,dest) @@\ Xinstall:: lib/**/libname.a @@\ X rm -f Slib/**/libname.a @@\ X ln lib/**/libname.a Slib/**/libname.a @@\ X $(INSTALL) -c $(INSTLIBFLAGS) Slib/**/libname.a dest @@\ X $(RANLIB) $(RANLIBINSTFLAGS) dest/Slib/**/libname.a X#define Xenix386 X#define Xenix X#define NdbmDefines -DSDBM X#define HasSockets X#define InstallXinitConfig YES X#define InstallXdmConfig YES X#define ManSuffix X X X/* X * Define if you have shared library X */ X#define HasSharedLibraries YES X#if HasSharedLibraries X#define SharedLibXext NO X#define SharedLibX YES X#define SharedLibXmu NO X#define SharedLibXt YES X#define SharedLibXaw YES X X/* X * Nulling of these functions is because the xenix library are using X * the normal library for the build. X */ X#define SharedLibraryObjectRule() X#define SharedAndDebuggedLibraryObjectRule() X#define SpecialSharedAndDebuggedObjectRule(objs,depends,options) X#define SpecialSharedObjectRule(objs,depends,options) X#define InstallSharedLibrary(libname,rev,dest) X#define InstallSharedLibraryData(libname,rev,dest) X#define NormalSharedLibraryTarget(libname,rev,solist) X#define NormalSharedLibraryDataTarget(libname,rev,salist) X X#if 1 X#if SharedLibXext X#define EXTENSIONLIB_Defined X EXTENSIONLIB = -LXext_s X#endif X#if SharedLibX X#define XLIB_Defined X XLIB = $(EXTENSIONLIB) -LX11_s X#endif X#if SharedLibXmu X#define XMULIB_Defined X XMULIB = -LXmu_s X#endif X#if SharedLibXt X#define XTOOLLIB_Defined X XTOOLLIB = -LXt_s X#endif X#if SharedLibX X#define XAWLIB_Defined X XAWLIB = -LXaw_s X#endif X#endif X X#define XawClientLibs $(XAWLIB) $(XMULIB) $(XLIB) X#endif X X/* X * ServerTarget - generate rules to compile, link, and relink an X server. X */ X#define ServerTarget(server,subdirs,objects,libs,syslibs) @@\ Xserver: subdirs objects libs @@\ X -@if [ -f server ]; then echo " $(MV) server server.bak"; \ @@\ X $(MV) server server.bak; else exit 0; fi @@\ X gcc $(CDEBUGFLAGS) $(CCOPTIONS) -o server objects libs Server_Extra_Libraries syslibs Server_Extra_Load_Flags @@\ X @@\ Xload/**/server: @@\ X -@if [ -f server ]; then echo " $(MV) server server.bak"; \ @@\ X $(MV) server server.bak; else exit 0; fi @@\ X $(CC) $(CDEBUGFLAGS) $(CCOPTIONS) -o server objects libs $(EXTRA_LIBRARIES) syslibs $(EXTRA_LOAD_FLAGS) X#define FilesToClean *.CKP *.ln *.BAK *.bak *.o core errs ,* *~ *.a .emacs_* tags TAGS make.log MakeOut a.out SHAR_EOF $TOUCH -am 0122195191 xenix.cf && chmod 0660 xenix.cf || echo "restore of xenix.cf failed" set `wc -c xenix.cf`;Wc_c=$1 if test "$Wc_c" != "4678"; then echo original size 4678, current size $Wc_c fi # ============= Project.example ============== echo "x - extracting Project.example (Text)" sed 's/^X//' << 'SHAR_EOF' > Project.example && X#if SharedLibXext X DEPEXTENSIONLIB = /* _Use($(USRLIBDIR),$(EXTENSIONSRC)/lib)/libXext.so.$(SOXEXTREV) */ X#ifndef EXTENSIONLIB_Defined X EXTENSIONLIB = _Use(-lXext,-L$(EXTENSIONSRC) -lXext) X#endif X#else X DEPEXTENSIONLIB = _Use($(USRLIBDIR),$(EXTENSIONSRC)/lib)/libXext.a X EXTENSIONLIB = LoaderLibPrefix _Use(-lXext, $(DEPEXTENSIONLIB)) X#endif X#if SharedLibX X DEPXLIB = $(DEPEXTENSIONLIB) /* _Use($(USRLIBDIR),$(XLIBSRC))/libX11.so.$(SOXLIBREV) */ X#ifndef XLIB_Defined X XLIB = $(EXTENSIONLIB) _Use(-lX11,-L$(XLIBSRC) -lX11) X#endif X#else X DEPXLIB = $(DEPEXTENSIONLIB) _Use($(USRLIBDIR),$(XLIBSRC))/libX11.a X XLIB = $(EXTENSIONLIB) LoaderLibPrefix _Use(-lX11,$(XLIBSRC)/libX11.a) X#endif X DEPXAUTHLIB = _Use($(USRLIBDIR),$(XAUTHSRC))/libXau.a X#ifndef XAUTHLIB_Defined X XAUTHLIB = LoaderLibPrefix _Use(-lXau,$(DEPXAUTHLIB)) X#endif X#if SharedLibXmu X DEPXMULIB = /* _Use($(USRLIBDIR),$(XMUSRC))/libXmu.so.$(SOXMUREV) */ X#ifndef XMULIB_Defined X XMULIB = _Use(-lXmu,-L$(XMUSRC) -lXmu) X#endif X#else X DEPXMULIB = _Use($(USRLIBDIR),$(XMUSRC))/libXmu.a X XMULIB = LoaderLibPrefix _Use(-lXmu,$(DEPXMULIB)) X#endif X#if SharedOldLibX X DEPOLDXLIB = /* _Use($(USRLIBDIR),$(OLDXLIBSRC))/liboldX.so.$(SOOLDXREV) */ X#ifndef OLDXLIB_Defined X OLDXLIB = _Use(-loldX,-L$(OLDXLIBSRC) -loldX) X#endif X#else X DEPOLDXLIB = _Use($(USRLIBDIR),$(OLDXLIBSRC))/liboldX.a X OLDXLIB = LoaderLibPrefix _Use(-loldX,$(DEPOLDXLIB)) X#endif X#if SharedLibXt X DEPXTOOLLIB = /* _Use($(USRLIBDIR),$(TOOLKITSRC))/libXt.so.$(SOXTREV) */ X#ifndef XTOOLLIB_Defined X XTOOLLIB = _Use(-lXt,-L$(TOOLKITSRC) -lXt) X#endif X#else X DEPXTOOLLIB = _Use($(USRLIBDIR),$(TOOLKITSRC))/libXt.a X XTOOLLIB = LoaderLibPrefix _Use(-lXt,$(DEPXTOOLLIB)) X#endif X#if SharedLibXaw X DEPXAWLIB = /* _Use($(USRLIBDIR),$(AWIDGETSRC))/libXaw.so.$(SOXAWREV) */ X#ifndef XAWLIB_Defined X XAWLIB = _Use(-lXaw,-L$(AWIDGETSRC) -lXaw) X#endif X#else X DEPXAWLIB = _Use($(USRLIBDIR),$(AWIDGETSRC))/libXaw.a X XAWLIB = LoaderLibPrefix _Use(-lXaw,$(DEPXAWLIB)) X#endif SHAR_EOF $TOUCH -am 0122180791 Project.example && chmod 0660 Project.example || echo "restore of Project.example failed" set `wc -c Project.example`;Wc_c=$1 if test "$Wc_c" != "2158"; then echo original size 2158, current size $Wc_c fi exit 0