summaryrefslogtreecommitdiff
path: root/gnu/usr.bin/perl/os2
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>1997-11-30 08:00:32 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>1997-11-30 08:00:32 +0000
commit3d06de7fcff1d605886d3c63220956f7260ddb84 (patch)
treeda5aa4b971926e3ef1f9263bbdeb714053206d02 /gnu/usr.bin/perl/os2
parentc54c74271308a8fd18f1bc3a193343d079ebe481 (diff)
perl 5.004_04
Diffstat (limited to 'gnu/usr.bin/perl/os2')
-rw-r--r--gnu/usr.bin/perl/os2/Makefile.SHs155
-rw-r--r--gnu/usr.bin/perl/os2/README229
-rw-r--r--gnu/usr.bin/perl/os2/README.old529
-rw-r--r--gnu/usr.bin/perl/os2/diff.configure863
-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.c1123
-rw-r--r--gnu/usr.bin/perl/os2/os2ish.h311
-rw-r--r--gnu/usr.bin/perl/os2/perl2cmd.pl5
9 files changed, 1744 insertions, 1514 deletions
diff --git a/gnu/usr.bin/perl/os2/Makefile.SHs b/gnu/usr.bin/perl/os2/Makefile.SHs
index bc99fd113b2..493aeab8c59 100644
--- a/gnu/usr.bin/perl/os2/Makefile.SHs
+++ b/gnu/usr.bin/perl/os2/Makefile.SHs
@@ -1,15 +1,44 @@
-# 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.
+# This file is read by Makefile.SH to produce rules for $(LIBPERL) (and
+# some additional rules as well).
+
+# Rerun `sh Makefile.SH; make depend' after making any change.
+
+# Additional rules supported: perl_, aout_test, aout_install, use them
+# for a.out style perl (which may fork).
+
+$spitshell >>Makefile <<!GROK!THIS!
+
+AOUT_CCCMD = \$(CC) $aout_ccflags $optimize
+AOUT_AR = $aout_ar
+AOUT_OBJ_EXT = $aout_obj_ext
+AOUT_LIB_EXT = $aout_lib_ext
+AOUT_LIBPERL = libperl$aout_lib_ext
+AOUT_CLDFLAGS = $aout_ldflags
+
+AOUT_LIBPERL_DLL = libperl_dll$aout_lib_ext
+AOUT_CCCMD_DLL = \$(CC) -DDOSISH -DOS2=2 -DEMBED -I. -DPACK_MALLOC -DDEBUGGING_MSTATS -DTWO_POT_OPTIMIZE -DPERL_EMERGENCY_SBRK
+AOUT_CLDFLAGS_DLL = -Zexe -Zmt -Zcrtdll
+
+LD_OPT = $optimize
+
+!GROK!THIS!
$spitshell >>Makefile <<'!NO!SUBS!'
-$(perllib): perl.imp perl.dll perl5.def
- emximp -o $(perllib) perl.imp
+$(LIBPERL): perl.imp perl.dll perl5.def
+ emximp -o $(LIBPERL) perl.imp
+
+$(AOUT_LIBPERL_DLL): perl.imp perl.dll perl5.def
+ emximp -o $(AOUT_LIBPERL_DLL) perl.imp
perl.imp: perl5.def
emximp -o perl.imp perl5.def
+ echo 'emx_calloc emxlibcm 400 ?' >> $@
+ echo 'emx_free emxlibcm 401 ?' >> $@
+ echo 'emx_malloc emxlibcm 402 ?' >> $@
+ echo 'emx_realloc emxlibcm 403 ?' >> $@
perl.dll: $(obj) perl5.def perl$(OBJ_EXT)
- $(LD) $(LDDLFLAGS) -o $@ perl$(OBJ_EXT) $(obj) -lsocket perl5.def
+ $(LD) $(LD_OPT) $(LDDLFLAGS) -o $@ perl$(OBJ_EXT) $(obj) $(libs) perl5.def
perl5.def: perl.linkexp
echo "LIBRARY 'Perl' INITINSTANCE TERMINSTANCE" > $@
@@ -19,8 +48,15 @@ perl5.def: perl.linkexp
echo DATA LOADONCALL NONSHARED MULTIPLE >>$@
echo EXPORTS >>$@
echo ' "ctermid"' >>$@
+ echo ' "get_sysinfo"' >>$@
echo ' "Perl_OS2_init"' >>$@
echo ' "OS2_Perl_data"' >>$@
+ echo ' "dlopen"' >>$@
+ echo ' "dlsym"' >>$@
+ echo ' "dlerror"' >>$@
+ echo ' "my_tmpfile"' >>$@
+ echo ' "my_tmpnam"' >>$@
+ echo ' "my_flock"' >>$@
!NO!SUBS!
if [ ! -z "$myttyname" ] ; then
@@ -35,25 +71,24 @@ $spitshell >>Makefile <<'!NO!SUBS!'
# 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"') | \
+ (echo "#include \"EXTERN.h\" \n#include \"perl.h\" \n#include \"perl.exp\""; \
+ echo "malloc\nrealloc\ncalloc\nfree") | \
$(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
+# We link miniperl statically, since .DLL depends on $(DYNALOADER)
+
+perl.map miniperl: $(obj) perl$(OBJ_EXT) miniperlmain$(OBJ_EXT)
+ $(CC) $(LARGE) $(CLDFLAGS) -o miniperl miniperlmain$(OBJ_EXT) perl$(OBJ_EXT) $(obj) $(libs) -Zmap -Zlinker /map
+ awk '{if ($$3 == "") print $$2}' <miniperl.map | sort | uniq > perl.map
+ rm miniperl.map
+ @./miniperl -w -Ilib -MExporter -e 0 || $(MAKE) minitest
-depend: os2ish.h
+depend: os2ish.h dlfcn.h
# Stupid make? Needed...
os2$(OBJ_EXT) : os2.c
@@ -61,11 +96,99 @@ os2$(OBJ_EXT) : os2.c
os2.c: os2/os2.c os2ish.h
cp $< $@
+dl_os2.c: os2/dl_os2.c os2ish.h
+ cp $< $@
+
os2ish.h: os2/os2ish.h
cp $< $@
+dlfcn.h: os2/dlfcn.h
+ cp $< $@
+
+# This one is compiled OMF, so cannot fork():
+
+perl___: $& perlmain$(OBJ_EXT) $(LIBPERL) $(DYNALOADER) $(static_ext) ext.libs
+ $(SHRPENV) $(CC) $(LARGE) $(CLDFLAGS) $(CCDLFLAGS) -o perl___ perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LIBPERL) `cat ext.libs` $(libs)
+
installcmd :
perl -e 'die qq{Give the option INSTALLCMDDIR=... to make!} if $$ARGV[0] eq ""' $(INSTALLCMDDIR)
perl os2/perl2cmd.pl $(INSTALLCMDDIR)
+# Aout section:
+
+aout_obj = $(addsuffix $(AOUT_OBJ_EXT),$(basename $(obj)))
+AOUT_DYNALOADER = $(addsuffix $(AOUT_LIB_EXT),$(basename $(DYNALOADER)))
+aout_static_ext = $(addsuffix $(AOUT_LIB_EXT),$(basename $(dynamic_ext)))
+aout_static_lib = $(addsuffix $(LIB_EXT),$(basename $(dynamic_ext)))
+
+aout_static_ext_dll = $(addsuffix $(AOUT_LIB_EXT),$(basename $(static_ext)))
+DYNALOADER_OBJ = ext/DynaLoader/DynaLoader$(OBJ_EXT)
+aout_static_ext_dll = $(addsuffix $(AOUT_LIB_EXT),$(basename $(static_ext)))
+AOUT_DYNALOADER_OBJ = $(addsuffix $(AOUT_OBJ_EXT),$(basename $(DYNALOADER_OBJ)))
+
+$(AOUT_DYNALOADER_OBJ) : $(DYNALOADER_OBJ)
+ emxaout -o $@ $<
+
+$(DYNALOADER_OBJ) : $(DYNALOADER)
+ @sh -c true
+
+$(AOUT_LIBPERL) : $(aout_obj) perl$(AOUT_OBJ_EXT)
+ rm -f $@
+ $(AOUT_AR) rcu $@ perl$(AOUT_OBJ_EXT) $(aout_obj)
+
+.c$(AOUT_OBJ_EXT):
+ $(AOUT_CCCMD) $(PLDLFLAGS) -c $*.c
+
+perlmain(AOUT_OBJ_EXT): perlmain.c
+ $(AOUT_CCCMD_DLL) $(PLDLFLAGS) -c perlmain.c
+
+aout_perlmain.c: miniperlmain.c config.sh makefile $(static_ext_autoinit)
+ sh writemain $(DYNALOADER) $(aout_static_lib) > tmp
+ sh mv-if-diff tmp aout_perlmain.c
+
+miniperl_: $& miniperlmain$(AOUT_OBJ_EXT) $(AOUT_LIBPERL) ext.libs
+ $(CC) $(LARGE) $(AOUT_CLDFLAGS) $(CCDLFLAGS) -o miniperl_ miniperlmain$(AOUT_OBJ_EXT) $(AOUT_LIBPERL) `cat ext.libs` $(libs)
+
+perl_: $& aout_perlmain$(AOUT_OBJ_EXT) $(AOUT_LIBPERL) $(AOUT_DYNALOADER) $(aout_static_ext) ext.libs
+ $(CC) $(LARGE) $(AOUT_CLDFLAGS) $(CCDLFLAGS) -o perl_ aout_perlmain$(AOUT_OBJ_EXT) $(AOUT_DYNALOADER) $(aout_static_ext) $(AOUT_LIBPERL) `cat ext.libs` $(libs)
+
+perl : perl__ perl___
+
+perl__: $& perlmain$(OBJ_EXT) $(LIBPERL) $(DYNALOADER) $(static_ext) ext.libs
+ $(CC) $(LARGE) $(CLDFLAGS) $(CCDLFLAGS) -o perl__ perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LIBPERL) `cat ext.libs` $(libs) -Zlinker /PM:PM
+
+# Forking dynamically loaded perl:
+
+perl: $& perlmain$(AOUT_OBJ_EXT) $(AOUT_DYNALOADER_OBJ) $(aout_static_ext_dll) $(AOUT_LIBPERL_DLL) ext.libs
+ $(CC) $(LARGE) $(AOUT_CLDFLAGS_DLL) $(CCDLFLAGS) -o perl perlmain$(AOUT_OBJ_EXT) $(AOUT_DYNALOADER_OBJ) $(aout_static_ext_dll) $(AOUT_LIBPERL_DLL) `cat ext.libs` $(libs)
+
+clean: aout_clean
+
+aout_clean:
+ -rm *perl_.* *.o *.a lib/auto/*/*.a ext/*/Makefile.aout
+
+aout_install: perl_ aout_install.perl
+
+aout_install.perl: perl_ installperl
+ ./perl_ installperl
+
+aout_test: perl_
+ - cd t && (rm -f perl_$(EXE_EXT); $(LNS) ../perl_$(EXE_EXT) perl$(EXE_EXT)) && ./perl TEST </dev/tty
+
+lib/auto/OS2/*/%.a : ext/OS2/%/Makefile.aout
+ cd ext/OS2/$(basename $(notdir $@)) ; make -f Makefile.aout config || echo "$make config failed, continuing anyway..."
+ cd ext/OS2/$(basename $(notdir $@)) ; make -f Makefile.aout LINKTYPE=static CCCDLFLAGS=
+
+lib/auto/*/%.a : ext/%/Makefile.aout
+ cd ext/$(basename $(notdir $@)) ; make -f Makefile.aout config || echo "$make config failed, continuing anyway..."
+ cd ext/$(basename $(notdir $@)) ; make -f Makefile.aout LINKTYPE=static CCCDLFLAGS=
+
+.PRECIOUS : ext/%/Makefile.aout ext/OS2/%/Makefile.aout
+
+ext/OS2/%/Makefile.aout : miniperl_
+ cd $(dir $@) ; ../../../miniperl_ -I ../../../lib Makefile.PL MAKEFILE=Makefile.aout INSTALLDIRS=perl
+
+ext/%/Makefile.aout : miniperl_
+ cd $(dir $@) ; ../../miniperl_ -I ../../lib Makefile.PL MAKEFILE=Makefile.aout INSTALLDIRS=perl
+
!NO!SUBS!
diff --git a/gnu/usr.bin/perl/os2/README b/gnu/usr.bin/perl/os2/README
deleted file mode 100644
index cd00a1f6032..00000000000
--- a/gnu/usr.bin/perl/os2/README
+++ /dev/null
@@ -1,229 +0,0 @@
-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/README.old b/gnu/usr.bin/perl/os2/README.old
deleted file mode 100644
index f49d6be1fa6..00000000000
--- a/gnu/usr.bin/perl/os2/README.old
+++ /dev/null
@@ -1,529 +0,0 @@
-This documentation to the previous version is somewhat applicable yet.
-No system() extensions, no -R option, the exec/system with one argument
-will use sh.exe only (if required). IZ
-
- Perl 5.001 for OS/2.
- Patchlevel "m"
-
- Copyright (c) 1989,1990,1991,1992,1993,1994 Larry Wall
- All rights reserved.
-
- OS/2 port Copyright (c) 1990, 1991, 1994-95
- Raymond Chen, Kai Uwe Rommel, Andreas Kaiser
-
-Version 5 port (this package) by Andreas Kaiser <ak@ananke.s.bawue.de>
-(2:246/8506.9@fidonet).
-
-To run the executables supplied with this file, you have to install the
-EMX runtime package emxrt.zip of version 0.9a05 (0.9a, fixlevel 5) or
-later.
-
-The file emxrt.zip is available at ftp.rus.uni-stuttgart.de (the
-origin), ftp-os2.nmsu.edu and many other places.
-
-The source code of the original Perl 5.0 distribution is not included
-here. You can get it at ftp://ftp.wpi.edu:/perl5/perl5.001.tar.gz (and
-many other places).
-
-For documentation of Perl 5, look at the files into the directory tree
-"pod". For TeX or Postscript docs, get perlref-5.000.0.tar.gz. A LaTeX
-and postscript reference card is available at
- ftp.NL.net:/pub/comp/programming/languages/perl/perlref-5.000.0.tar.gz
- prep.ai.mit.edu:/pub/gnu/perlref-5.000.0.tar.gz
-
-Many REXX DLLs complement the features available by standard Perl,
-supporting system calls (YdbaUtil - RXU??.ZIP), xBase (RexxBase,
-shareware), serial I/O (RxAsync) and basic PM dialogs (VRexx). These
-packages can be found at many OS/2 FTP servers.
-
------------------------------------------------------------------------------
-Installation:
--------------
-
-If you did not have HPFS up to now, this is the right time to reformat
-your filesystem(s)... While Perl itself does not require HPFS, a lot
-of Perl library files do. Or try EMXOPT=-t.
-
-copy perl5.exe perl5x.exe `some PATH dir`
-copy os2\perlglob.exe `some PATH dir`
-copy perl5.dll `some LIBPATH dir`
-
-set PERL5LIB=x:/your/own/perl/lib;y:/somewhere/perl5/lib
-
-The perl5 extension DLLs (POSIX_.DLL, REXX_.DLL, ...) do not need a
-LIBPATH entry.
-
-Executables:
-------------
-
-perl5.exe,perl5.dll : DynaLoader, REXX support, external DLLs
-
- No fork. Running a command via open() returns 1
- instead of the child process id.
-
- Other modules supported via extension DLLs, no
- builtins other than DynaLoader.
-
-perl5x.exe : No Dynaloader, no REXX.
-
- Supports fork. Running a command via open() uses fork
- (slow) and correctly returns the child process id.
-
- POSIX and Socket modules builtin. No other extension
- modules supported.
-
- Note that lib/Socket.pm and lib/POSIX.pm reflect
- DLL use. If you need them with perl5x.exe, you
- have to remove the "bootstrap" line.
-
------------------------------------------------------------------------------
-Building:
----------
-
-Requires:
-- Perl5.001.tar.gz (Perl 5.001 sources).
-- EMX 0.9a05 or later (Compiler).
-- OS/2 Development Toolkit (or change REXX inc/lib references).
-- Korn shell (ksh) or some other Unix-like shell named ksh.
-- DMake, with group recipes configured for a Unix shell.
-- Larry Walls "patch" program.
-- Several Unix-like tools, such as cp, cat, touch, find, ...
-
-get Perl 5.001 source
-apply patches\* -- "official unofficial" patches to 5.001
-apply os2\patches -- OS/2 platform patches
-copy ext\DynaLoader\dl_os2.xs ext\DynaLoader\DynaLoader.xs
-copy os2\config.sh .
-copy os2\makefile.mk .
-
-If you do not have UPM (User Profile Management), remove "UPM" from
-makefile.mk.
-
------------------------------------------------------------------------------
-Not supported, bugs, "OS/2 is Not Unix":
-----------------------------------------
-
-Depending on whether you run perl5.exe or perl5x.exe, you can either
-use extension modules and REXX, or fork, since the EMX implementation
-of fork conflicts with DLL support. Remember that there is a hidden
-fork in open(F, "-|") and open(F, "|-").
-
-config.sh (Config.pm) lies. It shows d_fork='undef' even though it is
-available in perl5x.exe. "dynamic_ext" and "extensions" are incorrect
-for perl5x.exe.
-
-flock is available but does not yet work in EMX 0.9a.
-
-ttyname and ctermid do not work (return NULL).
-
-... and of course a lot of Unix-isms like process group, user and group
-management, links, ...
-
-For details, look into config.sh and the EMX library reference.
-
-I did not test SDBM. I just added a lot of O_BINARY flags and compiled it.
-
-Several scripts of the test suite (see source distribution) fail due to
-Unix-isms like /bin/sh, `echo *`, different quoting requirements, ...
-
-When opening a command pipe [such as open(F,"cat|")], perl5.exe
-returns 1 instead of the child's process id. Perl5x.exe correctly
-returns the process id.
-
-OS/2 does not have a true exec API (which is used both by the exec
-function and when opening a command pipe with perl5x.exe). What
-actually happens is the call of a subprocess with the father waiting
-for the termination of its child. While waiting, the father still owns
-all its resources (it passes signals to the child however) and there
-may be some other side effects as well.
-
------------------------------------------------------------------------------
-OS2::REXX Module (external library):
-------------------------------------
-
-NOTE: By default, the REXX variable pool is not available, neither to
-Perl, nor to external REXX functions. To enable it, you have to start
-Perl with the switch -R, which makes Perl call its interpreter through
-REXX. REXX functions which do not use variables may be usable even
-without -R though.
-
-Load REXX DLL:
-
- $dll = load OS2::REXX NAME [, WHERE];
-
- NAME is DLL name, without path and extension.
-
- Directories are searched WHERE first (list of dirs), then
- environment paths PERL5REXX, PERLREXX or, as last resort, PATH.
-
- The DLL is not unloaded when the variable dies.
-
- Returns DLL object reference, or undef on failure.
-
-Define function prefix:
-
- $dll->prefix(NAME);
-
- Define the prefix of external functions, prepended to the
- function names used within your program, when looking for
- the entries in the DLL.
-
- Example:
- $dll = load OS2::REXX "RexxBase";
- $dll->prefix("RexxBase_");
- $dll->Init();
- is the same as
- $dll = load OS2::REXX "RexxBase";
- $dll->RexxBase_Init();
-
-Define queue:
-
- $dll->queue(NAME);
-
- Define the name of the REXX queue passed to all external
- functions of this module. Defaults to "SESSION".
-
-Check for functions (optional):
-
- BOOL = $dll->find(NAME [, NAME [, ...]]);
-
- Returns true if all functions are available.
-
-Call external REXX function:
-
- $dll->function(arguments);
-
- Returns the return string if the return code is 0, else undef.
- Dies with error message if the function is not available.
-
-Bind scalar variable to REXX variable:
-
- tie $var, OS2::REXX, "NAME";
-
-Bind array variable to REXX stem variable:
-
- tie @var, OS2::REXX, "NAME.";
-
- Only scalar operations work so far. No array assignments,
- no array operations, ... FORGET IT.
-
-Bind hash array variable to REXX stem variable:
-
- tie %var, OS2::REXX, "NAME.";
-
- To access all visible REXX variables via hash array, bind to "";
-
- No array assignments. No array operations, other than hash array
- operations. Just like the *dbm based implementations.
-
- For the usual REXX stem variables, append a "." to the name,
- as shown above. If the hash key is part of the stem name, for
- example if you bind to "", you cannot use lower case in the stem
- part of the key and it is subject to character set restrictions.
-
-Erase individual REXX variables (bound or not):
-
- OS2::REXX::drop("NAME" [, "NAME" [, ...]]);
-
-Note that while function and variable names are case insensitive in the
-REXX language, function names exported by a DLL and the REXX variables
-(as seen by Perl through the chosen API) are all case sensitive!
-
-Most REXX DLLs export function names all upper case, but there are a
-few which export mixed case names (such as RxExtras). When trying to
-find the entry point, both exact case and all upper case are searched.
-If the DLL exports "RxNap", you have to specify the exact case, if it
-exports "RXOPEN", you can use any case.
-
-To avoid interfering with subroutine names defined by Perl (DESTROY)
-or used within the REXX module (prefix, find), it is best to use mixed
-case and to avoid lowercase only or uppercase only names when calling
-REXX functions. Be consistent. The same function written in different
-ways results in different Perl stubs.
-
-There is no REXX interpolation on variable names, so the REXX variable
-name TEST.ONE is not affected by some other REXX variable ONE. And it
-is not the same variable as TEXT.one!
-
-You cannot call REXX functions which are not exported by the DLL.
-While most DLLs export all their functions, some, like RxFTP, export
-only "...LoadFuncs", which registers the functions within REXX only.
-
-You cannot call 16-bit DLLs. The few interesting ones I found
-(FTP,NETB,APPC) do not export their functions.
-
-I do not know whether the REXX API is reentrant with respect to
-exceptions (signals) when the REXX top-level exception handler is
-overridden. So unless you know better than I do, do not access REXX
-variables (probably tied to Perl variables) or call REXX functions
-which access REXX queues or REXX variables in signal handlers.
-
-See ext/OS2/REXX/rx*.pl for examples.
-
------------------------------------------------------------------------------
-OS2::UPM (external library):
-----------------------------
-
-UPM constants (see <upm.h>) are exported automatically, functions only
-on request.
-
-(USERID, TYPE) = local_user ()
-
- return local user
-
-LIST = user_list (REMOTENODE="", REMOTETYPE_UPM_LOCAL)
- LIST = 4 items per logged on user
- [0] = user id
- [1] = remote node name
- [2] = remote node type (INT)
- [3] = session id (INT)
-
-(USERID, TYPE) = local_logon ()
-
- do a local logon, PM window, if not already logged on
-
-BOOL = logon (USERID, PASSWORD, AUTHCHECK=UPM_USER, REMOTENODE="", REMOTETYPE=UPM_LOCAL)
-BOOL = logoff (USERID, REMOTENODE="", REMOTETYPE=UPM_LOCAL)
-
- logon/logoff process (DB2/2)
-
-BOOL = logon_user (USERID, PASSWORD, REMOTENODE="", REMOTETYPE=UPM_LOCAL)
-BOOL = logoff_user (USERID, REMOTENODE="", REMOTETYPE=UPM_LOCAL)
-
- logon/logoff user
-
-ERRCODE = error ()
-
- return UPM error code of last failure
-
-STRING = message (ERRCODE)
-
- return message text for supplied UPM error code
-
-Defaults:
- REMOTETYPE = UPM_LOCAL
- REMOTENODE = ""
- AUTHCHECK = UPM_USER
-
------------------------------------------------------------------------------
-OS2::FTP (external library):
-----------------------------
-
-$acct = new FTP "host", "userid", "passwd" [, "acct"]
-
- Create virtual FTP session - no login.
-
-FTP::logoff()
-
- Logoff all sessions.
-
-($msec, $address) = FTP::ping("host", pktlen);
-$msec = FTP::ping($address, pktlen);
-
- Ping host. Returns milliseconds or negative error code.
- $address is 32-bit number.
-
-$errno = $acct->errno();
-
- Return last error code (FTP*).
-
-$text = FTP::message($errno);
-
- Return message test of last error.
-
-$status: <0 on error, >=0 on success.
-$tfrtype: T_BINARY, T_ASCII, T_EBCDIC
-"mode": "w" for overwrite, "a" for append
-
-$status = $acct->dir("local", "pattern"="*");
-$status = $acct->ls("local", "pattern"="*");
-
-$status = $acct->chdir("dir");
-$status = $acct->mkdir("dir");
-$status = $acct->rmdir("dir");
-($status, $cwd) = $acct->getcwd();
-
-$status = $acct->get("local", "remote"=local, "mode"="w", $tfrtype=T_BINARY);
-
-$status = $acct->put("local", "remote"=local, $tfrtype=T_BINARY);
-$status = $acct->putunique("local", "remote"=local, $tfrtype=T_BINARY);
-$status = $acct->append("local", "remote"=local, $tfrtype=T_BINARY);
-
-$status = $acct->rename("from", "to");
-$status = $acct->delete("name");
-
-$status = $acct->proxy($source_acct, "dst_file", "src_file", $tfrtype=T_BINARY);
-
-$status = $acct->quote("string");
-$status = $acct->site("string");
-($status, $infostring) = $acct->sys();
-
------------------------------------------------------------------------------
-Other:
-------
-
- setpriority CLASS,PID,DELTA
-
- Set priority of process or process tree.
-
- PID:
- >= 0: process only
- < 0: process tree
-
- CLASS:
- 0 no change
- 1 idle-time (lowest)
- 2 regular (dynamic priority)
- 3 time-critical (highest)
- 4 fixed-high (between regular and time-critical)
-
- DELTA:
- -31..+31
-
- getpriority IGNORED,PID
-
- Return priority of process or process tree.
-
- Bits 8..15 priority class (1..4)
- Bits 0..7 priority within class (0..31)
-
- system LIST
-
- If the first element of LIST is an integer, it controls the
- started child process or session as follows:
-
- 0 = wait until child terminates (default)
- 1 = do not wait, use wait() or waitpid() for status
- 4 = new session
- 5 = detached
- 6 = PM program
-
- PM and session options, or-ed in:
-
- 0x00000 = default
- 0x00100 = minimized
- 0x00200 = maximized
- 0x00300 = fullscreen (session only)
- 0x00400 = windowed (session only)
-
- 0x00000 = foreground (only if running in foreground)
- 0x01000 = background
-
- 0x02000 = don't close window on exit (session only)
-
- 0x10000 = quote all arguments
- 0x20000 = MKS argument passing convention
-
- If the control is not zero, system() does not wait until
- the child terminates and the return code is the id of the
- child process.
-
- If the control is not zero, and you do not call wait or
- waitpid, the child status fills up memory.
-
- Note: If the program is started with a mode of 4 or 6, it may
- be aborted when the starting program (perl) terminates. Later
- releases of EMX.DLL will probably know yet another flag bit
- to cut this fatal relationship.
-
- system STRING
- exec STRING
-
- If the string starts with "@" or contains any of "%&|<>",
- it is called as a shell command. Else the program is called
- directly.
-
- If the environment variable SHELL is defined, it is used
- instead of COMSPEC when running shell commands. It should
- be a Unix-style shell.
-
- file checks (-X), stat(), ...
-
- When testing filenames, not handles, char-devices are detected
- only when prefixed by "/dev/", so "/dev/con" is valid, "con" is
- not.
-
- Currently, only /dev/con and /dev/tty are recognized.
-
------------------------------------------------------------------------------
-History:
-
-15.12.94 Initial release (perl5000.zip).
-
-17.12.94 Moved REXX sub defn to find(). Hash array for functions no
- longer required, allows overriding subs like "find".
-
- DLL entries are case sensitive, try both upper case and
- exact case.
-
-18.12.94 Detect char- and block-devices (stat() hack). Some future
- release may probably remove block device support, once
- char-device support is built into EMX.
-
- Fixed perl5db tty check.
-
-22.12.94 EMX fixlevel 2 exports its exception handler, so now
- signals work even when the REXX variable pool is enabled.
-
- Disabled error and exception popups.
-
-27.12.94 Case conversions of tied variables cleaned up.
-
- REXX (REXX.DLL, REXXAPI.DLL) now loaded on demand.
-
-7.1.95 Fixed Shell module (did not allow more than one argument).
-
-11.1.95 Accept drive letter as absolute path in do/require/use.
-
-13.1.95 Larrys memory-leak patches (#1, dated Friday 13).
-
-26.1.95 fcntl and ioctl were missing. fcntl was explicitly disabled
- in its source code (ifndef DOSISH) and the ioctl enabler is
- in the wrong place (unixish.h instead of config.sh).
-
-16.3.95 DosQueryFSAttach (stat hack) may crash the system. Now just
- look for /dev/con and /dev/tty.
-
- Applied "pad_findlex" patch (patches/1).
-
-23.3.95 Support fork. Two executables, one for DLLs and one for fork.
-
-24.3.95 5.001
-
-13.4.95 Patchlevel "c".
-
-21.4.95 Truncate names of extension DLLs to 8 chars - Warp no longer
- accepts them (2.x did).
-
-22.4.95 Replaced EMX dirent by my own to get all directory entries
- even when HPFS386 is used. Additionally, my implementation
- is not restricted in the total size of the directory (a
- conflict between Perls memory allocator and the one of the
- EMX library DLL).
-
-27.4.95 Support for fork() disabled system() in DLL version.
-
-7.5.95 Added Tye McQueen's FileGlob. See File::KGlob*.
-
-12.5.95 Fixed Cwd. Fixed OS/2 dependencies in MakeMaker, with
- a few Config.sh items added (separators, exe-extension).
-
- Moved UPM and REXX to OS2::. Combined REXXCALL and REXX.
- Plain old REXX module is still available as passthru though.
-
- Perl DLLs now have an underscore appended to avoid name
- conflicts with standard OS/2 DLLs (see DynaLoader.pm).
-
-13.5.95 Added FTP API support (OS2::FTP).
-
-2.7.95 Applied "official unofficial" patches up to level "m".
- The modpods documentation now is in the modules themselves.
-
-4.7.95 Implement command pipes (my_popen) using fork instead of
- standard popen in the fork version (perl5x.exe). While this
- is a lot slower, it correctly returns the process id and
- supports open(F,"-|") and open(F,"|-").
-
- Use the same code for exec(CMD) as for system(CMD).
-
- Support socket functions (set|get|end)(host|net|proto|serv)ent.
diff --git a/gnu/usr.bin/perl/os2/diff.configure b/gnu/usr.bin/perl/os2/diff.configure
index 53aa16b4a2e..9f42dc139fe 100644
--- a/gnu/usr.bin/perl/os2/diff.configure
+++ b/gnu/usr.bin/perl/os2/diff.configure
@@ -1,589 +1,274 @@
-*** 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
+--- Configure.orig Fri Aug 1 23:12:26 1997
++++ Configure Fri Aug 1 23:20:24 1997
+@@ -1489,7 +1489,7 @@
+ *)
+ 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
++ #exit 1
+ ;;
+ esac
+ done
+@@ -1498,7 +1498,9 @@
+ say=offhand
+ for file in $trylist; do
+ xxx=`./loc $file $file $pth`
+- eval $file=$xxx
++ if test "X$file" != "X$xxx" ; then
++ eval $file=$xxx
++ fi
+ eval _$file=$xxx
+ case "$xxx" in
+ /*)
+@@ -3198,7 +3200,7 @@
+ exit(0);
+ }
+ EOM
+-if $cc -o gccvers gccvers.c >/dev/null 2>&1; then
++if $cc -o gccvers gccvers.c $ldflags >/dev/null 2>&1; then
+ gccversion=`./gccvers`
+ case "$gccversion" in
+ '') echo "You are not using GNU cc." ;;
+@@ -3401,6 +3403,12 @@
+ *"-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
+@@ -3950,7 +3958,7 @@
+ esac
+ ;;
+ esac
+-libnames='';
++#libnames='';
+ case "$libs" in
+ '') ;;
+ *) for thislib in $libs; do
+@@ -3972,6 +3980,8 @@
+ :
+ 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$lib_ext X $xlibpth`; $test -f "$try"; then
+ :
+ else
+@@ -4156,6 +4166,10 @@
+ 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
+@@ -4166,23 +4180,33 @@
+ eval $xrun
+ else
+ echo " "
+- echo "nm didn't seem to work right. Trying ar instead..." >&4
++ 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
++ if test "X$osname" = "Xos2"; then ar_opt=tv ; else ar_opt=t ;fi
++ if $ar $ar_opt $libc > libc.tmp; then
++ echo \; > libc.tmp
++ for thisname in $libnames $libc; do
++ $ar $ar_opt $thisname >>libc.tmp
++ if test "X$osname" = "Xos2"; then
++ # Revision 50 of EMX has bug in $ar:
++ emximp -o tmp.imp $thisname \
++ 2>/dev/null && \
++ $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
++ < tmp.imp >>libc.tmp
++ $rm tmp.imp
++ fi
+ done
+- $sed -e 's/\.o$//' < libc.tmp > libc.list
++ $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 "$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
++ $ar t $thisname >>libc.tmp
+ done
+ echo "Ok." >&4
+ else
+@@ -5611,15 +5635,15 @@
+ EOCP
+ : check sys/file.h first, no particular reason here
+ if $test `./findhdr sys/file.h` && \
+- $cc $cppflags -DI_SYS_FILE access.c -o access >/dev/null 2>&1 ; then
++ $cc $ldflags $cppflags -DI_SYS_FILE access.c -o access >/dev/null 2>&1 ; then
+ h_sysfile=true;
+ echo "<sys/file.h> defines the *_OK access constants." >&4
+ elif $test `./findhdr fcntl.h` && \
+- $cc $cppflags -DI_FCNTL access.c -o access >/dev/null 2>&1 ; then
++ $cc $ldflags $cppflags -DI_FCNTL access.c -o access >/dev/null 2>&1 ; then
+ h_fcntl=true;
+ echo "<fcntl.h> defines the *_OK access constants." >&4
+ elif $test `./findhdr unistd.h` && \
+- $cc $cppflags -DI_UNISTD access.c -o access >/dev/null 2>&1 ; then
++ $cc $ldflags $cppflags -DI_UNISTD access.c -o access >/dev/null 2>&1 ; then
+ echo "<unistd.h> defines the *_OK access constants." >&4
+ else
+ echo "I can't find the four *_OK access constants--I'll use mine." >&4
+@@ -5913,7 +5937,7 @@
+ exit(result);
+ }
+ EOCP
+-if $cc -o try $ccflags try.c >/dev/null 2>&1; then
++if $cc -o try $ccflags try.c $ldflags >/dev/null 2>&1; then
+ ./try
+ yyy=$?
+ else
+@@ -5994,7 +6018,7 @@
+
+ }
+ EOCP
+-if $cc -o try $ccflags try.c >/dev/null 2>&1; then
++if $cc -o try $ccflags try.c $ldflags >/dev/null 2>&1; then
+ ./try
+ castflags=$?
+ else
+@@ -6033,7 +6057,7 @@
+ exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
+ }
+ EOF
+- if $cc $ccflags vprintf.c -o vprintf >/dev/null 2>&1 && ./vprintf; then
++ if $cc $ccflags vprintf.c $ldflags -o vprintf >/dev/null 2>&1 && ./vprintf; then
+ echo "Your vsprintf() returns (int)." >&4
+ val2="$undef"
+ else
+@@ -6381,7 +6405,7 @@
+ EOCP
+ : check sys/file.h first to get FREAD on Sun
+ if $test `./findhdr sys/file.h` && \
+- $cc $ccflags "-DI_SYS_FILE" -o open3 $ldflags open3.c $libs >/dev/null 2>&1 ; then
++ $cc $ldflags $ccflags "-DI_SYS_FILE" -o open3 $ldflags open3.c $libs >/dev/null 2>&1 ; then
+ h_sysfile=true;
+ echo "<sys/file.h> defines the O_* constants..." >&4
+ if ./open3; then
+@@ -6392,7 +6416,7 @@
+ val="$undef"
+ fi
+ elif $test `./findhdr fcntl.h` && \
+- $cc $ccflags "-DI_FCNTL" -o open3 $ldflags open3.c $libs >/dev/null 2>&1 ; then
++ $cc $ldflags $ccflags "-DI_FCNTL" -o open3 $ldflags open3.c $libs >/dev/null 2>&1 ; then
+ h_fcntl=true;
+ echo "<fcntl.h> defines the O_* constants..." >&4
+ if ./open3; then
+@@ -6898,7 +6922,7 @@
+ y*|true)
+ usemymalloc='y'
+ mallocsrc='malloc.c'
+- mallocobj='malloc.o'
++ mallocobj="malloc$obj_ext"
+ d_mymalloc="$define"
+ case "$libs" in
+ *-lmalloc*)
+@@ -8156,7 +8180,7 @@
+ printf("%d\n", (char *)&try.bar - (char *)&try.foo);
+ }
+ EOCP
+- if $cc $ccflags try.c -o try >/dev/null 2>&1; then
++ if $cc $ccflags $ldflags try.c -o try >/dev/null 2>&1; then
+ dflt=`./try`
+ else
+ dflt='8'
+@@ -8204,7 +8228,7 @@
+ }
+ EOCP
+ xxx_prompt=y
+- if $cc $ccflags try.c -o try >/dev/null 2>&1 && ./try > /dev/null; then
++ 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)
+@@ -8711,18 +8735,18 @@
+ $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.o bar1.o >/dev/null 2>&1
++$ar rc bar$lib_ext bar2.o bar1.o >/dev/null 2>&1
+ if $cc $ccflags $ldflags -o foobar foo.o bar$lib_ext $libs > /dev/null 2>&1 &&
+ ./foobar >/dev/null 2>&1; then
+- echo "ar appears to generate random libraries itself."
++ echo "$ar appears to generate random libraries itself."
+ orderlib=false
+ ranlib=":"
+-elif ar ts bar$lib_ext >/dev/null 2>&1 &&
++elif $ar ts bar$lib_ext >/dev/null 2>&1 &&
+ $cc $ccflags $ldflags -o foobar foo.o 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'."
++ echo "a table of contents needs to be added with '$ar ts'."
+ orderlib=false
+- ranlib="ar ts"
++ ranlib="$ar ts"
+ else
+ case "$ranlib" in
+ :) ranlib='';;
+@@ -8794,7 +8818,7 @@
+ '') $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
++ try.c -o try $ldflags >/dev/null 2>&1 ; then
+ set X $i_time $i_systime $i_systimek $sysselect $s_timeval
+ shift
+ flags="$*"
+@@ -8863,7 +8887,7 @@
+ #endif
+ }
+ EOCP
+-if $cc $ccflags -DTRYBITS fd_set.c -o fd_set >fd_set.out 2>&1 ; then
++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
+@@ -8880,7 +8904,7 @@
+ $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
++ 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
+@@ -9627,7 +9651,7 @@
+ else
+ echo "false"
+ fi
+-$rm -f varargs.o
++$rm -f varargs$obj_ext
+ EOP
+ chmod +x varargs
+
+@@ -9954,7 +9978,7 @@
+ echo " "
+ echo "Stripping down executable paths..." >&4
+ for file in $loclist $trylist; do
+- eval $file="\$file"
++ 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
deleted file mode 100644
index 7fcca0a7933..00000000000
--- a/gnu/usr.bin/perl/os2/diff.db_file
+++ /dev/null
@@ -1,15 +0,0 @@
-*** 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
deleted file mode 100644
index f8591878b6d..00000000000
--- a/gnu/usr.bin/perl/os2/notes
+++ /dev/null
@@ -1,28 +0,0 @@
-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
index a518c41d45f..8a292e30f25 100644
--- a/gnu/usr.bin/perl/os2/os2.c
+++ b/gnu/usr.bin/perl/os2/os2.c
@@ -1,10 +1,8 @@
#define INCL_DOS
#define INCL_NOPM
#define INCL_DOSFILEMGR
-#ifndef NO_SYS_ALLOC
-# define INCL_DOSMEMMGR
-# define INCL_DOSERRORS
-#endif /* ! defined NO_SYS_ALLOC */
+#define INCL_DOSMEMMGR
+#define INCL_DOSERRORS
#include <os2.h>
/*
@@ -15,29 +13,150 @@
#include <errno.h>
#include <limits.h>
#include <process.h>
+#include <fcntl.h>
#include "EXTERN.h"
#include "perl.h"
/*****************************************************************************/
+/* 2.1 would not resolve symbols on demand, and has no ExtLIBPATH. */
+static PFN ExtFCN[2]; /* Labeled by ord below. */
+static USHORT loadOrd[2] = { 874, 873 }; /* Query=874, Set=873. */
+#define ORD_QUERY_ELP 0
+#define ORD_SET_ELP 1
+
+APIRET
+loadByOrd(ULONG ord)
+{
+ if (ExtFCN[ord] == NULL) {
+ static HMODULE hdosc = 0;
+ BYTE buf[20];
+ PFN fcn;
+ APIRET rc;
+
+ if ((!hdosc && CheckOSError(DosLoadModule(buf, sizeof buf,
+ "doscalls", &hdosc)))
+ || CheckOSError(DosQueryProcAddr(hdosc, loadOrd[ord], NULL, &fcn)))
+ die("This version of OS/2 does not support doscalls.%i",
+ loadOrd[ord]);
+ ExtFCN[ord] = fcn;
+ }
+ if ((long)ExtFCN[ord] == -1) die("panic queryaddr");
+}
+
/* priorities */
+static signed char priors[] = {0, 1, 3, 2}; /* Last two interchanged,
+ self inverse. */
+#define QSS_INI_BUFFER 1024
-int setpriority(int which, int pid, int val)
+PQTOPLEVEL
+get_sysinfo(ULONG pid, ULONG flags)
{
- return DosSetPriority((pid < 0) ? PRTYS_PROCESSTREE : PRTYS_PROCESS,
- val >> 8, val & 0xFF, abs(pid));
+ char *pbuffer;
+ ULONG rc, buf_len = QSS_INI_BUFFER;
+
+ New(1322, pbuffer, buf_len, char);
+ /* QSS_PROCESS | QSS_MODULE | QSS_SEMAPHORES | QSS_SHARED */
+ rc = QuerySysState(flags, pid, pbuffer, buf_len);
+ while (rc == ERROR_BUFFER_OVERFLOW) {
+ Renew(pbuffer, buf_len *= 2, char);
+ rc = QuerySysState(flags, pid, pbuffer, buf_len);
+ }
+ if (rc) {
+ FillOSError(rc);
+ Safefree(pbuffer);
+ return 0;
+ }
+ return (PQTOPLEVEL)pbuffer;
+}
+
+#define PRIO_ERR 0x1111
+
+static ULONG
+sys_prio(pid)
+{
+ ULONG prio;
+ PQTOPLEVEL psi;
+
+ psi = get_sysinfo(pid, QSS_PROCESS);
+ if (!psi) {
+ return PRIO_ERR;
+ }
+ if (pid != psi->procdata->pid) {
+ Safefree(psi);
+ croak("panic: wrong pid in sysinfo");
+ }
+ prio = psi->procdata->threads->priority;
+ Safefree(psi);
+ return prio;
+}
+
+int
+setpriority(int which, int pid, int val)
+{
+ ULONG rc, prio;
+ PQTOPLEVEL psi;
+
+ prio = sys_prio(pid);
+
+ if (!(_emx_env & 0x200)) return 0; /* Nop if not OS/2. */
+ if (priors[(32 - val) >> 5] + 1 == (prio >> 8)) {
+ /* Do not change class. */
+ return CheckOSError(DosSetPriority((pid < 0)
+ ? PRTYS_PROCESSTREE : PRTYS_PROCESS,
+ 0,
+ (32 - val) % 32 - (prio & 0xFF),
+ abs(pid)))
+ ? -1 : 0;
+ } else /* if ((32 - val) % 32 == (prio & 0xFF)) */ {
+ /* Documentation claims one can change both class and basevalue,
+ * but I find it wrong. */
+ /* Change class, but since delta == 0 denotes absolute 0, correct. */
+ if (CheckOSError(DosSetPriority((pid < 0)
+ ? PRTYS_PROCESSTREE : PRTYS_PROCESS,
+ priors[(32 - val) >> 5] + 1,
+ 0,
+ abs(pid))))
+ return -1;
+ if ( ((32 - val) % 32) == 0 ) return 0;
+ return CheckOSError(DosSetPriority((pid < 0)
+ ? PRTYS_PROCESSTREE : PRTYS_PROCESS,
+ 0,
+ (32 - val) % 32,
+ abs(pid)))
+ ? -1 : 0;
+ }
+/* else return CheckOSError(DosSetPriority((pid < 0) */
+/* ? PRTYS_PROCESSTREE : PRTYS_PROCESS, */
+/* priors[(32 - val) >> 5] + 1, */
+/* (32 - val) % 32 - (prio & 0xFF), */
+/* abs(pid))) */
+/* ? -1 : 0; */
}
-int getpriority(int which /* ignored */, int pid)
+int
+getpriority(int which /* ignored */, int pid)
{
TIB *tib;
PIB *pib;
- DosGetInfoBlocks(&tib, &pib);
- return tib->tib_ptib2->tib2_ulpri;
+ ULONG rc, ret;
+
+ if (!(_emx_env & 0x200)) return 0; /* Nop if not OS/2. */
+ /* DosGetInfoBlocks has old priority! */
+/* if (CheckOSError(DosGetInfoBlocks(&tib, &pib))) return -1; */
+/* if (pid != pib->pib_ulpid) { */
+ ret = sys_prio(pid);
+ if (ret == PRIO_ERR) {
+ return -1;
+ }
+/* } else */
+/* ret = tib->tib_ptib2->tib2_ulpri; */
+ return (1 - priors[((ret >> 8) - 1)])*32 - (ret & 0xFF);
}
/*****************************************************************************/
/* spawn */
+typedef void (*Sigfunc) _((int));
static int
result(int flag, int pid)
@@ -45,22 +164,36 @@ 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() */
+#ifndef __EMX__
+ RESULTCODES res;
+ int rpid;
+#endif
- if (pid < 0 || flag != 0)
+ if (pid < 0 || flag != 0)
return pid;
- ihand = signal(SIGINT, SIG_IGN);
- qhand = signal(SIGQUIT, SIG_IGN);
+#ifdef __EMX__
+ ihand = rsignal(SIGINT, SIG_IGN);
+ qhand = rsignal(SIGQUIT, SIG_IGN);
do {
r = wait4pid(pid, &status, 0);
} while (r == -1 && errno == EINTR);
- signal(SIGINT, ihand);
- signal(SIGQUIT, qhand);
+ rsignal(SIGINT, ihand);
+ rsignal(SIGQUIT, qhand);
statusvalue = (U16)status;
if (r < 0)
return -1;
return status & 0xFFFF;
+#else
+ ihand = rsignal(SIGINT, SIG_IGN);
+ r = DosWaitChild(DCWA_PROCESS, DCWW_WAIT, &res, &rpid, pid);
+ rsignal(SIGINT, ihand);
+ statusvalue = res.codeResult << 8 | res.codeTerminate;
+ if (r)
+ return -1;
+ return statusvalue;
+#endif
}
int
@@ -70,15 +203,15 @@ register SV **mark;
register SV **sp;
{
register char **a;
- char *tmps;
+ char *tmps = NULL;
int rc;
- int flag = P_WAIT, trueflag;
+ int flag = P_WAIT, trueflag, err, secondtry = 0;
if (sp > mark) {
- New(401,Argv, sp - mark + 1, char*);
+ New(1301,Argv, sp - mark + 3, char*);
a = Argv;
- if (mark < sp && SvIOKp(*(mark+1))) {
+ if (mark < sp && SvNIOKp(*(mark+1)) && !SvPOKp(*(mark+1))) {
++mark;
flag = SvIVx(*mark);
}
@@ -95,13 +228,49 @@ register SV **sp;
if (flag == P_WAIT)
flag = P_NOWAIT;
- if (*Argv[0] != '/' && *Argv[0] != '\\') /* will swawnvp use PATH? */
+ if (strEQ(Argv[0],"/bin/sh")) Argv[0] = sh_path;
+
+ if (Argv[0][0] != '/' && Argv[0][0] != '\\'
+ && !(Argv[0][0] && Argv[0][1] == ':'
+ && (Argv[0][2] == '/' || Argv[0][2] != '\\'))
+ ) /* will swawnvp use PATH? */
TAINT_ENV(); /* testing IFS here is overkill, probably */
+ /* We should check PERL_SH* and PERLLIB_* as well? */
+ retry:
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 && secondtry == 0
+ && (!tmps || !*tmps)) { /* Cannot transfer `really' via shell. */
+ err = errno;
+ if (err == ENOENT) { /* No such file. */
+ /* One reason may be that EMX added .exe. We suppose
+ that .exe-less files are automatically shellable. */
+ char *no_dir;
+ (no_dir = strrchr(Argv[0], '/'))
+ || (no_dir = strrchr(Argv[0], '\\'))
+ || (no_dir = Argv[0]);
+ if (!strchr(no_dir, '.')) {
+ struct stat buffer;
+ if (stat(Argv[0], &buffer) != -1) { /* File exists. */
+ /* Maybe we need to specify the full name here? */
+ goto doshell;
+ }
+ }
+ } else if (err == ENOEXEC) { /* Need to send to shell. */
+ doshell:
+ while (a >= Argv) {
+ *(a + 2) = *a;
+ a--;
+ }
+ *Argv = sh_path;
+ *(Argv + 1) = "-c";
+ secondtry = 1;
+ goto retry;
+ }
+ }
if (rc < 0 && dowarn)
warn("Can't spawn \"%s\": %s", Argv[0], Strerror(errno));
if (rc < 0) rc = 255 << 8; /* Emulate the fork(). */
@@ -111,15 +280,22 @@ register SV **sp;
return rc;
}
+#define EXECF_SPAWN 0
+#define EXECF_EXEC 1
+#define EXECF_TRUEEXEC 2
+#define EXECF_SPAWN_NOWAIT 3
+
int
-do_spawn(cmd)
+do_spawn2(cmd, execf)
char *cmd;
+int execf;
{
register char **a;
register char *s;
char flags[10];
- char *shell, *copt;
- int rc;
+ char *shell, *copt, *news = NULL;
+ int rc, added_shell = 0, err, seenspace = 0;
+ char fullcmd[MAXNAMLEN + 1];
#ifdef TRYSHELL
if ((shell = getenv("EMXSHELL")) != NULL)
@@ -135,13 +311,23 @@ char *cmd;
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";
+ shell = sh_path;
copt = "-c";
#endif
while (*cmd && isSPACE(*cmd))
cmd++;
+ if (strnEQ(cmd,"/bin/sh",7) && isSPACE(cmd[7])) {
+ STRLEN l = strlen(sh_path);
+
+ New(1302, news, strlen(cmd) - 7 + l + 1, char);
+ strcpy(news, sh_path);
+ strcpy(news + l, cmd + 7);
+ cmd = news;
+ added_shell = 1;
+ }
+
/* save an extra exec if possible */
/* see if there are shell metacharacters in it */
@@ -157,21 +343,35 @@ char *cmd;
for (s = cmd; *s; s++) {
if (*s != ' ' && !isALPHA(*s) && strchr("$&*(){}[]'\";\\|?<>~`\n",*s)) {
- if (*s == '\n' && !s[1]) {
+ if (*s == '\n' && s[1] == '\0') {
*s = '\0';
break;
+ } else if (*s == '\\' && !seenspace) {
+ continue; /* Allow backslashes in names */
}
doshell:
+ if (execf == EXECF_TRUEEXEC)
+ return execl(shell,shell,copt,cmd,(char*)0);
+ else if (execf == EXECF_EXEC)
+ return spawnl(P_OVERLAY,shell,shell,copt,cmd,(char*)0);
+ else if (execf == EXECF_SPAWN_NOWAIT)
+ return spawnl(P_NOWAIT,shell,shell,copt,cmd,(char*)0);
+ /* In the ak code internal P_NOWAIT is P_WAIT ??? */
rc = result(P_WAIT,
- spawnl(P_NOWAIT,shell,shell,copt,cmd,(char*)0));
+ spawnl(P_NOWAIT,shell,shell,copt,cmd,(char*)0));
if (rc < 0 && dowarn)
- warn("Can't spawn \"%s\": %s", shell, Strerror(errno));
+ warn("Can't %s \"%s\": %s",
+ (execf == EXECF_SPAWN ? "spawn" : "exec"),
+ shell, Strerror(errno));
if (rc < 0) rc = 255 << 8; /* Emulate the fork(). */
+ if (news) Safefree(news);
return rc;
+ } else if (*s == ' ' || *s == '\t') {
+ seenspace = 1;
}
}
- New(402,Argv, (s - cmd) / 2 + 2, char*);
+ New(1303,Argv, (s - cmd) / 2 + 2, char*);
Cmd = savepvn(cmd, s-cmd);
a = Argv;
for (s = Cmd; *s;) {
@@ -184,31 +384,153 @@ char *cmd;
}
*a = Nullch;
if (Argv[0]) {
- rc = result(P_WAIT, spawnvp(P_NOWAIT,Argv[0],Argv));
+ int err;
+
+ if (execf == EXECF_TRUEEXEC)
+ rc = execvp(Argv[0],Argv);
+ else if (execf == EXECF_EXEC)
+ rc = spawnvp(P_OVERLAY,Argv[0],Argv);
+ else if (execf == EXECF_SPAWN_NOWAIT)
+ rc = spawnvp(P_NOWAIT,Argv[0],Argv);
+ else
+ rc = result(P_WAIT, spawnvp(P_NOWAIT,Argv[0],Argv));
+ if (rc < 0) {
+ err = errno;
+ if (err == ENOENT) { /* No such file. */
+ /* One reason may be that EMX added .exe. We suppose
+ that .exe-less files are automatically shellable. */
+ char *no_dir;
+ (no_dir = strrchr(Argv[0], '/'))
+ || (no_dir = strrchr(Argv[0], '\\'))
+ || (no_dir = Argv[0]);
+ if (!strchr(no_dir, '.')) {
+ struct stat buffer;
+ if (stat(Argv[0], &buffer) != -1) { /* File exists. */
+ /* Maybe we need to specify the full name here? */
+ goto doshell;
+ }
+ }
+ } else if (err == ENOEXEC) { /* Need to send to shell. */
+ goto doshell;
+ }
+ }
if (rc < 0 && dowarn)
- warn("Can't spawn \"%s\": %s", Argv[0], Strerror(errno));
+ warn("Can't %s \"%s\": %s",
+ ((execf != EXECF_EXEC && execf != EXECF_TRUEEXEC)
+ ? "spawn" : "exec"),
+ Argv[0], Strerror(err));
if (rc < 0) rc = 255 << 8; /* Emulate the fork(). */
} else
rc = -1;
+ if (news) Safefree(news);
do_execfree();
return rc;
}
-FILE *
-my_popen(cmd,mode)
+int
+do_spawn(cmd)
+char *cmd;
+{
+ return do_spawn2(cmd, EXECF_SPAWN);
+}
+
+int
+do_spawn_nowait(cmd)
+char *cmd;
+{
+ return do_spawn2(cmd, EXECF_SPAWN_NOWAIT);
+}
+
+bool
+do_exec(cmd)
+char *cmd;
+{
+ return do_spawn2(cmd, EXECF_EXEC);
+}
+
+bool
+os2exec(cmd)
+char *cmd;
+{
+ return do_spawn2(cmd, EXECF_TRUEEXEC);
+}
+
+PerlIO *
+my_syspopen(cmd,mode)
char *cmd;
char *mode;
{
- char *shell = getenv("EMXSHELL");
- FILE *res;
+#ifndef USE_POPEN
+
+ int p[2];
+ register I32 this, that, newfd;
+ register I32 pid, rc;
+ PerlIO *res;
+ SV *sv;
- my_setenv("EMXSHELL", "sh.exe");
+ if (pipe(p) < 0)
+ return Nullfp;
+ /* `this' is what we use in the parent, `that' in the child. */
+ this = (*mode == 'w');
+ that = !this;
+ if (tainting) {
+ taint_env();
+ taint_proper("Insecure %s%s", "EXEC");
+ }
+ /* Now we need to spawn the child. */
+ newfd = dup(*mode == 'r'); /* Preserve std* */
+ if (p[that] != (*mode == 'r')) {
+ dup2(p[that], *mode == 'r');
+ close(p[that]);
+ }
+ /* Where is `this' and newfd now? */
+ fcntl(p[this], F_SETFD, FD_CLOEXEC);
+ fcntl(newfd, F_SETFD, FD_CLOEXEC);
+ pid = do_spawn_nowait(cmd);
+ if (newfd != (*mode == 'r')) {
+ dup2(newfd, *mode == 'r'); /* Return std* back. */
+ close(newfd);
+ }
+ close(p[that]);
+ if (pid == -1) {
+ close(p[this]);
+ return NULL;
+ }
+ if (p[that] < p[this]) {
+ dup2(p[this], p[that]);
+ close(p[this]);
+ p[this] = p[that];
+ }
+ sv = *av_fetch(fdpid,p[this],TRUE);
+ (void)SvUPGRADE(sv,SVt_IV);
+ SvIVX(sv) = pid;
+ forkprocess = pid;
+ return PerlIO_fdopen(p[this], mode);
+
+#else /* USE_POPEN */
+
+ PerlIO *res;
+ SV *sv;
+
+# ifdef TRYSHELL
+ res = popen(cmd, mode);
+# else
+ char *shell = getenv("EMXSHELL");
+
+ my_setenv("EMXSHELL", sh_path);
res = popen(cmd, mode);
my_setenv("EMXSHELL", shell);
+# endif
+ sv = *av_fetch(fdpid, PerlIO_fileno(res), TRUE);
+ (void)SvUPGRADE(sv,SVt_IV);
+ SvIVX(sv) = -1; /* A cooky. */
return res;
+
+#endif /* USE_POPEN */
+
}
-/*****************************************************************************/
+/******************************************************************/
#ifndef HAS_FORK
int
@@ -220,7 +542,7 @@ fork(void)
}
#endif
-/*****************************************************************************/
+/*******************************************************************/
/* not implemented in EMX 0.9a */
void * ctermid(x) { return 0; }
@@ -229,18 +551,58 @@ void * ctermid(x) { return 0; }
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) {}
+/******************************************************************/
+/* my socket forwarders - EMX lib only provides static forwarders */
+
+static HMODULE htcp = 0;
+
+static void *
+tcp0(char *name)
+{
+ static BYTE buf[20];
+ PFN fcn;
+
+ if (!(_emx_env & 0x200)) croak("%s requires OS/2", name); /* Die if not OS/2. */
+ if (!htcp)
+ DosLoadModule(buf, sizeof buf, "tcp32dll", &htcp);
+ if (htcp && DosQueryProcAddr(htcp, 0, name, &fcn) == 0)
+ return (void *) ((void * (*)(void)) fcn) ();
+ return 0;
+}
+
+static void
+tcp1(char *name, int arg)
+{
+ static BYTE buf[20];
+ PFN fcn;
+
+ if (!(_emx_env & 0x200)) croak("%s requires OS/2", name); /* Die if not OS/2. */
+ if (!htcp)
+ DosLoadModule(buf, sizeof buf, "tcp32dll", &htcp);
+ if (htcp && DosQueryProcAddr(htcp, 0, name, &fcn) == 0)
+ ((void (*)(int)) fcn) (arg);
+}
+
+void * gethostent() { return tcp0("GETHOSTENT"); }
+void * getnetent() { return tcp0("GETNETENT"); }
+void * getprotoent() { return tcp0("GETPROTOENT"); }
+void * getservent() { return tcp0("GETSERVENT"); }
+void sethostent(x) { tcp1("SETHOSTENT", x); }
+void setnetent(x) { tcp1("SETNETENT", x); }
+void setprotoent(x) { tcp1("SETPROTOENT", x); }
+void setservent(x) { tcp1("SETSERVENT", x); }
+void endhostent() { tcp0("ENDHOSTENT"); }
+void endnetent() { tcp0("ENDNETENT"); }
+void endprotoent() { tcp0("ENDPROTOENT"); }
+void endservent() { tcp0("ENDSERVENT"); }
+
+/*****************************************************************************/
+/* not implemented in C Set++ */
+
+#ifndef __EMX__
+int setuid(x) { errno = EINVAL; return -1; }
+int setgid(x) { errno = EINVAL; return -1; }
+#endif
/*****************************************************************************/
/* stat() hack for char/block device */
@@ -268,55 +630,22 @@ os2_stat(char *name, struct stat *st)
#endif
-#ifndef NO_SYS_ALLOC
-
-static char *oldchunk;
-static long oldsize;
-
-#define _32_K (1<<15)
-#define _64_K (1<<16)
+#ifdef USE_PERL_SBRK
-/* 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. */
+/* SBRK() emulation, mostly moved to malloc.c. */
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);
+sys_alloc(int size) {
+ void *got;
+ APIRET rc = DosAllocMem(&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;
+ return got;
}
-#endif /* ! defined NO_SYS_ALLOC */
+
+#endif /* USE_PERL_SBRK */
/* tmp path */
@@ -357,28 +686,630 @@ XS(XS_File__Copy_syscopy)
flag = (unsigned long)SvIV(ST(2));
}
- errno = DosCopy(src, dst, flag);
- RETVAL = !errno;
+ RETVAL = !CheckOSError(DosCopy(src, dst, flag));
ST(0) = sv_newmortal();
sv_setiv(ST(0), (IV)RETVAL);
}
XSRETURN(1);
}
-OS2_Perl_data_t OS2_Perl_data;
+char *
+mod2fname(sv)
+ SV *sv;
+{
+ static char fname[9];
+ int pos = 6, len, avlen;
+ unsigned int sum = 0;
+ AV *av;
+ SV *svp;
+ char *s;
+
+ if (!SvROK(sv)) croak("Not a reference given to mod2fname");
+ sv = SvRV(sv);
+ if (SvTYPE(sv) != SVt_PVAV)
+ croak("Not array reference given to mod2fname");
+
+ avlen = av_len((AV*)sv);
+ if (avlen < 0)
+ croak("Empty array reference given to mod2fname");
+
+ s = SvPV(*av_fetch((AV*)sv, avlen, FALSE), na);
+ strncpy(fname, s, 8);
+ len = strlen(s);
+ if (len < 6) pos = len;
+ while (*s) {
+ sum = 33 * sum + *(s++); /* Checksumming first chars to
+ * get the capitalization into c.s. */
+ }
+ avlen --;
+ while (avlen >= 0) {
+ s = SvPV(*av_fetch((AV*)sv, avlen, FALSE), na);
+ while (*s) {
+ sum = 33 * sum + *(s++); /* 7 is primitive mod 13. */
+ }
+ avlen --;
+ }
+ fname[pos] = 'A' + (sum % 26);
+ fname[pos + 1] = 'A' + (sum / 26 % 26);
+ fname[pos + 2] = '\0';
+ return (char *)fname;
+}
+
+XS(XS_DynaLoader_mod2fname)
+{
+ dXSARGS;
+ if (items != 1)
+ croak("Usage: DynaLoader::mod2fname(sv)");
+ {
+ SV * sv = ST(0);
+ char * RETVAL;
+
+ RETVAL = mod2fname(sv);
+ ST(0) = sv_newmortal();
+ sv_setpv((SV*)ST(0), RETVAL);
+ }
+ XSRETURN(1);
+}
+
+char *
+os2error(int rc)
+{
+ static char buf[300];
+ ULONG len;
+
+ if (!(_emx_env & 0x200)) return ""; /* Nop if not OS/2. */
+ if (rc == 0)
+ return NULL;
+ if (DosGetMessage(NULL, 0, buf, sizeof buf - 1, rc, "OSO001.MSG", &len))
+ sprintf(buf, "OS/2 system error code %d=0x%x", rc, rc);
+ else
+ buf[len] = '\0';
+ return buf;
+}
+
+char *
+perllib_mangle(char *s, unsigned int l)
+{
+ static char *newp, *oldp;
+ static int newl, oldl, notfound;
+ static char ret[STATIC_FILE_LENGTH+1];
+
+ if (!newp && !notfound) {
+ newp = getenv("PERLLIB_PREFIX");
+ if (newp) {
+ char *s;
+
+ oldp = newp;
+ while (*newp && !isSPACE(*newp) && *newp != ';') {
+ newp++; oldl++; /* Skip digits. */
+ }
+ while (*newp && (isSPACE(*newp) || *newp == ';')) {
+ newp++; /* Skip whitespace. */
+ }
+ newl = strlen(newp);
+ if (newl == 0 || oldl == 0) {
+ die("Malformed PERLLIB_PREFIX");
+ }
+ strcpy(ret, newp);
+ s = ret;
+ while (*s) {
+ if (*s == '\\') *s = '/';
+ s++;
+ }
+ } else {
+ notfound = 1;
+ }
+ }
+ if (!newp) {
+ return s;
+ }
+ if (l == 0) {
+ l = strlen(s);
+ }
+ if (l < oldl || strnicmp(oldp, s, oldl) != 0) {
+ return s;
+ }
+ if (l + newl - oldl > STATIC_FILE_LENGTH || newl > STATIC_FILE_LENGTH) {
+ die("Malformed PERLLIB_PREFIX");
+ }
+ strcpy(ret + newl, s + oldl);
+ return ret;
+}
+
+extern void dlopen();
+void *fakedl = &dlopen; /* Pull in dynaloading part. */
+
+#define sys_is_absolute(path) ( isALPHA((path)[0]) && (path)[1] == ':' \
+ && ((path)[2] == '/' || (path)[2] == '\\'))
+#define sys_is_rooted _fnisabs
+#define sys_is_relative _fnisrel
+#define current_drive _getdrive
+
+#undef chdir /* Was _chdir2. */
+#define sys_chdir(p) (chdir(p) == 0)
+#define change_drive(d) (_chdrive(d), (current_drive() == toupper(d)))
+
+XS(XS_Cwd_current_drive)
+{
+ dXSARGS;
+ if (items != 0)
+ croak("Usage: Cwd::current_drive()");
+ {
+ char RETVAL;
+
+ RETVAL = current_drive();
+ ST(0) = sv_newmortal();
+ sv_setpvn(ST(0), (char *)&RETVAL, 1);
+ }
+ XSRETURN(1);
+}
+
+XS(XS_Cwd_sys_chdir)
+{
+ dXSARGS;
+ if (items != 1)
+ croak("Usage: Cwd::sys_chdir(path)");
+ {
+ char * path = (char *)SvPV(ST(0),na);
+ bool RETVAL;
+
+ RETVAL = sys_chdir(path);
+ ST(0) = boolSV(RETVAL);
+ if (SvREFCNT(ST(0))) sv_2mortal(ST(0));
+ }
+ XSRETURN(1);
+}
+
+XS(XS_Cwd_change_drive)
+{
+ dXSARGS;
+ if (items != 1)
+ croak("Usage: Cwd::change_drive(d)");
+ {
+ char d = (char)*SvPV(ST(0),na);
+ bool RETVAL;
+
+ RETVAL = change_drive(d);
+ ST(0) = boolSV(RETVAL);
+ if (SvREFCNT(ST(0))) sv_2mortal(ST(0));
+ }
+ XSRETURN(1);
+}
+
+XS(XS_Cwd_sys_is_absolute)
+{
+ dXSARGS;
+ if (items != 1)
+ croak("Usage: Cwd::sys_is_absolute(path)");
+ {
+ char * path = (char *)SvPV(ST(0),na);
+ bool RETVAL;
+
+ RETVAL = sys_is_absolute(path);
+ ST(0) = boolSV(RETVAL);
+ if (SvREFCNT(ST(0))) sv_2mortal(ST(0));
+ }
+ XSRETURN(1);
+}
+
+XS(XS_Cwd_sys_is_rooted)
+{
+ dXSARGS;
+ if (items != 1)
+ croak("Usage: Cwd::sys_is_rooted(path)");
+ {
+ char * path = (char *)SvPV(ST(0),na);
+ bool RETVAL;
+
+ RETVAL = sys_is_rooted(path);
+ ST(0) = boolSV(RETVAL);
+ if (SvREFCNT(ST(0))) sv_2mortal(ST(0));
+ }
+ XSRETURN(1);
+}
+
+XS(XS_Cwd_sys_is_relative)
+{
+ dXSARGS;
+ if (items != 1)
+ croak("Usage: Cwd::sys_is_relative(path)");
+ {
+ char * path = (char *)SvPV(ST(0),na);
+ bool RETVAL;
+
+ RETVAL = sys_is_relative(path);
+ ST(0) = boolSV(RETVAL);
+ if (SvREFCNT(ST(0))) sv_2mortal(ST(0));
+ }
+ XSRETURN(1);
+}
+
+XS(XS_Cwd_sys_cwd)
+{
+ dXSARGS;
+ if (items != 0)
+ croak("Usage: Cwd::sys_cwd()");
+ {
+ char p[MAXPATHLEN];
+ char * RETVAL;
+ RETVAL = _getcwd2(p, MAXPATHLEN);
+ ST(0) = sv_newmortal();
+ sv_setpv((SV*)ST(0), RETVAL);
+ }
+ XSRETURN(1);
+}
+
+XS(XS_Cwd_sys_abspath)
+{
+ dXSARGS;
+ if (items < 1 || items > 2)
+ croak("Usage: Cwd::sys_abspath(path, dir = NULL)");
+ {
+ char * path = (char *)SvPV(ST(0),na);
+ char * dir;
+ char p[MAXPATHLEN];
+ char * RETVAL;
+
+ if (items < 2)
+ dir = NULL;
+ else {
+ dir = (char *)SvPV(ST(1),na);
+ }
+ if (path[0] == '.' && (path[1] == '/' || path[1] == '\\')) {
+ path += 2;
+ }
+ if (dir == NULL) {
+ if (_abspath(p, path, MAXPATHLEN) == 0) {
+ RETVAL = p;
+ } else {
+ RETVAL = NULL;
+ }
+ } else {
+ /* Absolute with drive: */
+ if ( sys_is_absolute(path) ) {
+ if (_abspath(p, path, MAXPATHLEN) == 0) {
+ RETVAL = p;
+ } else {
+ RETVAL = NULL;
+ }
+ } else if (path[0] == '/' || path[0] == '\\') {
+ /* Rooted, but maybe on different drive. */
+ if (isALPHA(dir[0]) && dir[1] == ':' ) {
+ char p1[MAXPATHLEN];
+
+ /* Need to prepend the drive. */
+ p1[0] = dir[0];
+ p1[1] = dir[1];
+ Copy(path, p1 + 2, strlen(path) + 1, char);
+ RETVAL = p;
+ if (_abspath(p, p1, MAXPATHLEN) == 0) {
+ RETVAL = p;
+ } else {
+ RETVAL = NULL;
+ }
+ } else if (_abspath(p, path, MAXPATHLEN) == 0) {
+ RETVAL = p;
+ } else {
+ RETVAL = NULL;
+ }
+ } else {
+ /* Either path is relative, or starts with a drive letter. */
+ /* If the path starts with a drive letter, then dir is
+ relevant only if
+ a/b) it is absolute/x:relative on the same drive.
+ c) path is on current drive, and dir is rooted
+ In all the cases it is safe to drop the drive part
+ of the path. */
+ if ( !sys_is_relative(path) ) {
+ int is_drived;
+
+ if ( ( ( sys_is_absolute(dir)
+ || (isALPHA(dir[0]) && dir[1] == ':'
+ && strnicmp(dir, path,1) == 0))
+ && strnicmp(dir, path,1) == 0)
+ || ( !(isALPHA(dir[0]) && dir[1] == ':')
+ && toupper(path[0]) == current_drive())) {
+ path += 2;
+ } else if (_abspath(p, path, MAXPATHLEN) == 0) {
+ RETVAL = p; goto done;
+ } else {
+ RETVAL = NULL; goto done;
+ }
+ }
+ {
+ /* Need to prepend the absolute path of dir. */
+ char p1[MAXPATHLEN];
+
+ if (_abspath(p1, dir, MAXPATHLEN) == 0) {
+ int l = strlen(p1);
+
+ if (p1[ l - 1 ] != '/') {
+ p1[ l ] = '/';
+ l++;
+ }
+ Copy(path, p1 + l, strlen(path) + 1, char);
+ if (_abspath(p, p1, MAXPATHLEN) == 0) {
+ RETVAL = p;
+ } else {
+ RETVAL = NULL;
+ }
+ } else {
+ RETVAL = NULL;
+ }
+ }
+ done:
+ }
+ }
+ ST(0) = sv_newmortal();
+ sv_setpv((SV*)ST(0), RETVAL);
+ }
+ XSRETURN(1);
+}
+typedef APIRET (*PELP)(PSZ path, ULONG type);
+
+APIRET
+ExtLIBPATH(ULONG ord, PSZ path, ULONG type)
+{
+ loadByOrd(ord); /* Guarantied to load or die! */
+ return (*(PELP)ExtFCN[ord])(path, type);
+}
+
+#define extLibpath(type) \
+ (CheckOSError(ExtLIBPATH(ORD_QUERY_ELP, to, ((type) ? END_LIBPATH \
+ : BEGIN_LIBPATH))) \
+ ? NULL : to )
+
+#define extLibpath_set(p,type) \
+ (!CheckOSError(ExtLIBPATH(ORD_SET_ELP, (p), ((type) ? END_LIBPATH \
+ : BEGIN_LIBPATH))))
+
+XS(XS_Cwd_extLibpath)
+{
+ dXSARGS;
+ if (items < 0 || items > 1)
+ croak("Usage: Cwd::extLibpath(type = 0)");
+ {
+ bool type;
+ char to[1024];
+ U32 rc;
+ char * RETVAL;
+
+ if (items < 1)
+ type = 0;
+ else {
+ type = (int)SvIV(ST(0));
+ }
+
+ RETVAL = extLibpath(type);
+ ST(0) = sv_newmortal();
+ sv_setpv((SV*)ST(0), RETVAL);
+ }
+ XSRETURN(1);
+}
+
+XS(XS_Cwd_extLibpath_set)
+{
+ dXSARGS;
+ if (items < 1 || items > 2)
+ croak("Usage: Cwd::extLibpath_set(s, type = 0)");
+ {
+ char * s = (char *)SvPV(ST(0),na);
+ bool type;
+ U32 rc;
+ bool RETVAL;
+
+ if (items < 2)
+ type = 0;
+ else {
+ type = (int)SvIV(ST(1));
+ }
+
+ RETVAL = extLibpath_set(s, type);
+ ST(0) = boolSV(RETVAL);
+ if (SvREFCNT(ST(0))) sv_2mortal(ST(0));
+ }
+ XSRETURN(1);
+}
int
Xs_OS2_init()
{
char *file = __FILE__;
{
- newXS("File::Copy::syscopy", XS_File__Copy_syscopy, file);
+ GV *gv;
+
+ if (_emx_env & 0x200) { /* OS/2 */
+ newXS("File::Copy::syscopy", XS_File__Copy_syscopy, file);
+ newXS("Cwd::extLibpath", XS_Cwd_extLibpath, file);
+ newXS("Cwd::extLibpath_set", XS_Cwd_extLibpath_set, file);
+ }
+ newXS("DynaLoader::mod2fname", XS_DynaLoader_mod2fname, file);
+ newXS("Cwd::current_drive", XS_Cwd_current_drive, file);
+ newXS("Cwd::sys_chdir", XS_Cwd_sys_chdir, file);
+ newXS("Cwd::change_drive", XS_Cwd_change_drive, file);
+ newXS("Cwd::sys_is_absolute", XS_Cwd_sys_is_absolute, file);
+ newXS("Cwd::sys_is_rooted", XS_Cwd_sys_is_rooted, file);
+ newXS("Cwd::sys_is_relative", XS_Cwd_sys_is_relative, file);
+ newXS("Cwd::sys_cwd", XS_Cwd_sys_cwd, file);
+ newXS("Cwd::sys_abspath", XS_Cwd_sys_abspath, file);
+ gv = gv_fetchpv("OS2::is_aout", TRUE, SVt_PV);
+ GvMULTI_on(gv);
+#ifdef PERL_IS_AOUT
+ sv_setiv(GvSV(gv), 1);
+#endif
}
}
+OS2_Perl_data_t OS2_Perl_data;
+
void
-Perl_OS2_init()
+Perl_OS2_init(char **env)
{
+ char *shell;
+
settmppath();
OS2_Perl_data.xs_init = &Xs_OS2_init;
+ if (environ == NULL) {
+ environ = env;
+ }
+ if ( (shell = getenv("PERL_SH_DRIVE")) ) {
+ New(1304, sh_path, strlen(SH_PATH) + 1, char);
+ strcpy(sh_path, SH_PATH);
+ sh_path[0] = shell[0];
+ } else if ( (shell = getenv("PERL_SH_DIR")) ) {
+ int l = strlen(shell), i;
+ if (shell[l-1] == '/' || shell[l-1] == '\\') {
+ l--;
+ }
+ New(1304, sh_path, l + 8, char);
+ strncpy(sh_path, shell, l);
+ strcpy(sh_path + l, "/sh.exe");
+ for (i = 0; i < l; i++) {
+ if (sh_path[i] == '\\') sh_path[i] = '/';
+ }
+ }
+}
+
+#undef tmpnam
+#undef tmpfile
+
+char *
+my_tmpnam (char *str)
+{
+ char *p = getenv("TMP"), *tpath;
+ int len;
+
+ if (!p) p = getenv("TEMP");
+ tpath = tempnam(p, "pltmp");
+ if (str && tpath) {
+ strcpy(str, tpath);
+ return str;
+ }
+ return tpath;
+}
+
+FILE *
+my_tmpfile ()
+{
+ struct stat s;
+
+ stat(".", &s);
+ if (s.st_mode & S_IWOTH) {
+ return tmpfile();
+ }
+ return fopen(my_tmpnam(NULL), "w+b"); /* Race condition, but
+ grants TMP. */
+}
+
+#undef flock
+
+/* This code was contributed by Rocco Caputo. */
+int
+my_flock(int handle, int op)
+{
+ FILELOCK rNull, rFull;
+ ULONG timeout, handle_type, flag_word;
+ APIRET rc;
+ int blocking, shared;
+ static int use_my = -1;
+
+ if (use_my == -1) {
+ char *s = getenv("USE_PERL_FLOCK");
+ if (s)
+ use_my = atoi(s);
+ else
+ use_my = 1;
+ }
+ if (!(_emx_env & 0x200) || !use_my)
+ return flock(handle, op); /* Delegate to EMX. */
+
+ // is this a file?
+ if ((DosQueryHType(handle, &handle_type, &flag_word) != 0) ||
+ (handle_type & 0xFF))
+ {
+ errno = EBADF;
+ return -1;
+ }
+ // set lock/unlock ranges
+ rNull.lOffset = rNull.lRange = rFull.lOffset = 0;
+ rFull.lRange = 0x7FFFFFFF;
+ // set timeout for blocking
+ timeout = ((blocking = !(op & LOCK_NB))) ? 100 : 1;
+ // shared or exclusive?
+ shared = (op & LOCK_SH) ? 1 : 0;
+ // do not block the unlock
+ if (op & (LOCK_UN | LOCK_SH | LOCK_EX)) {
+ rc = DosSetFileLocks(handle, &rFull, &rNull, timeout, shared);
+ switch (rc) {
+ case 0:
+ errno = 0;
+ return 0;
+ case ERROR_INVALID_HANDLE:
+ errno = EBADF;
+ return -1;
+ case ERROR_SHARING_BUFFER_EXCEEDED:
+ errno = ENOLCK;
+ return -1;
+ case ERROR_LOCK_VIOLATION:
+ break; // not an error
+ case ERROR_INVALID_PARAMETER:
+ case ERROR_ATOMIC_LOCK_NOT_SUPPORTED:
+ case ERROR_READ_LOCKS_NOT_SUPPORTED:
+ errno = EINVAL;
+ return -1;
+ case ERROR_INTERRUPT:
+ errno = EINTR;
+ return -1;
+ default:
+ errno = EINVAL;
+ return -1;
+ }
+ }
+ // lock may block
+ if (op & (LOCK_SH | LOCK_EX)) {
+ // for blocking operations
+ for (;;) {
+ rc =
+ DosSetFileLocks(
+ handle,
+ &rNull,
+ &rFull,
+ timeout,
+ shared
+ );
+ switch (rc) {
+ case 0:
+ errno = 0;
+ return 0;
+ case ERROR_INVALID_HANDLE:
+ errno = EBADF;
+ return -1;
+ case ERROR_SHARING_BUFFER_EXCEEDED:
+ errno = ENOLCK;
+ return -1;
+ case ERROR_LOCK_VIOLATION:
+ if (!blocking) {
+ errno = EWOULDBLOCK;
+ return -1;
+ }
+ break;
+ case ERROR_INVALID_PARAMETER:
+ case ERROR_ATOMIC_LOCK_NOT_SUPPORTED:
+ case ERROR_READ_LOCKS_NOT_SUPPORTED:
+ errno = EINVAL;
+ return -1;
+ case ERROR_INTERRUPT:
+ errno = EINTR;
+ return -1;
+ default:
+ errno = EINVAL;
+ return -1;
+ }
+ // give away timeslice
+ DosSleep(1);
+ }
+ }
+
+ errno = 0;
+ return 0;
}
diff --git a/gnu/usr.bin/perl/os2/os2ish.h b/gnu/usr.bin/perl/os2/os2ish.h
index 41caa422b14..b62e3d04d4b 100644
--- a/gnu/usr.bin/perl/os2/os2ish.h
+++ b/gnu/usr.bin/perl/os2/os2ish.h
@@ -14,6 +14,41 @@
#define HAS_KILL
#define HAS_WAIT
+#define HAS_DLERROR
+#define HAS_WAITPID_RUNTIME (_emx_env & 0x200)
+
+/* USEMYBINMODE
+ * This symbol, if defined, indicates that the program should
+ * use the routine my_binmode(FILE *fp, char iotype) to insure
+ * that a file is in "binary" mode -- that is, that no translation
+ * of bytes occurs on read or write operations.
+ */
+#undef USEMYBINMODE
+
+/* USE_STAT_RDEV:
+ * This symbol is defined if this system has a stat structure declaring
+ * st_rdev
+ */
+#define USE_STAT_RDEV /**/
+
+/* ACME_MESS:
+ * This symbol, if defined, indicates that error messages should be
+ * should be generated in a format that allows the use of the Acme
+ * GUI/editor's autofind feature.
+ */
+#undef ACME_MESS /**/
+
+/* ALTERNATE_SHEBANG:
+ * This symbol, if defined, contains a "magic" string which may be used
+ * as the first line of a Perl program designed to be executed directly
+ * by name, instead of the standard Unix #!. If ALTERNATE_SHEBANG
+ * begins with a character other then #, then Perl will only treat
+ * it as a command line if if finds the string "perl" in the first
+ * word; otherwise it's treated as the first line of code in the script.
+ * (IOW, Perl won't hand off to another interpreter via an alternate
+ * shebang sequence that might be legal Perl code.)
+ */
+#define ALTERNATE_SHEBANG "extproc "
#ifndef SIGABRT
# define SIGABRT SIGILL
@@ -23,22 +58,64 @@
#endif
#define ABORT() kill(getpid(),SIGABRT);
-#define BIT_BUCKET "/dev/null" /* Will this work? */
+#define BIT_BUCKET "/dev/nul" /* Will this work? */
-void Perl_OS2_init();
+#if defined(I_SYS_UN) && !defined(TCPIPV4)
+/* It is not working without TCPIPV4 defined. */
+# undef I_SYS_UN
+#endif
+
+void Perl_OS2_init(char **);
+
+/* XXX This code hideously puts env inside: */
#define PERL_SYS_INIT(argcp, argvp) STMT_START { \
_response(argcp, argvp); \
_wildcard(argcp, argvp); \
- Perl_OS2_init(); } STMT_END
+ Perl_OS2_init(env); } STMT_END
#define PERL_SYS_TERM()
-#define dXSUB_SYS int fake = OS2_XS_init()
+/* #define PERL_SYS_TERM() STMT_START { \
+ if (Perl_HAB_set) WinTerminate(Perl_hab); } STMT_END */
+
+#define dXSUB_SYS OS2_XS_init()
+
+#ifdef PERL_IS_AOUT
+/* # define HAS_FORK */
+/* # define HIDEMYMALLOC */
+/* # define PERL_SBRK_VIA_MALLOC */ /* gets off-page sbrk... */
+#else /* !PERL_IS_AOUT */
+# ifndef PERL_FOR_X2P
+# ifdef EMX_BAD_SBRK
+# define USE_PERL_SBRK
+# endif
+# else
+# define PerlIO FILE
+# endif
+# define SYSTEM_ALLOC(a) sys_alloc(a)
+
+void *sys_alloc(int size);
+
+#endif /* !PERL_IS_AOUT */
+#if !defined(PERL_CORE) && !defined(PerlIO) /* a2p */
+# define PerlIO FILE
+#endif
#define TMPPATH tmppath
#define TMPPATH1 "plXXXXXX"
extern char *tmppath;
+PerlIO *my_syspopen(char *cmd, char *mode);
+/* Cannot prototype with I32 at this point. */
+int my_syspclose(PerlIO *f);
+FILE *my_tmpfile (void);
+char *my_tmpnam (char *);
+
+#define tmpfile my_tmpfile
+#define tmpnam my_tmpnam
+#define isatty _isterm
+#define rand random
+#define srand srandom
/*
* fwrite1() should be a routine with the same calling sequence as fwrite(),
@@ -49,6 +126,12 @@ extern char *tmppath;
#define fwrite1 fwrite
#define my_getenv(var) getenv(var)
+#define flock my_flock
+
+void *emx_calloc (size_t, size_t);
+void emx_free (void *);
+void *emx_malloc (size_t);
+void *emx_realloc (void *, size_t);
/*****************************************************************************/
@@ -61,7 +144,6 @@ extern char *tmppath;
/* 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) \
@@ -76,6 +158,7 @@ extern char *tmppath;
#define Stat(fname,bufptr) os2_stat((fname),(bufptr))
#define Fstat(fd,bufptr) fstat((fd),(bufptr))
#define Fflush(fp) fflush(fp)
+#define Mkdir(path,mode) mkdir((path),(mode))
#undef S_IFBLK
#undef S_ISBLK
@@ -87,23 +170,231 @@ extern char *tmppath;
#define Stat(fname,bufptr) stat((fname),(bufptr))
#define Fstat(fd,bufptr) fstat((fd),(bufptr))
#define Fflush(fp) fflush(fp)
+#define Mkdir(path,mode) mkdir((path),(mode))
#endif
+/* With SD386 it is impossible to debug register variables. */
+#if !defined(PERL_IS_AOUT) && defined(DEBUGGING) && !defined(register)
+# define register
+#endif
+
/* Our private OS/2 specific data. */
typedef struct OS2_Perl_data {
unsigned long flags;
unsigned long phab;
int (*xs_init)();
+ unsigned long rc;
+ unsigned long severity;
} 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 ((HAB)OS2_Perl_data.phab)
+#define Perl_rc (OS2_Perl_data.rc)
+#define Perl_severity (OS2_Perl_data.severity)
+#define errno_isOS2 12345678
+#define OS2_Perl_flags (OS2_Perl_data.flags)
#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 Perl_HAB_set (OS2_Perl_flags & Perl_HAB_set_f)
+#define set_Perl_HAB_f (OS2_Perl_flags |= Perl_HAB_set_f)
+#define set_Perl_HAB(h) (set_Perl_HAB_f, Perl_hab = h)
#define OS2_XS_init() (*OS2_Perl_data.xs_init)()
+/* The expressions below return true on error. */
+/* INCL_DOSERRORS needed. rc should be declared outside. */
+#define CheckOSError(expr) (!(rc = (expr)) ? 0 : (FillOSError(rc), 1))
+/* INCL_WINERRORS needed. */
+#define SaveWinError(expr) ((expr) ? : (FillWinError, 0))
+#define CheckWinError(expr) ((expr) ? 0: (FillWinError, 1))
+#define FillOSError(rc) (Perl_rc = rc, \
+ errno = errno_isOS2, \
+ Perl_severity = SEVERITY_ERROR)
+#define FillWinError (Perl_rc = WinGetLastError(Perl_hab), \
+ errno = errno_isOS2, \
+ Perl_severity = ERRORIDSEV(Perl_rc), \
+ Perl_rc = ERRORIDERROR(Perl_rc))
+#define Acquire_hab() if (!Perl_HAB_set) { \
+ Perl_hab = WinInitialize(0); \
+ if (!Perl_hab) die("WinInitialize failed"); \
+ set_Perl_HAB_f; \
+ }
+
+#define STATIC_FILE_LENGTH 127
+
+#define PERLLIB_MANGLE(s, n) perllib_mangle((s), (n))
+char *perllib_mangle(char *, unsigned int);
+
+char *os2error(int rc);
+
+/* ************************************************************ */
+#define Dos32QuerySysState DosQuerySysState
+#define QuerySysState(flags, pid, buf, bufsz) \
+ Dos32QuerySysState(flags, 0, pid, 0, buf, bufsz)
+
+#define QSS_PROCESS 1
+#define QSS_MODULE 4
+#define QSS_SEMAPHORES 2
+#define QSS_FILE 8 /* Buggy until fixpack18 */
+#define QSS_SHARED 16
+
+#ifdef _OS2EMX_H
+
+APIRET APIENTRY Dos32QuerySysState(ULONG func,ULONG arg1,ULONG pid,
+ ULONG _res_,PVOID buf,ULONG bufsz);
+typedef struct {
+ ULONG threadcnt;
+ ULONG proccnt;
+ ULONG modulecnt;
+} QGLOBAL, *PQGLOBAL;
+
+typedef struct {
+ ULONG rectype;
+ USHORT threadid;
+ USHORT slotid;
+ ULONG sleepid;
+ ULONG priority;
+ ULONG systime;
+ ULONG usertime;
+ UCHAR state;
+ UCHAR _reserved1_; /* padding to ULONG */
+ USHORT _reserved2_; /* padding to ULONG */
+} QTHREAD, *PQTHREAD;
+
+typedef struct {
+ USHORT sfn;
+ USHORT refcnt;
+ USHORT flags1;
+ USHORT flags2;
+ USHORT accmode1;
+ USHORT accmode2;
+ ULONG filesize;
+ USHORT volhnd;
+ USHORT attrib;
+ USHORT _reserved_;
+} QFDS, *PQFDS;
+
+typedef struct qfile {
+ ULONG rectype;
+ struct qfile *next;
+ ULONG opencnt;
+ PQFDS filedata;
+ char name[1];
+} QFILE, *PQFILE;
+
+typedef struct {
+ ULONG rectype;
+ PQTHREAD threads;
+ USHORT pid;
+ USHORT ppid;
+ ULONG type;
+ ULONG state;
+ ULONG sessid;
+ USHORT hndmod;
+ USHORT threadcnt;
+ ULONG privsem32cnt;
+ ULONG _reserved2_;
+ USHORT sem16cnt;
+ USHORT dllcnt;
+ USHORT shrmemcnt;
+ USHORT fdscnt;
+ PUSHORT sem16s;
+ PUSHORT dlls;
+ PUSHORT shrmems;
+ PUSHORT fds;
+} QPROCESS, *PQPROCESS;
+
+typedef struct sema {
+ struct sema *next;
+ USHORT refcnt;
+ UCHAR sysflags;
+ UCHAR sysproccnt;
+ ULONG _reserved1_;
+ USHORT index;
+ CHAR name[1];
+} QSEMA, *PQSEMA;
+
+typedef struct {
+ ULONG rectype;
+ ULONG _reserved1_;
+ USHORT _reserved2_;
+ USHORT syssemidx;
+ ULONG index;
+ QSEMA sema;
+} QSEMSTRUC, *PQSEMSTRUC;
+
+typedef struct {
+ USHORT pid;
+ USHORT opencnt;
+} QSEMOWNER32, *PQSEMOWNER32;
+
+typedef struct {
+ PQSEMOWNER32 own;
+ PCHAR name;
+ PVOID semrecs; /* array of associated sema's */
+ USHORT flags;
+ USHORT semreccnt;
+ USHORT waitcnt;
+ USHORT _reserved_; /* padding to ULONG */
+} QSEMSMUX32, *PQSEMSMUX32;
+
+typedef struct {
+ PQSEMOWNER32 own;
+ PCHAR name;
+ PQSEMSMUX32 mux;
+ USHORT flags;
+ USHORT postcnt;
+} QSEMEV32, *PQSEMEV32;
+
+typedef struct {
+ PQSEMOWNER32 own;
+ PCHAR name;
+ PQSEMSMUX32 mux;
+ USHORT flags;
+ USHORT refcnt;
+ USHORT thrdnum;
+ USHORT _reserved_; /* padding to ULONG */
+} QSEMMUX32, *PQSEMMUX32;
+
+typedef struct semstr32 {
+ struct semstr *next;
+ QSEMEV32 evsem;
+ QSEMMUX32 muxsem;
+ QSEMSMUX32 smuxsem;
+} QSEMSTRUC32, *PQSEMSTRUC32;
+
+typedef struct shrmem {
+ struct shrmem *next;
+ USHORT hndshr;
+ USHORT selshr;
+ USHORT refcnt;
+ CHAR name[1];
+} QSHRMEM, *PQSHRMEM;
+
+typedef struct module {
+ struct module *next;
+ USHORT hndmod;
+ USHORT type;
+ ULONG refcnt;
+ ULONG segcnt;
+ PVOID _reserved_;
+ PCHAR name;
+ USHORT modref[1];
+} QMODULE, *PQMODULE;
+
+typedef struct {
+ PQGLOBAL gbldata;
+ PQPROCESS procdata;
+ PQSEMSTRUC semadata;
+ PQSEMSTRUC32 sem32data;
+ PQSHRMEM shrmemdata;
+ PQMODULE moddata;
+ PVOID _reserved2_;
+ PQFILE filedata;
+} QTOPLEVEL, *PQTOPLEVEL;
+/* ************************************************************ */
+
+PQTOPLEVEL get_sysinfo(ULONG pid, ULONG flags);
+
+#endif /* _OS2EMX_H */
+
diff --git a/gnu/usr.bin/perl/os2/perl2cmd.pl b/gnu/usr.bin/perl/os2/perl2cmd.pl
index aa1c353f136..e774f773d03 100644
--- a/gnu/usr.bin/perl/os2/perl2cmd.pl
+++ b/gnu/usr.bin/perl/os2/perl2cmd.pl
@@ -16,13 +16,14 @@ EOU
$idir = $Config{installbin};
$indir =~ s|\\|/|g ;
-foreach $file (<$idir/*.>) {
+foreach $file (<$idir/*>) {
+ next if $file =~ /\.exe/i;
$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', "echo extproc perl -S >$dir\\$base.cmd";
system 'cmd.exe', '/c', "type $file >> $dir\\$base.cmd";
}