summaryrefslogtreecommitdiff
path: root/gnu/usr.bin/perl/os2
diff options
context:
space:
mode:
authorJason Downs <downsj@cvs.openbsd.org>1996-08-19 10:13:38 +0000
committerJason Downs <downsj@cvs.openbsd.org>1996-08-19 10:13:38 +0000
commit14856225739aa48b6c9cf4c17925362b2d95cea3 (patch)
treedfd38f1b654fb5bbdfc38887c1a829b658e71530 /gnu/usr.bin/perl/os2
parent77469082517e44fe6ca347d9e8dc7dffd1583637 (diff)
Import of Perl 5.003 into the tree. Makefile.bsd-wrapper and
config.sh.OpenBSD are the only local changes.
Diffstat (limited to 'gnu/usr.bin/perl/os2')
-rw-r--r--gnu/usr.bin/perl/os2/Makefile.SHs71
-rw-r--r--gnu/usr.bin/perl/os2/POSIX.mkfifo16
-rw-r--r--gnu/usr.bin/perl/os2/README229
-rw-r--r--gnu/usr.bin/perl/os2/diff.configure589
-rw-r--r--gnu/usr.bin/perl/os2/diff.db_file15
-rw-r--r--gnu/usr.bin/perl/os2/notes28
-rw-r--r--gnu/usr.bin/perl/os2/os2.c384
-rw-r--r--gnu/usr.bin/perl/os2/os2ish.h109
-rw-r--r--gnu/usr.bin/perl/os2/perl2cmd.pl28
9 files changed, 1469 insertions, 0 deletions
diff --git a/gnu/usr.bin/perl/os2/Makefile.SHs b/gnu/usr.bin/perl/os2/Makefile.SHs
new file mode 100644
index 00000000000..bc99fd113b2
--- /dev/null
+++ b/gnu/usr.bin/perl/os2/Makefile.SHs
@@ -0,0 +1,71 @@
+# 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$(OBJ_EXT)
+ $(LD) $(LDDLFLAGS) -o $@ perl$(OBJ_EXT) $(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 ' "Perl_OS2_init"' >>$@
+ echo ' "OS2_Perl_data"' >>$@
+!NO!SUBS!
+
+if [ ! -z "$myttyname" ] ; then
+ $spitshell >>Makefile <<'!NO!SUBS!'
+ echo ' "ttyname"' >>$@
+!NO!SUBS!
+fi
+
+$spitshell >>Makefile <<'!NO!SUBS!'
+ 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$(OBJ_EXT) miniperlmain$(OBJ_EXT)
+ $(CC) $(LARGE) $(CLDFLAGS) $(CCDLFLAGS) -o dummy.exe miniperlmain$(OBJ_EXT) perl$(OBJ_EXT) $(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
+
+# Stupid make? Needed...
+os2$(OBJ_EXT) : os2.c
+
+os2.c: os2/os2.c os2ish.h
+ cp $< $@
+
+os2ish.h: os2/os2ish.h
+ cp $< $@
+
+installcmd :
+ perl -e 'die qq{Give the option INSTALLCMDDIR=... to make!} if $$ARGV[0] eq ""' $(INSTALLCMDDIR)
+ perl os2/perl2cmd.pl $(INSTALLCMDDIR)
+
+!NO!SUBS!
diff --git a/gnu/usr.bin/perl/os2/POSIX.mkfifo b/gnu/usr.bin/perl/os2/POSIX.mkfifo
new file mode 100644
index 00000000000..5bd820edfd1
--- /dev/null
+++ b/gnu/usr.bin/perl/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/gnu/usr.bin/perl/os2/README b/gnu/usr.bin/perl/os2/README
new file mode 100644
index 00000000000..cd00a1f6032
--- /dev/null
+++ b/gnu/usr.bin/perl/os2/README
@@ -0,0 +1,229 @@
+Current state of the patches here is with respect to perl5.002b1d ;-).
+
+========================================================
+
+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:
+~~~~~~~~~~~~~~~~~~~
+patches should be applied as
+ patch -p0 <.....
+All the diff.* files and POSIX.mkfifo should be applied.
+
+Additional files are available on
+ ftp://ftp.math.ohio-state.edu/pub/users/ilya/os2
+including patched pdksh and gnumake, needed for build.
+
+
+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: (part of what is below is already included by Andy,
+~~~~~~~~~~~~~~~~~~~~~~~ thus there are skips below)
+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
+ 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
+
+
+ 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.
+ 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.
+ !!!!!! Also: installperl installman makedepend
+ !!!!!! added as dependencies to the corresponding
+ !!!!!! targets.
+ m) clean target extended to delete some intermediate files
+
+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, and that you have /tmp
+on the build partition.
+
+b) when extraction perl5.*.tar.gz you need to extract perl5.*/Configure
+separately, since by default perl5.001m/configure may overwrite it;
+ like this:
+ tar vzxf perl5.004.tar.gz --case-sensitive perl5.004/Configure
+
+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:/perl5.005
+make
+ # Will probably die after build of miniperl (unless you have DLL
+ # from previous compile). Need to move DLL where it belongs
+ #
+ # Somehow with 5.002b3 I needed to type another make after pod2man
+make
+ # some warnings in POSIX.c
+make test
+ # some tests fail, 9 or 10 on my system (see the list at end).
+ #
+ # before this you should create subdirs bin and lib in the
+ # prefix directory (f:/perl5.005 above):
+make install
+
+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.
+The binaries are included in
+ ftp://ftp.math.ohio-state.edu/pub/users/ilya/os2
+patches are available too.
+Note that the pdksh5.2.4 broke builds with -Zexe option because of a
+changed order of executable extensions. A patch is sent to maintainer.
+
+!!!!!!!!!!!!!!!!!
+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.
+
+======================================================
+Requires 0.9b (well, provision are made to make it build under 0.9a6,
+but they are not tested, please inform me on success).
+(earlier than 0.9b ttyname was not present, it is hard to maintain this
+difference automatically, though I try).
+======================================================
+
+You may try building with a.out style by using `-D emxaout' on the Configure
+line (dynamic extensions should not use CRT (and/or any perl API) in this
+case, which prohibits most buildin extensions). Probably no extension is
+possible, since boot code should return the amount on stack.
+
+The reason why compiling with a.out style executables leads to problems
+with dynamic extensions is:
+ a) OS/2 does not export symbols from executables;
+ b) Thus if extension needs to import symbols from an application
+ the symbols for the application should reside in a .dll.
+ c) You cannot export data from a .dll compiled with a.out style.
+On the other hand, aout-style compiled extension enjoys all the
+(dis)advantages of fork().
+
+======================================================
+Tests which fail with OMF compile:
+
+io/fs.t: 2-5, 7-11, 18 as they should.
+io/pipe: all, since open("|-") is not working (even with fork, so far).
+lib/"all the dbm".t: 1 test should fail (file permission).
+op/fork all fail, as they should
+op/stat 3 20 35 as they should, 39 (-t on /dev/null) ???? Sometimes 4 ????
+
+Segfault in socket ????, only if run with Testing tools.
+
+A lot of `bad free'... in databases, bug in DB confirmed on other
+platforms.
+
+Fail: Total 30 subtests (if stat:4 fails) in 10 scripts (one of 10
+is socket, which runs OK standalone).
+
+=======================================================
+
+Changes to calls to external programs:
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Due to a popular demand the perl external program calling has been changed.
+_If_ perl needs to call an external program via shell, the sh.exe will be
+called. The name of the shell is not overridable.
+
+Thus means that you need to pickup some copy of a sh.exe as well (I use one
+from pdksh).
+
+Reasons: a consensus on perl5-porters was that perl should use one
+non-overridable shell per platform. The obvious choices for OS/2 are cmd.exe
+and sh.exe. Having perl build itself would be impossible with cmd.exe as
+a shell, thus I picked up sh.exe. Thus assures almost 100% compatibility
+with the scripts coming from *nix.
+
+Disadvantages: sh.exe calls external programs via fork/exec, and there is
+_no_ functioning exec on OS/2. exec is emulated by EMX by asyncroneous call
+while the caller waits for child completion (to pretend that pid did
+not change). This means that 1 _extra_ copy of sh.exe is made active via
+fork/exec, which may lead to some resources taken from the system.
+
+The long-term solution proposed on p5-p is to have a directive
+ use OS2::Cmd;
+which will override system(), exec(), ``, and open(,' |'). With current
+perl you may override only system(), readpipe() - the explicit version
+of ``, and maybe exec(). The code will substitute a one-argument system
+by CORE::system('cmd.exe', '/c', shift).
+
+If you have some working code for OS2::Cmd.pm, please send it to me,
+I will include it into distribution. I have no need for such a module, so
+cannot test it.
+
+===================================================
+
+OS/2 extensions
+~~~~~~~~~~~~~~~
+I include 3 extensions by Andread Kaiser, OS2::REXX, OS2::UPM, and OS2::FTP,
+into my ftp directory, mirrored on CPAN. I made
+some minor changes needed to compile them by standard tools. I cannot
+test UPM and FTP, so I will appreciate your feedback.
+
+The -R switch of older perl is deprecated. If you need to call a REXX code
+which needs access to variables, include the call into a REXX compartment
+created by
+ REXX_call {...block...};
+
+Two new functions are supported by REXX code,
+ REXX_eval 'string';
+ REXX_eval_with 'string', REXX_function_name => \&perl_sub_reference;
+
+If you have some other extensions you want to share, send the code to me.
+Two jump to mind: tied access to EA's, and tied access to system databases.
diff --git a/gnu/usr.bin/perl/os2/diff.configure b/gnu/usr.bin/perl/os2/diff.configure
new file mode 100644
index 00000000000..53aa16b4a2e
--- /dev/null
+++ b/gnu/usr.bin/perl/os2/diff.configure
@@ -0,0 +1,589 @@
+*** Configure.orig Thu Dec 07 14:38:08 1995
+--- Configure Mon Dec 18 19:16:22 1995
+***************
+*** 1377,1383 ****
+ *)
+ echo "I don't know where '$file' is, and my life depends on it." >&4
+ echo "Go find a public domain implementation or fix your PATH setting!" >&4
+! exit 1
+ ;;
+ esac
+ done
+--- 1377,1383 ----
+ *)
+ echo "I don't know where '$file' is, and my life depends on it." >&4
+ echo "Go find a public domain implementation or fix your PATH setting!" >&4
+! #exit 1
+ ;;
+ esac
+ done
+***************
+*** 1386,1392 ****
+ say=offhand
+ for file in $trylist; do
+ xxx=`./loc $file $file $pth`
+! eval $file=$xxx
+ eval _$file=$xxx
+ case "$xxx" in
+ /*)
+--- 1386,1394 ----
+ 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
+ /*)
+***************
+*** 3173,3179 ****
+ 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." ;;
+--- 3175,3181 ----
+ 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." ;;
+***************
+*** 3765,3770 ****
+--- 3767,3778 ----
+ *"-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
+***************
+*** 3864,3870 ****
+ esac
+ ;;
+ esac
+! libnames='';
+ case "$libs" in
+ '') ;;
+ *) for thislib in $libs; do
+--- 3872,3878 ----
+ esac
+ ;;
+ esac
+! #libnames='';
+ case "$libs" in
+ '') ;;
+ *) for thislib in $libs; do
+***************
+*** 3878,3889 ****
+ :
+ 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
+--- 3886,3899 ----
+ :
+ 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
+***************
+*** 3932,3942 ****
+ 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
+--- 3942,3952 ----
+ 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
+***************
+*** 4049,4054 ****
+--- 4059,4068 ----
+ 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
+***************
+*** 4059,4081 ****
+ 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
+--- 4073,4096 ----
+ 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
+***************
+*** 4421,4427 ****
+ 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
+--- 4436,4442 ----
+ 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
+***************
+*** 4501,4507 ****
+ exit(result);
+ }
+ EOCP
+! if $cc -o try $ccflags try.c >/dev/null 2>&1; then
+ ./try
+ yyy=$?
+ else
+--- 4516,4522 ----
+ exit(result);
+ }
+ EOCP
+! if $cc -o try $ccflags try.c $ldflags >/dev/null 2>&1; then
+ ./try
+ yyy=$?
+ else
+***************
+*** 4582,4588 ****
+
+ }
+ EOCP
+! if $cc -o try $ccflags try.c >/dev/null 2>&1; then
+ ./try
+ castflags=$?
+ else
+--- 4597,4603 ----
+
+ }
+ EOCP
+! if $cc -o try $ccflags try.c $ldflags >/dev/null 2>&1; then
+ ./try
+ castflags=$?
+ else
+***************
+*** 4621,4627 ****
+ 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
+--- 4636,4642 ----
+ 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
+***************
+*** 4691,4697 ****
+ cryptlib=-lcrypt
+ fi
+ if $test -z "$cryptlib"; then
+! cryptlib=`./loc libcrypt.a "" $libpth`
+ else
+ cryptlib=-lcrypt
+ fi
+--- 4706,4712 ----
+ cryptlib=-lcrypt
+ fi
+ if $test -z "$cryptlib"; then
+! cryptlib=`./loc libcrypt$lib_ext "" $libpth`
+ else
+ cryptlib=-lcrypt
+ fi
+***************
+*** 5198,5204 ****
+ }
+ 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
+--- 5213,5219 ----
+ }
+ 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
+***************
+*** 5355,5361 ****
+ 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
+--- 5370,5376 ----
+ 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
+***************
+*** 5366,5372 ****
+ 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
+--- 5381,5387 ----
+ 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
+***************
+*** 5848,5854 ****
+ y*|true)
+ usemymalloc='y'
+ mallocsrc='malloc.c'
+! mallocobj='malloc.o'
+ d_mymalloc="$define"
+ case "$libs" in
+ *-lmalloc*)
+--- 5863,5869 ----
+ y*|true)
+ usemymalloc='y'
+ mallocsrc='malloc.c'
+! mallocobj="malloc$obj_ext"
+ d_mymalloc="$define"
+ case "$libs" in
+ *-lmalloc*)
+***************
+*** 6283,6292 ****
+ : 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"
+--- 6298,6307 ----
+ : 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"
+***************
+*** 6299,6305 ****
+ d_oldsock="$define"
+ fi
+ else
+! echo "or even in libnet.a, which is peculiar." >&4
+ d_socket="$undef"
+ d_oldsock="$undef"
+ fi
+--- 6314,6320 ----
+ d_oldsock="$define"
+ fi
+ else
+! echo "or even in libnet$lib_ext, which is peculiar." >&4
+ d_socket="$undef"
+ d_oldsock="$undef"
+ fi
+***************
+*** 7055,7061 ****
+ 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'
+--- 7070,7076 ----
+ 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'
+***************
+*** 7080,7086 ****
+ '') obj_ext='.o';;
+ esac
+ case "$path_sep" in
+! '') path_sep=':';;
+ esac
+ : Which makefile gets called first. This is used by make depend.
+ case "$firstmakefile" in
+--- 7095,7101 ----
+ '') obj_ext='.o';;
+ esac
+ case "$path_sep" in
+! '') path_sep="$p_";;
+ esac
+ : Which makefile gets called first. This is used by make depend.
+ case "$firstmakefile" in
+***************
+*** 7120,7126 ****
+ }
+ 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)
+--- 7135,7141 ----
+ }
+ 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)
+***************
+*** 7470,7476 ****
+ printf("%d\n",i);
+ }
+ EOCP
+! if $cc try.c -o try >/dev/null 2>&1 ; then
+ dflt=`try`
+ else
+ dflt='?'
+--- 7485,7491 ----
+ printf("%d\n",i);
+ }
+ EOCP
+! if $cc $ldflags try.c -o try >/dev/null 2>&1 ; then
+ dflt=`try`
+ else
+ dflt='?'
+***************
+*** 7497,7514 ****
+ $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='';;
+--- 7512,7529 ----
+ $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='';;
+***************
+*** 7580,7586 ****
+ '') $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="$*"
+--- 7595,7601 ----
+ '') $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="$*"
+***************
+*** 7649,7655 ****
+ #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
+--- 7664,7670 ----
+ #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
+***************
+*** 7666,7672 ****
+ $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
+--- 7681,7687 ----
+ $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
+***************
+*** 8380,8386 ****
+ else
+ echo "false"
+ fi
+! $rm -f varargs.o
+ EOP
+ chmod +x varargs
+
+--- 8395,8401 ----
+ else
+ echo "false"
+ fi
+! $rm -f varargs$obj_ext
+ EOP
+ chmod +x varargs
+
+***************
+*** 8744,8750 ****
+ echo " "
+ echo "Stripping down executable paths..." >&4
+ for file in $loclist $trylist; do
+! eval $file="\$file"
+ done
+ ;;
+ esac
+--- 8759,8765 ----
+ 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
diff --git a/gnu/usr.bin/perl/os2/diff.db_file b/gnu/usr.bin/perl/os2/diff.db_file
new file mode 100644
index 00000000000..7fcca0a7933
--- /dev/null
+++ b/gnu/usr.bin/perl/os2/diff.db_file
@@ -0,0 +1,15 @@
+*** ext/DB_File/db_file.xs~ Tue Nov 14 11:14:36 1995
+--- ext/DB_File/DB_File.xs Tue Dec 19 00:50:52 1995
+***************
+*** 424,429 ****
+--- 424,433 ----
+ }
+
+
++ #ifdef __EMX__
++ flags |= O_BINARY;
++ #endif /* __EMX__ */
++
+ RETVAL->dbp = dbopen(name, flags, mode, RETVAL->type, openinfo) ;
+
+ #if 0
diff --git a/gnu/usr.bin/perl/os2/notes b/gnu/usr.bin/perl/os2/notes
new file mode 100644
index 00000000000..f8591878b6d
--- /dev/null
+++ b/gnu/usr.bin/perl/os2/notes
@@ -0,0 +1,28 @@
+mv Makefile.SH Makefile.SHs
+exit 0
+
+Everything is updated to perl5.002b1d.
+
+I added a generally useful ;-) code to Makefile.SH to have dependencies
+on makedepend, installman and installperl (makedepend is the tricky one!).
+
+I did update MANIFEST with _all_ the added diff.* files, I hope
+some files will be just applied, thus not needed for MANIFEST. Well, the
+patch for MANIFEST is in os2/diff.MANIFEST ;-).
+
+diff.init is just a suggestion to move system-specific code into headers.
+
+I think that
+
+diff.Makefile
+diff.installperl
+diff.installman
+diff.x2pMakefile
+diff.mkdep
+
+are ready for prime time, though big ;-(.
+It is up to you what to do with them (They use long names like EXE_EXT now).
+
+diff.c2ph, diff.rest are small and should not break anything.
+
+diff.db_file adds binary mode.
diff --git a/gnu/usr.bin/perl/os2/os2.c b/gnu/usr.bin/perl/os2/os2.c
new file mode 100644
index 00000000000..a518c41d45f
--- /dev/null
+++ b/gnu/usr.bin/perl/os2/os2.c
@@ -0,0 +1,384 @@
+#define INCL_DOS
+#define INCL_NOPM
+#define INCL_DOSFILEMGR
+#ifndef NO_SYS_ALLOC
+# define INCL_DOSMEMMGR
+# define INCL_DOSERRORS
+#endif /* ! defined NO_SYS_ALLOC */
+#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);
+ do {
+ r = wait4pid(pid, &status, 0);
+ } while (r == -1 && errno == EINTR);
+ 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 (*Argv[0] != '/' && *Argv[0] != '\\') /* will swawnvp use PATH? */
+ TAINT_ENV(); /* testing IFS here is overkill, probably */
+ 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));
+ if (rc < 0) rc = 255 << 8; /* Emulate the fork(). */
+ } 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;
+
+#ifdef TRYSHELL
+ if ((shell = getenv("EMXSHELL")) != NULL)
+ copt = "-c";
+ else if ((shell = getenv("SHELL")) != NULL)
+ copt = "-c";
+ else if ((shell = getenv("COMSPEC")) != NULL)
+ copt = "/C";
+ else
+ shell = "cmd.exe";
+#else
+ /* Consensus on perl5-porters is that it is _very_ important to
+ have a shell which will not change between computers with the
+ same architecture, to avoid "action on a distance".
+ And to have simple build, this shell should be sh. */
+ shell = "sh.exe";
+ copt = "-c";
+#endif
+
+ while (*cmd && isSPACE(*cmd))
+ cmd++;
+
+ /* save an extra exec if possible */
+ /* see if there are shell metacharacters in it */
+
+ if (*cmd == '.' && isSPACE(cmd[1]))
+ goto doshell;
+
+ if (strnEQ(cmd,"exec",4) && isSPACE(cmd[4]))
+ goto doshell;
+
+ for (s = cmd; *s && isALPHA(*s); s++) ; /* catch VAR=val gizmo */
+ if (*s == '=')
+ goto doshell;
+
+ for (s = cmd; *s; s++) {
+ if (*s != ' ' && !isALPHA(*s) && strchr("$&*(){}[]'\";\\|?<>~`\n",*s)) {
+ if (*s == '\n' && !s[1]) {
+ *s = '\0';
+ break;
+ }
+ doshell:
+ rc = result(P_WAIT,
+ spawnl(P_NOWAIT,shell,shell,copt,cmd,(char*)0));
+ if (rc < 0 && dowarn)
+ warn("Can't spawn \"%s\": %s", shell, Strerror(errno));
+ if (rc < 0) rc = 255 << 8; /* Emulate the fork(). */
+ return rc;
+ }
+ }
+
+ 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));
+ if (rc < 0) rc = 255 << 8; /* Emulate the fork(). */
+ } else
+ rc = -1;
+ do_execfree();
+ return rc;
+}
+
+FILE *
+my_popen(cmd,mode)
+char *cmd;
+char *mode;
+{
+ char *shell = getenv("EMXSHELL");
+ FILE *res;
+
+ my_setenv("EMXSHELL", "sh.exe");
+ res = popen(cmd, mode);
+ my_setenv("EMXSHELL", shell);
+ return res;
+}
+
+/*****************************************************************************/
+
+#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; }
+
+#ifdef MYTTYNAME /* was not in emx0.9a */
+void * ttyname(x) { return 0; }
+#endif
+
+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
+
+#ifndef NO_SYS_ALLOC
+
+static char *oldchunk;
+static long oldsize;
+
+#define _32_K (1<<15)
+#define _64_K (1<<16)
+
+/* The real problem is that DosAllocMem will grant memory on 64K-chunks
+ * boundaries only. Note that addressable space for application memory
+ * is around 240M, thus we will run out of addressable space if we
+ * allocate around 14M worth of 4K segments.
+ * Thus we allocate memory in 64K chunks, and abandon the rest of the old
+ * chunk if the new is bigger than that rest. Also, we just allocate
+ * whatever is requested if the size is bigger that 32K. With this strategy
+ * we cannot lose more than 1/2 of addressable space. */
+
+void *
+sbrk(int size)
+{
+ char *got;
+ APIRET rc;
+ int small, reqsize;
+
+ if (!size) return 0;
+ else if (size <= oldsize) {
+ got = oldchunk;
+ oldchunk += size;
+ oldsize -= size;
+ return (void *)got;
+ } else if (size >= _32_K) {
+ small = 0;
+ } else {
+ reqsize = size;
+ size = _64_K;
+ small = 1;
+ }
+ rc = DosAllocMem((void **)&got, size, PAG_COMMIT | PAG_WRITE);
+ if (rc == ERROR_NOT_ENOUGH_MEMORY) {
+ return (void *) -1;
+ } else if ( rc ) die("Got an error from DosAllocMem: %li", (long)rc);
+ if (small) {
+ /* Chunk is small, register the rest for future allocs. */
+ oldchunk = got + reqsize;
+ oldsize = size - reqsize;
+ }
+ return (void *)got;
+}
+#endif /* ! defined NO_SYS_ALLOC */
+
+/* tmp path */
+
+char *tmppath = TMPPATH1;
+
+void
+settmppath()
+{
+ char *p = getenv("TMP"), *tpath;
+ int len;
+
+ if (!p) p = getenv("TEMP");
+ if (!p) return;
+ len = strlen(p);
+ tpath = (char *)malloc(len + strlen(TMPPATH1) + 2);
+ strcpy(tpath, p);
+ tpath[len] = '/';
+ strcpy(tpath + len + 1, TMPPATH1);
+ tmppath = tpath;
+}
+
+#include "XSUB.h"
+
+XS(XS_File__Copy_syscopy)
+{
+ dXSARGS;
+ if (items < 2 || items > 3)
+ croak("Usage: File::Copy::syscopy(src,dst,flag=0)");
+ {
+ char * src = (char *)SvPV(ST(0),na);
+ char * dst = (char *)SvPV(ST(1),na);
+ U32 flag;
+ int RETVAL, rc;
+
+ if (items < 3)
+ flag = 0;
+ else {
+ flag = (unsigned long)SvIV(ST(2));
+ }
+
+ errno = DosCopy(src, dst, flag);
+ RETVAL = !errno;
+ ST(0) = sv_newmortal();
+ sv_setiv(ST(0), (IV)RETVAL);
+ }
+ XSRETURN(1);
+}
+
+OS2_Perl_data_t OS2_Perl_data;
+
+int
+Xs_OS2_init()
+{
+ char *file = __FILE__;
+ {
+ newXS("File::Copy::syscopy", XS_File__Copy_syscopy, file);
+ }
+}
+
+void
+Perl_OS2_init()
+{
+ settmppath();
+ OS2_Perl_data.xs_init = &Xs_OS2_init;
+}
diff --git a/gnu/usr.bin/perl/os2/os2ish.h b/gnu/usr.bin/perl/os2/os2ish.h
new file mode 100644
index 00000000000..41caa422b14
--- /dev/null
+++ b/gnu/usr.bin/perl/os2/os2ish.h
@@ -0,0 +1,109 @@
+#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);
+
+#define BIT_BUCKET "/dev/null" /* Will this work? */
+
+void Perl_OS2_init();
+
+#define PERL_SYS_INIT(argcp, argvp) STMT_START { \
+ _response(argcp, argvp); \
+ _wildcard(argcp, argvp); \
+ Perl_OS2_init(); } STMT_END
+
+#define PERL_SYS_TERM()
+
+#define dXSUB_SYS int fake = OS2_XS_init()
+
+#define TMPPATH tmppath
+#define TMPPATH1 "plXXXXXX"
+extern char *tmppath;
+
+/*
+ * 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))
+#define Fflush(fp) fflush(fp)
+
+#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))
+#define Fflush(fp) fflush(fp)
+
+#endif
+
+/* Our private OS/2 specific data. */
+
+typedef struct OS2_Perl_data {
+ unsigned long flags;
+ unsigned long phab;
+ int (*xs_init)();
+} OS2_Perl_data_t;
+
+extern OS2_Perl_data_t OS2_Perl_data;
+
+#define hab ((HAB)OS2_Perl_data->phab)
+#define OS2_Perl_flag (OS2_Perl_data->flag)
+#define Perl_HAB_set_f 1
+#define Perl_HAB_set (OS2_Perl_flag & Perl_HAB_set_f)
+#define set_Perl_HAB_f (OS2_Perl_flag |= Perl_HAB_set_f)
+#define set_Perl_HAB(h) (set_Perl_HAB_f, hab = h)
+#define OS2_XS_init() (*OS2_Perl_data.xs_init)()
diff --git a/gnu/usr.bin/perl/os2/perl2cmd.pl b/gnu/usr.bin/perl/os2/perl2cmd.pl
new file mode 100644
index 00000000000..aa1c353f136
--- /dev/null
+++ b/gnu/usr.bin/perl/os2/perl2cmd.pl
@@ -0,0 +1,28 @@
+# This will put installed perl files into some other location
+# Note that we cannot put hashbang to be extproc to make Configure work.
+
+use Config;
+
+$dir = shift;
+$dir =~ s|/|\\|g ;
+$nowarn = 1, $dir = shift if $dir eq '-n';
+
+die <<EOU unless defined $dir and -d $dir;
+usage: $^X $0 [-n] directory-to-install
+ -n do not check whether the directory is not on path
+EOU
+
+@path = split /;/, $ENV{PATH};
+$idir = $Config{installbin};
+$indir =~ s|\\|/|g ;
+
+foreach $file (<$idir/*.>) {
+ $base = $file;
+ $base =~ s/\.$//; # just in case...
+ $base =~ s|.*/||;
+ $file =~ s|/|\\|g ;
+ print "Processing $file => $dir\\$base.cmd\n";
+ system 'cmd.exe', '/c', "echo extproc perl -Sx > $dir\\$base.cmd";
+ system 'cmd.exe', '/c', "type $file >> $dir\\$base.cmd";
+}
+