diff options
Diffstat (limited to 'os2')
-rw-r--r-- | os2/Makefile.SH | 54 | ||||
-rw-r--r-- | os2/POSIX.mkfifo | 16 | ||||
-rw-r--r-- | os2/README | 155 | ||||
-rw-r--r-- | os2/diff.Makefile | 436 | ||||
-rw-r--r-- | os2/diff.configure | 604 | ||||
-rw-r--r-- | os2/diff.installperl | 248 | ||||
-rw-r--r-- | os2/diff.mkdep | 128 | ||||
-rw-r--r-- | os2/diff.x2pMakefile | 222 | ||||
-rw-r--r-- | os2/os2.c | 215 | ||||
-rw-r--r-- | os2/os2ish.h | 72 |
10 files changed, 2150 insertions, 0 deletions
diff --git a/os2/Makefile.SH b/os2/Makefile.SH new file mode 100644 index 0000000000..78c12187c0 --- /dev/null +++ b/os2/Makefile.SH @@ -0,0 +1,54 @@ +# This file is read by Makefile.SH to produce rules for $(perllib) +# We insert perl5.def since I do not know how to generate it yet. + +$spitshell >>Makefile <<'!NO!SUBS!' +$(perllib): perl.imp perl.dll perl5.def + emximp -o $(perllib) perl.imp + +perl.imp: perl5.def + emximp -o perl.imp perl5.def + +perl.dll: $(obj) perl5.def perl$(O) + $(LD) $(LDDLFLAGS) -o $@ perl$(O) $(obj) -lsocket perl5.def + +perl5.def: perl.linkexp + echo "LIBRARY 'Perl' INITINSTANCE TERMINSTANCE" > $@ + echo DESCRIPTION "'Perl interpreter, export autogenerated'" >>$@ + echo STACKSIZE 32768 >>$@ + echo CODE LOADONCALL >>$@ + echo DATA LOADONCALL NONSHARED MULTIPLE >>$@ + echo EXPORTS >>$@ + echo ' "ctermid"' >>$@ + echo ' "ttyname"' >>$@ + cat perl.linkexp >>$@ + +# grep -v '"\(malloc\|realloc\|free\)"' perl.linkexp >>$@ + + +# We assume here that perl is available somewhere ... + +perl.exports: perl.exp EXTERN.h perl.h + (echo '#include "EXTERN.h"'; echo '#include "perl.h"' ; \ + echo '#include "perl.exp"') | \ + $(CC) -DEMBED -E - | \ + awk '{if ($$2 == "") print $$1}' | sort | uniq > $@ + +# perl -ne 'print if (/^#!/ .. /^#\s/) && s/^(\w+) *$$/$$1/' > $@ + +perl.linkexp: perl.exports perl.map + cat perl.exports perl.map | sort | uniq -d | sed -e 's/\w\+/ "\0"/' > perl.linkexp + +perl.map: $(obj) perl$(O) miniperlmain$(O) + $(CC) $(LARGE) $(CLDFLAGS) $(CCDLFLAGS) -o dummy.exe miniperlmain$(O) perl$(O) $(obj) -lsocket -lm -Zmap -Zlinker /map + awk '{if ($$3 == "") print $$2}' <dummy.map | sort | uniq > perl.map + rm dummy.exe dummy.map + +depend: os2ish.h + +os2.c: os2/os2.c os2ish.h + cp $< $@ + +os2ish.h: os2/os2ish.h + cp $< $@ + +!NO!SUBS! diff --git a/os2/POSIX.mkfifo b/os2/POSIX.mkfifo new file mode 100644 index 0000000000..5bd820edfd --- /dev/null +++ b/os2/POSIX.mkfifo @@ -0,0 +1,16 @@ +diff -cr ..\perl5os2.patch\perl5.001m.andy/ext/POSIX/POSIX.xs ./ext/POSIX/POSIX.xs +*** ../perl5os2.patch/perl5.001m.andy/ext/POSIX/POSIX.xs Tue May 23 11:54:26 1995 +--- ./ext/POSIX/POSIX.xs Thu Sep 28 00:00:16 1995 +*************** +*** 81,86 **** +--- 81,90 ---- + /* Possibly needed prototypes */ + char *cuserid _((char *)); + ++ #ifndef HAS_MKFIFO ++ #define mkfifo(a,b) not_here("mkfifo") ++ #endif ++ + #ifndef HAS_CUSERID + #define cuserid(a) (char *) not_here("cuserid") + #endif diff --git a/os2/README b/os2/README new file mode 100644 index 0000000000..20614dd31a --- /dev/null +++ b/os2/README @@ -0,0 +1,155 @@ +# This message contains the description of the patch. +# The actual patch will be posted to p5-p later, the parts that +# are relevant to other lists will be posted there separately +# +# This is needed _before_ application of the patch: + +mkdir os2 +touch os2/Makefile.SH hints/os2.sh os2/os2.c os2/os2ish.h +touch ext/DynaLoader/dl_os2.xs +exit 0 + +======================================================== + +The OS/2 patchkit was submitted by ilya@math.ohio-state.edu. I have +applied some parts that I suspect won't cause any problems. +Others do things that I haven't had time to fully consider. + +Still other patches included here should perhaps be integrated with the +metaconfig package that generates Configure. + + Andy Dougherty <doughera@lafcol.lafayette.edu> + +======================================================== + +Notes on the patch: +~~~~~~~~~~~~~~~~~~~ +1) run the above commands +2) patches should be applied as + patch -p0 <..... + +Patches are relative to perl5.001n. +It is tested under Solaris and OS/2. +The complete distribution of this patch is available on + ftp://ftp.math.ohio-state.edu/pub/users/ilya/os2 +The file diff.for.o.Configure should be applied last. It will repatch +Configure. + +Target: +~~~~~~~ + +This is not supposed to make a perfect Perl on OS/2. This patch is +concerned only with perfect _build_ of Perl on OS/2. A lot of good +features from Andreas Kaiser port missed this patch. + +Annotations of changes: +~~~~~~~~~~~~~~~~~~~~~~~ +1) C files +2) Configure +3) MakeMaker +4) Build tools + +1) C files + a) mkfifo macro added to Posix.c + b) Copyright notice for OS/2 port changed + c) MYMALLOC section in perl.h moved (why?) + d) setgrent grent and getgrent wrapped in ifdef + e) declarations for #if defined(MYMALLOC) && defined(HIDEMYMALLOC) + added + f) some diagnostics added to tests + +2) Configure + 0) Differences are provided with plain 5.001m + andys. + a) New vars exe_ext obj_ext lib_ext ar plibext + firstmakefile archobjs cldlibs path_sep + I think they should be set by the hints files only + b) Support for extraction from NE style libraries. + c) a lot of + cc -o whatever + lines did not have $ldopts. + d) The above variables are used throughout the file for checks + +3) Build tools and libraries + + Since Configure can go out of sync with the other tools, + all the added configuration variables are checked for + existence, if not, set to reasonable values. Thus the + changes are independent of Configure patch. + + a) ln changed to $ln in some places + b) Makefiles and related scripts made to use $(O), $(A), $(AR) + using the vars found by Configure or defaulted to + some reasonable value. + c) $firstmakefile is the file make looks onto before Makefile + d) $plibext is the extension for the perl library + e) $archobjs is the list of additional object files needed for + local build. + $cldlibs are libs to use when linking miniperl. + f) Sanity checks look for perl$Config{exe_ext}. + g) installperl was looping through config.sh in a wrong way + h) installperl needs to change permission to 0777 before + unlink on OS/2. + i) Cwd.pm updated for OS/2. + j) Find.pm updated for OS/2. + k) Shell.pm updated for OS/2. + l) Makefile.SH : added sh in front of some commands + if $d_shrplib is 'custom', looks into + $osname/Makefile.$osname.SH to construct the section + on shared Perl library. + m) clean target extended to delete some intermediate files + n) Test::Harness works. + + +Notes on build on OS/2: +~~~~~~~~~~~~~~~~~~~~~~~ +The change of C code in this patch is based on the ak port of 5.001+. + +a) Make sure your sort is not the broken OS/2 one. + +b) when extraction perl5.001m.tar.gz you need to extract perl5.001m/Configure +separately, since by default perl5.001m/configure overwrites it; + +c) Necessary manual intervention when compiling on OS/2: + + Need to put perl.dll on LIBPATH after it is created. + +d) Compile summary: + +# Look for hints/os2.sh and correct what is different on your system +# I have rather spartan configuration. + + # Prefix means where to install: +sh Configure -des -D prefix=f:/perl5m +make + # Will probably die after build of miniperl (unless you have DLL + # from previous compile). Need to move DLL where it belongs +make + # some warnings in POSIX.c +make test + # some tests fail, 10 on my system + # + # before this you should create subdirs bin and lib in the + # prefix directory (f:/perl5m above): +make install + # man pages are not installed + +e) At the end of August GNU make and pdksh were too buggy for compile. +Both maintainers have patches that make it possible to compile perl. +They are included into distribution of this patch on + ftp://ftp.math.ohio-state.edu/pub/users/ilya/os2 + +!!!!!!!!!!!!!!!!! +If you see that some '/' became '\' in pdksh 5.2.3, you did not apply +my patches! +Same with segfaults in Make 3.74. +!!!!!!!!!!!!!!!!! + +Problems reported: + +a) one of the latest tr is broken, get an old one :-( + 1.11 works. (On compuserver?) +b) You need a perlglob.exe and link386. +c) Get rid of invalid perl.dll on your LIBPATH. + + +Send comments to ilya@math.ohio-state.edu. diff --git a/os2/diff.Makefile b/os2/diff.Makefile new file mode 100644 index 0000000000..f351b2594e --- /dev/null +++ b/os2/diff.Makefile @@ -0,0 +1,436 @@ +diff -cr ..\perl5os2.patch\perl5.001m.andy/Makefile.SH ./Makefile.SH +*** ../perl5os2.patch/perl5.001m.andy/Makefile.SH Mon Oct 09 21:40:46 1995 +--- ./Makefile.SH Thu Sep 28 00:13:40 1995 +*************** +*** 22,27 **** +--- 22,31 ---- + *) suidperl='';; + esac + ++ # In case Configure is not patched: ++ : ${obj_ext=.o} ${obj_ext_regexp='\.o'} ${lib_ext=.a} ${ar=ar} ${firstmakefile=makefile} ++ : ${exe_ext=} ${cldlibs="$libs $cryptlib"} ++ + shrpenv="" + case "$d_shrplib" in + *define*) +*************** +*** 31,43 **** + *[0-9]) plibsuf=.$so.$patchlevel;; + *) plibsuf=.$so;; + esac + case "$shrpdir" in + /usr/lib) ;; + "") ;; + *) shrpenv="env LD_RUN_PATH=$shrpdir";; + esac + pldlflags="$cccdlflags";; +! *) plibsuf=.a + pldlflags="";; + esac + +--- 35,48 ---- + *[0-9]) plibsuf=.$so.$patchlevel;; + *) plibsuf=.$so;; + esac ++ if test "x$plibext" != "x" ; then plibsuf=$plibext d_shrplib=custom ; fi + case "$shrpdir" in + /usr/lib) ;; + "") ;; + *) shrpenv="env LD_RUN_PATH=$shrpdir";; + esac + pldlflags="$cccdlflags";; +! *) plibsuf=$lib_ext + pldlflags="";; + esac + +*************** +*** 53,59 **** + static_ai_list=' ' + for f in $static_ext; do + base=`echo "$f" | sed 's/.*\///'` +! static_list="$static_list lib/auto/$f/$base.a" + if test -f ext/$f/AutoInit.c; then + static_ai_list="$static_ai_list ext/$f/AutoInit.c" + fi +--- 58,64 ---- + static_ai_list=' ' + for f in $static_ext; do + base=`echo "$f" | sed 's/.*\///'` +! static_list="$static_list lib/auto/$f/$base\$(A)" + if test -f ext/$f/AutoInit.c; then + static_ai_list="$static_ai_list ext/$f/AutoInit.c" + fi +*************** +*** 115,129 **** + static_ext = $static_list + ext = \$(dynamic_ext) \$(static_ext) + static_ext_autoinit = $static_ai_list +! DYNALOADER = lib/auto/DynaLoader/DynaLoader.a +! + + libs = $libs $cryptlib + + public = perl $suidperl + + shellflags = $shellflags + + ## To use an alternate make, set \$altmake in config.sh. + MAKE = ${altmake-make} + !GROK!THIS! +--- 120,152 ---- + static_ext = $static_list + ext = \$(dynamic_ext) \$(static_ext) + static_ext_autoinit = $static_ai_list +! DYNALOADER = lib/auto/DynaLoader/DynaLoader\$(A) + + libs = $libs $cryptlib ++ cldlibs = $cldlibs + + public = perl $suidperl + + shellflags = $shellflags + ++ ## To make it possible a build on a case-unsensitive filesystem ++ ++ firstmakefile = $firstmakefile ++ ++ ## Architecture-specific objects ++ ++ archobjs = $archobjs ++ ++ ## Extention of object files ++ ++ O = $obj_ext ++ O_REGEXP = $obj_ext_regexp ++ A = $lib_ext ++ AR = $ar ++ exe_ext = $exe_ext ++ ++ .SUFFIXES: .c \$(O) ++ + ## To use an alternate make, set \$altmake in config.sh. + MAKE = ${altmake-make} + !GROK!THIS! +*************** +*** 153,163 **** + + c = $(c1) $(c2) $(c3) miniperlmain.c perlmain.c + +! obj1 = $(mallocobj) gv.o toke.o perly.o op.o regcomp.o dump.o util.o mg.o +! obj2 = hv.o av.o run.o pp_hot.o sv.o pp.o scope.o pp_ctl.o pp_sys.o +! obj3 = doop.o doio.o regexec.o taint.o deb.o globals.o + +! obj = $(obj1) $(obj2) $(obj3) + + # Once perl has been Configure'd and built ok you build different + # perl variants (Debugging, Embedded, Multiplicity etc) by saying: +--- 175,185 ---- + + c = $(c1) $(c2) $(c3) miniperlmain.c perlmain.c + +! obj1 = $(mallocobj) gv$(O) toke$(O) perly$(O) op$(O) regcomp$(O) dump$(O) util$(O) mg$(O) +! obj2 = hv$(O) av$(O) run$(O) pp_hot$(O) sv$(O) pp$(O) scope$(O) pp_ctl$(O) pp_sys$(O) +! obj3 = doop$(O) doio$(O) regexec$(O) taint$(O) deb$(O) globals$(O) + +! obj = $(obj1) $(obj2) $(obj3) $(archobjs) + + # Once perl has been Configure'd and built ok you build different + # perl variants (Debugging, Embedded, Multiplicity etc) by saying: +*************** +*** 175,184 **** + # grrr + SHELL = /bin/sh + +! .c.o: + $(CCCMD) $(PLDLFLAGS) $*.c + +! all: makefile miniperl $(private) $(public) $(dynamic_ext) + @echo " "; echo " Making x2p stuff"; cd x2p; $(MAKE) all + + # This is now done by installman only if you actually want the man pages. +--- 197,206 ---- + # grrr + SHELL = /bin/sh + +! .c$(O): + $(CCCMD) $(PLDLFLAGS) $*.c + +! all: $(firstmakefile) miniperl $(private) $(public) $(dynamic_ext) + @echo " "; echo " Making x2p stuff"; cd x2p; $(MAKE) all + + # This is now done by installman only if you actually want the man pages. +*************** +*** 187,208 **** + # Phony target to force checking subdirectories. + # Apparently some makes require an action for the FORCE target. + FORCE: +! @true + + # The $& notation tells Sequent machines that it can do a parallel make, + # and is harmless otherwise. + +! miniperl: $& miniperlmain.o $(perllib) +! $(CC) $(LARGE) $(CLDFLAGS) -o miniperl miniperlmain.o $(perllib) $(libs) + +! miniperlmain.o: miniperlmain.c + $(CCCMD) $(PLDLFLAGS) $*.c + +! perlmain.c: miniperlmain.c config.sh makefile $(static_ext_autoinit) + sh writemain $(DYNALOADER) $(static_ext) > tmp + sh mv-if-diff tmp perlmain.c + +! perlmain.o: perlmain.c + $(CCCMD) $(PLDLFLAGS) $*.c + + # The file ext.libs is a list of libraries that must be linked in +--- 209,230 ---- + # Phony target to force checking subdirectories. + # Apparently some makes require an action for the FORCE target. + FORCE: +! @sh -c true + + # The $& notation tells Sequent machines that it can do a parallel make, + # and is harmless otherwise. + +! miniperl: $& miniperlmain$(O) $(perllib) +! $(CC) $(LARGE) $(CLDFLAGS) -o miniperl miniperlmain$(O) $(perllib) $(cldlibs) + +! miniperlmain$(O): miniperlmain.c + $(CCCMD) $(PLDLFLAGS) $*.c + +! perlmain.c: miniperlmain.c config.sh $(firstmakefile) $(static_ext_autoinit) + sh writemain $(DYNALOADER) $(static_ext) > tmp + sh mv-if-diff tmp perlmain.c + +! perlmain$(O): perlmain.c + $(CCCMD) $(PLDLFLAGS) $*.c + + # The file ext.libs is a list of libraries that must be linked in +*************** +*** 211,238 **** + ext.libs: $(static_ext) + -@test -f ext.libs || touch ext.libs + +! perl: $& perlmain.o $(perllib) $(DYNALOADER) $(static_ext) ext.libs +! $(SHRPENV) $(CC) $(LARGE) $(CLDFLAGS) $(CCDLFLAGS) -o perl perlmain.o $(perllib) $(DYNALOADER) $(static_ext) `cat ext.libs` $(libs) + +! pureperl: $& perlmain.o $(perllib) $(DYNALOADER) $(static_ext) ext.libs +! purify $(CC) $(LARGE) $(CLDFLAGS) $(CCDLFLAGS) -o pureperl perlmain.o $(perllib) $(DYNALOADER) $(static_ext) `cat ext.libs` $(libs) + +- quantperl: $& perlmain.o $(perllib) $(DYNALOADER) $(static_ext) ext.libs +- quantify $(CC) $(LARGE) $(CLDFLAGS) $(CCDLFLAGS) -o quantperl perlmain.o $(perllib) $(DYNALOADER) $(static_ext) `cat ext.libs` $(libs) + +! $(perllib): $& perl.o $(obj) + !NO!SUBS! + + case "$d_shrplib" in + *define*) + $spitshell >>Makefile <<'!NO!SUBS!' +! $(LD) $(LDDLFLAGS) -o $@ perl.o $(obj) + !NO!SUBS! + ;; + *) + $spitshell >>Makefile <<'!NO!SUBS!' + rm -f $(perllib) +! ar rcu $(perllib) perl.o $(obj) + @$(ranlib) $(perllib) + !NO!SUBS! + ;; +--- 233,280 ---- + ext.libs: $(static_ext) + -@test -f ext.libs || touch ext.libs + +! perl: $& perlmain$(O) $(perllib) $(DYNALOADER) $(static_ext) ext.libs +! $(SHRPENV) $(CC) $(LARGE) $(CLDFLAGS) $(CCDLFLAGS) -o perl perlmain$(O) $(perllib) $(DYNALOADER) $(static_ext) `cat ext.libs` $(libs) +! +! pureperl: $& perlmain$(O) $(perllib) $(DYNALOADER) $(static_ext) ext.libs +! purify $(CC) $(LARGE) $(CLDFLAGS) $(CCDLFLAGS) -o pureperl perlmain$(O) $(perllib) $(DYNALOADER) $(static_ext) `cat ext.libs` $(libs) + +! quantperl: $& perlmain$(O) $(perllib) $(DYNALOADER) $(static_ext) ext.libs +! quantify $(CC) $(LARGE) $(CLDFLAGS) $(CCDLFLAGS) -o quantperl perlmain$(O) $(perllib) $(DYNALOADER) $(static_ext) `cat ext.libs` $(libs) +! +! !NO!SUBS! + + +! case "$d_shrplib" in +! custom) ;; +! *) +! $spitshell >>Makefile <<'!NO!SUBS!' +! $(perllib): $& perl$(O) $(obj) + !NO!SUBS! ++ esac + + case "$d_shrplib" in + *define*) + $spitshell >>Makefile <<'!NO!SUBS!' +! $(LD) $(LDDLFLAGS) -o $@ perl$(O) $(obj) + !NO!SUBS! + ;; ++ custom) ++ if test -r $osname/Makefile.SH ; then ++ . $osname/Makefile.SH ++ $spitshell >>Makefile <<!GROK!THIS! ++ ++ Makefile: $osname/Makefile.SH ++ ++ !GROK!THIS! ++ else ++ echo "Could not find $osname/Makefile.SH! Skipping target \$(perllib) in Makefile!" ++ fi ++ ;; + *) + $spitshell >>Makefile <<'!NO!SUBS!' + rm -f $(perllib) +! $(AR) rcu $(perllib) perl$(O) $(obj) + @$(ranlib) $(perllib) + !NO!SUBS! + ;; +*************** +*** 245,254 **** + # checks as well as the special code to validate that the script in question + # has been invoked correctly. + +! suidperl: $& sperl.o perlmain.o $(perllib) $(DYNALOADER) $(static_ext) ext.libs +! $(CC) $(LARGE) $(CLDFLAGS) $(CCDLFLAGS) -o suidperl perlmain.o sperl.o $(perllib) $(DYNALOADER) $(static_ext) `cat ext.libs` $(libs) + +! sperl.o: perl.c perly.h patchlevel.h $(h) + $(RMS) sperl.c + $(LNS) perl.c sperl.c + $(CCCMD) -DIAMSUID sperl.c +--- 287,296 ---- + # checks as well as the special code to validate that the script in question + # has been invoked correctly. + +! suidperl: $& sperl$(O) perlmain$(O) $(perllib) $(DYNALOADER) $(static_ext) ext.libs +! $(CC) $(LARGE) $(CLDFLAGS) $(CCDLFLAGS) -o suidperl perlmain$(O) sperl$(O) $(perllib) $(DYNALOADER) $(static_ext) `cat ext.libs` $(libs) + +! sperl$(O): perl.c perly.h patchlevel.h $(h) + $(RMS) sperl.c + $(LNS) perl.c sperl.c + $(CCCMD) -DIAMSUID sperl.c +*************** +*** 258,264 **** + # test -d lib/auto || mkdir lib/auto + # + preplibrary: miniperl lib/Config.pm +! @./makedir lib/auto + @echo " AutoSplitting perl library" + @./miniperl -Ilib -e 'use AutoSplit; \ + autosplit_lib_modules(@ARGV)' lib/*.pm lib/*/*.pm +--- 300,306 ---- + # test -d lib/auto || mkdir lib/auto + # + preplibrary: miniperl lib/Config.pm +! @sh ./makedir lib/auto + @echo " AutoSplitting perl library" + @./miniperl -Ilib -e 'use AutoSplit; \ + autosplit_lib_modules(@ARGV)' lib/*.pm lib/*/*.pm +*************** +*** 339,346 **** + @sh ext/util/make_ext static $@ LIBPERL_A=$(perllib) + + clean: +! rm -f *.o *.a all perlmain.c + rm -f perl.exp ext.libs + -cd x2p; $(MAKE) clean + -cd pod; $(MAKE) clean + -@for x in $(DYNALOADER) $(dynamic_ext) $(static_ext) ; do \ +--- 381,389 ---- + @sh ext/util/make_ext static $@ LIBPERL_A=$(perllib) + + clean: +! rm -f *$(O) *$(A) all perlmain.c + rm -f perl.exp ext.libs ++ -rm perl.export perl.dll perl.libexp perl.map perl.def + -cd x2p; $(MAKE) clean + -cd pod; $(MAKE) clean + -@for x in $(DYNALOADER) $(dynamic_ext) $(static_ext) ; do \ +*************** +*** 356,362 **** + done + rm -f *.orig */*.orig *~ */*~ core t/core t/c t/perl + rm -rf $(addedbyconf) +! rm -f makefile makefile.old + rm -f $(private) + rm -rf lib/auto + rm -f lib/.exists +--- 399,405 ---- + done + rm -f *.orig */*.orig *~ */*~ core t/core t/c t/perl + rm -rf $(addedbyconf) +! rm -f $(firstmakefile) makefile.old + rm -f $(private) + rm -rf lib/auto + rm -f lib/.exists +*************** +*** 377,383 **** + lint: perly.c $(c) + lint $(lintflags) $(defs) perly.c $(c) > perl.fuzz + +! makefile: Makefile + $(MAKE) depend + + config.h: config.sh +--- 420,426 ---- + lint: perly.c $(c) + lint $(lintflags) $(defs) perly.c $(c) > perl.fuzz + +! $(firstmakefile): Makefile + $(MAKE) depend + + config.h: config.sh +*************** +*** 385,401 **** + + # When done, touch perlmain.c so that it doesn't get remade each time. + depend: makedepend +! ./makedepend + - test -s perlmain.c && touch perlmain.c + cd x2p; $(MAKE) depend + + test: miniperl perl preplibrary $(dynamic_ext) + - cd t && chmod +x TEST */*.t +! - cd t && (rm -f perl; $(LNS) ../perl perl) && ./perl TEST </dev/tty + + minitest: miniperl + - cd t && chmod +x TEST */*.t +! - cd t && (rm -f perl; $(LNS) ../miniperl perl) \ + && ./perl TEST base/*.t comp/*.t cmd/*.t io/*.t op/*.t </dev/tty + + clist: $(c) +--- 428,444 ---- + + # When done, touch perlmain.c so that it doesn't get remade each time. + depend: makedepend +! sh ./makedepend + - test -s perlmain.c && touch perlmain.c + cd x2p; $(MAKE) depend + + test: miniperl perl preplibrary $(dynamic_ext) + - cd t && chmod +x TEST */*.t +! - cd t && (rm -f perl$(exe_ext); $(LNS) ../perl$(exe_ext) perl$(exe_ext)) && ./perl TEST </dev/tty + + minitest: miniperl + - cd t && chmod +x TEST */*.t +! - cd t && (rm -f perl$(exe_ext); $(LNS) ../miniperl$(exe_ext) perl$(exe_ext)) \ + && ./perl TEST base/*.t comp/*.t cmd/*.t io/*.t op/*.t </dev/tty + + clist: $(c) +*************** +*** 415,421 **** + case `pwd` in + *SH) + $rm -f ../Makefile +! ln Makefile ../Makefile + ;; + esac +! rm -f makefile +--- 458,464 ---- + case `pwd` in + *SH) + $rm -f ../Makefile +! $ln Makefile ../Makefile + ;; + esac +! rm -f $firstmakefile diff --git a/os2/diff.configure b/os2/diff.configure new file mode 100644 index 0000000000..09e2447aba --- /dev/null +++ b/os2/diff.configure @@ -0,0 +1,604 @@ +*** Configure.orig Thu Oct 19 07:48:18 1995 +--- Configure Wed Nov 01 20:14:32 1995 +*************** +*** 561,566 **** +--- 561,575 ---- + defvoidused='' + voidflags='' + CONFIG='' ++ archobjs='' ++ firstmakefile='makefile' ++ obj_ext='.o' ++ obj_ext_regexp='\.o' ++ lib_ext='.a' ++ exe_ext= ++ ar='ar' ++ plibext= ++ path_sep=$p_ + + define='define' + undef='undef' +*************** +*** 1363,1369 **** + say=offhand + for file in $trylist; do + xxx=`./loc $file $file $pth` +! eval $file=$xxx + eval _$file=$xxx + case "$xxx" in + /*) +--- 1370,1378 ---- + say=offhand + for file in $trylist; do + xxx=`./loc $file $file $pth` +! if test "X$file" != "X$xxx" ; then +! eval $file=$xxx +! fi + eval _$file=$xxx + case "$xxx" in + /*) +*************** +*** 2156,2162 **** + exit(0); + } + EOM +! if $cc -o gccvers gccvers.c >/dev/null 2>&1; then + gccversion=`./gccvers` + case "$gccversion" in + '') echo "You are not using GNU cc." ;; +--- 2165,2171 ---- + exit(0); + } + EOM +! if $cc -o gccvers gccvers.c $ldflags >/dev/null 2>&1; then + gccversion=`./gccvers` + case "$gccversion" in + '') echo "You are not using GNU cc." ;; +*************** +*** 3851,3856 **** +--- 3860,3871 ---- + *"-l$thislib "*);; + *) dflt="$dflt -l$thislib";; + esac ++ elif xxx=`./loc $thislib.lib X $libpth`; $test -f "$xxx"; then ++ echo "Found -l$thislib." ++ case " $dflt " in ++ *"-l$thislib "*);; ++ *) dflt="$dflt -l$thislib";; ++ esac + else + echo "No -l$thislib." + fi +*************** +*** 3964,3975 **** + : + elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then + : +! elif try=`./loc lib$thislib.a X $libpth`; $test -f "$try"; then + : + elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then + : + elif try=`./loc $thislib X $libpth`; $test -f "$try"; then + : + elif try=`./loc Slib$thislib.a X $xlibpth`; $test -f "$try"; then + : + else +--- 3979,3992 ---- + : + elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then + : +! elif try=`./loc lib$thislib$lib_ext X $libpth`; $test -f "$try"; then + : + elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then + : + elif try=`./loc $thislib X $libpth`; $test -f "$try"; then + : ++ elif try=`./loc $thislib$lib_ext X $libpth`; $test -f "$try"; then ++ : + elif try=`./loc Slib$thislib.a X $xlibpth`; $test -f "$try"; then + : + else +*************** +*** 4018,4028 **** + fi + elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then + echo "Your C library seems to be in $libc, as you said before." +! elif $test -r $incpath/usr/lib/libc.a; then +! libc=$incpath/usr/lib/libc.a; + echo "Your C library seems to be in $libc. That's fine." +! elif $test -r /lib/libc.a; then +! libc=/lib/libc.a; + echo "Your C library seems to be in $libc. You're normal." + else + if tans=`./loc libc.a blurfl/dyick $libpth`; $test -r "$tans"; then +--- 4035,4045 ---- + fi + elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then + echo "Your C library seems to be in $libc, as you said before." +! elif $test -r $incpath/usr/lib/libc$lib_ext; then +! libc=$incpath/usr/lib/libc$lib_ext; + echo "Your C library seems to be in $libc. That's fine." +! elif $test -r /lib/libc$lib_ext; then +! libc=/lib/libc$lib_ext; + echo "Your C library seems to be in $libc. You're normal." + else + if tans=`./loc libc.a blurfl/dyick $libpth`; $test -r "$tans"; then +*************** +*** 4135,4140 **** +--- 4152,4161 ---- + eval $xscan;\ + $contains '^fprintf$' libc.list >/dev/null 2>&1; then + eval $xrun ++ elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\ ++ eval $xscan;\ ++ $contains '^fprintf$' libc.list >/dev/null 2>&1; then ++ eval $xrun + else + nm -p $* 2>/dev/null >libc.tmp + $grep fprintf libc.tmp > libc.ptf +*************** +*** 4145,4167 **** + eval $xrun + else + echo " " +! echo "nm didn't seem to work right. Trying ar instead..." >&4 + com='' +! if ar t $libc > libc.tmp; then + for thisname in $libnames; do +! ar t $thisname >>libc.tmp + done +! $sed -e 's/\.o$//' < libc.tmp > libc.list + echo "Ok." >&4 + else +! echo "ar didn't seem to work right." >&4 + echo "Maybe this is a Cray...trying bld instead..." >&4 + if bld t $libc | $sed -e 's/.*\///' -e 's/\.o:.*$//' > libc.list + then + for thisname in $libnames; do + bld t $libnames | \ + $sed -e 's/.*\///' -e 's/\.o:.*$//' >>libc.list +! ar t $thisname >>libc.tmp + done + echo "Ok." >&4 + else +--- 4166,4189 ---- + eval $xrun + else + echo " " +! echo "nm didn't seem to work right. Trying $ar instead..." >&4 + com='' +! if test "X$osname" = "Xos2"; then ar_opt=tv ; else ar_opt=t ;fi +! if $ar $ar_opt $libc > libc.tmp; then + for thisname in $libnames; do +! $ar $ar_opt $thisname >>libc.tmp + done +! $sed -e 's/\.o$//' -e 's/^ \+//' < libc.tmp | grep -v "^IMPORT#" > libc.list + echo "Ok." >&4 + else +! echo "$ar didn't seem to work right." >&4 + echo "Maybe this is a Cray...trying bld instead..." >&4 + if bld t $libc | $sed -e 's/.*\///' -e 's/\.o:.*$//' > libc.list + then + for thisname in $libnames; do + bld t $libnames | \ + $sed -e 's/.*\///' -e 's/\.o:.*$//' >>libc.list +! $ar t $thisname >>libc.tmp + done + echo "Ok." >&4 + else +*************** +*** 4507,4513 **** + exit(0); + } + EOCP +! if $cc $ccflags try.c -o try >/dev/null 2>&1 && ./try > /dev/null; then + intsize=`./try` + echo "Your integers are $intsize bytes long." + else +--- 4529,4535 ---- + exit(0); + } + EOCP +! if $cc $ccflags $ldflags try.c -o try >/dev/null 2>&1 && ./try > /dev/null; then + intsize=`./try` + echo "Your integers are $intsize bytes long." + else +*************** +*** 4587,4593 **** + exit(result); + } + EOCP +! if $cc -o try $ccflags try.c >/dev/null 2>&1; then + ./try + yyy=$? + else +--- 4609,4615 ---- + exit(result); + } + EOCP +! if $cc -o try $ccflags try.c $ldflags >/dev/null 2>&1; then + ./try + yyy=$? + else +*************** +*** 4668,4674 **** + + } + EOCP +! if $cc -o try $ccflags try.c >/dev/null 2>&1; then + ./try + castflags=$? + else +--- 4690,4696 ---- + + } + EOCP +! if $cc -o try $ccflags try.c $ldflags >/dev/null 2>&1; then + ./try + castflags=$? + else +*************** +*** 4707,4713 **** + exit((unsigned long)vsprintf(buf,"%s",args) > 10L); + } + EOF +! if $cc $ccflags vprintf.c -o vprintf >/dev/null 2>&1 && ./vprintf; then + echo "Your vsprintf() returns (int)." >&4 + val2="$undef" + else +--- 4729,4735 ---- + exit((unsigned long)vsprintf(buf,"%s",args) > 10L); + } + EOF +! if $cc $ccflags vprintf.c $ldflags -o vprintf >/dev/null 2>&1 && ./vprintf; then + echo "Your vsprintf() returns (int)." >&4 + val2="$undef" + else +*************** +*** 4777,4783 **** + cryptlib=-lcrypt + fi + if $test -z "$cryptlib"; then +! cryptlib=`./loc libcrypt.a "" $libpth` + else + cryptlib=-lcrypt + fi +--- 4799,4805 ---- + cryptlib=-lcrypt + fi + if $test -z "$cryptlib"; then +! cryptlib=`./loc libcrypt$lib_ext "" $libpth` + else + cryptlib=-lcrypt + fi +*************** +*** 5284,5290 **** + } + EOM + if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && +! $ld $lddlflags -o dyna.$dlext dyna.o > /dev/null 2>&1 && + $cc $ccflags $ldflags $cccdlflags $ccdlflags fred.c -o fred $libs > /dev/null 2>&1; then + xxx=`./fred` + case $xxx in +--- 5306,5312 ---- + } + EOM + if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && +! $ld $lddlflags -o dyna.$dlext dyna$obj_ext > /dev/null 2>&1 && + $cc $ccflags $ldflags $cccdlflags $ccdlflags fred.c -o fred $libs > /dev/null 2>&1; then + xxx=`./fred` + case $xxx in +*************** +*** 5441,5447 **** + EOCP + : check sys/file.h first to get FREAD on Sun + if $test `./findhdr sys/file.h` && \ +! $cc $cppflags "-DI_SYS_FILE" open3.c -o open3 >/dev/null 2>&1 ; then + h_sysfile=true; + echo "<sys/file.h> defines the O_* constants..." >&4 + if ./open3; then +--- 5463,5469 ---- + EOCP + : check sys/file.h first to get FREAD on Sun + if $test `./findhdr sys/file.h` && \ +! $cc $cppflags $ldflags "-DI_SYS_FILE" open3.c -o open3 >/dev/null 2>&1 ; then + h_sysfile=true; + echo "<sys/file.h> defines the O_* constants..." >&4 + if ./open3; then +*************** +*** 5452,5458 **** + val="$undef" + fi + elif $test `./findhdr fcntl.h` && \ +! $cc "-DI_FCNTL" open3.c -o open3 >/dev/null 2>&1 ; then + h_fcntl=true; + echo "<fcntl.h> defines the O_* constants..." >&4 + if ./open3; then +--- 5474,5480 ---- + val="$undef" + fi + elif $test `./findhdr fcntl.h` && \ +! $cc "-DI_FCNTL" $ldflags open3.c -o open3 >/dev/null 2>&1 ; then + h_fcntl=true; + echo "<fcntl.h> defines the O_* constants..." >&4 + if ./open3; then +*************** +*** 5931,5937 **** + y*|true) + usemymalloc='y' + mallocsrc='malloc.c' +! mallocobj='malloc.o' + d_mymalloc="$define" + case "$libs" in + *-lmalloc*) +--- 5953,5959 ---- + y*|true) + usemymalloc='y' + mallocsrc='malloc.c' +! mallocobj="malloc$obj_ext" + d_mymalloc="$define" + case "$libs" in + *-lmalloc*) +*************** +*** 6366,6375 **** + : we will have to assume that it supports the 4.2 BSD interface + d_oldsock="$undef" + else +! echo "You don't have Berkeley networking in libc.a..." >&4 +! if test -f /usr/lib/libnet.a; then +! ( (nm $nm_opt /usr/lib/libnet.a | eval $nm_extract) || \ +! ar t /usr/lib/libnet.a) 2>/dev/null >> libc.list + if $contains socket libc.list >/dev/null 2>&1; then + echo "...but the Wollongong group seems to have hacked it in." >&4 + socketlib="-lnet" +--- 6388,6397 ---- + : we will have to assume that it supports the 4.2 BSD interface + d_oldsock="$undef" + else +! echo "You don't have Berkeley networking in libc$lib_ext..." >&4 +! if test -f /usr/lib/libnet$lib_ext; then +! ( (nm $nm_opt /usr/lib/libnet$lib_ext | eval $nm_extract) || \ +! $ar t /usr/lib/libnet$lib_ext) 2>/dev/null >> libc.list + if $contains socket libc.list >/dev/null 2>&1; then + echo "...but the Wollongong group seems to have hacked it in." >&4 + socketlib="-lnet" +*************** +*** 6382,6388 **** + d_oldsock="$define" + fi + else +! echo "or even in libnet.a, which is peculiar." >&4 + d_socket="$undef" + d_oldsock="$undef" + fi +--- 6404,6410 ---- + d_oldsock="$define" + fi + else +! echo "or even in libnet$lib_ext, which is peculiar." >&4 + d_socket="$undef" + d_oldsock="$undef" + fi +*************** +*** 6905,6911 **** + printf("%d\n", (char *)&try.bar - (char *)&try.foo); + } + EOCP +! if $cc $ccflags try.c -o try >/dev/null 2>&1; then + dflt=`./try` + else + dflt='8' +--- 6927,6933 ---- + printf("%d\n", (char *)&try.bar - (char *)&try.foo); + } + EOCP +! if $cc $ccflags $ldflags try.c -o try >/dev/null 2>&1; then + dflt=`./try` + else + dflt='8' +*************** +*** 6953,6959 **** + } + EOCP + xxx_prompt=y +! if $cc $ccflags try.c -o try >/dev/null 2>&1 && ./try > /dev/null; then + dflt=`./try` + case "$dflt" in + [1-4][1-4][1-4][1-4]|12345678|87654321) +--- 6975,6981 ---- + } + EOCP + xxx_prompt=y +! if $cc $ccflags $ldflags try.c -o try >/dev/null 2>&1 && ./try > /dev/null; then + dflt=`./try` + case "$dflt" in + [1-4][1-4][1-4][1-4]|12345678|87654321) +*************** +*** 7531,7537 **** + printf("%d\n",i); + } + EOCP +! if $cc try.c -o try >/dev/null 2>&1 ; then + dflt=`try` + else + dflt='?' +--- 7553,7559 ---- + printf("%d\n",i); + } + EOCP +! if $cc $ldflags try.c -o try >/dev/null 2>&1 ; then + dflt=`try` + else + dflt='?' +*************** +*** 7558,7575 **** + $cc $ccflags -c bar1.c >/dev/null 2>&1 + $cc $ccflags -c bar2.c >/dev/null 2>&1 + $cc $ccflags -c foo.c >/dev/null 2>&1 +! ar rc bar.a bar2.o bar1.o >/dev/null 2>&1 +! if $cc $ccflags $ldflags -o foobar foo.o bar.a $libs > /dev/null 2>&1 && + ./foobar >/dev/null 2>&1; then +! echo "ar appears to generate random libraries itself." + orderlib=false + ranlib=":" +! elif ar ts bar.a >/dev/null 2>&1 && +! $cc $ccflags $ldflags -o foobar foo.o bar.a $libs > /dev/null 2>&1 && + ./foobar >/dev/null 2>&1; then + echo "a table of contents needs to be added with 'ar ts'." + orderlib=false +! ranlib="ar ts" + else + case "$ranlib" in + :) ranlib='';; +--- 7580,7597 ---- + $cc $ccflags -c bar1.c >/dev/null 2>&1 + $cc $ccflags -c bar2.c >/dev/null 2>&1 + $cc $ccflags -c foo.c >/dev/null 2>&1 +! $ar rc bar$lib_ext bar2$obj_ext bar1$obj_ext >/dev/null 2>&1 +! if $cc $ccflags $ldflags -o foobar foo$obj_ext bar$lib_ext $libs > /dev/null 2>&1 && + ./foobar >/dev/null 2>&1; then +! echo "$ar appears to generate random libraries itself." + orderlib=false + ranlib=":" +! elif $ar ts bar$lib_ext >/dev/null 2>&1 && +! $cc $ccflags $ldflags -o foobar foo$obj_ext bar$lib_ext $libs > /dev/null 2>&1 && + ./foobar >/dev/null 2>&1; then + echo "a table of contents needs to be added with 'ar ts'." + orderlib=false +! ranlib="$ar ts" + else + case "$ranlib" in + :) ranlib='';; +*************** +*** 7641,7647 **** + '') $echo $n ".$c" + if $cc $ccflags \ + $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone \ +! try.c -o try >/dev/null 2>&1 ; then + set X $i_time $i_systime $i_systimek $sysselect $s_timeval + shift + flags="$*" +--- 7663,7669 ---- + '') $echo $n ".$c" + if $cc $ccflags \ + $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone \ +! try.c -o try $ldflags >/dev/null 2>&1 ; then + set X $i_time $i_systime $i_systimek $sysselect $s_timeval + shift + flags="$*" +*************** +*** 7710,7716 **** + #endif + } + EOCP +! if $cc $ccflags -DTRYBITS fd_set.c -o fd_set >fd_set.out 2>&1 ; then + d_fds_bits="$define" + d_fd_set="$define" + echo "Well, your system knows about the normal fd_set typedef..." >&4 +--- 7732,7738 ---- + #endif + } + EOCP +! if $cc $ccflags $ldflags -DTRYBITS fd_set.c -o fd_set >fd_set.out 2>&1 ; then + d_fds_bits="$define" + d_fd_set="$define" + echo "Well, your system knows about the normal fd_set typedef..." >&4 +*************** +*** 7727,7733 **** + $cat <<'EOM' + Hmm, your compiler has some difficulty with fd_set. Checking further... + EOM +! if $cc $ccflags fd_set.c -o fd_set >fd_set.out 2>&1 ; then + d_fds_bits="$undef" + d_fd_set="$define" + echo "Well, your system has some sort of fd_set available..." >&4 +--- 7749,7755 ---- + $cat <<'EOM' + Hmm, your compiler has some difficulty with fd_set. Checking further... + EOM +! if $cc $ccflags $ldflags fd_set.c -o fd_set >fd_set.out 2>&1 ; then + d_fds_bits="$undef" + d_fd_set="$define" + echo "Well, your system has some sort of fd_set available..." >&4 +*************** +*** 8353,8359 **** + else + echo "false" + fi +! $rm -f varargs.o + EOP + chmod +x varargs + +--- 8375,8381 ---- + else + echo "false" + fi +! $rm -f varargs$obj_ext + EOP + chmod +x varargs + +*************** +*** 8496,8506 **** + echo " " + echo "Stripping down executable paths..." >&4 + for file in $loclist $trylist; do +! eval $file="\$file" + done + ;; + esac + + : create config.sh file + echo " " + echo "Creating config.sh..." >&4 +--- 8518,8531 ---- + echo " " + echo "Stripping down executable paths..." >&4 + for file in $loclist $trylist; do +! if test X$file != Xln -o X$osname != Xos2; then eval $file="\$file"; fi + done + ;; + esac + ++ # Setup libraries for linking miniperl (if not set already) ++ : ${cldlibs="$libs $cryptlib"} ++ + : create config.sh file + echo " " + echo "Creating config.sh..." >&4 +*************** +*** 8556,8561 **** +--- 8581,8587 ---- + chmod='$chmod' + chown='$chown' + clocktype='$clocktype' ++ cldlibs='$cldlibs' + comm='$comm' + compress='$compress' + contains='$contains' +*************** +*** 8752,8757 **** +--- 8778,8784 ---- + expr='$expr' + extensions='$extensions' + find='$find' ++ firstmakefile='$firstmakefile' + flex='$flex' + fpostype='$fpostype' + freetype='$freetype' +*************** +*** 8962,8967 **** +--- 8989,9002 ---- + voidflags='$voidflags' + xlibpth='$xlibpth' + zcat='$zcat' ++ archobjs='$archobjs' ++ obj_ext='$obj_ext' ++ obj_ext_regexp='$obj_ext_regexp' ++ lib_ext='$lib_ext' ++ exe_ext='$exe_ext' ++ ar='$ar' ++ plibext='$plibext' ++ path_sep='$path_sep' + EOT + + : add special variables diff --git a/os2/diff.installperl b/os2/diff.installperl new file mode 100644 index 0000000000..c94db2e464 --- /dev/null +++ b/os2/diff.installperl @@ -0,0 +1,248 @@ +diff -cr ..\perl5os2.patch\perl5.001m.andy/installperl ./installperl +*** ../perl5os2.patch/perl5.001m.andy/installperl Wed Jun 21 12:09:26 1995 +--- ./installperl Thu Sep 28 00:00:20 1995 +*************** +*** 24,35 **** + # Read in the config file. + + open(CONFIG, "config.sh") || die "You haven't run Configure yet!\n"; +! while (<CONFIG>) { +! if (s/^(\w+=)/\$$1/) { + $accum =~ s/'undef'/undef/g; + eval $accum; + $accum = ''; + } + $accum .= $_; + } + close CONFIG; +--- 24,37 ---- + # Read in the config file. + + open(CONFIG, "config.sh") || die "You haven't run Configure yet!\n"; +! while (1) { +! $_ = <CONFIG>; +! if (s/^(\w+=)/\$$1/ or not defined $_) { + $accum =~ s/'undef'/undef/g; + eval $accum; + $accum = ''; + } ++ last unless defined $_; # To get the last two lines too + $accum .= $_; + } + close CONFIG; +*************** +*** 50,57 **** + -w $installbin || die "$installbin is not writable by you\n" + unless $installbin =~ m#^/afs/# || $nonono; + +! -x 'perl' || die "perl isn't executable!\n"; +! -x 'suidperl' || die "suidperl isn't executable!\n" if $d_dosuid; + + -x 't/TEST' || warn "WARNING: You've never run 'make test'!!!", + " (Installing anyway.)\n"; +--- 52,59 ---- + -w $installbin || die "$installbin is not writable by you\n" + unless $installbin =~ m#^/afs/# || $nonono; + +! -x 'perl' . $exe_ext || die "perl isn't executable!\n"; +! -x 'suidperl' . $exe_ext|| die "suidperl isn't executable!\n" if $d_dosuid; + + -x 't/TEST' || warn "WARNING: You've never run 'make test'!!!", + " (Installing anyway.)\n"; +*************** +*** 69,81 **** + + # First we install the version-numbered executables. + +! &safe_unlink("$installbin/perl$ver"); +! &cmd("cp perl $installbin/perl$ver"); + +! &safe_unlink("$installbin/sperl$ver"); + if ($d_dosuid) { +! &cmd("cp suidperl $installbin/sperl$ver"); +! &chmod(04711, "$installbin/sperl$ver"); + } + + exit 0 if $versiononly; +--- 71,83 ---- + + # First we install the version-numbered executables. + +! &safe_unlink("$installbin/perl$ver$exe_ext"); +! &cmd("cp perl$exe_ext $installbin/perl$ver$exe_ext"); + +! &safe_unlink("$installbin/sperl$ver$exe_ext"); + if ($d_dosuid) { +! &cmd("cp suidperl$exe_ext $installbin/sperl$ver$exe_ext"); +! &chmod(04711, "$installbin/sperl$ver$exe_ext"); + } + + exit 0 if $versiononly; +*************** +*** 83,97 **** + # Make links to ordinary names if installbin directory isn't current directory. + + if (! &samepath($installbin, '.')) { +! &safe_unlink("$installbin/perl", "$installbin/suidperl"); +! &link("$installbin/perl$ver", "$installbin/perl"); +! &link("$installbin/sperl$ver", "$installbin/suidperl") if $d_dosuid; + } + + if (! &samepath($installbin, 'x2p')) { +! &safe_unlink("$installbin/a2p"); +! &cmd("cp x2p/a2p $installbin/a2p"); +! &chmod(0755, "$installbin/a2p"); + } + + # Install scripts. +--- 85,100 ---- + # Make links to ordinary names if installbin directory isn't current directory. + + if (! &samepath($installbin, '.')) { +! &safe_unlink("$installbin/perl$exe_ext", "$installbin/suidperl$exe_ext"); +! &link("$installbin/perl$ver$exe_ext", "$installbin/perl$exe_ext"); +! &link("$installbin/sperl$ver$exe_ext", "$installbin/suidperl$exe_ext") +! if $d_dosuid; + } + + if (! &samepath($installbin, 'x2p')) { +! &safe_unlink("$installbin/a2p$exe_ext"); +! &cmd("cp x2p/a2p$exe_ext $installbin/a2p$exe_ext"); +! &chmod(0755, "$installbin/a2p$exe_ext"); + } + + # Install scripts. +*************** +*** 174,187 **** + if (-w $mainperldir && ! &samepath($mainperldir, $installbin) && !$nonono) { + # First make sure $mainperldir/perl is not already the same as + # the perl we just installed +! if (-x "$mainperldir/perl") { + # Try to be clever about mainperl being a symbolic link + # to binexp/perl if binexp and installbin are different. + $mainperl_is_instperl = +! &samepath("$mainperldir/perl", "$installbin/perl") || + (($binexp ne $installbin) && +! (-l "$mainperldir/perl") && +! ((readlink "$mainperldir/perl") eq "$binexp/perl")); + } + if ((! $mainperl_is_instperl) && + (&yn("Many scripts expect perl to be installed as " . +--- 177,190 ---- + if (-w $mainperldir && ! &samepath($mainperldir, $installbin) && !$nonono) { + # First make sure $mainperldir/perl is not already the same as + # the perl we just installed +! if (-x "$mainperldir/perl$exe_ext") { + # Try to be clever about mainperl being a symbolic link + # to binexp/perl if binexp and installbin are different. + $mainperl_is_instperl = +! &samepath("$mainperldir/perl$exe_ext", "$installbin/perl$exe_ext") || + (($binexp ne $installbin) && +! (-l "$mainperldir/perl$exe_ext") && +! ((readlink "$mainperldir/perl$exe_ext") eq "$binexp/perl$exe_ext")); + } + if ((! $mainperl_is_instperl) && + (&yn("Many scripts expect perl to be installed as " . +*************** +*** 189,198 **** + "Do you wish to have $mainperldir/perl be the same as\n" . + "$binexp/perl? [y] "))) + { +! unlink("$mainperldir/perl"); +! eval 'link("$installbin/perl", "$mainperldir/perl")' || +! eval 'symlink("$binexp/perl", "$mainperldir/perl")' || +! &cmd("cp $installbin/perl $mainperldir"); + $mainperl_is_instperl = 1; + } + } +--- 192,201 ---- + "Do you wish to have $mainperldir/perl be the same as\n" . + "$binexp/perl? [y] "))) + { +! unlink("$mainperldir/perl$exe_ext"); +! eval 'link("$installbin/perl$exe_ext", "$mainperldir/perl$exe_ext")' || +! eval 'symlink("$binexp/perl$exe_ext", "$mainperldir/perl$exe_ext")' || +! &cmd("cp $installbin/perl$exe_ext $mainperldir$exe_ext"); + $mainperl_is_instperl = 1; + } + } +*************** +*** 203,209 **** + # Also skip $mainperl if the user opted to have it be a link to the + # installed perl. + +! @path = split(/:/, $ENV{"PATH"}); + @otherperls = (); + for (@path) { + next unless m,^/,; +--- 206,214 ---- + # Also skip $mainperl if the user opted to have it be a link to the + # installed perl. + +! $dirsep = ($osname =~ m:^os/?2$:i) ? ';' : ':' ; +! ($path = $ENV{"PATH"}) =~ s:\\:/:g ; +! @path = split(/$dirsep/, $path); + @otherperls = (); + for (@path) { + next unless m,^/,; +*************** +*** 211,217 **** + # Use &samepath here because some systems have other dirs linked + # to $mainperldir (like SunOS) + next if ($mainperl_is_instperl && &samepath($_, $mainperldir)); +! push(@otherperls, "$_/perl") if (-x "$_/perl" && ! -d "$_/perl"); + } + if (@otherperls) { + print STDERR "\nWarning: perl appears in your path in the following " . +--- 216,223 ---- + # Use &samepath here because some systems have other dirs linked + # to $mainperldir (like SunOS) + next if ($mainperl_is_instperl && &samepath($_, $mainperldir)); +! push(@otherperls, "$_/perl$exe_ext") +! if (-x "$_/perl$exe_ext" && ! -d "$_/perl$exe_ext"); + } + if (@otherperls) { + print STDERR "\nWarning: perl appears in your path in the following " . +*************** +*** 244,249 **** +--- 250,256 ---- + foreach $name (@names) { + next unless -e $name; + print STDERR " unlink $name\n"; ++ chmod 0777, $name if $osname =~ m:^os/?2$:i ; + unlink($name) || warn "Couldn't unlink $name: $!\n" unless $nonono; + } + } +*************** +*** 255,260 **** +--- 262,268 ---- + next unless -e $name; + print STDERR " unlink $name\n"; + next if $nonono; ++ chmod 0777, $name if $osname =~ m:^os/?2$:i ; + next if unlink($name); + warn "Couldn't unlink $name: $!\n"; + if ($! =~ /busy/i) { +*************** +*** 290,296 **** + local($from,$to) = @_; + + print STDERR " ln $from $to\n"; +! link($from,$to) || warn "Couldn't link $from to $to: $!\n" unless $nonono; + } + + sub chmod { +--- 298,310 ---- + local($from,$to) = @_; + + print STDERR " ln $from $to\n"; +! eval { +! link($from,$to) || warn "Couldn't link $from to $to: $!\n" unless $nonono; +! }; +! if ($@) { +! system( $cp, $from, $to ) +! && warn "Couldn't copy $from to $to: $!\n" unless $nonono; +! } + } + + sub chmod { diff --git a/os2/diff.mkdep b/os2/diff.mkdep new file mode 100644 index 0000000000..595d260238 --- /dev/null +++ b/os2/diff.mkdep @@ -0,0 +1,128 @@ +diff -cr ..\perl5os2.patch\perl5.001m.andy/makedepend.SH ./makedepend.SH +*** ../perl5os2.patch/perl5.001m.andy/makedepend.SH Mon Oct 09 21:41:04 1995 +--- ./makedepend.SH Thu Sep 28 00:00:28 1995 +*************** +*** 43,48 **** +--- 43,51 ---- + ;; + esac + ++ # In case Configure is not patched: ++ : ${firstmakefile=makefile} ++ + # We need .. when we are in the x2p directory if we are using the + # cppstdin wrapper script. + # Put .. and . first so that we pick up the present cppstdin, not +*************** +*** 53,69 **** + $cat /dev/null >.deptmp + $rm -f *.c.c c/*.c.c + if test -f Makefile; then +! cp Makefile makefile + fi +! mf=makefile + if test -f $mf; then + defrule=`<$mf sed -n \ +! -e '/^\.c\.o:.*;/{' \ + -e 's/\$\*\.c//' \ + -e 's/^[^;]*;[ ]*//p' \ + -e q \ + -e '}' \ +! -e '/^\.c\.o: *$/{' \ + -e N \ + -e 's/\$\*\.c//' \ + -e 's/^.*\n[ ]*//p' \ +--- 56,72 ---- + $cat /dev/null >.deptmp + $rm -f *.c.c c/*.c.c + if test -f Makefile; then +! cp Makefile $firstmakefile + fi +! mf=$firstmakefile + if test -f $mf; then + defrule=`<$mf sed -n \ +! -e '/^\.c\$(O_REGEXP):.*;/{' \ + -e 's/\$\*\.c//' \ + -e 's/^[^;]*;[ ]*//p' \ + -e q \ + -e '}' \ +! -e '/^\.c\$(O_REGEXP): *$/{' \ + -e N \ + -e 's/\$\*\.c//' \ + -e 's/^.*\n[ ]*//p' \ +*************** +*** 91,97 **** + */*) finc="-I`echo $file | sed 's#/[^/]*$##`" ;; + *) finc= ;; + esac +! $echo "Finding dependencies for $filebase.o." + ( $echo "#line 1 \"$file\""; \ + $sed -n <$file \ + -e "/^${filebase}_init(/q" \ +--- 94,100 ---- + */*) finc="-I`echo $file | sed 's#/[^/]*$##`" ;; + *) finc= ;; + esac +! $echo "Finding dependencies for $filebase$obj_ext." + ( $echo "#line 1 \"$file\""; \ + $sed -n <$file \ + -e "/^${filebase}_init(/q" \ +*************** +*** 107,114 **** + -e 's#\.[0-9][0-9]*\.c#'"$file.c#" \ + -e 's/^[ ]*#[ ]*line/#/' \ + -e '/^# *[0-9][0-9]* *[".\/]/!d' \ +! -e 's/^.*"\(.*\)".*$/'$filebase'.o: \1/' \ +! -e 's/^# *[0-9][0-9]* \(.*\)$/'$filebase'.o: \1/' \ + -e 's|: \./|: |' \ + -e 's|\.c\.c|.c|' | \ + $uniq | $sort | $uniq >> .deptmp +--- 110,117 ---- + -e 's#\.[0-9][0-9]*\.c#'"$file.c#" \ + -e 's/^[ ]*#[ ]*line/#/' \ + -e '/^# *[0-9][0-9]* *[".\/]/!d' \ +! -e 's/^.*"\(.*\)".*$/'$filebase'\$(O): \1/' \ +! -e 's/^# *[0-9][0-9]* \(.*\)$/'$filebase'\$(O): \1/' \ + -e 's|: \./|: |' \ + -e 's|\.c\.c|.c|' | \ + $uniq | $sort | $uniq >> .deptmp +*************** +*** 126,132 **** + $echo "Updating $mf..." + $echo "# If this runs make out of memory, delete /usr/include lines." \ + >> $mf.new +! $sed 's|^\(.*\.o:\) *\(.*/.*\.c\) *$|\1 \2; '"$defrule \2|" .deptmp \ + >>$mf.new + else + $MAKE hlist || ($echo "Searching for .h files..."; \ +--- 129,135 ---- + $echo "Updating $mf..." + $echo "# If this runs make out of memory, delete /usr/include lines." \ + >> $mf.new +! $sed 's|^\(.*\$(O_REGEXP):\) *\(.*/.*\.c\) *$|\1 \2; '"$defrule \2|" .deptmp \ + >>$mf.new + else + $MAKE hlist || ($echo "Searching for .h files..."; \ +*************** +*** 136,145 **** + $echo "Updating $mf..." + <.clist $sed -n \ + -e '/\//{' \ +! -e 's|^\(.*\)/\(.*\)\.c|\2.o: \1/\2.c; '"$defrule \1/\2.c|p" \ + -e d \ + -e '}' \ +! -e 's|^\(.*\)\.c|\1.o: \1.c|p' >> $mf.new + <.hlist $sed -n 's|\(.*/\)\(.*\)|s= \2= \1\2=|p' >.hsed + <.deptmp $sed -n 's|c:#include "\(.*\)".*$|o: \1|p' | \ + $sed 's|^[^;]*/||' | \ +--- 139,148 ---- + $echo "Updating $mf..." + <.clist $sed -n \ + -e '/\//{' \ +! -e 's|^\(.*\)/\(.*\)\.c|\2\$(O): \1/\2.c; '"$defrule \1/\2.c|p" \ + -e d \ + -e '}' \ +! -e 's|^\(.*\)\.c|\1\$(O): \1.c|p' >> $mf.new + <.hlist $sed -n 's|\(.*/\)\(.*\)|s= \2= \1\2=|p' >.hsed + <.deptmp $sed -n 's|c:#include "\(.*\)".*$|o: \1|p' | \ + $sed 's|^[^;]*/||' | \ diff --git a/os2/diff.x2pMakefile b/os2/diff.x2pMakefile new file mode 100644 index 0000000000..af3058452f --- /dev/null +++ b/os2/diff.x2pMakefile @@ -0,0 +1,222 @@ +diff -cr ..\perl5os2.patch\perl5.001m.andy/x2p/Makefile.SH ./x2p/Makefile.SH +*** ../perl5os2.patch/perl5.001m.andy/x2p/Makefile.SH Fri May 26 07:33:48 1995 +--- ./x2p/Makefile.SH Thu Sep 28 00:00:42 1995 +*************** +*** 17,22 **** +--- 17,25 ---- + */*) cd `expr X$0 : 'X\(.*\)/'` ;; + esac + ++ # In case Configure is not patched: ++ : ${obj_ext=.o} ${obj_ext_regexp='\.o'} ${lib_ext=.a} ${ar=ar} ${firstmakefile=makefile} ++ + echo "Extracting x2p/Makefile (with variable substitutions)" + rm -f Makefile + cat >Makefile <<!GROK!THIS! +*************** +*** 33,39 **** +--- 36,51 ---- + mallocobj = $mallocobj + shellflags = $shellflags + ++ firstmakefile = $firstmakefile ++ + libs = $libs ++ O = $obj_ext ++ O_REGEXP = $obj_ext_regexp ++ A = $lib_ext ++ AR = $ar ++ ++ .SUFFIXES: .c \$(O) ++ + !GROK!THIS! + + cat >>Makefile <<'!NO!SUBS!' +*************** +*** 56,76 **** + + c = hash.c $(mallocsrc) str.c util.c walk.c + +! obj = hash.o $(mallocobj) str.o util.o walk.o + + lintflags = -phbvxac + + # grrr + SHELL = /bin/sh + +! .c.o: + $(CCCMD) $*.c + + all: $(public) $(private) $(util) + touch all + +! a2p: $(obj) a2p.o +! $(CC) $(LDFLAGS) $(obj) a2p.o $(libs) -o a2p + + # I now supply a2p.c with the kits, so the following section is + # used only if you force byacc to run by saying +--- 67,87 ---- + + c = hash.c $(mallocsrc) str.c util.c walk.c + +! obj = hash$(O) $(mallocobj) str$(O) util$(O) walk$(O) + + lintflags = -phbvxac + + # grrr + SHELL = /bin/sh + +! .c$(O): + $(CCCMD) $*.c + + all: $(public) $(private) $(util) + touch all + +! a2p: $(obj) a2p$(O) +! $(CC) $(LDFLAGS) $(obj) a2p$(O) $(libs) -o a2p + + # I now supply a2p.c with the kits, so the following section is + # used only if you force byacc to run by saying +*************** +*** 86,100 **** + a2p.c: a2p.y + -@touch a2p.c + +! a2p.o: a2p.c a2py.c a2p.h EXTERN.h util.h INTERN.h handy.h ../config.h str.h hash.h + $(CCCMD) $(LARGE) a2p.c + + clean: +! rm -f a2p *.o + + realclean: clean + rm -f *.orig core $(addedbyconf) all malloc.c +! rm -f makefile makefile.old + + # The following lint has practically everything turned on. Unfortunately, + # you have to wade through a lot of mumbo jumbo that can't be suppressed. +--- 97,111 ---- + a2p.c: a2p.y + -@touch a2p.c + +! a2p$(O): a2p.c a2py.c a2p.h EXTERN.h util.h INTERN.h handy.h ../config.h str.h hash.h + $(CCCMD) $(LARGE) a2p.c + + clean: +! rm -f a2p *$(O) + + realclean: clean + rm -f *.orig core $(addedbyconf) all malloc.c +! rm -f $(firstmakefile) makefile.old + + # The following lint has practically everything turned on. Unfortunately, + # you have to wade through a lot of mumbo jumbo that can't be suppressed. +*************** +*** 105,111 **** + lint $(lintflags) $(defs) $(c) > a2p.fuzz + + depend: $(mallocsrc) ../makedepend +! ../makedepend + + clist: + echo $(c) | tr ' ' '\012' >.clist +--- 116,122 ---- + lint $(lintflags) $(defs) $(c) > a2p.fuzz + + depend: $(mallocsrc) ../makedepend +! sh ../makedepend + + clist: + echo $(c) | tr ' ' '\012' >.clist +*************** +*** 131,137 **** + case `pwd` in + *SH) + $rm -f ../Makefile +! ln Makefile ../Makefile + ;; + esac +! rm -f makefile +--- 142,148 ---- + case `pwd` in + *SH) + $rm -f ../Makefile +! $ln Makefile ../Makefile + ;; + esac +! rm -f $firstmakefile +*** installman.orig Thu Jun 22 10:42:40 1995 +--- installman Thu Nov 02 04:07:38 1995 +*************** +*** 6,11 **** +--- 6,12 ---- + require Cwd; + + umask 022; ++ $ENV{SHELL} = 'sh' if $Config{osname} eq 'os2'; + + $ver = $]; + $release = substr($ver,0,3); # Not used presently. +*************** +*** 38,48 **** + + #Sanity checks + +! -x "./perl" || warn "./perl not found! Have you run make?\n"; + -d $Config{'installprivlib'} + || warn "Perl library directory $Config{'installprivlib'} not found. + Have you run make install?. (Installing anyway.)\n"; +! -x 't/TEST' || warn "WARNING: You've never run 'make test'!!!", + " (Installing anyway.)\n"; + + # Install the main pod pages. +--- 39,50 ---- + + #Sanity checks + +! -x "./perl$Config{exe_ext}" +! or warn "./perl$Config{exe_ext} not found! Have you run make?\n"; + -d $Config{'installprivlib'} + || warn "Perl library directory $Config{'installprivlib'} not found. + Have you run make install?. (Installing anyway.)\n"; +! -x "t/perl$Config{exe_ext}" || warn "WARNING: You've never run 'make test'!!!", + " (Installing anyway.)\n"; + + # Install the main pod pages. +*************** +*** 66,72 **** + # are enhancements or changes from previous installed versions. + # The error message doesn't include the '..' because the user + # won't be aware that we've chdir to $poddir. +! -x "../pod/pod2man" || die "Executable pod/pod2man not found.\n"; + + # We want to be sure to use the current perl. We can't rely on + # the installed perl because it might not be actually installed +--- 68,74 ---- + # are enhancements or changes from previous installed versions. + # The error message doesn't include the '..' because the user + # won't be aware that we've chdir to $poddir. +! -r "../pod/pod2man" || die "Executable pod/pod2man not found.\n"; + + # We want to be sure to use the current perl. We can't rely on + # the installed perl because it might not be actually installed +*************** +*** 86,92 **** + # Convert name from File/Basename.pm to File::Basename.3 format, + # if necessary. + $manpage =~ s#\.p(m|od)$##; +! $manpage =~ s#/#::#g; + $manpage = "${mandir}/${manpage}.${manext}"; + # Print $release $patchlevel stuff? or should pod2man do that? + &cmd("$pod2man $mod > $manpage"); +--- 88,98 ---- + # Convert name from File/Basename.pm to File::Basename.3 format, + # if necessary. + $manpage =~ s#\.p(m|od)$##; +! if ($Config{osname} eq "os2") { +! $manpage =~ s#/#.#g; +! } else { +! $manpage =~ s#/#::#g; +! } + $manpage = "${mandir}/${manpage}.${manext}"; + # Print $release $patchlevel stuff? or should pod2man do that? + &cmd("$pod2man $mod > $manpage"); diff --git a/os2/os2.c b/os2/os2.c new file mode 100644 index 0000000000..f6c76082bd --- /dev/null +++ b/os2/os2.c @@ -0,0 +1,215 @@ +#define INCL_DOS +#define INCL_NOPM +#include <os2.h> + +/* + * Various Unix compatibility functions for OS/2 + */ + +#include <stdio.h> +#include <errno.h> +#include <limits.h> +#include <process.h> + +#include "EXTERN.h" +#include "perl.h" + +/*****************************************************************************/ +/* priorities */ + +int setpriority(int which, int pid, int val) +{ + return DosSetPriority((pid < 0) ? PRTYS_PROCESSTREE : PRTYS_PROCESS, + val >> 8, val & 0xFF, abs(pid)); +} + +int getpriority(int which /* ignored */, int pid) +{ + TIB *tib; + PIB *pib; + DosGetInfoBlocks(&tib, &pib); + return tib->tib_ptib2->tib2_ulpri; +} + +/*****************************************************************************/ +/* spawn */ + +static int +result(int flag, int pid) +{ + int r, status; + Signal_t (*ihand)(); /* place to save signal during system() */ + Signal_t (*qhand)(); /* place to save signal during system() */ + + if (pid < 0 || flag != 0) + return pid; + + ihand = signal(SIGINT, SIG_IGN); + qhand = signal(SIGQUIT, SIG_IGN); + r = waitpid(pid, &status, 0); + signal(SIGINT, ihand); + signal(SIGQUIT, qhand); + + statusvalue = (U16)status; + if (r < 0) + return -1; + return status & 0xFFFF; +} + +int +do_aspawn(really,mark,sp) +SV *really; +register SV **mark; +register SV **sp; +{ + register char **a; + char *tmps; + int rc; + int flag = P_WAIT, trueflag; + + if (sp > mark) { + New(401,Argv, sp - mark + 1, char*); + a = Argv; + + if (mark < sp && SvIOKp(*(mark+1))) { + ++mark; + flag = SvIVx(*mark); + } + + while (++mark <= sp) { + if (*mark) + *a++ = SvPVx(*mark, na); + else + *a++ = ""; + } + *a = Nullch; + + trueflag = flag; + if (flag == P_WAIT) + flag = P_NOWAIT; + + if (really && *(tmps = SvPV(really, na))) + rc = result(trueflag, spawnvp(flag,tmps,Argv)); + else + rc = result(trueflag, spawnvp(flag,Argv[0],Argv)); + + if (rc < 0 && dowarn) + warn("Can't spawn \"%s\": %s", Argv[0], Strerror(errno)); + } else + rc = -1; + do_execfree(); + return rc; +} + +int +do_spawn(cmd) +char *cmd; +{ + register char **a; + register char *s; + char flags[10]; + char *shell, *copt; + int rc; + + if ((shell = getenv("SHELL")) != NULL) + copt = "-c"; + else if ((shell = getenv("COMSPEC")) != NULL) + copt = "/C"; + else + shell = "cmd.exe"; + + /* save an extra exec if possible */ + /* see if there are shell metacharacters in it */ + + /*SUPPRESS 530*/ + if (*cmd == '@') { + ++cmd; + goto shell_cmd; + } + for (s = cmd; *s; s++) { + if (*s != ' ' && !isALPHA(*s) && strchr("%&|<>\n",*s)) { + if (*s == '\n' && !s[1]) { + *s = '\0'; + break; + } +shell_cmd: return result(P_WAIT, spawnl(P_NOWAIT,shell,shell,copt,cmd,(char*)0)); + } + } + New(402,Argv, (s - cmd) / 2 + 2, char*); + Cmd = savepvn(cmd, s-cmd); + a = Argv; + for (s = Cmd; *s;) { + while (*s && isSPACE(*s)) s++; + if (*s) + *(a++) = s; + while (*s && !isSPACE(*s)) s++; + if (*s) + *s++ = '\0'; + } + *a = Nullch; + if (Argv[0]) { + rc = result(P_WAIT, spawnvp(P_NOWAIT,Argv[0],Argv)); + if (rc < 0 && dowarn) + warn("Can't spawn \"%s\": %s", Argv[0], Strerror(errno)); + } else + rc = -1; + do_execfree(); + return rc; +} + +/*****************************************************************************/ + +#ifndef HAS_FORK +int +fork(void) +{ + die(no_func, "Unsupported function fork"); + errno = EINVAL; + return -1; +} +#endif + +/*****************************************************************************/ +/* not implemented in EMX 0.9a */ + +void * ctermid(x) { return 0; } +void * ttyname(x) { return 0; } + +void * gethostent() { return 0; } +void * getnetent() { return 0; } +void * getprotoent() { return 0; } +void * getservent() { return 0; } +void sethostent(x) {} +void setnetent(x) {} +void setprotoent(x) {} +void setservent(x) {} +void endhostent(x) {} +void endnetent(x) {} +void endprotoent(x) {} +void endservent(x) {} + +/*****************************************************************************/ +/* stat() hack for char/block device */ + +#if OS2_STAT_HACK + + /* First attempt used DosQueryFSAttach which crashed the system when + used with 5.001. Now just look for /dev/. */ + +int +os2_stat(char *name, struct stat *st) +{ + static int ino = SHRT_MAX; + + if (stricmp(name, "/dev/con") != 0 + && stricmp(name, "/dev/tty") != 0) + return stat(name, st); + + memset(st, 0, sizeof *st); + st->st_mode = S_IFCHR|0666; + st->st_ino = (ino-- & 0x7FFF); + st->st_nlink = 1; + return 0; +} + +#endif diff --git a/os2/os2ish.h b/os2/os2ish.h new file mode 100644 index 0000000000..061726dc2d --- /dev/null +++ b/os2/os2ish.h @@ -0,0 +1,72 @@ +#include <signal.h> + +/* HAS_IOCTL: + * This symbol, if defined, indicates that the ioctl() routine is + * available to set I/O characteristics + */ +#define HAS_IOCTL /**/ + +/* HAS_UTIME: + * This symbol, if defined, indicates that the routine utime() is + * available to update the access and modification times of files. + */ +#define HAS_UTIME /**/ + +#define HAS_KILL +#define HAS_WAIT + +#ifndef SIGABRT +# define SIGABRT SIGILL +#endif +#ifndef SIGILL +# define SIGILL 6 /* blech */ +#endif +#define ABORT() kill(getpid(),SIGABRT); + +/* + * fwrite1() should be a routine with the same calling sequence as fwrite(), + * but which outputs all of the bytes requested as a single stream (unlike + * fwrite() itself, which on some systems outputs several distinct records + * if the number_of_items parameter is >1). + */ +#define fwrite1 fwrite + +#define my_getenv(var) getenv(var) + +/*****************************************************************************/ + +#include <stdlib.h> /* before the following definitions */ +#include <unistd.h> /* before the following definitions */ + +#define chdir _chdir2 +#define getcwd _getcwd2 + +/* This guy is needed for quick stdstd */ + +#if defined(USE_STDIO_PTR) && defined(STDIO_PTR_LVALUE) && defined(STDIO_CNT_LVALUE) +# define _filbuf _fill + /* Perl uses ungetc only with successful return */ +# define ungetc(c,fp) \ + (FILE_ptr(fp) > FILE_base(fp) && c == (int)*(FILE_ptr(fp) - 1) \ + ? (--FILE_ptr(fp), ++FILE_cnt(fp), (int)c) : ungetc(c,fp)) +#endif + +#define OP_BINARY O_BINARY + +#define OS2_STAT_HACK 1 +#if OS2_STAT_HACK + +#define Stat(fname,bufptr) os2_stat((fname),(bufptr)) +#define Fstat(fd,bufptr) fstat((fd),(bufptr)) + +#undef S_IFBLK +#undef S_ISBLK +#define S_IFBLK 0120000 +#define S_ISBLK(mode) (((mode) & S_IFMT) == S_IFBLK) + +#else + +#define Stat(fname,bufptr) stat((fname),(bufptr)) +#define Fstat(fd,bufptr) fstat((fd),(bufptr)) + +#endif |