summaryrefslogtreecommitdiff
path: root/os2
diff options
context:
space:
mode:
authorPerl 5 Porters <perl5-porters@africa.nicoh.com>1996-02-08 10:31:00 +0000
committerAndy Dougherty <doughera@lafcol.lafayette.edu>1996-02-08 10:31:00 +0000
commitc0c09dfd3cf50dacd0bf01dff34b4904c5ed1cc6 (patch)
tree584582791ab07b60b371935bd59423b9e7d2ea0d /os2
parent6f45a1d401152a2c8202b58306cc112de4c9bafe (diff)
downloadperl-c0c09dfd3cf50dacd0bf01dff34b4904c5ed1cc6.tar.gz
OS/2 updates.
Diffstat (limited to 'os2')
-rw-r--r--os2/Makefile.SHs1
-rw-r--r--os2/README87
-rw-r--r--os2/README.old529
-rw-r--r--os2/diff.Makefile66
-rw-r--r--os2/diff.c2ph2
-rw-r--r--os2/diff.exec77
-rw-r--r--os2/os2.c129
-rw-r--r--os2/os2ish.h7
8 files changed, 846 insertions, 52 deletions
diff --git a/os2/Makefile.SHs b/os2/Makefile.SHs
index 35a9f17278..a08a3f0da1 100644
--- a/os2/Makefile.SHs
+++ b/os2/Makefile.SHs
@@ -19,6 +19,7 @@ perl5.def: perl.linkexp
echo DATA LOADONCALL NONSHARED MULTIPLE >>$@
echo EXPORTS >>$@
echo ' "ctermid"' >>$@
+ echo ' "settmppath"' >>$@
!NO!SUBS!
if [ ! -z "$myttyname" ] ; then
diff --git a/os2/README b/os2/README
index 5df90ce03d..7cac330dc3 100644
--- a/os2/README
+++ b/os2/README
@@ -78,10 +78,11 @@ 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.
+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 overwrites it;
+separately, since by default perl5.001m/configure may overwrite it;
like this:
tar vzxf perl5.004.tar.gz perl5.004/Configure
@@ -99,25 +100,24 @@ 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 on my system
+ # 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
- # man pages are not installed
e) At the end of August GNU make and pdksh were too buggy for compile.
Both maintainers have patches that make it possible to compile perl.
The binaries are included in
ftp://ftp.math.ohio-state.edu/pub/users/ilya/os2
patches are available too.
-Note that the beta of pdksh5.2.4 can run Configure, but not build, since
- sh file
-may actually call file.SH ! The maintainer is notified, I hope this will be
-fixed before actual release.
+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
@@ -155,3 +155,74 @@ with dynamic extensions is:
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,
+with 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/os2/README.old b/os2/README.old
new file mode 100644
index 0000000000..f49d6be1fa
--- /dev/null
+++ b/os2/README.old
@@ -0,0 +1,529 @@
+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/os2/diff.Makefile b/os2/diff.Makefile
index d97cc067e9..2d0b7238f1 100644
--- a/os2/diff.Makefile
+++ b/os2/diff.Makefile
@@ -1,5 +1,5 @@
-*** Makefile.SH.orig Mon Nov 20 12:56:12 1995
---- Makefile.SH Fri Dec 08 00:02:46 1995
+*** Makefile.SH.orig Fri Feb 02 16:38:32 1996
+--- Makefile.SH Sat Feb 03 14:40:28 1996
***************
*** 31,43 ****
*[0-9]) plibsuf=.$so.$patchlevel;;
@@ -77,7 +77,7 @@
## In the following dollars and backticks do not need the extra backslash.
***************
-*** 180,190 ****
+*** 178,188 ****
c = $(c1) $(c2) $(c3) miniperlmain.c perlmain.c
@@ -89,7 +89,7 @@
obj = $(obj1) $(obj2) $(obj3) $(ARCHOBJS)
# Once perl has been Configure'd and built ok you build different
---- 182,191 ----
+--- 180,189 ----
c = $(c1) $(c2) $(c3) miniperlmain.c perlmain.c
@@ -101,7 +101,7 @@
# Once perl has been Configure'd and built ok you build different
***************
-*** 203,209 ****
+*** 201,207 ****
# grrr
SHELL = /bin/sh
@@ -109,7 +109,7 @@
$(CCCMD) $(PLDLFLAGS) $*.c
all: makefile miniperl $(private) $(plextract) $(public) $(dynamic_ext)
---- 204,210 ----
+--- 202,208 ----
# grrr
SHELL = /bin/sh
@@ -118,12 +118,13 @@
all: makefile miniperl $(private) $(plextract) $(public) $(dynamic_ext)
***************
-*** 220,236 ****
- # The $& notation tells Sequent machines that it can do a parallel make,
- # and is harmless otherwise.
+*** 230,247 ****
+ # build problems but that's not obvious to the novice.
+ # The Module used here must not depend on Config or any extensions.
! miniperl: $& miniperlmain.o $(perllib)
! $(CC) $(LARGE) $(CLDFLAGS) -o miniperl miniperlmain.o $(perllib) $(libs)
+ @miniperl -w -MExporter -e 0 || $(MAKE) minitest
! miniperlmain.o: miniperlmain.c
$(CCCMD) $(PLDLFLAGS) $*.c
@@ -136,12 +137,13 @@
$(CCCMD) $(PLDLFLAGS) $*.c
# The file ext.libs is a list of libraries that must be linked in
---- 221,237 ----
- # The $& notation tells Sequent machines that it can do a parallel make,
- # and is harmless otherwise.
+--- 231,248 ----
+ # build problems but that's not obvious to the novice.
+ # The Module used here must not depend on Config or any extensions.
! miniperl: $& miniperlmain$(OBJ_EXT) $(perllib)
! $(CC) $(LARGE) $(CLDFLAGS) -o miniperl miniperlmain$(OBJ_EXT) $(perllib) $(libs)
+ @miniperl -w -MExporter -e 0 || $(MAKE) minitest
! miniperlmain$(OBJ_EXT): miniperlmain.c
$(CCCMD) $(PLDLFLAGS) $*.c
@@ -155,7 +157,7 @@
# The file ext.libs is a list of libraries that must be linked in
***************
-*** 239,266 ****
+*** 250,277 ****
ext.libs: $(static_ext)
-@test -f ext.libs || touch ext.libs
@@ -184,7 +186,7 @@
@$(ranlib) $(perllib)
!NO!SUBS!
;;
---- 240,279 ----
+--- 251,290 ----
ext.libs: $(static_ext)
-@test -f ext.libs || touch ext.libs
@@ -226,7 +228,7 @@
!NO!SUBS!
;;
***************
-*** 273,282 ****
+*** 284,293 ****
# checks as well as the special code to validate that the script in question
# has been invoked correctly.
@@ -237,7 +239,7 @@
$(RMS) sperl.c
$(LNS) perl.c sperl.c
$(CCCMD) -DIAMSUID sperl.c
---- 286,295 ----
+--- 297,306 ----
# checks as well as the special code to validate that the script in question
# has been invoked correctly.
@@ -249,7 +251,7 @@
$(LNS) perl.c sperl.c
$(CCCMD) -DIAMSUID sperl.c
***************
-*** 286,292 ****
+*** 297,303 ****
# test -d lib/auto || mkdir lib/auto
#
preplibrary: miniperl lib/Config.pm $(plextract)
@@ -257,7 +259,7 @@
@echo " AutoSplitting perl library"
@./miniperl -Ilib -e 'use AutoSplit; \
autosplit_lib_modules(@ARGV)' lib/*.pm lib/*/*.pm
---- 299,305 ----
+--- 310,316 ----
# test -d lib/auto || mkdir lib/auto
#
preplibrary: miniperl lib/Config.pm $(plextract)
@@ -266,7 +268,7 @@
@./miniperl -Ilib -e 'use AutoSplit; \
autosplit_lib_modules(@ARGV)' lib/*.pm lib/*/*.pm
***************
-*** 304,317 ****
+*** 315,328 ****
install: all install.perl install.man
@@ -281,7 +283,7 @@
# ./perl installhtml
# I now supply perly.c with the kits, so the following section is
---- 317,330 ----
+--- 328,341 ----
install: all install.perl install.man
@@ -297,27 +299,27 @@
# I now supply perly.c with the kits, so the following section is
***************
-*** 371,378 ****
+*** 382,389 ****
@sh ext/util/make_ext static $@ LIBPERL_A=$(perllib)
clean:
! rm -f *.o *.a all perlmain.c
rm -f perl.exp ext.libs
- -cd x2p; $(MAKE) clean
-cd pod; $(MAKE) clean
- -@for x in $(DYNALOADER) $(dynamic_ext) $(static_ext) ; do \
---- 384,392 ----
+ -cd utils; $(MAKE) clean
+ -cd x2p; $(MAKE) clean
+--- 395,403 ----
@sh ext/util/make_ext static $@ LIBPERL_A=$(perllib)
clean:
! rm -f *$(OBJ_EXT) *$(LIB_EXT) all perlmain.c
rm -f perl.exp ext.libs
+ -rm perl.export perl.dll perl.libexp perl.map perl.def
- -cd x2p; $(MAKE) clean
-cd pod; $(MAKE) clean
- -@for x in $(DYNALOADER) $(dynamic_ext) $(static_ext) ; do \
+ -cd utils; $(MAKE) clean
+ -cd x2p; $(MAKE) clean
***************
-*** 389,395 ****
+*** 402,408 ****
done
rm -f *.orig */*.orig *~ */*~ core t/core t/c t/perl
rm -rf $(addedbyconf)
@@ -325,7 +327,7 @@
rm -f $(private)
rm -rf lib/auto
rm -f lib/.exists
---- 403,409 ----
+--- 416,422 ----
done
rm -f *.orig */*.orig *~ */*~ core t/core t/c t/perl
rm -rf $(addedbyconf)
@@ -334,7 +336,7 @@
rm -rf lib/auto
rm -f lib/.exists
***************
-*** 410,434 ****
+*** 423,447 ****
lint: perly.c $(c)
lint $(lintflags) $(defs) perly.c $(c) > perl.fuzz
@@ -360,7 +362,7 @@
&& ./perl TEST base/*.t comp/*.t cmd/*.t io/*.t op/*.t </dev/tty
clist: $(c)
---- 424,456 ----
+--- 437,469 ----
lint: perly.c $(c)
lint $(lintflags) $(defs) perly.c $(c) > perl.fuzz
@@ -395,7 +397,7 @@
clist: $(c)
***************
-*** 451,457 ****
+*** 464,470 ****
case `pwd` in
*SH)
$rm -f ../Makefile
@@ -403,7 +405,7 @@
;;
esac
! rm -f makefile
---- 473,479 ----
+--- 486,492 ----
case `pwd` in
*SH)
$rm -f ../Makefile
diff --git a/os2/diff.c2ph b/os2/diff.c2ph
index 4d2c320a36..a3fb6c625f 100644
--- a/os2/diff.c2ph
+++ b/os2/diff.c2ph
@@ -1,5 +1,5 @@
*** c2ph.PL~ Mon Nov 20 09:36:16 1995
---- c2ph.PL Thu Dec 07 15:24:10 1995
+--- utils/c2ph.PL Thu Dec 07 15:24:10 1995
***************
*** 1180,1184 ****
close OUT or die "Can't close $file: $!";
diff --git a/os2/diff.exec b/os2/diff.exec
new file mode 100644
index 0000000000..f3ef938610
--- /dev/null
+++ b/os2/diff.exec
@@ -0,0 +1,77 @@
+Only #if lines are changed below.
+
+diff -rc perl5.002b3/pp_sys.c perl5.002b3.new/pp_sys.c
+*** perl5.002b3/pp_sys.c Fri Feb 02 16:39:40 1996
+--- perl5.002b3.new/pp_sys.c Sat Feb 03 21:20:56 1996
+***************
+*** 2771,2777 ****
+ Signal_t (*ihand)(); /* place to save signal during system() */
+ Signal_t (*qhand)(); /* place to save signal during system() */
+
+! #if defined(HAS_FORK) && !defined(VMS)
+ if (SP - MARK == 1) {
+ if (tainting) {
+ char *junk = SvPV(TOPs, na);
+--- 2771,2777 ----
+ Signal_t (*ihand)(); /* place to save signal during system() */
+ Signal_t (*qhand)(); /* place to save signal during system() */
+
+! #if defined(HAS_FORK) && !defined(VMS) && !defined(OS2)
+ if (SP - MARK == 1) {
+ if (tainting) {
+ char *junk = SvPV(TOPs, na);
+***************
+*** 2817,2823 ****
+ value = (I32)do_exec(SvPVx(sv_mortalcopy(*SP), na));
+ }
+ _exit(-1);
+! #else /* ! FORK or VMS */
+ if (op->op_flags & OPf_STACKED) {
+ SV *really = *++MARK;
+ value = (I32)do_aspawn(really, MARK, SP);
+--- 2817,2823 ----
+ value = (I32)do_exec(SvPVx(sv_mortalcopy(*SP), na));
+ }
+ _exit(-1);
+! #else /* ! FORK or VMS or OS/2 */
+ if (op->op_flags & OPf_STACKED) {
+ SV *really = *++MARK;
+ value = (I32)do_aspawn(really, MARK, SP);
+diff -rc perl5.002b3/util.c perl5.002b3.new/util.c
+*** perl5.002b3/util.c Fri Jan 26 15:46:42 1996
+--- perl5.002b3.new/util.c Sat Feb 03 23:03:48 1996
+***************
+*** 1287,1293 ****
+ VTOH(vtohl,long)
+ #endif
+
+! #if !defined(DOSISH) && !defined(VMS) /* VMS' my_popen() is in VMS.c */
+ FILE *
+ my_popen(cmd,mode)
+ char *cmd;
+--- 1287,1294 ----
+ VTOH(vtohl,long)
+ #endif
+
+! #if !defined(DOSISH) && !defined(VMS) /* VMS' my_popen() is in
+! VMS.c, same with OS/2. */
+ FILE *
+ my_popen(cmd,mode)
+ char *cmd;
+***************
+*** 1364,1370 ****
+ return fdopen(p[this], mode);
+ }
+ #else
+! #if defined(atarist) || defined(OS2)
+ FILE *popen();
+ FILE *
+ my_popen(cmd,mode)
+--- 1365,1371 ----
+ return fdopen(p[this], mode);
+ }
+ #else
+! #if defined(atarist)
+ FILE *popen();
+ FILE *
+ my_popen(cmd,mode)
diff --git a/os2/os2.c b/os2/os2.c
index fa41298532..9b88b7ff29 100644
--- a/os2/os2.c
+++ b/os2/os2.c
@@ -1,5 +1,9 @@
#define INCL_DOS
#define INCL_NOPM
+#ifndef NO_SYS_ALLOC
+# define INCL_DOSMEMMGR
+# define INCL_DOSERRORS
+#endif /* ! defined NO_SYS_ALLOC */
#include <os2.h>
/*
@@ -41,12 +45,14 @@ result(int flag, int pid)
Signal_t (*ihand)(); /* place to save signal during system() */
Signal_t (*qhand)(); /* place to save signal during system() */
- if (pid < 0 || flag != 0)
+ if (pid < 0 || flag != 0)
return pid;
ihand = signal(SIGINT, SIG_IGN);
qhand = signal(SIGQUIT, SIG_IGN);
- r = waitpid(pid, &status, 0);
+ do {
+ r = wait4pid(pid, &status, 0);
+ } while (r == -1 && errno == EINTR);
signal(SIGINT, ihand);
signal(SIGQUIT, qhand);
@@ -88,6 +94,8 @@ register SV **sp;
if (flag == P_WAIT)
flag = P_NOWAIT;
+ if (*Argv[0] != '/' && *Argv[0] != '\\') /* will swawnvp use PATH? */
+ TAINT_ENV(); /* testing IFS here is overkill, probably */
if (really && *(tmps = SvPV(really, na)))
rc = result(trueflag, spawnvp(flag,tmps,Argv));
else
@@ -95,6 +103,7 @@ register SV **sp;
if (rc < 0 && dowarn)
warn("Can't spawn \"%s\": %s", Argv[0], Strerror(errno));
+ if (rc < 0) rc = 255 << 8; /* Emulate the fork(). */
} else
rc = -1;
do_execfree();
@@ -111,30 +120,56 @@ char *cmd;
char *shell, *copt;
int rc;
- if ((shell = getenv("SHELL")) != NULL)
+#ifdef TRYSHELL
+ if ((shell = getenv("EMXSHELL")) != NULL)
+ copt = "-c";
+ else if ((shell = getenv("SHELL")) != NULL)
copt = "-c";
else if ((shell = getenv("COMSPEC")) != NULL)
copt = "/C";
else
shell = "cmd.exe";
+#else
+ /* Consensus on perl5-porters is that it is _very_ important to
+ have a shell which will not change between computers with the
+ same architecture, to avoid "action on a distance".
+ And to have simple build, this shell should be sh. */
+ shell = "sh.exe";
+ copt = "-c";
+#endif
+
+ while (*cmd && isSPACE(*cmd))
+ cmd++;
/* save an extra exec if possible */
/* see if there are shell metacharacters in it */
- /*SUPPRESS 530*/
- if (*cmd == '@') {
- ++cmd;
- goto shell_cmd;
- }
+ if (*cmd == '.' && isSPACE(cmd[1]))
+ goto doshell;
+
+ if (strnEQ(cmd,"exec",4) && isSPACE(cmd[4]))
+ goto doshell;
+
+ for (s = cmd; *s && isALPHA(*s); s++) ; /* catch VAR=val gizmo */
+ if (*s == '=')
+ goto doshell;
+
for (s = cmd; *s; s++) {
- if (*s != ' ' && !isALPHA(*s) && strchr("%&|<>\n",*s)) {
+ if (*s != ' ' && !isALPHA(*s) && strchr("$&*(){}[]'\";\\|?<>~`\n",*s)) {
if (*s == '\n' && !s[1]) {
*s = '\0';
break;
}
-shell_cmd: return result(P_WAIT, spawnl(P_NOWAIT,shell,shell,copt,cmd,(char*)0));
+ doshell:
+ rc = result(P_WAIT,
+ spawnl(P_NOWAIT,shell,shell,copt,cmd,(char*)0));
+ if (rc < 0 && dowarn)
+ warn("Can't spawn \"%s\": %s", shell, Strerror(errno));
+ if (rc < 0) rc = 255 << 8; /* Emulate the fork(). */
+ return rc;
}
}
+
New(402,Argv, (s - cmd) / 2 + 2, char*);
Cmd = savepvn(cmd, s-cmd);
a = Argv;
@@ -151,12 +186,27 @@ shell_cmd: return result(P_WAIT, spawnl(P_NOWAIT,shell,shell,copt,cmd,(char*)0)
rc = result(P_WAIT, spawnvp(P_NOWAIT,Argv[0],Argv));
if (rc < 0 && dowarn)
warn("Can't spawn \"%s\": %s", Argv[0], Strerror(errno));
+ if (rc < 0) rc = 255 << 8; /* Emulate the fork(). */
} else
rc = -1;
do_execfree();
return rc;
}
+FILE *
+my_popen(cmd,mode)
+char *cmd;
+char *mode;
+{
+ char *shell = getenv("EMXSHELL");
+ FILE *res;
+
+ my_setenv("EMXSHELL", "sh.exe");
+ res = popen(cmd, mode);
+ my_setenv("EMXSHELL", shell);
+ return res;
+}
+
/*****************************************************************************/
#ifndef HAS_FORK
@@ -216,3 +266,62 @@ os2_stat(char *name, struct stat *st)
}
#endif
+
+#ifndef NO_SYS_ALLOC
+
+static char *old2K;
+
+#define ONE_K (1<<10)
+#define TWO_K (1<<11)
+#define FOUR_K (1<<12)
+#define FOUR_K_FLAG (FOUR_K - 1)
+
+
+void *
+sbrk(int size)
+{
+ char *got;
+ APIRET rc;
+ int is2K = 0;
+
+ if (!size) return 0;
+ else if (size == TWO_K) {
+ is2K = 1;
+ if (old2K) {
+ char *ret = old2K;
+
+ old2K = 0;
+ return (void *)ret;
+ }
+ size = FOUR_K;
+ } else if (size & FOUR_K_FLAG) {
+ croak("Memory allocation in units %li not multiple to 4K", size);
+ }
+ rc = DosAllocMem((void **)&got, size, PAG_COMMIT | PAG_WRITE);
+ if (rc == ERROR_NOT_ENOUGH_MEMORY) {
+ return (void *) -1;
+ } else if ( rc ) die("Got an error from DosAllocMem: %li", (long)rc);
+ if (is2K) old2K = got + TWO_K;
+ return (void *)got;
+}
+#endif /* ! defined NO_SYS_ALLOC */
+
+/* tmp path */
+
+char *tmppath = TMPPATH1;
+
+void
+settmppath()
+{
+ char *p = getenv("TMP"), *tpath;
+ int len;
+
+ if (!p) p = getenv("TEMP");
+ if (!p) return;
+ len = strlen(p);
+ tpath = (char *)malloc(len + strlen(TMPPATH1) + 2);
+ strcpy(tpath, p);
+ tpath[len] = '/';
+ strcpy(tpath + len + 1, TMPPATH1);
+ tmppath = tpath;
+}
diff --git a/os2/os2ish.h b/os2/os2ish.h
index 20e92b0845..8d0820dcfb 100644
--- a/os2/os2ish.h
+++ b/os2/os2ish.h
@@ -27,8 +27,13 @@
#define PERL_SYS_INIT(argcp, argvp) do { \
_response(argcp, argvp); \
- _wildcard(argcp, argvp); } while (0)
+ _wildcard(argcp, argvp); \
+ settmppath(); } while (0)
+#define TMPPATH tmppath
+#define TMPPATH1 "plXXXXXX"
+extern char *tmppath;
+void settmppath();
/*
* fwrite1() should be a routine with the same calling sequence as fwrite(),