Some patches to make patchlevel 40 compilable.

#!/bin/sh
# This is a shell archive (produced by shar 3.53)
# To extract the files from this archive, save it to a file, remove
# everything above the "!/bin/sh" line above, and type "sh file_name".
#
# made 11/16/1990 20:07 UTC by unknown@os2
# Source directory F:\
#
# existing files will NOT be overwritten unless -c is specified
#
# This shar contains:
# length  mode       name
# ------ ---------- ------------------------------------------
#   5603 -rw-rw-rw- perl3040.dif
#   4092 -rw-rw-rw- alarm.c
#     52 -rw-rw-rw- alarm.h
#    280 -rw-rw-rw- alarm.pl
#
# ============= perl3040.dif ==============
if test -f 'perl3040.dif' -a X"$1" != X"-c"; then
	echo 'x - skipping perl3040.dif (File already exists)'
else
echo 'x - extracting perl3040.dif (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'perl3040.dif' &&
Only in perl3040/OS2: alarm.c
Only in perl3040/OS2: alarm.h
Only in perl3040/OS2/EG: alarm.pl
diff -cbBwr perl-3.0@40/os2/config.h perl3040/OS2/config.h
*** perl-3.0@40/os2/config.h	Sun Oct 28 15:40:02 1990
--- perl3040/os2/config.h	Thu Nov 15 22:16:00 1990
***************
*** 235,241 ****
X   *	This symbol, if defined, indicates that ndbm.h exists and should
X   *	be included.
X   */
! /*#define	NDBM		/**/
X  
X  /* ODBM:
X   *	This symbol, if defined, indicates that dbm.h exists and should
--- 235,241 ----
X   *	This symbol, if defined, indicates that ndbm.h exists and should
X   *	be included.
X   */
! #define	NDBM		/**/
X  
X  /* ODBM:
X   *	This symbol, if defined, indicates that dbm.h exists and should
***************
*** 494,500 ****
X  #ifdef OS2
X  #define SIG_NAME "ZERO","HUP","INT","QUIT","ILL","TRAP","IOT","EMT","FPE",\
X  	  /*      0      1     2     3      4      5     6     7    8 */\
!    "KILL","BUS","SEGV","SYS","PIPE","ALRM","TERM","USR1","USR2","CLD",\
X    /* 9     10     11    12    13     14     15     16     17    18 */\
X     "PWR","USR3","BREAK","ABRT"
X    /*19     20     21    22   */
--- 494,500 ----
X  #ifdef OS2
X  #define SIG_NAME "ZERO","HUP","INT","QUIT","ILL","TRAP","IOT","EMT","FPE",\
X  	  /*      0      1     2     3      4      5     6     7    8 */\
!    "KILL","BUS","SEGV","SYS","PIPE","UALRM","TERM","ALRM","USR2","CLD",\
X    /* 9     10     11    12    13     14     15     16     17    18 */\
X     "PWR","USR3","BREAK","ABRT"
X    /*19     20     21    22   */
diff -cbBwr perl-3.0@40/os2/eg/os2.pl perl3040/OS2/EG/os2.pl
*** perl-3.0@40/os2/eg/os2.pl	Sun Oct 28 15:40:02 1990
--- perl3040/os2/eg/os2.pl	Thu Nov 15 22:07:24 1990
***************
*** 1,4 ****
--- 1,5 ----
X  extproc C:\binp\misc\perl.exe -S
+ #!perl
X  
X  # os2.pl:  Demonstrates the OS/2 system calls and shows off some of the
X  # features in common with the UNIX version.
diff -cbBwr perl-3.0@40/os2/perl.bad perl3040/OS2/perl.bad
*** perl-3.0@40/os2/perl.bad	Wed Nov 14 23:39:52 1990
--- perl3040/os2/perl.bad	Thu Nov 15 20:02:04 1990
***************
*** 5,7 ****
--- 5,8 ----
X  DOSSETPRTY
X  DOSGETPRTY
X  DOSQFSATTACH
+ DOSCREATETHREAD
diff -cbBwr perl-3.0@40/os2/perl.cs perl3040/OS2/perl.cs
*** perl-3.0@40/os2/perl.cs	Wed Nov 14 23:39:54 1990
--- perl3040/os2/perl.cs	Thu Nov 15 20:00:08 1990
***************
*** 3,11 ****
X  hash.c perl.c perly.c regcomp.c regexec.c stab.c str.c util.c
X  )
X  (-W1 -Od -Olt -B2C2L -B3C3L -DDEBUGGING eval.c{evalargs.xc} toke.c)
! (-W1 -Od -Olt -I.
! os2\os2.c os2\popen.c os2\mktemp.c os2\director.c os2\suffix.c
X  )
X  
X  setargv.obj
X  os2\perl.def
--- 3,15 ----
X  hash.c perl.c perly.c regcomp.c regexec.c stab.c str.c util.c
X  )
X  (-W1 -Od -Olt -B2C2L -B3C3L -DDEBUGGING eval.c{evalargs.xc} toke.c)
! (-W1 -Od -Olt -I. -Ios2
! os2\os2.c os2\popen.c os2\mktemp.c os2\director.c os2\suffix.c os2\alarm.c
X  )
+ 
+ ; link with this library if you have GNU gdbm for OS/2
+ ; remember to enable the NDBM symbol in config.h before compiling
+ lgdbm.lib
X  
X  setargv.obj
X  os2\perl.def
diff -cbBwr perl-3.0@40/os2/perl.def perl3040/OS2/perl.def
*** perl-3.0@40/os2/perl.def	Wed Nov 14 23:39:56 1990
--- perl3040/os2/perl.def	Thu Nov 15 18:36:58 1990
***************
*** 1,2 ****
X  NAME PERL WINDOWCOMPAT NEWFILES
! DESCRIPTION 'PERL 3.0, patchlevel 37 - for MS-DOS and OS/2'
--- 1,2 ----
X  NAME PERL WINDOWCOMPAT NEWFILES
! DESCRIPTION 'PERL 3.0 - for MS-DOS and OS/2'
diff -cbBwr perl-3.0@40/os2/README.OS2 perl3040/OS2/readme.os2
*** perl-3.0@40/os2/readme.os2	Wed Nov 14 23:38:50 1990
--- perl3040/os2/readme.os2	Thu Nov 15 22:31:56 1990
***************
*** 325,330 ****
--- 325,332 ----
X  os2.c             kernel of OS/2 port (see below)
X  popen.c           new popen.c
X  mktemp.c          enhanced mktemp(), uses TMP env. variable, used by popen.c
+ alarm.c           PD implementation for alarm()
+ alarm.h		  header for alarm.c
X  
X  perl.cs           Compiler Shell script for perl itself
X  perl.def          linker definition file for perl
***************
*** 375,380 ****
--- 378,395 ----
X  + I am not shure if I can verify the OS/2 port with each release
X    from Larry Wall. Therefore, in future releases there may be
X    changes required to compile perl for OS/2.
+ 
X  				October 1990
+ 
+                                 Kai Uwe Rommel
+                                 rommel@lan.informatik.tu-muenchen.dbp.de
+ 
+ 
+ Verified patchlevel 40.
+ Some bugs were fixed. Added alarm() support (using PD implementation).
+ 
+ 
+ 				November 1990
+ 
X                                  Kai Uwe Rommel
X                                  rommel@lan.informatik.tu-muenchen.dbp.de
diff -cbBwr perl-3.0@40/os2/suffix.c perl3040/OS2/suffix.c
*** perl-3.0@40/os2/suffix.c	Sun Oct 28 15:40:04 1990
--- perl3040/os2/suffix.c	Thu Nov 15 19:01:40 1990
***************
*** 134,146 ****
X  
X      switch(DosOpen(s, &hf, &usAction, 0L, 0, FILE_OPEN,
X  	OPEN_ACCESS_READONLY | OPEN_SHARE_DENYNONE, 0L)) {
X      case NO_ERROR:
X  	DosClose(hf);
X  	/*FALLTHROUGH*/
X      default:
X  	return 1;
-     case ERROR_FILENAME_EXCED_RANGE:
- 	return 0;
X      }
X  }
X  #endif /* OS2 */
--- 134,147 ----
X  
X      switch(DosOpen(s, &hf, &usAction, 0L, 0, FILE_OPEN,
X  	OPEN_ACCESS_READONLY | OPEN_SHARE_DENYNONE, 0L)) {
+     case ERROR_INVALID_NAME:
+     case ERROR_FILENAME_EXCED_RANGE:
+ 	return 0;
X      case NO_ERROR:
X  	DosClose(hf);
X  	/*FALLTHROUGH*/
X      default:
X  	return 1;
X      }
X  }
X  #endif /* OS2 */
SHAR_EOF
chmod 0666 perl3040.dif ||
echo 'restore of perl3040.dif failed'
Wc_c="`wc -c 'perl3040.dif'`"
test 5436 -eq "$Wc_c" ||
	echo 'perl3040.dif: original size 5436, current size' "$Wc_c"
fi
# ============= alarm.c ==============
if test -f 'alarm.c' -a X"$1" != X"-c"; then
	echo 'x - skipping alarm.c (File already exists)'
else
echo 'x - extracting alarm.c (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'alarm.c' &&
/*
X * This software is Copyright 1989 by Jack Hudler.
X *
X * Permission is hereby granted to copy, reproduce, redistribute or otherwise
X * use this software as long as: there is no monetary profit gained
X * specifically from the use or reproduction or this software, it is not
X * sold, rented, traded or otherwise marketed, and this copyright notice is
X * included prominently in any copy made.
X *
X * The author make no claims as to the fitness or correctness of this software
X * for any use whatsoever, and it is provided as is. Any use of this software
X * is at the user's own risk.
X *
X */
X
/****************************** Module Header ******************************\
* Module Name: alarm.c
* Created    : 11-08-89
* Author     : Jack Hudler  [jack@csccat.lonestar.org]
* Copyright  : 1988 Jack Hudler.
* Function   : Unix like alarm signal simulator.
\***************************************************************************/
X
/* Tested using OS2 1.2 with Microsoft C 5.1 and 6.0. */
X
#define INCL_DOSPROCESS
#define INCL_DOSSIGNALS
#define INCL_DOS
#include <os2.h>
X
#include <stdlib.h>
#include <stdio.h>
#include <signal.h>
X
#include "alarm.h"
X
#define ALARM_STACK 4096    /* This maybe over kill, but the page size is 4K */
X
static  PBYTE     pbAlarmStack;
static  SEL       selAlarmStack;
static  TID       tidAlarm;
static  PID       pidMain;
static  BOOL      bAlarmInit=FALSE;
static  BOOL      bAlarmRunning=FALSE;
static  USHORT    uTime;
X
static VOID FAR alarm_thread ( VOID )
{
X    while(1)
X    {
X      if (bAlarmRunning)
X      {
X        DosSleep(1000L);
X        uTime--;
X        if (uTime==0)
X        {
X          // send signal to the main process.. I could have put raise() here
X          // however that would require the use of the multithreaded library,
X          // and it does not contain raise()!
X          // I tried it with the standard library, this signaled ok, but a
X          // test printf in the signal would not work and even caused SEGV.
X          // So I signal the process through OS/2 and then the process
X          // signals itself.
X          if (bAlarmRunning)
X            DosFlagProcess(pidMain,FLGP_PID, PFLG_A,1);
X          bAlarmRunning=FALSE;
X        }
X      }
X      else
X        DosSleep(500L);
X    }
}
X
static VOID PASCAL FAR AlarmSignal(USHORT usSigArg,USHORT usSigNum)
{
X    /*
X     * this is not executed from the thread. The thread triggers Process
X     * flag A which is in the main processes scope, this inturn triggers
X     * (via the raise) SIGUSR1 which is defined to SIGALRM.
X     */
X    raise(SIGUSR1);
}
X
static void alarm_init(void)
{
X    PFNSIGHANDLER pfnPrev;
X    USHORT       pfAction;
X    PIDINFO      pid;
X
X    bAlarmInit = TRUE;
X
X    if (!DosAllocSeg( ALARM_STACK, (PSEL) &selAlarmStack, SEG_NONSHARED ))
X    {
X      OFFSETOF(pbAlarmStack) = ALARM_STACK - 2;
X      SELECTOROF(pbAlarmStack) = selAlarmStack;
X      /* Create the thread */
X      if (DosCreateThread( alarm_thread, &tidAlarm, pbAlarmStack ))
X      {
X        fprintf(stderr,"Alarm thread failed to start.\n");
X        exit(1);
X      }
X      /* Setup the signal handler for Process Flag A */
X      if (DosSetSigHandler(AlarmSignal,&pfnPrev,&pfAction,SIGA_ACCEPT,SIG_PFLG_A))
X      {
X        fprintf(stderr,"SigHandler Failed to install.\n");
X        exit(1);
X      }
X      /* Save main process ID, we'll need it for triggering the signal */
X      DosGetPID(&pid);
X      pidMain = pid.pid;
X    }
X    else
X      exit(1);
}
X
unsigned alarm(unsigned sec)
{
X    if (!bAlarmInit) alarm_init();
X
X    if (sec)
X    {
X      uTime = sec;
X      bAlarmRunning = TRUE;
X    }
X    else
X      bAlarmRunning = FALSE;
X
X    return 0;
}
X
#ifdef TESTING
/* A simple test to see if it works */
BOOL  x;
X
void timeout(void)
{
X    fprintf(stderr,"ALARM TRIGGERED!!\n");
X    DosBeep(1000,500);
X    x++;
}
X
void main(void)
{
X    (void) signal(SIGALRM, timeout);
X    (void) alarm(1L);
X    printf("ALARM RUNNING!!\n");
X    while(!x);
}
#endif
SHAR_EOF
chmod 0666 alarm.c ||
echo 'restore of alarm.c failed'
Wc_c="`wc -c 'alarm.c'`"
test 3943 -eq "$Wc_c" ||
	echo 'alarm.c: original size 3943, current size' "$Wc_c"
fi
# ============= alarm.h ==============
if test -f 'alarm.h' -a X"$1" != X"-c"; then
	echo 'x - skipping alarm.h (File already exists)'
else
echo 'x - extracting alarm.h (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'alarm.h' &&
#define SIGALRM SIGUSR1
unsigned alarm(unsigned);
SHAR_EOF
chmod 0666 alarm.h ||
echo 'restore of alarm.h failed'
Wc_c="`wc -c 'alarm.h'`"
test 50 -eq "$Wc_c" ||
	echo 'alarm.h: original size 50, current size' "$Wc_c"
fi
# ============= alarm.pl ==============
if test -f 'alarm.pl' -a X"$1" != X"-c"; then
	echo 'x - skipping alarm.pl (File already exists)'
else
echo 'x - extracting alarm.pl (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'alarm.pl' &&
sub handler {
X  local($sig) = @_;
X  print "Caught a SIG-$sig -- shutting down\n";
X  exit(0);
}
X
$SIG{'INT'} = 'handler';
$SIG{'QUIT'} = 'handler';
$SIG{'ALRM'} = 'handler';
X
print "Starting execution ...\n";
X
alarm(5);
X
while ( <> ) {
}
X
print "Normal exit.\n";
SHAR_EOF
chmod 0666 alarm.pl ||
echo 'restore of alarm.pl failed'
Wc_c="`wc -c 'alarm.pl'`"
test 262 -eq "$Wc_c" ||
	echo 'alarm.pl: original size 262, current size' "$Wc_c"
fi
exit 0
