diff options
author | Larry Wall <lwall@netlabs.com> | 1994-10-17 23:00:00 +0000 |
---|---|---|
committer | Larry Wall <lwall@netlabs.com> | 1994-10-17 23:00:00 +0000 |
commit | a0d0e21ea6ea90a22318550944fe6cb09ae10cda (patch) | |
tree | faca1018149b736b1142f487e44d1ff2de5cc1fa /os2 | |
parent | 85e6fe838fb25b257a1b363debf8691c0992ef71 (diff) | |
download | perl-a0d0e21ea6ea90a22318550944fe6cb09ae10cda.tar.gz |
perl 5.000perl-5.000
[editor's note: this commit combines approximate 4 months of furious
releases of Andy Dougherty and Larry Wall - see pod/perlhist.pod for
details. Andy notes that;
Alas neither my "Irwin AccuTrack" nor my DC 600A quarter-inch cartridge
backup tapes from that era seem to be readable anymore. I guess 13 years
exceeds the shelf life for that backup technology :-(.
]
Diffstat (limited to 'os2')
-rw-r--r-- | os2/Makefile | 65 | ||||
-rw-r--r-- | os2/README.OS2 | 434 | ||||
-rw-r--r-- | os2/a2p.cs | 8 | ||||
-rw-r--r-- | os2/a2p.def | 1 | ||||
-rw-r--r-- | os2/alarm.c | 149 | ||||
-rw-r--r-- | os2/alarm.h | 2 | ||||
-rw-r--r-- | os2/config.h | 910 | ||||
-rw-r--r-- | os2/crypt.c | 276 | ||||
-rw-r--r-- | os2/dir.h | 76 | ||||
-rw-r--r-- | os2/director.c | 250 | ||||
-rw-r--r-- | os2/eg/alarm.pl | 17 | ||||
-rw-r--r-- | os2/eg/os2.pl | 71 | ||||
-rw-r--r-- | os2/eg/syscalls.pl | 16 | ||||
-rw-r--r-- | os2/glob.c | 21 | ||||
-rw-r--r-- | os2/makefile | 125 | ||||
-rw-r--r-- | os2/mktemp.c | 1 | ||||
-rw-r--r-- | os2/os2.c | 298 | ||||
-rw-r--r-- | os2/perl.bad | 8 | ||||
-rw-r--r-- | os2/perl.cs | 21 | ||||
-rw-r--r-- | os2/perl.def | 2 | ||||
-rw-r--r-- | os2/perldb.dif | 0 | ||||
-rw-r--r-- | os2/perlglob.bad | 1 | ||||
-rw-r--r-- | os2/perlglob.cs | 9 | ||||
-rw-r--r-- | os2/perlglob.def | 1 | ||||
-rw-r--r-- | os2/perlsh.cmd | 19 | ||||
-rw-r--r-- | os2/popen.c | 241 | ||||
-rwxr-xr-x | os2/s2p.cmd | 678 | ||||
-rwxr-xr-x | os2/selfrun.bat | 12 | ||||
-rw-r--r-- | os2/selfrun.cmd | 7 | ||||
-rw-r--r-- | os2/suffix.c | 147 | ||||
-rw-r--r-- | os2/tests.dif | 589 |
31 files changed, 0 insertions, 4455 deletions
diff --git a/os2/Makefile b/os2/Makefile deleted file mode 100644 index 97d190f5cd..0000000000 --- a/os2/Makefile +++ /dev/null @@ -1,65 +0,0 @@ -# -# Makefile for compiling Perl under OS/2 -# -# Needs Microsoft C 6.00 and NMAKE -# - -EXP = c:\ms\lib\setargv.obj -link /noe - -DEF = os2\perl.def -BAD = os2\perl.bad - -OBJ = array.obj cmd.obj cons.obj consarg.obj doarg.obj doio.obj \ - dolist.obj dump.obj eval.obj form.obj hash.obj perl.obj perly.obj \ - regcomp.obj regexec.obj stab.obj str.obj toke.obj util.obj -OBJO = os2.obj popen.obj suffix.obj director.obj alarm.obj crypt.obj - -LIBS = lgdbm.lib - -YACC=bison -YFLAGS=-d - -CC=cl -nologo -CCL=cl -nologo -B2C2L -B3C3L - -CFLAGS=-W1 -AL -Zep -J -G2s -Olt -Gt 2048 -DDEBUGGING -#CFLAGS=-W1 -AL -Ziep -J -G2 -Od -Gt 2048 -DDEBUGGING - -LDFLAGS=-AL -Lp -F 8000 -#LDFLAGS=-AL -Lp -Zi -Li -F 8000 - -STRIP=bind -nologo -#STRIP=rem - -.c.obj: - $(CC) -c $(CFLAGS) $< - -{os2}.c{}.obj: - $(CC) -c $(CFLAGS) -I. -Ios2 $< - -all: perl.exe perlglob.exe - -perl.exe: $(OBJ) $(OBJO) - $(CC) $(LDFLAGS) $(OBJ) $(OBJO) $(LIBS) os2\perl.def -o $@ $(EXP) - $(STRIP) $@ -n @$(BAD) - -$(OBJ) $(OBJO): config.h -perl.obj str.obj cons.obj toke.obj: perly.h - -config.h: os2\config.h - cp os2\config.h config.h - -perly.c perly.h: perly.y - $(YACC) $(YFLAGS) -o $*.c $*.y - -eval.obj: eval.c - $(CCL) -c $(CFLAGS) $*.c -toke.obj: toke.c - $(CCL) -c $(CFLAGS) $*.c - -perlglob.exe: os2\glob.c os2\director.c - $(CC) -Zep -G2s -Olt -Lp os2\glob.c $(DEF) -o $@ $(EXP) - $(STRIP) $@ -n @$(BAD) - -clean: - -rm perly.c perly.h config.h *.obj >nul diff --git a/os2/README.OS2 b/os2/README.OS2 deleted file mode 100644 index 2cca20cda8..0000000000 --- a/os2/README.OS2 +++ /dev/null @@ -1,434 +0,0 @@ - Notes on the OS/2 Perl port - - Raymond Chen - (rjc@math.princeton.edu) - - Kai Uwe Rommel - (rommel@lan.informatik.tu-muenchen.dbp.de) - --1. Background. - -This port was based on the MS-DOS port by Diomidis Spinellis. - -0. Set-up. - -First copy the files in the os2 directory into the parent -directory. Also install the file msdos/dir.h in your include -directory. - -1. Compiling. - -Perl has been compiled under MS-DOS using the Microsoft C compiler -version 6.0. Before compiling install dir.h as <sys/dir.h>. You will -need a Unix-like make program and something like yacc (e.g. bison). I -just ran yacc on my UNIX box and downloaded the resulting y.tab.[ch] -files. Compilation takes 45 minutes on a 16MHz 386 machine running -no jobs other than the compiler, so you will probably need something to -do in the meantime. Like, say, lunch. (Compilation time does not -include formatting the manual.) If you compile with optimization -turned off, it takes about half as long. - -The executable is 270k (perlsym.exe is 473k; if you compile -without optimization, the sizes are 329K/531K), and the top level -directory needs 800K for sources, 550K for object code, and 800K for the -executables, assuming you want to build both perl.exe and perlsym.exe -with full optimization. - -The makefile will compile glob for you which you will need to place -somewhere in your path so that perl globbing will work correctly. All -the tests were run, although some modifications were necessary because -OS/2 isn't UNIX. The tests that failed failed because of limitations of -the operating system and aren't the fault of the compiler. a2p and s2p -were not tested. - -In the eg directory you will find the syscalls.pl header file, -and a sample program that demonstrates some of the improvements -of the OS/2 version over the MS-DOS version and some of the -system calls. - -2. Using OS/2 Perl - -The OS/2 version of perl has much of the functionality of the Unix -version. Here are some things that don't work: sockets, password -functions, [gs]et[eug]id, dbm functions, fork. - -One thing that doesn't work is "split" with no arguments. Somehow, -yylval.arg is empty ... [[ Wait, sorry, I fixed that. --rjc ]] - -Care has been taken to implement the rest, although the implementation -might not be the best possible. Here are short notes on the tricky -bits: - -2.1. In-place editing. - -Files currently can be edited in-place provided you are creating a -backup. Considerable effort is made to ensure that a reasonable -name for the backup is selected, while still remaining within -the 8.3 contraints of the FAT filesystem. (HPFS users have nothing -to worry about, since HPFS doesn't have the stupid 8.3 rule.) - -The rules for how OS/2 perl combines your filename with the suffix -(the thing passed to "-i") are rather complicated, but the basic -idea is that the "obvious" name is chosen. - -Here are the rules: - -Style 0: Append the suffix exactly as UNIX perl would do it. - If the filesystem likes it, use it. (HPFS will always - swallow it. FAT will rarely accept it.) - -Style 1: If the suffix begins with a '.', change the file extension - to whatever you supplied. If the name matches the original - name, use the fallback method. - -Style 2: If the suffix is a single character, not a '.', try to add the - suffix to the following places, using the first one that works. - [1] Append to extension. - [2] Append to filename, - [3] Replace end of extension, - [4] Replace end of filename. - If the name matches the original name, use the fallback method. - -Style 3: Any other case: Ignore the suffix completely and use the - fallback method. - -Fallback method: Change the extension to ".$$$". If that matches the - original name, then change the extension to ".~~~". - -If filename is more than 1000 characters long, we die a horrible -death. Sorry. - -Examples, assuming style 0 failed. - -suffix = ".bak" (style 1) - foo.bar => foo.bak - foo.bak => foo.$$$ (fallback) - foo.$$$ => foo.~~~ (fallback) - makefile => makefile.bak - -suffix = "~" (style 2) - foo.c => foo.c~ - foo.c~ => foo.c~~ - foo.c~~ => foo~.c~~ - foo~.c~~ => foo~~.c~~ - foo~~~~~.c~~ => foo~~~~~.$$$ (fallback) - - foo.pas => foo~.pas - makefile => makefile.~ - longname.fil => longname.fi~ - longname.fi~ => longnam~.fi~ - longnam~.fi~ => longnam~.$$$ - -2.2. Directory access. - -Are implemented, but in order to support telldir() and seekdir(), -they operate by reading in the entire directory at opendir(), -then handing out pieces of it each time you do a readdir(). - -2.3. Pipes and redirection. - -Pipes and redirection are supported. Although OS/2 does not -terminate programs which try to write to closed pipes, perl will -kill them for you if you do it like this: - - open(I, "long-running-program|"); - ... process a few lines ... - close(I); # discard the rest ... - -The killing works like this: We wait until the child program either -closes its stdout or tries to write to it. If it writes to its stdout, -we kill it. Otherwise, we cwait for it. This is pretty much what UNIX -does by default. - -All pipe commands are given to cmd.exe (or your COMSPEC) for execution as - - CMD /c your-command-line - -so you can go ahead and load it up with any goofy things you want, -like 2>1 redirection, more pipes, && || etc. - -The pipe() function is also supported, so you can go ahead and -make your own funky file descriptor connections before piping off -a process. However, you have to mark the descriptor you are -retaining as NOINHERIT before spawning, else you are in deadlock city. -Unfortunately, there's no way to mark the handle as NOINHERIT yet. -It's on my wish list. - -2.4. Syscall and Ioctl - -IOCtl is not supported because the API is very different from the -UNIX API. Instead, IOCtl is supported as a syscall. Here are -the syscalls I've written so far: - - $OS2_GetVersion = 0; - $OS2_Shutdown = 1; - $OS2_Beep = 2; - $OS2_PhysicalDisk = 3; - $OS2_Config = 4; - $OS2_IOCtl = 5; - $OS2_QCurDisk = 6; - $OS2_SelectDisk = 7; - $OS2_SetMaxFH = 8; - $OS2_Sleep = 9; - $OS2_StartSession = 10; - $OS2_StopSession = 11; - $OS2_SelectSession = 12; - -The arguments you pass are handed off to OS/2 without interpretation, -and the return value is returned straight to you. However, you don't -have to supply arguments for the ones whose descriptions are "must be -zero"; perl will supply the mandatory zeros for you. - -2.5. Binary file access - -Files are opened in text mode by default. This means that CR LF pairs -are translated to LF. If binary access is needed the `binarymode' -function should be used. There is currently no way to reverse the -effect of the binary function. If that is needed close and reopen the -file. - -2.6. Priority - -The getpriority and setpriority functions are implemented, but since -OS/2 priorities are different from UNIX priorities, the arguments aren't -the same. Basically, the arguments you pass are handed directly to -OS/2. The only exception is the last argument to setpriority. To make -it easier to make delta priorities, if the priority class is 0xff, it -is changed to 0. That way, you can write - - setpriority(0,0,-2) - -instead of - - setpriority(0,0,0xfe) - -to decrease the delta by 2. - -2.7. Interpreter startup. - -The effect of the Unix #!/bin/perl interpreter startup can be obtained -under OS/2 by giving the script a .cmd extension and beginning the script -with the line - - extproc C:\binp\perl.exe -S - -You should provide the appropriate path to your executable, and -the -S option is necessary so that perl can find your script. - -2.8. The kill function. - -UNIX and OS/2 have different ideas about the kill function. I've -done a pretty feeble job of taking perl's UNIXish approach and -trying to jam it into the OS/2 way. No doubt you'll find that -your kill()s aren't working. My apologies in advance. - -3. Bug reports. - -I don't normally have access to an OS/2 machine, so if you find -a bug, you can go ahead and tell me about it, but the odds that -I'd be able to fix it are slim. - -4. Wish list. - -4.1. OS/2. - -Make ENOPIPE a fatal error. - -Permit linking of files. (Allegedly, they're working on this.) - -Get a fork. - -Make CMD.EXE pass through the return code of its child. - -4.2 perl. - -Provide a nice way to add new functions to perl without having -to understand the innards of perl. Not being fluent in perl -innards hacking, I added my extra functions via syscall. - -4.3. My port. - -4.3.1. In-place editing. - -Make more idiot-proof. - -Allow in-place editing without backup. (How?) - -4.3.2. Spawning and piping. - -Make popen() cleverer. Currently, it blindly hands everything -off to CMD.EXE. This wastes an exec if the command line didn't -have any shell metacharacters and if the program being run -is not a batch file. - -Clever spawning is carried out by do_spawn. We should try -to make popen() do much of the same sort of preprocessing -as do_spawn does (which means, of course, that we probably -should yank out code to be dished off into a subroutine). - -In do_spawn(), use DosExecPgm instead of spawnl in order to get more -precise reasons why the child terminated (RESULTCODES). - - - July 1990 - - Raymond Chen <rjc@math.princeton.edu> - 1817 Oxford St. Apt 6 - Berkeley, CA 94709-1828 USA - ------------------------ -I picked up the OS/2 port with patches 19-28. When compiling, I found -out that os2.c and director.c were missing. I had to rewrite them because -even the original author of the port (Raymond Chen) did no longer have them. - -I had directory routines laying around, this was no big deal. -I rewrote os2.c, but did not implement the syscall() as described above. -I had not the time and did not really need it. Feel free ... - -Changes to above described port: - -- the small program GLOB is now named PERLGLOB for better ordering in - my /bin directory - -- added help page (well, a graphical user interface would be overkill - but a simple help page should be in every program :-) - -- several cosmetic changes in standard distribution files because of - naming conventions etc., #ifdef'd OS2 - -- syscall() not supported as noted above - -- chdir now recognizes also drive letters and changes also the drive - -- new mypopen(), mypclose() functions and simulation routines for DOS mode, - they are selected automatically in real mode -- the new pclose() does not kill the child, my experience is that this is - not needed. - -- setpriority is now: setpriority(class, pid, val) - see description of DosSetPrty() for class and val meanings -- getpriority is now: getpriority(dummy, pid) - see description of DosGetPrty() - -- kill is now: kill(pid, sig) - where sig can be 0 (kill process) - 1-3 (send process flags A-C, see DosFlagProcess()) - if pid is less than zero, the signal is sent to the whole - process tree originating at -pid. - -The following files are now new with patch >=29: - -readme.os2 this file - -dir.h sys/dir.h -director.c directory routines -os2.c kernel of OS/2 port (see below) -popen.c new popen.c -mktemp.c enhanced mktemp(), uses TMP env. variable, used by popen.c -alarm.c PD implementation for alarm() -alarm.h header for alarm.c - -perl.cs Compiler Shell script for perl itself -perl.def linker definition file for perl -perl.bad names of protect-only API calls for BIND -perlglob.cs Compiler Shell script for perl globbing program -perlglob.def linker definition file for perlglob -a2p.cs Compiler Shell script for a2p (see below) -a2p.def linker definition file for a2p -makefile Makefile, not tested - -perlsh.cmd the converted perlsh -perldb.dif changes required for perldb.pl (change for your needs) -selfrun.cmd sample selfrunning perl script for OS/2 -selfrun.bat sample selfrunning perl script for DOS mode - -Note: I don't use make but my own utility, the Compiler Shell CS. -It was posted in comp.binaries.os2 or you can ask me for the newest -version. The .CS files are the "makefiles" for it. - -Note: MS C 6.00 is required. C 5.1 is not capable of compiling perl, -especially not with -DDEBUGGING - - - August 1990 - - Kai Uwe Rommel - rommel@lan.informatik.tu-muenchen.dbp.de - Zennerstr. 1 - D-8000 Muenchen 70 - - -+ I have verified with patchlevel 37, that the OS/2 port compiles, - after doing two minor changes. HPFS filenames support was also added. - Some bugs were fixed. -+ To compile, - - you need the bison parser generator - - copy config.h from os2 into the main perl directory (important !) - - copy perl.cs and perlglob.cs from the os2 subdir to the main dir - - copy a2p.cs from os2 to x2p - - say "bison -d perl.y" - "ren perl_tab.c perl.c" and - "ren perl_tab.h perly.h" in the main directory - - say "cs perl" and - "cs perlglob" in the main directory - - say "cs a2p" in the x2p subdir -+ If you don't have CS or don't want to use it, you have to - construct a makefile ... -+ If you have GNU gdbm, you can define NDBM in config.h and link with a - large model library of gdbm. -+ I am not sure if I can verify the OS/2 port with each release - from Larry Wall. Therefore, in future releases there may be - changes required to compile perl for OS/2. - 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 - - Kai Uwe Rommel - rommel@lan.informatik.tu-muenchen.dbp.de -Verified perl 4.0 at patchlevel 10 -Changes: -- some minor corrections and updates in various files -- new os2/config.h created from original config.H -- added support for crypt(), PD routine by A.Tanenbaum in new os2/crypt.c -- added support for wait4pid() in os2.c -- fixed/added support for -P option (requires a standard CPP for OS/2) -- os2/mktemp.c deleted, no longer needed -- new Makefile created for MS C 6.00 and it's NMAKE -- with os2/perl.cs, bison has no longer to be called manually -I have successfully run most tests. Diffs are in os2/tests.dif. -Often, only command names, shell expansion etc. have to be changed. -Test that still don't run are Unix-specific ones or fail because -of CR/LF-problems: -- io/argv.t, io/inplace.t, op/exec.t, op/glob.t (minor problems) -- io/fs.t, io/pipe.t op/fork.t, op/magic.t, op/time.t - (under OS/2 not supported features of Unix) -- op/pat.t (bug, not yet fixed) -Remember to remove the HAS_GDBM symbol from os2/config.h or -get GNU gdbm for OS/2. - June 1991 - Kai Uwe Rommel - rommel@lan.informatik.tu-muenchen.dbp.de -Verified perl 4.0 at patchlevel 19 -Minor fixes. Previous fixes at PL10 were not included into distribution. - November 1991 - Kai Uwe Rommel - rommel@informatik.tu-muenchen.dbp.de - - -Verified patchlevel 44. -Only two #ifdefs added to eval.c. Stack size for A2P had to be corrected. -PERLGLOB separated from DOS version because of HPFS support. - -[Note: instead of #ifdef'ing eval.c I fixed it in perl.h--lwall] - - January 1991 - - Kai Uwe Rommel - rommel@lan.informatik.tu-muenchen.dbp.de diff --git a/os2/a2p.cs b/os2/a2p.cs deleted file mode 100644 index 063ec25f46..0000000000 --- a/os2/a2p.cs +++ /dev/null @@ -1,8 +0,0 @@ -(-W1 -Od -Ocgelt a2p.y{a2py.c}) -(-W1 -Od -Ocgelt hash.c str.c util.c walk.c) - -setargv.obj -..\os2\perl.def -a2p.exe - --AL -LB -S0x9000 diff --git a/os2/a2p.def b/os2/a2p.def deleted file mode 100644 index a14bc63f16..0000000000 --- a/os2/a2p.def +++ /dev/null @@ -1 +0,0 @@ -(deprecated) diff --git a/os2/alarm.c b/os2/alarm.c deleted file mode 100644 index 974e2380d8..0000000000 --- a/os2/alarm.c +++ /dev/null @@ -1,149 +0,0 @@ -/* - * This software is Copyright 1989 by Jack Hudler. - * - * Permission is hereby granted to copy, reproduce, redistribute or otherwise - * use this software as long as: there is no monetary profit gained - * specifically from the use or reproduction or this software, it is not - * sold, rented, traded or otherwise marketed, and this copyright notice is - * included prominently in any copy made. - * - * The author make no claims as to the fitness or correctness of this software - * for any use whatsoever, and it is provided as is. Any use of this software - * is at the user's own risk. - * - */ - -/****************************** 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. -\***************************************************************************/ - -/* Tested using OS2 1.2 with Microsoft C 5.1 and 6.0. */ - -#define INCL_DOSPROCESS -#define INCL_DOSSIGNALS -#define INCL_DOS -#include <os2.h> - -#include <stdlib.h> -#include <stdio.h> -#include <signal.h> - -#include "alarm.h" - -#define ALARM_STACK 4096 /* This maybe over kill, but the page size is 4K */ - -static PBYTE pbAlarmStack; -static SEL selAlarmStack; -static TID tidAlarm; -static PID pidMain; -static BOOL bAlarmInit=FALSE; -static BOOL bAlarmRunning=FALSE; -static USHORT uTime; - -static VOID FAR alarm_thread ( VOID ) -{ - while(1) - { - if (bAlarmRunning) - { - DosSleep(1000L); - uTime--; - if (uTime==0L) - { - // send signal to the main process.. I could have put raise() here - // however that would require the use of the multithreaded library, - // and it does not contain raise()! - // I tried it with the standard library, this signaled ok, but a - // test printf in the signal would not work and even caused SEGV. - // So I signal the process through OS/2 and then the process - // signals itself. - if (bAlarmRunning) - DosFlagProcess(pidMain,FLGP_PID, PFLG_A,1); - bAlarmRunning=FALSE; - } - } - else - DosSleep(500L); - } -} - -static VOID PASCAL FAR AlarmSignal(USHORT usSigArg,USHORT usSigNum) -{ - /* - * this is not executed from the thread. The thread triggers Process - * flag A which is in the main processes scope, this inturn triggers - * (via the raise) SIGUSR1 which is defined to SIGALRM. - */ - raise(SIGUSR1); -} - -static void alarm_init(void) -{ - PFNSIGHANDLER pfnPrev; - USHORT pfAction; - PIDINFO pid; - - bAlarmInit = TRUE; - - if (!DosAllocSeg( ALARM_STACK, (PSEL) &selAlarmStack, SEG_NONSHARED )) - { - OFFSETOF(pbAlarmStack) = ALARM_STACK - 2; - SELECTOROF(pbAlarmStack) = selAlarmStack; - /* Create the thread */ - if (DosCreateThread( alarm_thread, &tidAlarm, pbAlarmStack )) - { - fprintf(stderr,"Alarm thread failed to start.\n"); - exit(1); - } - /* Setup the signal handler for Process Flag A */ - if (DosSetSigHandler(AlarmSignal,&pfnPrev,&pfAction,SIGA_ACCEPT,SIG_PFLG_A)) - { - fprintf(stderr,"SigHandler Failed to install.\n"); - exit(1); - } - /* Save main process ID, we'll need it for triggering the signal */ - DosGetPID(&pid); - pidMain = pid.pid; - } - else - exit(1); -} - -unsigned alarm(unsigned sec) -{ - if (!bAlarmInit) alarm_init(); - - if (sec) - { - uTime = sec; - bAlarmRunning = TRUE; - } - else - bAlarmRunning = FALSE; - - return 0; -} - -#ifdef TESTING -/* A simple test to see if it works */ -BOOL x; - -void timeout(void) -{ - fprintf(stderr,"ALARM TRIGGERED!!\n"); - DosBeep(1000,500); - x++; -} - -void main(void) -{ - (void) signal(SIGALRM, timeout); - (void) alarm(1L); - printf("ALARM RUNNING!!\n"); - while(!x); -} -#endif diff --git a/os2/alarm.h b/os2/alarm.h deleted file mode 100644 index b5fe69445b..0000000000 --- a/os2/alarm.h +++ /dev/null @@ -1,2 +0,0 @@ -#define SIGALRM SIGUSR1 -unsigned alarm(unsigned); diff --git a/os2/config.h b/os2/config.h deleted file mode 100644 index b37cf5ef5b..0000000000 --- a/os2/config.h +++ /dev/null @@ -1,910 +0,0 @@ -/* manually edited version for OS/2 with MS C 6.00 - check the HAS_?DBM symbols and if you have such a library ... - June 1991, Kai Uwe Rommel */ - -#ifndef config_h -#define config_h -/* config.h - * This file was produced by running the config.h.SH script, which - * gets its values from config.sh, which is generally produced by - * running Configure. - * - * Feel free to modify any of this as the need arises. Note, however, - * that running config.h.SH again will wipe out any changes you've made. - * For a more permanent change edit config.sh and rerun config.h.SH. - */ - -#define OS2 - -/* OS/2 supports some additional things MS-DOS doesn't. - */ -#define S_ISUID 0 -#define S_ISGID 0 - -#define HAS_ALARM -#define HAS_GETPPID -#define HAS_PIPE -#define HAS_KILL -#define HAS_WAIT -#define HAS_UMASK -#define HAS_GDBM - -/* EUNICE - * This symbol, if defined, indicates that the program is being compiled - * under the EUNICE package under VMS. The program will need to handle - * things like files that don't go away the first time you unlink them, - * due to version numbering. It will also need to compensate for lack - * of a respectable link() command. - */ -/* VMS - * This symbol, if defined, indicates that the program is running under - * VMS. It is currently only set in conjunction with the EUNICE symbol. - */ -/*#undef EUNICE /**/ -/*#undef VMS /**/ - -/* ALIGNBYTES - * This symbol contains the number of bytes required to align a double. - * Usual values are 2, 4, and 8. - */ -#define ALIGNBYTES 2 /**/ - -/* BIN - * This symbol holds the name of the directory in which the user wants - * to keep publicly executable images for the package in question. It - * is most often a local directory such as /usr/local/bin. - */ -#define BIN "c:/bin" /**/ - -/* BYTEORDER - * This symbol contains an encoding of the order of bytes in a long. - * Usual values (in octal) are 01234, 04321, 02143, 03412... - */ -#define BYTEORDER 0x1234 /**/ - -/* CPPSTDIN - * This symbol contains the first part of the string which will invoke - * the C preprocessor on the standard input and produce to standard - * output. Typical value of "cc -E" or "/lib/cpp". - */ -/* CPPMINUS - * This symbol contains the second part of the string which will invoke - * the C preprocessor on the standard input and produce to standard - * output. This symbol will have the value "-" if CPPSTDIN needs a minus - * to specify standard input, otherwise the value is "". - */ -#define CPPSTDIN "cpp -P" -#define CPPMINUS "" - -/* HAS_BCMP - * This symbol, if defined, indicates that the bcmp routine is available - * to compare blocks of memory. If undefined, use memcmp. If that's - * not available, roll your own. - */ -/* #define HAS_BCMP /**/ - -/* HAS_BCOPY - * This symbol, if defined, indicates that the bcopy routine is available - * to copy blocks of memory. Otherwise you should probably use memcpy(). - */ -/* #define HAS_BCOPY /**/ - -/* HAS_BZERO - * This symbol, if defined, indicates that the bzero routine is available - * to zero blocks of memory. Otherwise you should probably use memset() - * or roll your own. - */ -/* #define HAS_BZERO /**/ - -/* CASTNEGFLOAT - * This symbol, if defined, indicates that this C compiler knows how to - * cast negative or large floating point numbers to unsigned longs, ints - * and shorts. - */ -/* CASTFLAGS - * This symbol contains flags that say what difficulties the compiler - * has casting odd floating values to unsigned long: - * 1 = couldn't cast < 0 - * 2 = couldn't cast >= 0x80000000 - */ -#define CASTNEGFLOAT /**/ -#define CASTFLAGS 1 /**/ - -/* CHARSPRINTF - * This symbol is defined if this system declares "char *sprintf()" in - * stdio.h. The trend seems to be to declare it as "int sprintf()". It - * is up to the package author to declare sprintf correctly based on the - * symbol. - */ -/* #define CHARSPRINTF /**/ - -/* HAS_CHSIZE - * This symbol, if defined, indicates that the chsize routine is available - * to truncate files. You might need a -lx to get this routine. - */ -#undef HAS_CHSIZE /**/ - -/* HAS_CRYPT - * This symbol, if defined, indicates that the crypt routine is available - * to encrypt passwords and the like. - */ -#define HAS_CRYPT /**/ - -/* CSH - * This symbol, if defined, indicates that the C-shell exists. - * If defined, contains the full pathname of csh. - */ -/* #define CSH "/bin/csh" /**/ - -/* DOSUID - * This symbol, if defined, indicates that the C program should - * check the script that it is executing for setuid/setgid bits, and - * attempt to emulate setuid/setgid on systems that have disabled - * setuid #! scripts because the kernel can't do it securely. - * It is up to the package designer to make sure that this emulation - * is done securely. Among other things, it should do an fstat on - * the script it just opened to make sure it really is a setuid/setgid - * script, it should make sure the arguments passed correspond exactly - * to the argument on the #! line, and it should not trust any - * subprocesses to which it must pass the filename rather than the - * file descriptor of the script to be executed. - */ -/*#undef DOSUID /**/ - -/* HAS_DUP2 - * This symbol, if defined, indicates that the dup2 routine is available - * to dup file descriptors. Otherwise you should use dup(). - */ -#define HAS_DUP2 /**/ - -/* HAS_FCHMOD - * This symbol, if defined, indicates that the fchmod routine is available - * to change mode of opened files. If unavailable, use chmod(). - */ -/* #define HAS_FCHMOD /**/ - -/* HAS_FCHOWN - * This symbol, if defined, indicates that the fchown routine is available - * to change ownership of opened files. If unavailable, use chown(). - */ -/* #define HAS_FCHOWN /**/ - -/* HAS_FCNTL - * This symbol, if defined, indicates to the C program that - * the fcntl() function exists. - */ -/* #define HAS_FCNTL /**/ - -/* FLEXFILENAMES - * This symbol, if defined, indicates that the system supports filenames - * longer than 14 characters. - */ -#define FLEXFILENAMES /**/ - -/* HAS_FLOCK - * This symbol, if defined, indicates that the flock() routine is - * available to do file locking. - */ -/* #define HAS_FLOCK /**/ - -/* HAS_GETGROUPS - * This symbol, if defined, indicates that the getgroups() routine is - * available to get the list of process groups. If unavailable, multiple - * groups are probably not supported. - */ -/* #define HAS_GETGROUPS /**/ - -/* HAS_GETHOSTENT - * This symbol, if defined, indicates that the gethostent() routine is - * available to lookup host names in some data base or other. - */ -/*#undef HAS_GETHOSTENT /**/ - -/* HAS_GETPGRP - * This symbol, if defined, indicates that the getpgrp() routine is - * available to get the current process group. - */ -/* #define HAS_GETPGRP /**/ - -/* HAS_GETPGRP2 - * This symbol, if defined, indicates that the getpgrp2() (as in DG/UX) - * routine is available to get the current process group. - */ -/*#undef HAS_GETPGRP2 /**/ - -/* HAS_GETPRIORITY - * This symbol, if defined, indicates that the getpriority() routine is - * available to get a process's priority. - */ -#define HAS_GETPRIORITY /**/ - -/* HAS_HTONS - * This symbol, if defined, indicates that the htons routine (and friends) - * are available to do network order byte swapping. - */ -/* HAS_HTONL - * This symbol, if defined, indicates that the htonl routine (and friends) - * are available to do network order byte swapping. - */ -/* HAS_NTOHS - * This symbol, if defined, indicates that the ntohs routine (and friends) - * are available to do network order byte swapping. - */ -/* HAS_NTOHL - * This symbol, if defined, indicates that the ntohl routine (and friends) - * are available to do network order byte swapping. - */ -/* #define HAS_HTONS /**/ -/* #define HAS_HTONL /**/ -/* #define HAS_NTOHS /**/ -/* #define HAS_NTOHL /**/ - -/* index - * This preprocessor symbol is defined, along with rindex, if the system - * uses the strchr and strrchr routines instead. - */ -/* rindex - * This preprocessor symbol is defined, along with index, if the system - * uses the strchr and strrchr routines instead. - */ -#define index strchr /* cultural */ -#define rindex strrchr /* differences? */ - -/* HAS_ISASCII - * This symbol, if defined, indicates that the isascii routine is available - * to test characters for asciiness. - */ -/*#undef HAS_ISASCII /**/ - -/* HAS_KILLPG - * This symbol, if defined, indicates that the killpg routine is available - * to kill process groups. If unavailable, you probably should use kill - * with a negative process number. - */ -/* #define HAS_KILLPG /**/ - -/* HAS_LSTAT - * This symbol, if defined, indicates that the lstat() routine is - * available to stat symbolic links. - */ -/* #define HAS_LSTAT /**/ - -/* HAS_MEMCMP - * This symbol, if defined, indicates that the memcmp routine is available - * to compare blocks of memory. If undefined, roll your own. - */ -#define HAS_MEMCMP /**/ - -/* HAS_MEMCPY - * This symbol, if defined, indicates that the memcpy routine is available - * to copy blocks of memory. Otherwise you should probably use bcopy(). - * If neither is defined, roll your own. - */ -/* SAFE_MEMCPY - * This symbol, if defined, indicates that the memcpy routine is available - * to copy potentially overlapping copy blocks of memory. Otherwise you - * should probably use memmove() or bcopy(). If neither is defined, - * roll your own. - */ -#define HAS_MEMCPY /**/ -/*#undef SAFE_MEMCPY /**/ - -/* HAS_MEMMOVE - * This symbol, if defined, indicates that the memmove routine is available - * to move potentially overlapping blocks of memory. Otherwise you - * should use bcopy() or roll your own. - */ -/*#undef HAS_MEMMOVE /**/ - -/* HAS_MEMSET - * This symbol, if defined, indicates that the memset routine is available - * to set a block of memory to a character. If undefined, roll your own. - */ -#define HAS_MEMSET /**/ - -/* HAS_MKDIR - * This symbol, if defined, indicates that the mkdir routine is available - * to create directories. Otherwise you should fork off a new process to - * exec /bin/mkdir. - */ -#define HAS_MKDIR /**/ - -/* HAS_MSG - * This symbol, if defined, indicates that the entire msg*(2) library is - * supported. - */ -/* #define HAS_MSG /**/ - -/* HAS_MSGCTL - * This symbol, if defined, indicates that the msgctl() routine is - * available to control message passing. - */ -/* #define HAS_MSGCTL /**/ - -/* HAS_MSGGET - * This symbol, if defined, indicates that the msgget() routine is - * available to get messages. - */ -/* #define HAS_MSGGET /**/ - -/* HAS_MSGRCV - * This symbol, if defined, indicates that the msgrcv() routine is - * available to receive messages. - */ -/* #define HAS_MSGRCV /**/ - -/* HAS_MSGSND - * This symbol, if defined, indicates that the msgsnd() routine is - * available to send messages. - */ -/* #define HAS_MSGSND /**/ - -/* HAS_NDBM - * This symbol, if defined, indicates that ndbm.h exists and should - * be included. - */ -/* #define HAS_NDBM /**/ - -/* HAS_ODBM - * This symbol, if defined, indicates that dbm.h exists and should - * be included. - */ -/* #define HAS_ODBM /**/ - -/* HAS_OPEN3 - * This manifest constant lets the C program know that the three - * argument form of open(2) is available. - */ -#define HAS_OPEN3 /**/ - -/* HAS_READDIR - * This symbol, if defined, indicates that the readdir routine is available - * from the C library to read directories. - */ -#define HAS_READDIR /**/ - -/* HAS_RENAME - * This symbol, if defined, indicates that the rename routine is available - * to rename files. Otherwise you should do the unlink(), link(), unlink() - * trick. - */ -#define HAS_RENAME /**/ - -/* HAS_REWINDDIR - * This symbol, if defined, indicates that the rewindir routine is - * available to rewind directories. - */ -#define HAS_REWINDDIR /**/ - -/* HAS_RMDIR - * This symbol, if defined, indicates that the rmdir routine is available - * to remove directories. Otherwise you should fork off a new process to - * exec /bin/rmdir. - */ -#define HAS_RMDIR /**/ - -/* HAS_SEEKDIR - * This symbol, if defined, indicates that the seekdir routine is - * available to seek into directories. - */ -#define HAS_SEEKDIR /**/ - -/* HAS_SELECT - * This symbol, if defined, indicates that the select() subroutine - * exists. - */ -/* #define HAS_SELECT /**/ - -/* HAS_SEM - * This symbol, if defined, indicates that the entire sem*(2) library is - * supported. - */ -/* #define HAS_SEM /**/ - -/* HAS_SEMCTL - * This symbol, if defined, indicates that the semctl() routine is - * available to control semaphores. - */ -/* #define HAS_SEMCTL /**/ - -/* HAS_SEMGET - * This symbol, if defined, indicates that the semget() routine is - * available to get semaphores ids. - */ -/* #define HAS_SEMGET /**/ - -/* HAS_SEMOP - * This symbol, if defined, indicates that the semop() routine is - * available to perform semaphore operations. - */ -/* #define HAS_SEMOP /**/ - -/* HAS_SETEGID - * This symbol, if defined, indicates that the setegid routine is available - * to change the effective gid of the current program. - */ -/* #define HAS_SETEGID /**/ - -/* HAS_SETEUID - * This symbol, if defined, indicates that the seteuid routine is available - * to change the effective uid of the current program. - */ -/* #define HAS_SETEUID /**/ - -/* HAS_SETPGRP - * This symbol, if defined, indicates that the setpgrp() routine is - * available to set the current process group. - */ -/* #define HAS_SETPGRP /**/ - -/* HAS_SETPGRP2 - * This symbol, if defined, indicates that the setpgrp2() (as in DG/UX) - * routine is available to set the current process group. - */ -/*#undef HAS_SETPGRP2 /**/ - -/* HAS_SETPRIORITY - * This symbol, if defined, indicates that the setpriority() routine is - * available to set a process's priority. - */ -#define HAS_SETPRIORITY /**/ - -/* HAS_SETREGID - * This symbol, if defined, indicates that the setregid routine is - * available to change the real and effective gid of the current program. - */ -/* HAS_SETRESGID - * This symbol, if defined, indicates that the setresgid routine is - * available to change the real, effective and saved gid of the current - * program. - */ -/* #define HAS_SETREGID /**/ -/*#undef HAS_SETRESGID /**/ - -/* HAS_SETREUID - * This symbol, if defined, indicates that the setreuid routine is - * available to change the real and effective uid of the current program. - */ -/* HAS_SETRESUID - * This symbol, if defined, indicates that the setresuid routine is - * available to change the real, effective and saved uid of the current - * program. - */ -/* #define HAS_SETREUID /**/ -/*#undef HAS_SETRESUID /**/ - -/* HAS_SETRGID - * This symbol, if defined, indicates that the setrgid routine is available - * to change the real gid of the current program. - */ -/* #define HAS_SETRGID /**/ - -/* HAS_SETRUID - * This symbol, if defined, indicates that the setruid routine is available - * to change the real uid of the current program. - */ -/* #define HAS_SETRUID /**/ - -/* HAS_SHM - * This symbol, if defined, indicates that the entire shm*(2) library is - * supported. - */ -/* #define HAS_SHM /**/ - -/* HAS_SHMAT - * This symbol, if defined, indicates that the shmat() routine is - * available to attach a shared memory segment. - */ -/* VOID_SHMAT - * This symbol, if defined, indicates that the shmat() routine - * returns a pointer of type void*. - */ -/* #define HAS_SHMAT /**/ - -/*#undef VOIDSHMAT /**/ - -/* HAS_SHMCTL - * This symbol, if defined, indicates that the shmctl() routine is - * available to control a shared memory segment. - */ -/* #define HAS_SHMCTL /**/ - -/* HAS_SHMDT - * This symbol, if defined, indicates that the shmdt() routine is - * available to detach a shared memory segment. - */ -/* #define HAS_SHMDT /**/ - -/* HAS_SHMGET - * This symbol, if defined, indicates that the shmget() routine is - * available to get a shared memory segment id. - */ -/* #define HAS_SHMGET /**/ - -/* HAS_SOCKET - * This symbol, if defined, indicates that the BSD socket interface is - * supported. - */ -/* HAS_SOCKETPAIR - * This symbol, if defined, indicates that the BSD socketpair call is - * supported. - */ -/* OLDSOCKET - * This symbol, if defined, indicates that the 4.1c BSD socket interface - * is supported instead of the 4.2/4.3 BSD socket interface. - */ -/* #define HAS_SOCKET /**/ - -/* #define HAS_SOCKETPAIR /**/ - -/*#undef OLDSOCKET /**/ - -/* STATBLOCKS - * This symbol is defined if this system has a stat structure declaring - * st_blksize and st_blocks. - */ -/* #define STATBLOCKS /**/ - -/* STDSTDIO - * This symbol is defined if this system has a FILE structure declaring - * _ptr and _cnt in stdio.h. - */ -#define STDSTDIO /**/ - -/* STRUCTCOPY - * This symbol, if defined, indicates that this C compiler knows how - * to copy structures. If undefined, you'll need to use a block copy - * routine of some sort instead. - */ -#define STRUCTCOPY /**/ - -/* HAS_STRERROR - * This symbol, if defined, indicates that the strerror() routine is - * available to translate error numbers to strings. - */ -/*#undef HAS_STRERROR /**/ - -/* HAS_SYMLINK - * This symbol, if defined, indicates that the symlink routine is available - * to create symbolic links. - */ -/* #define HAS_SYMLINK /**/ - -/* HAS_SYSCALL - * This symbol, if defined, indicates that the syscall routine is available - * to call arbitrary system calls. If undefined, that's tough. - */ -/* #define HAS_SYSCALL /**/ - -/* HAS_TELLDIR - * This symbol, if defined, indicates that the telldir routine is - * available to tell your location in directories. - */ -#define HAS_TELLDIR /**/ - -/* HAS_TRUNCATE - * This symbol, if defined, indicates that the truncate routine is - * available to truncate files. - */ -/* #define HAS_TRUNCATE /**/ - -/* HAS_VFORK - * This symbol, if defined, indicates that vfork() exists. - */ -/* #define HAS_VFORK /**/ - -/* VOIDSIG - * This symbol is defined if this system declares "void (*signal())()" in - * signal.h. The old way was to declare it as "int (*signal())()". It - * is up to the package author to declare things correctly based on the - * symbol. - */ -/* TO_SIGNAL - * This symbol's value is either "void" or "int", corresponding to the - * appropriate return "type" of a signal handler. Thus, one can declare - * a signal handler using "TO_SIGNAL (*handler())()", and define the - * handler using "TO_SIGNAL handler(sig)". - */ -#define VOIDSIG /**/ -#define TO_SIGNAL void /**/ - -/* HASVOLATILE - * This symbol, if defined, indicates that this C compiler knows about - * the volatile declaration. - */ -#define HASVOLATILE /**/ - -/* HAS_VPRINTF - * This symbol, if defined, indicates that the vprintf routine is available - * to printf with a pointer to an argument list. If unavailable, you - * may need to write your own, probably in terms of _doprnt(). - */ -/* CHARVSPRINTF - * This symbol is defined if this system has vsprintf() returning type - * (char*). The trend seems to be to declare it as "int vsprintf()". It - * is up to the package author to declare vsprintf correctly based on the - * symbol. - */ -#define HAS_VPRINTF /**/ -/* #define CHARVSPRINTF /**/ - -/* HAS_WAIT4 - * This symbol, if defined, indicates that wait4() exists. - */ -/* #define HAS_WAIT4 /**/ - -/* HAS_WAITPID - * This symbol, if defined, indicates that waitpid() exists. - */ -#define HAS_WAITPID /**/ - -/* GIDTYPE - * This symbol has a value like gid_t, int, ushort, or whatever type is - * used to declare group ids in the kernel. - */ -#define GIDTYPE int /**/ - -/* GROUPSTYPE - * This symbol has a value like gid_t, int, ushort, or whatever type is - * used in the return value of getgroups(). - */ -#define GROUPSTYPE int /**/ - -/* I_FCNTL - * This manifest constant tells the C program to include <fcntl.h>. - */ -/*#undef I_FCNTL /**/ - -/* I_GDBM - * This symbol, if defined, indicates that gdbm.h exists and should - * be included. - */ -#define I_GDBM /**/ - -/* I_GRP - * This symbol, if defined, indicates to the C program that it should - * include grp.h. - */ -/* #define I_GRP /**/ - -/* I_NETINET_IN - * This symbol, if defined, indicates to the C program that it should - * include netinet/in.h. - */ -/* I_SYS_IN - * This symbol, if defined, indicates to the C program that it should - * include sys/in.h. - */ -/* #define I_NETINET_IN /**/ -/*#undef I_SYS_IN /**/ - -/* I_PWD - * This symbol, if defined, indicates to the C program that it should - * include pwd.h. - */ -/* PWQUOTA - * This symbol, if defined, indicates to the C program that struct passwd - * contains pw_quota. - */ -/* PWAGE - * This symbol, if defined, indicates to the C program that struct passwd - * contains pw_age. - */ -/* PWCHANGE - * This symbol, if defined, indicates to the C program that struct passwd - * contains pw_change. - */ -/* PWCLASS - * This symbol, if defined, indicates to the C program that struct passwd - * contains pw_class. - */ -/* PWEXPIRE - * This symbol, if defined, indicates to the C program that struct passwd - * contains pw_expire. - */ -/* PWCOMMENT - * This symbol, if defined, indicates to the C program that struct passwd - * contains pw_comment. - */ -/* #define I_PWD /**/ -/*#undef PWQUOTA /**/ -/* #define PWAGE /**/ -/*#undef PWCHANGE /**/ -/*#undef PWCLASS /**/ -/*#undef PWEXPIRE /**/ -/* #define PWCOMMENT /**/ - -/* I_SYS_FILE - * This manifest constant tells the C program to include <sys/file.h>. - */ -/* #define I_SYS_FILE /**/ - -/* I_SYSIOCTL - * This symbol, if defined, indicates that sys/ioctl.h exists and should - * be included. - */ -/* #define I_SYSIOCTL /**/ - -/* I_TIME - * This symbol is defined if the program should include <time.h>. - */ -/* I_SYS_TIME - * This symbol is defined if the program should include <sys/time.h>. - */ -/* SYSTIMEKERNEL - * This symbol is defined if the program should include <sys/time.h> - * with KERNEL defined. - */ -/* I_SYS_SELECT - * This symbol is defined if the program should include <sys/select.h>. - */ -#define I_TIME /**/ -/* #define I_SYS_TIME /**/ -/*#undef SYSTIMEKERNEL /**/ -/*#undef I_SYS_SELECT /**/ - -/* I_UTIME - * This symbol, if defined, indicates to the C program that it should - * include utime.h. - */ -/* #define I_UTIME /**/ - -/* I_VARARGS - * This symbol, if defined, indicates to the C program that it should - * include varargs.h. - */ -#define I_VARARGS /**/ - -/* I_VFORK - * This symbol, if defined, indicates to the C program that it should - * include vfork.h. - */ -/* #define I_VFORK /**/ - -/* INTSIZE - * This symbol contains the size of an int, so that the C preprocessor - * can make decisions based on it. - */ -#define INTSIZE 2 /**/ - -/* I_DIRENT - * This symbol, if defined, indicates that the program should use the - * P1003-style directory routines, and include <dirent.h>. - */ -/* I_SYS_DIR - * This symbol, if defined, indicates that the program should use the - * directory functions by including <sys/dir.h>. - */ -/* I_NDIR - * This symbol, if defined, indicates that the program should include the - * system's version of ndir.h, rather than the one with this package. - */ -/* I_SYS_NDIR - * This symbol, if defined, indicates that the program should include the - * system's version of sys/ndir.h, rather than the one with this package. - */ -/* I_MY_DIR - * This symbol, if defined, indicates that the program should compile - * the ndir.c code provided with the package. - */ -/* DIRNAMLEN - * This symbol, if defined, indicates to the C program that the length - * of directory entry names is provided by a d_namlen field. Otherwise - * you need to do strlen() on the d_name field. - */ -/* #define I_DIRENT /**/ -#define I_SYS_DIR /**/ -/*#undef I_NDIR /**/ -/*#undef I_SYS_NDIR /**/ -/*#undef I_MY_DIR /**/ -#define DIRNAMLEN /**/ - -/* MYMALLOC - * This symbol, if defined, indicates that we're using our own malloc. - */ -/* MALLOCPTRTYPE - * This symbol defines the kind of ptr returned by malloc and realloc. - */ -#define MYMALLOC /**/ - -#define MALLOCPTRTYPE void /**/ - - -/* RANDBITS - * This symbol contains the number of bits of random number the rand() - * function produces. Usual values are 15, 16, and 31. - */ -#define RANDBITS 15 /**/ - -/* SCRIPTDIR - * This symbol holds the name of the directory in which the user wants - * to keep publicly executable scripts for the package in question. It - * is often a directory that is mounted across diverse architectures. - */ -#define SCRIPTDIR "c:/bin/perl" /**/ - -/* SIG_NAME - * This symbol contains an list of signal names in order. - */ -#define SIG_NAME \ - "ZERO","HUP","INT","QUIT","ILL","TRAP","IOT","EMT","FPE",\ - /* 0 1 2 3 4 5 6 7 8 */\ - "KILL","BUS","SEGV","SYS","PIPE","UALRM","TERM","ALRM","USR2","CLD",\ - /* 9 10 11 12 13 14 15 16 17 18 */\ - "PWR","USR3","BREAK","ABRT" - /*19 20 21 22 */ - -/* STDCHAR - * This symbol is defined to be the type of char used in stdio.h. - * It has the values "unsigned char" or "char". - */ -#define STDCHAR char /**/ - -/* UIDTYPE - * This symbol has a value like uid_t, int, ushort, or whatever type is - * used to declare user ids in the kernel. - */ -#define UIDTYPE int /**/ - -/* VOIDHAVE - * This symbol indicates how much support of the void type is given by this - * compiler. What various bits mean: - * - * 1 = supports declaration of void - * 2 = supports arrays of pointers to functions returning void - * 4 = supports comparisons between pointers to void functions and - * addresses of void functions - * - * The package designer should define VOIDWANT to indicate the requirements - * of the package. This can be done either by #defining VOIDWANT before - * including config.h, or by defining voidwant in Myinit.U. If the level - * of void support necessary is not present, config.h defines void to "int", - * VOID to the empty string, and VOIDP to "char *". - */ -/* void - * This symbol is used for void casts. On implementations which support - * void appropriately, its value is "void". Otherwise, its value maps - * to "int". - */ -/* VOID - * This symbol's value is "void" if the implementation supports void - * appropriately. Otherwise, its value is the empty string. The primary - * use of this symbol is in specifying void parameter lists for function - * prototypes. - */ -/* VOIDP - * This symbol is used for casting generic pointers. On implementations - * which support void appropriately, its value is "void *". Otherwise, - * its value is "char *". - */ -#ifndef VOIDWANT -#define VOIDWANT 7 -#endif -#define VOIDHAVE 7 -#if (VOIDHAVE & VOIDWANT) != VOIDWANT -#define void int /* is void to be avoided? */ -#define VOID -#define VOIDP (char *) -#define M_VOID /* Xenix strikes again */ -#else -#define VOID void -#define VOIDP (void *) -#endif - -/* PRIVLIB - * This symbol contains the name of the private library for this package. - * The library is private in the sense that it needn't be in anyone's - * execution path, but it should be accessible by the world. The program - * should be prepared to do ~ expansion. - */ -#define PRIVLIB "c:/bin/perl" /**/ - -/* - * BINARY: - * This symbol is defined if you run under an operating system that - * distinguishes between binary and text files. If so the function - * setmode will be used to set the file into binary mode. - */ -#define BINARY - -#endif diff --git a/os2/crypt.c b/os2/crypt.c deleted file mode 100644 index 9f9b562c36..0000000000 --- a/os2/crypt.c +++ /dev/null @@ -1,276 +0,0 @@ -/* From Andy Tanenbaum's book "Computer Networks", - rewritten in C -*/ - -struct block { - unsigned char b_data[64]; -}; - -struct ordering { - unsigned char o_data[64]; -}; - -static struct block key; - -static struct ordering InitialTr = { - 58,50,42,34,26,18,10, 2,60,52,44,36,28,20,12, 4, - 62,54,46,38,30,22,14, 6,64,56,48,40,32,24,16, 8, - 57,49,41,33,25,17, 9, 1,59,51,43,35,27,19,11, 3, - 61,53,45,37,29,21,13, 5,63,55,47,39,31,23,15, 7, -}; - -static struct ordering FinalTr = { - 40, 8,48,16,56,24,64,32,39, 7,47,15,55,23,63,31, - 38, 6,46,14,54,22,62,30,37, 5,45,13,53,21,61,29, - 36, 4,44,12,52,20,60,28,35, 3,43,11,51,19,59,27, - 34, 2,42,10,50,18,58,26,33, 1,41, 9,49,17,57,25, -}; - -static struct ordering swap = { - 33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48, - 49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64, - 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,16, - 17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32, -}; - -static struct ordering KeyTr1 = { - 57,49,41,33,25,17, 9, 1,58,50,42,34,26,18, - 10, 2,59,51,43,35,27,19,11, 3,60,52,44,36, - 63,55,47,39,31,23,15, 7,62,54,46,38,30,22, - 14, 6,61,53,45,37,29,21,13, 5,28,20,12, 4, -}; - -static struct ordering KeyTr2 = { - 14,17,11,24, 1, 5, 3,28,15, 6,21,10, - 23,19,12, 4,26, 8,16, 7,27,20,13, 2, - 41,52,31,37,47,55,30,40,51,45,33,48, - 44,49,39,56,34,53,46,42,50,36,29,32, -}; - -static struct ordering etr = { - 32, 1, 2, 3, 4, 5, 4, 5, 6, 7, 8, 9, - 8, 9,10,11,12,13,12,13,14,15,16,17, - 16,17,18,19,20,21,20,21,22,23,24,25, - 24,25,26,27,28,29,28,29,30,31,32, 1, -}; - -static struct ordering ptr = { - 16, 7,20,21,29,12,28,17, 1,15,23,26, 5,18,31,10, - 2, 8,24,14,32,27, 3, 9,19,13,30, 6,22,11, 4,25, -}; - -static unsigned char s_boxes[8][64] = { -{ 14, 4,13, 1, 2,15,11, 8, 3,10, 6,12, 5, 9, 0, 7, - 0,15, 7, 4,14, 2,13, 1,10, 6,12,11, 9, 5, 3, 8, - 4, 1,14, 8,13, 6, 2,11,15,12, 9, 7, 3,10, 5, 0, - 15,12, 8, 2, 4, 9, 1, 7, 5,11, 3,14,10, 0, 6,13, -}, - -{ 15, 1, 8,14, 6,11, 3, 4, 9, 7, 2,13,12, 0, 5,10, - 3,13, 4, 7,15, 2, 8,14,12, 0, 1,10, 6, 9,11, 5, - 0,14, 7,11,10, 4,13, 1, 5, 8,12, 6, 9, 3, 2,15, - 13, 8,10, 1, 3,15, 4, 2,11, 6, 7,12, 0, 5,14, 9, -}, - -{ 10, 0, 9,14, 6, 3,15, 5, 1,13,12, 7,11, 4, 2, 8, - 13, 7, 0, 9, 3, 4, 6,10, 2, 8, 5,14,12,11,15, 1, - 13, 6, 4, 9, 8,15, 3, 0,11, 1, 2,12, 5,10,14, 7, - 1,10,13, 0, 6, 9, 8, 7, 4,15,14, 3,11, 5, 2,12, -}, - -{ 7,13,14, 3, 0, 6, 9,10, 1, 2, 8, 5,11,12, 4,15, - 13, 8,11, 5, 6,15, 0, 3, 4, 7, 2,12, 1,10,14, 9, - 10, 6, 9, 0,12,11, 7,13,15, 1, 3,14, 5, 2, 8, 4, - 3,15, 0, 6,10, 1,13, 8, 9, 4, 5,11,12, 7, 2,14, -}, - -{ 2,12, 4, 1, 7,10,11, 6, 8, 5, 3,15,13, 0,14, 9, - 14,11, 2,12, 4, 7,13, 1, 5, 0,15,10, 3, 9, 8, 6, - 4, 2, 1,11,10,13, 7, 8,15, 9,12, 5, 6, 3, 0,14, - 11, 8,12, 7, 1,14, 2,13, 6,15, 0, 9,10, 4, 5, 3, -}, - -{ 12, 1,10,15, 9, 2, 6, 8, 0,13, 3, 4,14, 7, 5,11, - 10,15, 4, 2, 7,12, 9, 5, 6, 1,13,14, 0,11, 3, 8, - 9,14,15, 5, 2, 8,12, 3, 7, 0, 4,10, 1,13,11, 6, - 4, 3, 2,12, 9, 5,15,10,11,14, 1, 7, 6, 0, 8,13, -}, - -{ 4,11, 2,14,15, 0, 8,13, 3,12, 9, 7, 5,10, 6, 1, - 13, 0,11, 7, 4, 9, 1,10,14, 3, 5,12, 2,15, 8, 6, - 1, 4,11,13,12, 3, 7,14,10,15, 6, 8, 0, 5, 9, 2, - 6,11,13, 8, 1, 4,10, 7, 9, 5, 0,15,14, 2, 3,12, -}, - -{ 13, 2, 8, 4, 6,15,11, 1,10, 9, 3,14, 5, 0,12, 7, - 1,15,13, 8,10, 3, 7, 4,12, 5, 6,11, 0,14, 9, 2, - 7,11, 4, 1, 9,12,14, 2, 0, 6,10,13,15, 3, 5, 8, - 2, 1,14, 7, 4,10, 8,13,15,12, 9, 0, 3, 5, 6,11, -}, -}; - -static int rots[] = { - 1,1,2,2,2,2,2,2,1,2,2,2,2,2,2,1, -}; - -static void transpose(struct block *data, struct ordering *t, int n) -{ - struct block x; - - x = *data; - - while (n-- > 0) { - data->b_data[n] = x.b_data[t->o_data[n] - 1]; - } -} - -static void rotate(struct block *key) -{ - register unsigned char *p = key->b_data; - register unsigned char *ep = &(key->b_data[55]); - int data0 = key->b_data[0], data28 = key->b_data[28]; - - while (p++ < ep) *(p-1) = *p; - key->b_data[27] = (char) data0; - key->b_data[55] = (char) data28; -} - -static struct ordering *EP = &etr; - -static void f(int i, struct block *key, struct block *a, struct block *x) -{ - struct block e, ikey, y; - int k; - register unsigned char *p, *q, *r; - - e = *a; - transpose(&e, EP, 48); - for (k = rots[i]; k; k--) rotate(key); - ikey = *key; - transpose(&ikey, &KeyTr2, 48); - p = &(y.b_data[48]); - q = &(e.b_data[48]); - r = &(ikey.b_data[48]); - while (p > y.b_data) { - *--p = *--q ^ *--r; - } - q = x->b_data; - for (k = 0; k < 8; k++) { - register int xb, r; - - r = *p++ << 5; - r += *p++ << 3; - r += *p++ << 2; - r += *p++ << 1; - r += *p++; - r += *p++ << 4; - - xb = s_boxes[k][r]; - - *q++ = (char) (xb >> 3) & 1; - *q++ = (char) (xb>>2) & 1; - *q++ = (char) (xb>>1) & 1; - *q++ = (char) (xb & 1); - } - transpose(x, &ptr, 32); -} - -void definekey(char *k) -{ - - key = *((struct block *) k); - transpose(&key, &KeyTr1, 56); -} - -void encrypt(char *blck, int edflag) -{ - register struct block *p = (struct block *) blck; - register int i; - - transpose(p, &InitialTr, 64); - for (i = 15; i>= 0; i--) { - int j = edflag ? i : 15 - i; - register int k; - struct block b, x; - - b = *p; - for (k = 31; k >= 0; k--) { - p->b_data[k] = b.b_data[k + 32]; - } - f(j, &key, p, &x); - for (k = 31; k >= 0; k--) { - p->b_data[k+32] = b.b_data[k] ^ x.b_data[k]; - } - } - transpose(p, &swap, 64); - transpose(p, &FinalTr, 64); -} - -char *crypt(char *pw, char *salt) -{ - - char pwb[66]; - static char result[16]; - register char *p = pwb; - struct ordering new_etr; - register int i; - - while (*pw && p < &pwb[64]) { - register int j = 7; - - while (j--) { - *p++ = (*pw >> j) & 01; - } - pw++; - *p++ = 0; - } - while (p < &pwb[64]) *p++ = 0; - - definekey(p = pwb); - - while (p < &pwb[66]) *p++ = 0; - - new_etr = etr; - EP = &new_etr; - for (i = 0; i < 2; i++) { - register char c = *salt++; - register int j; - - result[i] = c; - if ( c > 'Z') c -= 6 + 7 + '.'; /* c was a lower case letter */ - else if ( c > '9') c -= 7 + '.';/* c was upper case letter */ - else c -= '.'; /* c was digit, '.' or '/'. */ - /* now, 0 <= c <= 63 */ - for (j = 0; j < 6; j++) { - if ((c >> j) & 01) { - int t = 6*i + j; - int temp = new_etr.o_data[t]; - new_etr.o_data[t] = new_etr.o_data[t+24]; - new_etr.o_data[t+24] = (char) temp; - } - } - } - - if (result[1] == 0) result[1] = result[0]; - - for (i = 0; i < 25; i++) encrypt(pwb,0); - EP = &etr; - - p = pwb; - pw = result+2; - while (p < &pwb[66]) { - register int c = 0; - register int j = 6; - - while (j--) { - c <<= 1; - c |= *p++; - } - c += '.'; /* becomes >= '.' */ - if (c > '9') c += 7; /* not in [./0-9], becomes upper */ - if (c > 'Z') c += 6; /* not in [A-Z], becomes lower */ - *pw++ = (char) c; - } - *pw = 0; - return result; -} diff --git a/os2/dir.h b/os2/dir.h deleted file mode 100644 index 8ebfae988a..0000000000 --- a/os2/dir.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * @(#) dir.h 1.4 87/11/06 Public Domain. - * - * A public domain implementation of BSD directory routines for - * MS-DOS. Written by Michael Rendell ({uunet,utai}michael@garfield), - * August 1987 - * - * Enhanced and ported to OS/2 by Kai Uwe Rommel; added scandir() prototype - * December 1989, February 1990 - * Change of MAXPATHLEN for HPFS, October 1990 - */ - - -#define MAXNAMLEN 256 -#define MAXPATHLEN 256 - -#define A_RONLY 0x01 -#define A_HIDDEN 0x02 -#define A_SYSTEM 0x04 -#define A_LABEL 0x08 -#define A_DIR 0x10 -#define A_ARCHIVE 0x20 - - -struct direct -{ - ino_t d_ino; /* a bit of a farce */ - int d_reclen; /* more farce */ - int d_namlen; /* length of d_name */ - char d_name[MAXNAMLEN + 1]; /* null terminated */ - /* nonstandard fields */ - long d_size; /* size in bytes */ - unsigned d_mode; /* DOS or OS/2 file attributes */ - unsigned d_time; - unsigned d_date; -}; - -/* The fields d_size and d_mode are extensions by me (Kai Uwe Rommel). - * The find_first and find_next calls deliver this data without any extra cost. - * If this data is needed, these fields save a lot of extra calls to stat() - * (each stat() again performs a find_first call !). - */ - -struct _dircontents -{ - char *_d_entry; - long _d_size; - unsigned _d_mode, _d_time, _d_date; - struct _dircontents *_d_next; -}; - -typedef struct _dirdesc -{ - int dd_id; /* uniquely identify each open directory */ - long dd_loc; /* where we are in directory entry is this */ - struct _dircontents *dd_contents; /* pointer to contents of dir */ - struct _dircontents *dd_cp; /* pointer to current position */ -} -DIR; - - -extern int attributes; - -extern DIR *opendir(char *); -extern struct direct *readdir(DIR *); -extern void seekdir(DIR *, long); -extern long telldir(DIR *); -extern void closedir(DIR *); -#define rewinddir(dirp) seekdir(dirp, 0L) - -extern int scandir(char *, struct direct ***, - int (*)(struct direct *), - int (*)(struct direct *, struct direct *)); - -extern int getfmode(char *); -extern int setfmode(char *, unsigned); diff --git a/os2/director.c b/os2/director.c deleted file mode 100644 index 3966d3d4bf..0000000000 --- a/os2/director.c +++ /dev/null @@ -1,250 +0,0 @@ -/* - * @(#)dir.c 1.4 87/11/06 Public Domain. - * - * A public domain implementation of BSD directory routines for - * MS-DOS. Written by Michael Rendell ({uunet,utai}michael@garfield), - * August 1897 - * Ported to OS/2 by Kai Uwe Rommel - * December 1989, February 1990 - * Change for HPFS support, October 1990 - */ - -#include <sys/types.h> -#include <sys/stat.h> -#include <sys/dir.h> - -#include <stdlib.h> -#include <stdio.h> -#include <malloc.h> -#include <string.h> -#include <ctype.h> - -#define INCL_NOPM -#include <os2.h> - - -#ifndef PERLGLOB -int attributes = A_DIR | A_HIDDEN; - - -static char *getdirent(char *); -static void free_dircontents(struct _dircontents *); - -static HDIR hdir; -static USHORT count; -static FILEFINDBUF find; -static BOOL lower; - - -DIR *opendir(char *name) -{ - struct stat statb; - DIR *dirp; - char c; - char *s; - struct _dircontents *dp; - char nbuf[MAXPATHLEN + 1]; - - strcpy(nbuf, name); - - if ( ((c = nbuf[strlen(nbuf) - 1]) == '\\' || c == '/') && - (strlen(nbuf) > 1) ) - { - nbuf[strlen(nbuf) - 1] = 0; - - if ( nbuf[strlen(nbuf) - 1] == ':' ) - strcat(nbuf, "\\."); - } - else - if ( nbuf[strlen(nbuf) - 1] == ':' ) - strcat(nbuf, "."); - - if (stat(nbuf, &statb) < 0 || (statb.st_mode & S_IFMT) != S_IFDIR) - return NULL; - - if ( (dirp = malloc(sizeof(DIR))) == NULL ) - return NULL; - - if ( nbuf[strlen(nbuf) - 1] == '.' ) - strcpy(nbuf + strlen(nbuf) - 1, "*.*"); - else - if ( ((c = nbuf[strlen(nbuf) - 1]) == '\\' || c == '/') && - (strlen(nbuf) == 1) ) - strcat(nbuf, "*.*"); - else - strcat(nbuf, "\\*.*"); - - dirp -> dd_loc = 0; - dirp -> dd_contents = dirp -> dd_cp = NULL; - - if ((s = getdirent(nbuf)) == NULL) - return dirp; - - do - { - if (((dp = malloc(sizeof(struct _dircontents))) == NULL) || - ((dp -> _d_entry = malloc(strlen(s) + 1)) == NULL) ) - { - if (dp) - free(dp); - free_dircontents(dirp -> dd_contents); - - return NULL; - } - - if (dirp -> dd_contents) - dirp -> dd_cp = dirp -> dd_cp -> _d_next = dp; - else - dirp -> dd_contents = dirp -> dd_cp = dp; - - strcpy(dp -> _d_entry, s); - dp -> _d_next = NULL; - - dp -> _d_size = find.cbFile; - dp -> _d_mode = find.attrFile; - dp -> _d_time = *(unsigned *) &(find.ftimeLastWrite); - dp -> _d_date = *(unsigned *) &(find.fdateLastWrite); - } - while ((s = getdirent(NULL)) != NULL); - - dirp -> dd_cp = dirp -> dd_contents; - - return dirp; -} - - -void closedir(DIR * dirp) -{ - free_dircontents(dirp -> dd_contents); - free(dirp); -} - - -struct direct *readdir(DIR * dirp) -{ - static struct direct dp; - - if (dirp -> dd_cp == NULL) - return NULL; - - dp.d_namlen = dp.d_reclen = - strlen(strcpy(dp.d_name, dirp -> dd_cp -> _d_entry)); - - dp.d_ino = 0; - - dp.d_size = dirp -> dd_cp -> _d_size; - dp.d_mode = dirp -> dd_cp -> _d_mode; - dp.d_time = dirp -> dd_cp -> _d_time; - dp.d_date = dirp -> dd_cp -> _d_date; - - dirp -> dd_cp = dirp -> dd_cp -> _d_next; - dirp -> dd_loc++; - - return &dp; -} - - -void seekdir(DIR * dirp, long off) -{ - long i = off; - struct _dircontents *dp; - - if (off >= 0) - { - for (dp = dirp -> dd_contents; --i >= 0 && dp; dp = dp -> _d_next); - - dirp -> dd_loc = off - (i + 1); - dirp -> dd_cp = dp; - } -} - - -long telldir(DIR * dirp) -{ - return dirp -> dd_loc; -} - - -static void free_dircontents(struct _dircontents * dp) -{ - struct _dircontents *odp; - - while (dp) - { - if (dp -> _d_entry) - free(dp -> _d_entry); - - dp = (odp = dp) -> _d_next; - free(odp); - } -} - - -static -#endif -int IsFileSystemFAT(char *dir) -{ - USHORT nDrive; - ULONG lMap; - BYTE bData[64], bName[3]; - USHORT cbData; - - if ( _osmode == DOS_MODE ) - return TRUE; - else - { - /* We separate FAT and HPFS file systems here. - * Filenames read from a FAT system are converted to lower case - * while the case of filenames read from a HPFS (and other future - * file systems, like Unix-compatibles) is preserved. - */ - - if ( isalpha(dir[0]) && (dir[1] == ':') ) - nDrive = toupper(dir[0]) - '@'; - else - DosQCurDisk(&nDrive, &lMap); - - bName[0] = (char) (nDrive + '@'); - bName[1] = ':'; - bName[2] = 0; - - cbData = sizeof(bData); - - if ( !DosQFSAttach(bName, 0U, 1U, bData, &cbData, 0L) ) - return !strcmp(bData + (*(USHORT *) (bData + 2) + 7), "FAT"); - else - return FALSE; - - /* End of this ugly code */ - } -} - -#ifndef PERLGLOB -static char *getdirent(char *dir) -{ - int done; - - if (dir != NULL) - { /* get first entry */ - lower = IsFileSystemFAT(dir); - - hdir = HDIR_CREATE; - count = 1; - done = DosFindFirst(dir, &hdir, attributes, - &find, sizeof(find), &count, 0L); - } - else /* get next entry */ - done = DosFindNext(hdir, &find, sizeof(find), &count); - - if ( lower ) - strlwr(find.achName); - - if (done == 0) - return find.achName; - else - { - DosFindClose(hdir); - return NULL; - } -} -#endif diff --git a/os2/eg/alarm.pl b/os2/eg/alarm.pl deleted file mode 100644 index e244df47cc..0000000000 --- a/os2/eg/alarm.pl +++ /dev/null @@ -1,17 +0,0 @@ -sub handler { - local($sig) = @_; - print "Caught a SIG$sig -- shutting down\n"; - exit(0); -} - -$SIG{'ALRM'} = 'handler'; -$SIG{'INT'} = 'handler'; # Ctrl-C pressed -$SIG{'BREAK'} = 'handler'; # Ctrl-Break pressed -$SIG{'TERM'} = 'handler'; # Killed by another process - -print "Starting execution ...\n"; -alarm(10); - -while ( <> ) { -} -print "Normal exit.\n"; diff --git a/os2/eg/os2.pl b/os2/eg/os2.pl deleted file mode 100644 index 411d32712d..0000000000 --- a/os2/eg/os2.pl +++ /dev/null @@ -1,71 +0,0 @@ -extproc C:\binp\misc\perl.exe -S -#!perl - -# os2.pl: Demonstrates the OS/2 system calls and shows off some of the -# features in common with the UNIX version. - -do "syscalls.pl" || die "Cannot load syscalls.pl ($!)"; - -# OS/2 version number. - - $version = " "; syscall($OS2_GetVersion,$version); - ($minor, $major) = unpack("CC", $version); - print "You are using OS/2 version ", int($major/10), - ".", int($minor/10), "\n\n"; - -# Process ID. - print "This process ID is $$ and its parent's ID is ", - getppid(), "\n\n"; - -# Priority. - - printf "Current priority is %x\n", getpriority(0,0); - print "Changing priority by +5\n"; - print "Failed!\n" unless setpriority(0,0,+5); - printf "Priority is now %x\n\n", getpriority(0,0); - -# Beep. - print "Here is an A440.\n\n"; - syscall($OS2_Beep,440,50); - -# Pipes. Unlike MS-DOS, OS/2 supports true asynchronous pipes. - open(ROT13, '|perl -pe y/a-zA-Z/n-za-mN-ZA-M/') || die; - select(ROT13); $|=1; select(STDOUT); - print "Type two lines of stuff, and I'll ROT13 it while you wait.\n". - "If you type fast, you might be able to type both of your\n". - "lines before I get a chance to translate the first line.\n"; - $_ = <STDIN>; print ROT13 $_; - $_ = <STDIN>; print ROT13 $_; - close(ROT13); - print "Thanks.\n\n"; - -# Inspecting the disks. - print "Let's look at the disks you have installed...\n\n"; - - $x = "\0\0"; - syscall($OS2_Config, $x, 2); - print "You have ", unpack("S", $x), " floppy disks,\n"; - - $x = " "; - syscall($OS2_PhysicalDisk, 1, $x, 2, 0, 0); - ($numdisks) = unpack("S", $x); - - print "and $numdisks partitionable disks.\n\n"; - for ($i = 1; $i <= $numdisks; $i++) { - $disk = $i . ":"; - $handle = " "; - syscall($OS2_PhysicalDisk, 2, $handle, 2, $disk, 3); - ($numhandle) = unpack("S", $handle); - $zero = pack("C", 0); - $parmblock = " " x 16; - syscall($OS2_IOCtl, $parmblock, $zero, 0x63, 9, $numhandle); - ($x, $cylinders, $heads, $sect) = unpack("SSSS", $parmblock); - print "Hard drive #$i:\n"; - print " cylinders: $cylinders\n"; - print " heads: $heads\n"; - print " sect/trk: $sect\n"; - syscall($OS2_PhysicalDisk, 3, 0, 0, $handle, 2); - } - -# I won't bother with the other stuff. You get the idea. - diff --git a/os2/eg/syscalls.pl b/os2/eg/syscalls.pl deleted file mode 100644 index 2356f2e478..0000000000 --- a/os2/eg/syscalls.pl +++ /dev/null @@ -1,16 +0,0 @@ -# OS/2 syscall values - -$OS2_GetVersion = 0; -$OS2_Shutdown = 1; -$OS2_Beep = 2; -$OS2_PhysicalDisk = 3; -$OS2_Config = 4; -$OS2_IOCtl = 5; -$OS2_QCurDisk = 6; -$OS2_SelectDisk = 7; -$OS2_SetMaxFH = 8; -$OS2_Sleep = 9; -$OS2_StartSession = 10; -$OS2_StopSession = 11; -$OS2_SelectSession = 12; -1; diff --git a/os2/glob.c b/os2/glob.c deleted file mode 100644 index 75b00848be..0000000000 --- a/os2/glob.c +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Globbing for OS/2. Relies on the expansion done by the library - * startup code. - */ - -#define PERLGLOB -#include "director.c" - -int main(int argc, char **argv) -{ - SHORT i; - USHORT r; - CHAR *f; - - for (i = 1; i < argc; i++) - { - f = IsFileSystemFAT(argv[i]) ? strlwr(argv[i]) : argv[i]; - DosWrite(1, f, strlen(f) + 1, &r); - } - return argc - 1; -} diff --git a/os2/makefile b/os2/makefile deleted file mode 100644 index 9d5fac42b0..0000000000 --- a/os2/makefile +++ /dev/null @@ -1,125 +0,0 @@ -# -# Makefile for compiling Perl under OS/2 -# -# Needs a Unix compatible make. -# This makefile works for an initial compilation. It does not -# include all dependencies and thus is unsuitable for serious -# development work. Hey, I'm just inheriting what Diomidis gave me. -# -# Originally by Diomidis Spinellis, March 1990 -# Adjusted for OS/2 port by Raymond Chen, June 1990 -# - -# Source files -SRC = array.c cmd.c cons.c consarg.c doarg.c doio.c dolist.c dump.c \ -eval.c form.c hash.c perl.y perly.c regcomp.c regexec.c \ -stab.c str.c toke.c util.c os2.c popen.c director.c suffix.c mktemp.c - -# Object files -OBJ = perl.obj array.obj cmd.obj cons.obj consarg.obj doarg.obj doio.obj \ -dolist.obj dump.obj eval.obj form.obj hash.obj perly.obj regcomp.obj \ -regexec.obj stab.obj str.obj toke.obj util.obj os2.obj popen.obj \ -director.obj suffix.obj mktemp.obj - -# Files in the OS/2 distribution -DOSFILES=config.h director.c dir.h makefile os2.c popen.c suffix.c \ -mktemp.c readme.os2 - -# Yacc flags -YFLAGS=-d - -# Manual pages -MAN=perlman.1 perlman.2 perlman.3 perlman.4 - -CC=cl -# CBASE = flags everybody gets -# CPLAIN = flags for modules that give the compiler indigestion -# CFLAGS = flags for milder modules -# PERL = which version of perl to build -# -# For preliminary building: No optimization, DEBUGGING set, symbols included. -#CBASE=-AL -Zi -G2 -Gs -DDEBUGGING -#CPLAIN=$(CBASE) -Od -#CFLAGS=$(CBASE) -Od -#PERL=perlsym.exe - -# For the final build: Optimization on, symbols stripped. -CBASE=-AL -Zi -G2 -Gs -DDEBUGGING -CPLAIN=$(CBASE) -Olt -CFLAGS=$(CBASE) -Oeglt -PERL=perl.exe - -# Destination directory for executables -DESTDIR=\usr\bin - -# Deliverables -# -all: $(PERL) glob.exe - -perl.exe: $(OBJ) perl.arp - link @perl.arp,perl,nul,/stack:32767 /NOE; - exehdr /nologo /newfiles /pmtype:windowcompat perl.exe >nul - -perlsym.exe: $(OBJ) perl.arp - link @perl.arp,perlsym,nul,/stack:32767 /NOE /CODE; - exehdr /nologo /newfiles /pmtype:windowcompat perlsym.exe >nul - -perl.arp: - echo array+cmd+cons+consarg+doarg+doio+dolist+dump+ >perl.arp - echo eval+form+hash+perl+perly+regcomp+regexec+stab+suffix+ >>perl.arp - echo str+toke+util+os2+popen+director+\c600\lib\setargv >>perl.arp - -glob.exe: glob.c - $(CC) glob.c setargv.obj -link /NOE - exehdr /nologo /newfiles /pmtype:windowcompat glob.exe >nul - -array.obj: array.c - $(CC) $(CPLAIN) -c array.c -cmd.obj: cmd.c -cons.obj: cons.c perly.h -consarg.obj: consarg.c -# $(CC) $(CPLAIN) -c consarg.c -doarg.obj: doarg.c -doio.obj: doio.c -dolist.obj: dolist.c -dump.obj: dump.c -eval.obj: eval.c evalargs.xc - $(CC) /B2c2l /B3c3l $(CFLAGS) -c eval.c -form.obj: form.c -hash.obj: hash.c -perl.obj: perl.y -perly.obj: perly.c -regcomp.obj: regcomp.c -regexec.obj: regexec.c -stab.obj: stab.c - $(CC) $(CPLAIN) -c stab.c -str.obj: str.c -suffix.obj: suffix.c -toke.obj: toke.c - $(CC) /B3c3l $(CFLAGS) -c toke.c -util.obj: util.c -# $(CC) $(CPLAIN) -c util.c -perly.h: ytab.h - cp ytab.h perly.h -director.obj: director.c -popen.obj: popen.c -os2.obj: os2.c - -perl.1: $(MAN) - nroff -man $(MAN) >perl.1 - -install: all - exepack perl.exe $(DESTDIR)\perl.exe - exepack glob.exe $(DESTDIR)\glob.exe - -clean: - rm -f *.obj *.exe perl.1 perly.h perl.arp - -tags: - ctags *.c *.h *.xc - -dosperl: - mv $(DOSFILES) ../perl30.new - -doskit: - mv $(DOSFILES) ../os2 diff --git a/os2/mktemp.c b/os2/mktemp.c deleted file mode 100644 index a14bc63f16..0000000000 --- a/os2/mktemp.c +++ /dev/null @@ -1 +0,0 @@ -(deprecated) diff --git a/os2/os2.c b/os2/os2.c deleted file mode 100644 index a0aa0acd1a..0000000000 --- a/os2/os2.c +++ /dev/null @@ -1,298 +0,0 @@ -/* $RCSfile: os2.c,v $$Revision: 4.1 $$Date: 92/08/07 18:25:20 $ - * - * (C) Copyright 1989, 1990 Diomidis Spinellis. - * - * You may distribute under the terms of either the GNU General Public - * License or the Artistic License, as specified in the README file. - * - * $Log: os2.c,v $ - * Revision 4.1 92/08/07 18:25:20 lwall - * - * Revision 4.0.1.2 92/06/08 14:32:30 lwall - * patch20: new OS/2 support - * - * Revision 4.0.1.1 91/06/07 11:23:06 lwall - * patch4: new copyright notice - * - * Revision 4.0 91/03/20 01:36:21 lwall - * 4.0 baseline. - * - * Revision 3.0.1.2 90/11/10 01:42:38 lwall - * patch38: more msdos/os2 upgrades - * - * Revision 3.0.1.1 90/10/15 17:49:55 lwall - * patch29: Initial revision - * - * Revision 3.0.1.1 90/03/27 16:10:41 lwall - * patch16: MSDOS support - * - * Revision 1.1 90/03/18 20:32:01 dds - * Initial revision - * - */ - -#define INCL_DOS -#define INCL_NOPM -#include <os2.h> - -/* - * Various Unix compatibility functions for OS/2 - */ - -#include <stdio.h> -#include <errno.h> -#include <process.h> - -#include "EXTERN.h" -#include "perl.h" - - -/* dummies */ - -int ioctl(int handle, unsigned int function, char *data) -{ return -1; } - -int userinit() -{ return -1; } - -int syscall() -{ return -1; } - - -/* extended chdir() */ - -int chdir(char *path) -{ - if ( path[0] != 0 && path[1] == ':' ) - if ( DosSelectDisk(toupper(path[0]) - '@') ) - return -1; - - return DosChDir(path, 0L); -} - - -/* priorities */ - -int setpriority(int class, int pid, int val) -{ - int flag = 0; - - if ( pid < 0 ) - { - flag++; - pid = -pid; - } - - return DosSetPrty(flag ? PRTYS_PROCESSTREE : PRTYS_PROCESS, class, val, pid); -} - -int getpriority(int which /* ignored */, int pid) -{ - USHORT val; - - if ( DosGetPrty(PRTYS_PROCESS, &val, pid) ) - return -1; - else - return val; -} - - -/* get parent process id */ - -int getppid(void) -{ - PIDINFO pi; - - DosGetPID(&pi); - return pi.pidParent; -} - - -/* wait for specific pid */ -int wait4pid(int pid, int *status, int flags) -{ - RESULTCODES res; - int endpid, rc; - if ( DosCwait(DCWA_PROCESS, flags ? DCWW_NOWAIT : DCWW_WAIT, - &res, &endpid, pid) ) - return -1; - *status = res.codeResult; - return endpid; -} -/* kill */ - -int kill(int pid, int sig) -{ - int flag = 0; - - if ( pid < 0 ) - { - flag++; - pid = -pid; - } - - switch ( sig & 3 ) - { - - case 0: - DosKillProcess(flag ? DKP_PROCESSTREE : DKP_PROCESS, pid); - break; - - case 1: /* FLAG A */ - DosFlagProcess(pid, flag ? FLGP_SUBTREE : FLGP_PID, PFLG_A, 0); - break; - - case 2: /* FLAG B */ - DosFlagProcess(pid, flag ? FLGP_SUBTREE : FLGP_PID, PFLG_B, 0); - break; - - case 3: /* FLAG C */ - DosFlagProcess(pid, flag ? FLGP_SUBTREE : FLGP_PID, PFLG_C, 0); - break; - - } -} - - -/* Sleep function. */ -void -sleep(unsigned len) -{ - DosSleep(len * 1000L); -} - -/* Just pretend that everyone is a superuser */ - -int setuid() -{ return 0; } - -int setgid() -{ return 0; } - -int getuid(void) -{ return 0; } - -int geteuid(void) -{ return 0; } - -int getgid(void) -{ return 0; } - -int getegid(void) -{ return 0; } - -/* - * The following code is based on the do_exec and do_aexec functions - * in file doio.c - */ -int -do_aspawn(really,arglast) -STR *really; -int *arglast; -{ - register STR **st = stack->ary_array; - register int sp = arglast[1]; - register int items = arglast[2] - sp; - register char **a; - char **argv; - char *tmps; - int status; - - if (items) { - New(1101,argv, items+1, char*); - a = argv; - for (st += ++sp; items > 0; items--,st++) { - if (*st) - *a++ = str_get(*st); - else - *a++ = ""; - } - *a = Nullch; - if (really && *(tmps = str_get(really))) - status = spawnvp(P_WAIT,tmps,argv); - else - status = spawnvp(P_WAIT,argv[0],argv); - Safefree(argv); - } - return status; -} - -char *getenv(char *name); - -int -do_spawn(cmd) -char *cmd; -{ - register char **a; - register char *s; - char **argv; - char flags[10]; - int status; - char *shell, *cmd2; - - /* save an extra exec if possible */ - if ((shell = getenv("COMSPEC")) == 0) - shell = "C:\\OS2\\CMD.EXE"; - - /* see if there are shell metacharacters in it */ - if (strchr(cmd, '>') || strchr(cmd, '<') || strchr(cmd, '|') - || strchr(cmd, '&') || strchr(cmd, '^')) - doshell: - return spawnl(P_WAIT,shell,shell,"/C",cmd,(char*)0); - - New(1102,argv, strlen(cmd) / 2 + 2, char*); - - New(1103,cmd2, strlen(cmd) + 1, char); - strcpy(cmd2, cmd); - a = argv; - for (s = cmd2; *s;) { - while (*s && isspace(*s)) s++; - if (*s) - *(a++) = s; - while (*s && !isspace(*s)) s++; - if (*s) - *s++ = '\0'; - } - *a = Nullch; - if (argv[0]) - if ((status = spawnvp(P_WAIT,argv[0],argv)) == -1) { - Safefree(argv); - Safefree(cmd2); - goto doshell; - } - Safefree(cmd2); - Safefree(argv); - return status; -} - -usage(char *myname) -{ -#ifdef MSDOS - printf("\nUsage: %s [-acdnpPsSvw] [-0[octal]] [-Dnumber] [-i[extension]] [-Idirectory]" -#else - printf("\nUsage: %s [-acdnpPsSuUvw] [-Dnumber] [-i[extension]] [-Idirectory]" -#endif - "\n [-e \"command\"] [-x[directory]] [filename] [arguments]\n", myname); - - printf("\n -a autosplit mode with -n or -p" - "\n -c syntaxcheck only" - "\n -d run scripts under debugger" - "\n -n assume 'while (<>) { ...script... }' loop arround your script" - "\n -p assume loop like -n but print line also like sed" - "\n -P run script through C preprocessor befor compilation" - "\n -s enable some switch parsing for switches after script name" - "\n -S look for the script using PATH environment variable"); -#ifndef MSDOS - printf("\n -u dump core after compiling the script" - "\n -U allow unsafe operations"); -#endif - printf("\n -v print version number and patchlevel of perl" - "\n -w turn warnings on for compilation of your script\n" - "\n -0[octal] specify record separator (0, if no argument)" - "\n -Dnumber set debugging flags (argument is a bit mask)" - "\n -i[extension] edit <> files in place (make backup if extension supplied)" - "\n -Idirectory specify include directory in conjunction with -P" - "\n -e command one line of script, multiple -e options are allowed" - "\n [filename] can be ommitted, when -e is used" - "\n -x[directory] strip off text before #!perl line and perhaps cd to directory\n"); -} diff --git a/os2/perl.bad b/os2/perl.bad deleted file mode 100644 index 8dd016c513..0000000000 --- a/os2/perl.bad +++ /dev/null @@ -1,8 +0,0 @@ -DOSMAKEPIPE -DOSCWAIT -DOSKILLPROCESS -DOSFLAGPROCESS -DOSSETPRTY -DOSGETPRTY -DOSQFSATTACH -DOSCREATETHREAD diff --git a/os2/perl.cs b/os2/perl.cs deleted file mode 100644 index 000d2c08b4..0000000000 --- a/os2/perl.cs +++ /dev/null @@ -1,21 +0,0 @@ -(-W1 -Od -Olt -DDEBUGGING -Gt2048 -array.c cmd.c cons.c consarg.c doarg.c doio.c dolist.c dump.c form.c -hash.c perl.c regcomp.c regexec.c stab.c str.c util.c -) -(-W1 -Od -Olt -DDEBUGGING -Gt2048 (-d perly.y)) -(-W1 -Od -Olt -B2C2L -B3C3L -DDEBUGGING eval.c toke.c) -(-W1 -Od -Olt -I. -Ios2 -os2\os2.c os2\popen.c os2\suffix.c -os2\director.c os2\alarm.c os2\crypt.c -) - -; link with this library if you have GNU gdbm for OS/2 -; remember to enable the GDBM symbol in config.h before compiling -llibgdbm.lib - -setargv.obj -os2\perl.def -os2\perl.bad -perl.exe - --AL -LB -S0x8000 diff --git a/os2/perl.def b/os2/perl.def deleted file mode 100644 index 7c0fca0174..0000000000 --- a/os2/perl.def +++ /dev/null @@ -1,2 +0,0 @@ -NAME WINDOWCOMPAT NEWFILES -DESCRIPTION 'PERL 4.0 - for MS-DOS and OS/2' diff --git a/os2/perldb.dif b/os2/perldb.dif deleted file mode 100644 index e69de29bb2..0000000000 --- a/os2/perldb.dif +++ /dev/null diff --git a/os2/perlglob.bad b/os2/perlglob.bad deleted file mode 100644 index a14bc63f16..0000000000 --- a/os2/perlglob.bad +++ /dev/null @@ -1 +0,0 @@ -(deprecated) diff --git a/os2/perlglob.cs b/os2/perlglob.cs deleted file mode 100644 index b5fc1c99b2..0000000000 --- a/os2/perlglob.cs +++ /dev/null @@ -1,9 +0,0 @@ -os2\glob.c - -setargv.obj - -os2\perl.def -os2\perl.bad -perlglob.exe - --AS -LB -S0x1000 diff --git a/os2/perlglob.def b/os2/perlglob.def deleted file mode 100644 index a14bc63f16..0000000000 --- a/os2/perlglob.def +++ /dev/null @@ -1 +0,0 @@ -(deprecated) diff --git a/os2/perlsh.cmd b/os2/perlsh.cmd deleted file mode 100644 index c583af7099..0000000000 --- a/os2/perlsh.cmd +++ /dev/null @@ -1,19 +0,0 @@ -extproc perl -x -#!perl - -# Poor man's perl shell. - -# Simply type two carriage returns every time you want to evaluate. -# Note that it must be a complete perl statement--don't type double -# carriage return in the middle of a loop. - -print "Perl shell\n> "; - -$/ = ''; # set paragraph mode -$SHlinesep = "\n"; - -while ($SHcmd = <>) { - $/ = $SHlinesep; - eval $SHcmd; print $@ || "\n> "; - $SHlinesep = $/; $/ = ''; -} diff --git a/os2/popen.c b/os2/popen.c deleted file mode 100644 index b9522b5671..0000000000 --- a/os2/popen.c +++ /dev/null @@ -1,241 +0,0 @@ -/* added real/protect mode branch at runtime and real mode version - * names changed for perl - * Kai Uwe Rommel - */ - -/* -Several people in the past have asked about having Unix-like pipe -calls in OS/2. The following source file, adapted from 4.3 BSD Unix, -uses a #define to give you a pipe(2) call, and contains function -definitions for popen(3) and pclose(3). Anyone with problems should -send mail to me; they seem to work fine. - -Mark Towfigh -Racal Interlan, Inc. -----------------------------------cut-here------------------------------------ -*/ - -/* - * The following code segment is derived from BSD 4.3 Unix. See - * copyright below. Any bugs, questions, improvements, or problems - * should be sent to Mark Towfigh (towfiq@interlan.interlan.com). - * - * Racal InterLan Inc. - */ - -/* - * Copyright (c) 1980 Regents of the University of California. - * All rights reserved. The Berkeley software License Agreement - * specifies the terms and conditions for redistribution. - */ - -#include <stdio.h> -#include <stdlib.h> -#include <io.h> -#include <string.h> -#include <process.h> -#include <errno.h> - -#define INCL_NOPM -#define INCL_DOS -#include <os2.h> - -static FILE *dos_popen(const char *cmd, const char *flags); -static int dos_pclose(FILE *pipe); - -/* - * emulate Unix pipe(2) call - */ - -#define tst(a,b) (*mode == 'r'? (b) : (a)) -#define READH 0 -#define WRITEH 1 - -static int popen_pid[20]; - -FILE *mypopen(char *cmd, char *mode) -{ - int p[2]; - register myside, hisside, save_stream; - char *shell = getenv("COMPSPEC"); - - if ( shell == NULL ) - shell = "C:\\OS2\\CMD.EXE"; - - if ( _osmode == DOS_MODE ) - return dos_popen(cmd, mode); - - if ( _pipe(p, 4096, 0) ) - return NULL; - - myside = tst(p[WRITEH], p[READH]); - hisside = tst(p[READH], p[WRITEH]); - - /* set up file descriptors for remote function */ - save_stream = dup(tst(0, 1)); /* don't lose stdin/out! */ - if (dup2(hisside, tst(0, 1)) < 0) - { - perror("dup2"); - return NULL; - } - close(hisside); - - /* - * make sure that we can close our side of the pipe, by - * preventing it from being inherited! - */ - - /* set no-inheritance flag */ - DosSetFHandState(myside, OPEN_FLAGS_NOINHERIT); - - /* execute the command: it will inherit our other file descriptors */ - popen_pid[myside] = spawnlp(P_NOWAIT, shell, shell, "/C", cmd, NULL); - - /* now restore our previous file descriptors */ - if (dup2(save_stream, tst(0, 1)) < 0) /* retrieve stdin/out */ - { - perror("dup2"); - return NULL; - } - close(save_stream); - - return fdopen(myside, mode); /* return a FILE pointer */ -} - -int mypclose(FILE *ptr) -{ - register f; - int status; - - if ( _osmode == DOS_MODE ) - return dos_pclose(ptr); - - f = fileno(ptr); - fclose(ptr); - - /* wait for process to terminate */ - cwait(&status, popen_pid[f], WAIT_GRANDCHILD); - - return status; -} - - -int pipe(int *filedes) -{ - int res; - - if ( res = _pipe(filedes, 4096, 0) ) - return res; - - DosSetFHandState(filedes[0], OPEN_FLAGS_NOINHERIT); - DosSetFHandState(filedes[1], OPEN_FLAGS_NOINHERIT); - return 0; -} - - -/* this is the MS-DOS version */ - -typedef enum { unopened = 0, reading, writing } pipemode; - -static struct -{ - char *name; - char *command; - pipemode pmode; -} -pipes[_NFILE]; - -static FILE *dos_popen(const char *command, const char *mode) -{ - FILE *current; - char name[128]; - char *tmp = getenv("TMP"); - int cur; - pipemode curmode; - - /* - ** decide on mode. - */ - if(strchr(mode, 'r') != NULL) - curmode = reading; - else if(strchr(mode, 'w') != NULL) - curmode = writing; - else - return NULL; - - /* - ** get a name to use. - */ - strcpy(name, tmp ? tmp : "\\"); - if ( name[strlen(name) - 1] != '\\' ) - strcat(name, "\\"); - strcat(name, "piXXXXXX"); - mktemp(name); - - /* - ** If we're reading, just call system to get a file filled with - ** output. - */ - if(curmode == reading) - { - char cmd[256]; - sprintf(cmd,"%s > %s", command, name); - system(cmd); - - if((current = fopen(name, mode)) == NULL) - return NULL; - } - else - { - if((current = fopen(name, mode)) == NULL) - return NULL; - } - - cur = fileno(current); - pipes[cur].name = strdup(name); - pipes[cur].command = strdup(command); - pipes[cur].pmode = curmode; - - return current; -} - -static int dos_pclose(FILE * current) -{ - int cur = fileno(current), rval; - char command[256]; - - /* - ** check for an open file. - */ - if(pipes[cur].pmode == unopened) - return -1; - - if(pipes[cur].pmode == reading) - { - /* - ** input pipes are just files we're done with. - */ - rval = fclose(current); - unlink(pipes[cur].name); - } - else - { - /* - ** output pipes are temporary files we have - ** to cram down the throats of programs. - */ - fclose(current); - sprintf(command,"%s < %s", pipes[cur].command, pipes[cur].name); - rval = system(command); - unlink(pipes[cur].name); - } - - /* - ** clean up current pipe. - */ - free(pipes[cur].name); - free(pipes[cur].command); - pipes[cur].pmode = unopened; - - return rval; -} diff --git a/os2/s2p.cmd b/os2/s2p.cmd deleted file mode 100755 index d0a1246186..0000000000 --- a/os2/s2p.cmd +++ /dev/null @@ -1,678 +0,0 @@ -extproc perl -Sx -#!perl - -$bin = 'c:/bin'; - -# $RCSfile: s2p.cmd,v $$Revision: 4.1 $$Date: 92/08/07 18:25:37 $ -# -# $Log: s2p.cmd,v $ -# Revision 4.1 92/08/07 18:25:37 lwall -# -# Revision 4.0 91/03/20 01:37:09 lwall -# 4.0 baseline. -# -# Revision 3.0.1.6 90/10/20 02:21:43 lwall -# patch37: changed some ". config.sh" to ". ./config.sh" -# -# Revision 3.0.1.5 90/10/16 11:32:40 lwall -# patch29: s2p modernized -# -# Revision 3.0.1.4 90/08/09 05:50:43 lwall -# patch19: s2p didn't translate \n right -# -# Revision 3.0.1.3 90/03/01 10:31:21 lwall -# patch9: s2p didn't handle \< and \> -# -# Revision 3.0.1.2 89/11/17 15:51:27 lwall -# patch5: in s2p, line labels without a subsequent statement were done wrong -# patch5: s2p left residue in /tmp -# -# Revision 3.0.1.1 89/11/11 05:08:25 lwall -# patch2: in s2p, + within patterns needed backslashing -# patch2: s2p was printing out some debugging info to the output file -# -# Revision 3.0 89/10/18 15:35:02 lwall -# 3.0 baseline -# -# Revision 2.0.1.1 88/07/11 23:26:23 root -# patch2: s2p didn't put a proper prologue on output script -# -# Revision 2.0 88/06/05 00:15:55 root -# Baseline version 2.0. -# -# - -$indent = 4; -$shiftwidth = 4; -$l = '{'; $r = '}'; - -while ($ARGV[0] =~ /^-/) { - $_ = shift; - last if /^--/; - if (/^-D/) { - $debug++; - open(BODY,'>-'); - next; - } - if (/^-n/) { - $assumen++; - next; - } - if (/^-p/) { - $assumep++; - next; - } - die "I don't recognize this switch: $_\n"; -} - -unless ($debug) { - open(BODY,">sperl$$") || - &Die("Can't open temp file: $!\n"); -} - -if (!$assumen && !$assumep) { - print BODY <<'EOT'; -while ($ARGV[0] =~ /^-/) { - $_ = shift; - last if /^--/; - if (/^-n/) { - $nflag++; - next; - } - die "I don't recognize this switch: $_\\n"; -} - -EOT -} - -print BODY <<'EOT'; - -#ifdef PRINTIT -#ifdef ASSUMEP -$printit++; -#else -$printit++ unless $nflag; -#endif -#endif -LINE: while (<>) { -EOT - -LINE: while (<>) { - - # Wipe out surrounding whitespace. - - s/[ \t]*(.*)\n$/$1/; - - # Perhaps it's a label/comment. - - if (/^:/) { - s/^:[ \t]*//; - $label = &make_label($_); - if ($. == 1) { - $toplabel = $label; - } - $_ = "$label:"; - if ($lastlinewaslabel++) { - $indent += 4; - print BODY &tab, ";\n"; - $indent -= 4; - } - if ($indent >= 2) { - $indent -= 2; - $indmod = 2; - } - next; - } else { - $lastlinewaslabel = ''; - } - - # Look for one or two address clauses - - $addr1 = ''; - $addr2 = ''; - if (s/^([0-9]+)//) { - $addr1 = "$1"; - } - elsif (s/^\$//) { - $addr1 = 'eof()'; - } - elsif (s|^/||) { - $addr1 = &fetchpat('/'); - } - if (s/^,//) { - if (s/^([0-9]+)//) { - $addr2 = "$1"; - } elsif (s/^\$//) { - $addr2 = "eof()"; - } elsif (s|^/||) { - $addr2 = &fetchpat('/'); - } else { - &Die("Invalid second address at line $.\n"); - } - $addr1 .= " .. $addr2"; - } - - # Now we check for metacommands {, }, and ! and worry - # about indentation. - - s/^[ \t]+//; - # a { to keep vi happy - if ($_ eq '}') { - $indent -= 4; - next; - } - if (s/^!//) { - $if = 'unless'; - $else = "$r else $l\n"; - } else { - $if = 'if'; - $else = ''; - } - if (s/^{//) { # a } to keep vi happy - $indmod = 4; - $redo = $_; - $_ = ''; - $rmaybe = ''; - } else { - $rmaybe = "\n$r"; - if ($addr2 || $addr1) { - $space = ' ' x $shiftwidth; - } else { - $space = ''; - } - $_ = &transmogrify(); - } - - # See if we can optimize to modifier form. - - if ($addr1) { - if ($_ !~ /[\n{}]/ && $rmaybe && !$change && - $_ !~ / if / && $_ !~ / unless /) { - s/;$/ $if $addr1;/; - $_ = substr($_,$shiftwidth,1000); - } else { - $_ = "$if ($addr1) $l\n$change$_$rmaybe"; - } - $change = ''; - next LINE; - } -} continue { - @lines = split(/\n/,$_); - for (@lines) { - unless (s/^ *<<--//) { - print BODY &tab; - } - print BODY $_, "\n"; - } - $indent += $indmod; - $indmod = 0; - if ($redo) { - $_ = $redo; - $redo = ''; - redo LINE; - } -} -if ($lastlinewaslabel++) { - $indent += 4; - print BODY &tab, ";\n"; - $indent -= 4; -} - -print BODY "}\n"; -if ($appendseen || $tseen || !$assumen) { - $printit++ if $dseen || (!$assumen && !$assumep); - print BODY <<'EOT'; - -continue { -#ifdef PRINTIT -#ifdef DSEEN -#ifdef ASSUMEP - print if $printit++; -#else - if ($printit) - { print; } - else - { $printit++ unless $nflag; } -#endif -#else - print if $printit; -#endif -#else - print; -#endif -#ifdef TSEEN - $tflag = ''; -#endif -#ifdef APPENDSEEN - if ($atext) { print $atext; $atext = ''; } -#endif -} -EOT -} - -close BODY; - -unless ($debug) { - open(HEAD,">sperl2$$.c") - || &Die("Can't open temp file 2: $!\n"); - print HEAD "#define PRINTIT\n" if ($printit); - print HEAD "#define APPENDSEEN\n" if ($appendseen); - print HEAD "#define TSEEN\n" if ($tseen); - print HEAD "#define DSEEN\n" if ($dseen); - print HEAD "#define ASSUMEN\n" if ($assumen); - print HEAD "#define ASSUMEP\n" if ($assumep); - if ($opens) {print HEAD "$opens\n";} - open(BODY,"sperl$$") - || &Die("Can't reopen temp file: $!\n"); - while (<BODY>) { - print HEAD $_; - } - close HEAD; - - print <<"EOT"; -#!$bin/perl -eval 'exec $bin/perl -S \$0 \$*' - if \$running_under_some_shell; - -EOT - open(BODY,"cc -E sperl2$$.c |") || - &Die("Can't reopen temp file: $!\n"); - while (<BODY>) { - /^# [0-9]/ && next; - /^[ \t]*$/ && next; - s/^<><>//; - print; - } -} - -&Cleanup; -exit; - -sub Cleanup { - unlink "sperl$$", "sperl2$$", "sperl2$$.c"; -} -sub Die { - &Cleanup; - die $_[0]; -} -sub tab { - "\t" x ($indent / 8) . ' ' x ($indent % 8); -} -sub make_filehandle { - local($_) = $_[0]; - local($fname) = $_; - s/[^a-zA-Z]/_/g; - s/^_*//; - substr($_,0,1) =~ y/a-z/A-Z/ if /^[a-z]/; - if (!$seen{$_}) { - $opens .= <<"EOT"; -open($_,'>$fname') || die "Can't create $fname"; -EOT - } - $seen{$_} = $_; -} - -sub make_label { - local($label) = @_; - $label =~ s/[^a-zA-Z0-9]/_/g; - if ($label =~ /^[0-9_]/) { $label = 'L' . $label; } - $label = substr($label,0,8); - - # Could be a reserved word, so capitalize it. - substr($label,0,1) =~ y/a-z/A-Z/ - if $label =~ /^[a-z]/; - - $label; -} - -sub transmogrify { - { # case - if (/^d/) { - $dseen++; - chop($_ = <<'EOT'); -<<--#ifdef PRINTIT -$printit = ''; -<<--#endif -next LINE; -EOT - next; - } - - if (/^n/) { - chop($_ = <<'EOT'); -<<--#ifdef PRINTIT -<<--#ifdef DSEEN -<<--#ifdef ASSUMEP -print if $printit++; -<<--#else -if ($printit) - { print; } -else - { $printit++ unless $nflag; } -<<--#endif -<<--#else -print if $printit; -<<--#endif -<<--#else -print; -<<--#endif -<<--#ifdef APPENDSEEN -if ($atext) {print $atext; $atext = '';} -<<--#endif -$_ = <>; -<<--#ifdef TSEEN -$tflag = ''; -<<--#endif -EOT - next; - } - - if (/^a/) { - $appendseen++; - $command = $space . '$atext .=' . "\n<<--'"; - $lastline = 0; - while (<>) { - s/^[ \t]*//; - s/^[\\]//; - unless (s|\\$||) { $lastline = 1;} - s/'/\\'/g; - s/^([ \t]*\n)/<><>$1/; - $command .= $_; - $command .= '<<--'; - last if $lastline; - } - $_ = $command . "';"; - last; - } - - if (/^[ic]/) { - if (/^c/) { $change = 1; } - $addr1 = '$iter = (' . $addr1 . ')'; - $command = $space . 'if ($iter == 1) { print' - . "\n<<--'"; - $lastline = 0; - while (<>) { - s/^[ \t]*//; - s/^[\\]//; - unless (s/\\$//) { $lastline = 1;} - s/'/\\'/g; - s/^([ \t]*\n)/<><>$1/; - $command .= $_; - $command .= '<<--'; - last if $lastline; - } - $_ = $command . "';}"; - if ($change) { - $dseen++; - $change = "$_\n"; - chop($_ = <<"EOT"); -<<--#ifdef PRINTIT -$space\$printit = ''; -<<--#endif -${space}next LINE; -EOT - } - last; - } - - if (/^s/) { - $delim = substr($_,1,1); - $len = length($_); - $repl = $end = 0; - $inbracket = 0; - for ($i = 2; $i < $len; $i++) { - $c = substr($_,$i,1); - if ($c eq $delim) { - if ($inbracket) { - substr($_, $i, 0) = '\\'; - $i++; - $len++; - } - else { - if ($repl) { - $end = $i; - last; - } else { - $repl = $i; - } - } - } - elsif ($c eq '\\') { - $i++; - if ($i >= $len) { - $_ .= 'n'; - $_ .= <>; - $len = length($_); - $_ = substr($_,0,--$len); - } - elsif (substr($_,$i,1) =~ /^[n]$/) { - ; - } - elsif (!$repl && - substr($_,$i,1) =~ /^[(){}\w]$/) { - $i--; - $len--; - substr($_, $i, 1) = ''; - } - elsif (!$repl && - substr($_,$i,1) =~ /^[<>]$/) { - substr($_,$i,1) = 'b'; - } - } - elsif ($c eq '[' && !$repl) { - $i++ if substr($_,$i,1) eq '^'; - $i++ if substr($_,$i,1) eq ']'; - $inbracket = 1; - } - elsif ($c eq ']') { - $inbracket = 0; - } - elsif (!$repl && index("()+",$c) >= 0) { - substr($_, $i, 0) = '\\'; - $i++; - $len++; - } - } - &Die("Malformed substitution at line $.\n") - unless $end; - $pat = substr($_, 0, $repl + 1); - $repl = substr($_, $repl+1, $end-$repl-1); - $end = substr($_, $end + 1, 1000); - $dol = '$'; - $repl =~ s/\$/\\$/; - $repl =~ s'&'$&'g; - $repl =~ s/[\\]([0-9])/$dol$1/g; - $subst = "$pat$repl$delim"; - $cmd = ''; - while ($end) { - if ($end =~ s/^g//) { - $subst .= 'g'; - next; - } - if ($end =~ s/^p//) { - $cmd .= ' && (print)'; - next; - } - if ($end =~ s/^w[ \t]*//) { - $fh = &make_filehandle($end); - $cmd .= " && (print $fh \$_)"; - $end = ''; - next; - } - &Die("Unrecognized substitution command". - "($end) at line $.\n"); - } - chop ($_ = <<"EOT"); -<<--#ifdef TSEEN -$subst && \$tflag++$cmd; -<<--#else -$subst$cmd; -<<--#endif -EOT - next; - } - - if (/^p/) { - $_ = 'print;'; - next; - } - - if (/^w/) { - s/^w[ \t]*//; - $fh = &make_filehandle($_); - $_ = "print $fh \$_;"; - next; - } - - if (/^r/) { - $appendseen++; - s/^r[ \t]*//; - $file = $_; - $_ = "\$atext .= `cat $file 2>/dev/null`;"; - next; - } - - if (/^P/) { - $_ = 'print $1 if /(^.*\n)/;'; - next; - } - - if (/^D/) { - chop($_ = <<'EOT'); -s/^.*\n//; -redo LINE if $_; -next LINE; -EOT - next; - } - - if (/^N/) { - chop($_ = <<'EOT'); -$_ .= <>; -<<--#ifdef TSEEN -$tflag = ''; -<<--#endif -EOT - next; - } - - if (/^h/) { - $_ = '$hold = $_;'; - next; - } - - if (/^H/) { - $_ = '$hold .= $_ ? $_ : "\n";'; - next; - } - - if (/^g/) { - $_ = '$_ = $hold;'; - next; - } - - if (/^G/) { - $_ = '$_ .= $hold ? $hold : "\n";'; - next; - } - - if (/^x/) { - $_ = '($_, $hold) = ($hold, $_);'; - next; - } - - if (/^b$/) { - $_ = 'next LINE;'; - next; - } - - if (/^b/) { - s/^b[ \t]*//; - $lab = &make_label($_); - if ($lab eq $toplabel) { - $_ = 'redo LINE;'; - } else { - $_ = "goto $lab;"; - } - next; - } - - if (/^t$/) { - $_ = 'next LINE if $tflag;'; - $tseen++; - next; - } - - if (/^t/) { - s/^t[ \t]*//; - $lab = &make_label($_); - $_ = q/if ($tflag) {$tflag = ''; /; - if ($lab eq $toplabel) { - $_ .= 'redo LINE;}'; - } else { - $_ .= "goto $lab;}"; - } - $tseen++; - next; - } - - if (/^=/) { - $_ = 'print "$.\n";'; - next; - } - - if (/^q/) { - chop($_ = <<'EOT'); -close(ARGV); -@ARGV = (); -next LINE; -EOT - next; - } - } continue { - if ($space) { - s/^/$space/; - s/(\n)(.)/$1$space$2/g; - } - last; - } - $_; -} - -sub fetchpat { - local($outer) = @_; - local($addr) = $outer; - local($inbracket); - local($prefix,$delim,$ch); - - # Process pattern one potential delimiter at a time. - - DELIM: while (s#^([^\]+(|)[\\/]*)([]+(|)[\\/])##) { - $prefix = $1; - $delim = $2; - if ($delim eq '\\') { - s/(.)//; - $ch = $1; - $delim = '' if $ch =~ /^[(){}A-Za-mo-z]$/; - $ch = 'b' if $ch =~ /^[<>]$/; - $delim .= $ch; - } - elsif ($delim eq '[') { - $inbracket = 1; - s/^\^// && ($delim .= '^'); - s/^]// && ($delim .= ']'); - } - elsif ($delim eq ']') { - $inbracket = 0; - } - elsif ($inbracket || $delim ne $outer) { - $delim = '\\' . $delim; - } - $addr .= $prefix; - $addr .= $delim; - if ($delim eq $outer && !$inbracket) { - last DELIM; - } - } - $addr; -} diff --git a/os2/selfrun.bat b/os2/selfrun.bat deleted file mode 100755 index 9ec8a2920d..0000000000 --- a/os2/selfrun.bat +++ /dev/null @@ -1,12 +0,0 @@ -@echo off -perl -x %0.bat -goto exit -#!perl - -printf " -This is a self-running perl script for DOS. - -" - -__END__ -:exit diff --git a/os2/selfrun.cmd b/os2/selfrun.cmd deleted file mode 100644 index 471a959005..0000000000 --- a/os2/selfrun.cmd +++ /dev/null @@ -1,7 +0,0 @@ -extproc perl -x -#!perl - -printf " -This is a self-running perl script using the -extproc feature of the OS/2 command processor. -" diff --git a/os2/suffix.c b/os2/suffix.c deleted file mode 100644 index d766da37bc..0000000000 --- a/os2/suffix.c +++ /dev/null @@ -1,147 +0,0 @@ -/* - * Suffix appending for in-place editing under MS-DOS and OS/2. - * - * Here are the rules: - * - * Style 0: Append the suffix exactly as standard perl would do it. - * If the filesystem groks it, use it. (HPFS will always - * grok it. FAT will rarely accept it.) - * - * Style 1: The suffix begins with a '.'. The extension is replaced. - * If the name matches the original name, use the fallback method. - * - * Style 2: The suffix is a single character, not a '.'. Try to add the - * suffix to the following places, using the first one that works. - * [1] Append to extension. - * [2] Append to filename, - * [3] Replace end of extension, - * [4] Replace end of filename. - * If the name matches the original name, use the fallback method. - * - * Style 3: Any other case: Ignore the suffix completely and use the - * fallback method. - * - * Fallback method: Change the extension to ".$$$". If that matches the - * original name, then change the extension to ".~~~". - * - * If filename is more than 1000 characters long, we die a horrible - * death. Sorry. - * - * The filename restriction is a cheat so that we can use buf[] to store - * assorted temporary goo. - * - * Examples, assuming style 0 failed. - * - * suffix = ".bak" (style 1) - * foo.bar => foo.bak - * foo.bak => foo.$$$ (fallback) - * foo.$$$ => foo.~~~ (fallback) - * makefile => makefile.bak - * - * suffix = "~" (style 2) - * foo.c => foo.c~ - * foo.c~ => foo.c~~ - * foo.c~~ => foo~.c~~ - * foo~.c~~ => foo~~.c~~ - * foo~~~~~.c~~ => foo~~~~~.$$$ (fallback) - * - * foo.pas => foo~.pas - * makefile => makefile.~ - * longname.fil => longname.fi~ - * longname.fi~ => longnam~.fi~ - * longnam~.fi~ => longnam~.$$$ - * - */ - -#include "EXTERN.h" -#include "perl.h" -#ifdef OS2 -#define INCL_DOSFILEMGR -#define INCL_DOSERRORS -#include <os2.h> -#endif /* OS2 */ - -static char suffix1[] = ".$$$"; -static char suffix2[] = ".~~~"; - -#define ext (&buf[1000]) - -add_suffix(str,suffix) -register STR *str; -register char *suffix; -{ - int baselen; - int extlen; - char *s, *t, *p; - STRLEN slen; - - if (!(str->str_pok)) (void)str_2ptr(str); - if (str->str_cur > 1000) - fatal("Cannot do inplace edit on long filename (%d characters)", str->str_cur); - -#ifdef OS2 - /* Style 0 */ - slen = str->str_cur; - str_cat(str, suffix); - if (valid_filename(str->str_ptr)) return; - - /* Fooey, style 0 failed. Fix str before continuing. */ - str->str_ptr[str->str_cur = slen] = '\0'; -#endif /* OS2 */ - - slen = strlen(suffix); - t = buf; baselen = 0; s = str->str_ptr; - while ( (*t = *s) && *s != '.') { - baselen++; - if (*s == '\\' || *s == '/') baselen = 0; - s++; t++; - } - p = t; - - t = ext; extlen = 0; - while (*t++ = *s++) extlen++; - if (extlen == 0) { ext[0] = '.'; ext[1] = 0; extlen++; } - - if (*suffix == '.') { /* Style 1 */ - if (strEQ(ext, suffix)) goto fallback; - strcpy(p, suffix); - } else if (suffix[1] == '\0') { /* Style 2 */ - if (extlen < 4) { - ext[extlen] = *suffix; - ext[++extlen] = '\0'; - } else if (baselen < 8) { - *p++ = *suffix; - } else if (ext[3] != *suffix) { - ext[3] = *suffix; - } else if (buf[7] != *suffix) { - buf[7] = *suffix; - } else goto fallback; - strcpy(p, ext); - } else { /* Style 3: Panic */ -fallback: - (void)bcopy(strEQ(ext, suffix1) ? suffix2 : suffix1, p, 4+1); - } - str_set(str, buf); -} - -#ifdef OS2 -int -valid_filename(s) -char *s; -{ - HFILE hf; - USHORT usAction; - - switch(DosOpen(s, &hf, &usAction, 0L, 0, FILE_OPEN, - OPEN_ACCESS_READONLY | OPEN_SHARE_DENYNONE, 0L)) { - case ERROR_INVALID_NAME: - case ERROR_FILENAME_EXCED_RANGE: - return 0; - case NO_ERROR: - DosClose(hf); - /*FALLTHROUGH*/ - default: - return 1; - } -} -#endif /* OS2 */ diff --git a/os2/tests.dif b/os2/tests.dif deleted file mode 100644 index e0ad6fba0c..0000000000 --- a/os2/tests.dif +++ /dev/null @@ -1,589 +0,0 @@ -diff -cbBwr perl-4.019/t/base/term.t new/t/base/term.t -*** perl-4.019/t/base/term.t Wed Mar 20 08:47:14 1991 ---- new/t/base/term.t Sun Jun 16 20:39:50 1991 -*************** -*** 29,35 **** - - # check <> pseudoliteral - -! open(try, "/dev/null") || (die "Can't open /dev/null."); - if (<try> eq '') { - print "ok 5\n"; - } ---- 29,35 ---- - - # check <> pseudoliteral - -! open(try, "nul") || (die "Can't open /dev/null."); - if (<try> eq '') { - print "ok 5\n"; - } -diff -cbBwr perl-4.019/t/cmd/while.t new/t/cmd/while.t -*** perl-4.019/t/cmd/while.t Wed Mar 20 08:46:28 1991 ---- new/t/cmd/while.t Sun Jun 16 20:52:36 1991 -*************** -*** 90,96 **** - if (!eof || $bad) {print "not ok 8\n";} else {print "ok 8\n";} - if (!$badcont) {print "ok 9\n";} else {print "not ok 9\n";} - -! `/bin/rm -f Cmd.while.tmp`; - - #$x = 0; - #while (1) { ---- 90,97 ---- - if (!eof || $bad) {print "not ok 8\n";} else {print "ok 8\n";} - if (!$badcont) {print "ok 9\n";} else {print "not ok 9\n";} - -! close(fh); -! `del Cmd.while.tmp`; - - #$x = 0; - #while (1) { -diff -cbBwr perl-4.019/t/comp/cpp.t new/t/comp/cpp.t -*** perl-4.019/t/comp/cpp.t Wed Mar 20 08:48:44 1991 ---- new/t/comp/cpp.t Sun Jun 16 20:54:00 1991 -*************** -*** 32,39 **** - print TRY '#define OK "ok 3\n"' . "\n"; - close TRY; - -! $pwd=`pwd`; - $pwd =~ s/\n//; -! $x = `./perl -P Comp.cpp.tmp`; - print $x; - unlink "Comp.cpp.tmp", "Comp.cpp.inc"; ---- 32,39 ---- - print TRY '#define OK "ok 3\n"' . "\n"; - close TRY; - -! $pwd=`cd`; - $pwd =~ s/\n//; -! $x = `perl -P Comp.cpp.tmp`; - print $x; - unlink "Comp.cpp.tmp", "Comp.cpp.inc"; -diff -cbBwr perl-4.019/t/comp/script.t new/t/comp/script.t -*** perl-4.019/t/comp/script.t Wed Mar 20 08:48:50 1991 ---- new/t/comp/script.t Sun Jun 16 21:05:02 1991 -*************** -*** 4,10 **** - - print "1..3\n"; - -! $x = `./perl -e 'print "ok\n";'`; - - if ($x eq "ok\n") {print "ok 1\n";} else {print "not ok 1\n";} - ---- 4,10 ---- - - print "1..3\n"; - -! $x = `perl -e "print \\\"ok\\n\\\";"`; - - if ($x eq "ok\n") {print "ok 1\n";} else {print "not ok 1\n";} - -*************** -*** 12,23 **** - print try 'print "ok\n";'; print try "\n"; - close try; - -! $x = `./perl Comp.script`; - - if ($x eq "ok\n") {print "ok 2\n";} else {print "not ok 2\n";} - -! $x = `./perl <Comp.script`; - - if ($x eq "ok\n") {print "ok 3\n";} else {print "not ok 3\n";} - -! `/bin/rm -f Comp.script`; ---- 12,23 ---- - print try 'print "ok\n";'; print try "\n"; - close try; - -! $x = `perl Comp.script`; - - if ($x eq "ok\n") {print "ok 2\n";} else {print "not ok 2\n";} - -! $x = `perl <Comp.script`; - - if ($x eq "ok\n") {print "ok 3\n";} else {print "not ok 3\n";} - -! `del Comp.script`; -diff -cbBwr perl-4.019/t/io/argv.t new/t/io/argv.t -*** perl-4.019/t/io/argv.t Wed Mar 20 08:48:38 1991 ---- new/t/io/argv.t Sun Jun 16 21:14:14 1991 -*************** -*** 8,26 **** - print try "a line\n"; - close try; - -! $x = `./perl -e 'while (<>) {print \$.,\$_;}' Io.argv.tmp Io.argv.tmp`; - - if ($x eq "1a line\n2a line\n") {print "ok 1\n";} else {print "not ok 1\n";} - -! $x = `echo foo|./perl -e 'while (<>) {print $_;}' Io.argv.tmp -`; - - if ($x eq "a line\nfoo\n") {print "ok 2\n";} else {print "not ok 2\n";} - -! $x = `echo foo|./perl -e 'while (<>) {print $_;}'`; - - if ($x eq "foo\n") {print "ok 3\n";} else {print "not ok 3 :$x:\n";} - -! @ARGV = ('Io.argv.tmp', 'Io.argv.tmp', '/dev/null', 'Io.argv.tmp'); - while (<>) { - $y .= $. . $_; - if (eof()) { ---- 8,26 ---- - print try "a line\n"; - close try; - -! $x = `perl -e "while (<>) {print \$.,\$_;}" Io.argv.tmp Io.argv.tmp`; - - if ($x eq "1a line\n2a line\n") {print "ok 1\n";} else {print "not ok 1\n";} - -! $x = `echo foo | perl -e "while (<>) {print $_;}" Io.argv.tmp -`; - - if ($x eq "a line\nfoo\n") {print "ok 2\n";} else {print "not ok 2\n";} - -! $x = `echo foo | perl -e "while (<>) {print $_;}"`; - - if ($x eq "foo\n") {print "ok 3\n";} else {print "not ok 3 :$x:\n";} - -! @ARGV = ('Io.argv.tmp', 'Io.argv.tmp', 'nul', 'Io.argv.tmp'); - while (<>) { - $y .= $. . $_; - if (eof()) { -*************** -*** 33,36 **** - else - {print "not ok 5\n";} - -! `/bin/rm -f Io.argv.tmp`; ---- 33,36 ---- - else - {print "not ok 5\n";} - -! `del Io.argv.tmp`; -diff -cbBwr perl-4.019/t/io/pipe.t new/t/io/pipe.t -*** perl-4.019/t/io/pipe.t Wed Mar 20 08:48:38 1991 ---- new/t/io/pipe.t Sun Jun 16 21:25:14 1991 -*************** -*** 5,11 **** - $| = 1; - print "1..8\n"; - -! open(PIPE, "|-") || (exec 'tr', '[A-Z]', '[a-z]'); - print PIPE "OK 1\n"; - print PIPE "ok 2\n"; - close PIPE; ---- 5,11 ---- - $| = 1; - print "1..8\n"; - -! open(PIPE, "|-") || (exec 'tr.exe', '[A-Z]', '[a-z]'); - print PIPE "OK 1\n"; - print PIPE "ok 2\n"; - close PIPE; -*************** -*** 18,24 **** - } - else { - print STDOUT "not ok 3\n"; -! exec 'echo', 'not ok 4'; - } - - pipe(READER,WRITER) || die "Can't open pipe"; ---- 18,24 ---- - } - else { - print STDOUT "not ok 3\n"; -! exec 'perlglob', 'not ok 4'; - } - - pipe(READER,WRITER) || die "Can't open pipe"; -diff -cbBwr perl-4.019/t/op/exec.t new/t/op/exec.t -*** perl-4.019/t/op/exec.t Wed Mar 20 08:48:46 1991 ---- new/t/op/exec.t Sun Jun 16 21:39:32 1991 -*************** -*** 7,21 **** - - print "not ok 1\n" if system "echo ok \\1"; # shell interpreted - print "not ok 2\n" if system "echo ok 2"; # split and directly called -! print "not ok 3\n" if system "echo", "ok", "3"; # directly called - -! if (system "true") {print "not ok 4\n";} else {print "ok 4\n";} - -! if ((system "/bin/sh -c 'exit 1'") != 256) { print "not "; } - print "ok 5\n"; - -! if ((system "lskdfj") == 255 << 8) {print "ok 6\n";} else {print "not ok 6\n";} - - unless (exec "lskdjfalksdjfdjfkls") {print "ok 7\n";} else {print "not ok 7\n";} - -! exec "echo","ok","8"; ---- 7,21 ---- - - print "not ok 1\n" if system "echo ok \\1"; # shell interpreted - print "not ok 2\n" if system "echo ok 2"; # split and directly called -! print "not ok 3\n" if system "perlglob", "ok", "3", "\n"; # directly called - -! if (system "expr 1 >nul") {print "not ok 4\n";} else {print "ok 4\n";} - -! if ((system "sh -c \"exit 1\"") != 1) { print "not "; } - print "ok 5\n"; - -! if ((system "lskdfj") == 1) {print "ok 6\n";} else {print "not ok 6\n";} - - unless (exec "lskdjfalksdjfdjfkls") {print "ok 7\n";} else {print "not ok 7\n";} - -! exec "perlglob","ok","8"; -diff -cbBwr perl-4.019/t/op/glob.t new/t/op/glob.t -*** perl-4.019/t/op/glob.t Wed Mar 20 08:48:54 1991 ---- new/t/op/glob.t Sun Jun 16 21:43:26 1991 -*************** -*** 7,13 **** - @ops = <op/*>; - $list = join(' ',@ops); - -! chop($otherway = `echo op/*`); - - print $list eq $otherway ? "ok 1\n" : "not ok 1\n$list\n$otherway\n"; - ---- 7,13 ---- - @ops = <op/*>; - $list = join(' ',@ops); - -! chop($otherway = `perlglob op/*`); - - print $list eq $otherway ? "ok 1\n" : "not ok 1\n$list\n$otherway\n"; - -diff -cbBwr perl-4.019/t/op/goto.t new/t/op/goto.t -*** perl-4.019/t/op/goto.t Wed Mar 20 08:48:46 1991 ---- new/t/op/goto.t Sun Jun 16 21:50:54 1991 -*************** -*** 29,34 **** - print "#2\t:$foo: == 4\n"; - if ($foo == 4) {print "ok 2\n";} else {print "not ok 2\n";} - -! $x = `./perl -e 'goto foo;' 2>&1`; - print "#3\t/label/ in :$x"; - if ($x =~ /label/) {print "ok 3\n";} else {print "not ok 3\n";} ---- 29,34 ---- - print "#2\t:$foo: == 4\n"; - if ($foo == 4) {print "ok 2\n";} else {print "not ok 2\n";} - -! $x = `perl -e "goto foo;" 2>&1`; - print "#3\t/label/ in :$x"; - if ($x =~ /label/) {print "ok 3\n";} else {print "not ok 3\n";} -diff -cbBwr perl-4.019/t/op/magic.t new/t/op/magic.t -*** perl-4.019/t/op/magic.t Wed Mar 20 08:48:36 1991 ---- new/t/op/magic.t Sun Jun 16 21:56:14 1991 -*************** -*** 7,13 **** - print "1..5\n"; - - eval '$ENV{"foo"} = "hi there";'; # check that ENV is inited inside eval -! if (`echo \$foo` eq "hi there\n") {print "ok 1\n";} else {print "not ok 1\n";} - - unlink 'ajslkdfpqjsjfk'; - $! = 0; ---- 7,13 ---- - print "1..5\n"; - - eval '$ENV{"foo"} = "hi there";'; # check that ENV is inited inside eval -! if (`echo %foo%` eq "hi there\n") {print "ok 1\n";} else {print "not ok 1\n";} - - unlink 'ajslkdfpqjsjfk'; - $! = 0; -*************** -*** 17,30 **** - # the next tests are embedded inside system simply because sh spits out - # a newline onto stderr when a child process kills itself with SIGINT. - -! system './perl', - '-e', '$| = 1; # command buffering', - -! '-e', '$SIG{"INT"} = "ok3"; kill 2,$$;', -! '-e', '$SIG{"INT"} = "IGNORE"; kill 2,$$; print "ok 4\n";', -! '-e', '$SIG{"INT"} = "DEFAULT"; kill 2,$$; print "not ok\n";', - -! '-e', 'sub ok3 { print "ok 3\n" if pop(@_) eq "INT"; }'; - - @val1 = @ENV{keys(%ENV)}; # can we slice ENV? - @val2 = values(%ENV); ---- 17,30 ---- - # the next tests are embedded inside system simply because sh spits out - # a newline onto stderr when a child process kills itself with SIGINT. - -! system 'perl', - '-e', '$| = 1; # command buffering', - -! '-e', '$SIG{"TERM"} = "ok3"; kill 0,$$;', -! '-e', '$SIG{"TERM"} = "IGNORE"; kill 0,$$; print "ok 4\n";', -! '-e', '$SIG{"TERM"} = "DEFAULT"; kill 0,$$; print "not ok\n";', - -! '-e', 'sub ok3 { print "ok 3\n" if pop(@_) eq "TERM"; }'; - - @val1 = @ENV{keys(%ENV)}; # can we slice ENV? - @val2 = values(%ENV); -diff -cbBwr perl-4.019/t/op/mkdir.t new/t/op/mkdir.t -*** perl-4.019/t/op/mkdir.t Wed Mar 20 08:48:54 1991 ---- new/t/op/mkdir.t Sun Jun 16 22:00:06 1991 -*************** -*** 4,14 **** - - print "1..7\n"; - -! `rm -rf blurfl`; - - print (mkdir('blurfl',0777) ? "ok 1\n" : "not ok 1\n"); - print (mkdir('blurfl',0777) ? "not ok 2\n" : "ok 2\n"); -! print ($! =~ /exist/ ? "ok 3\n" : "not ok 3\n"); - print (-d 'blurfl' ? "ok 4\n" : "not ok 4\n"); - print (rmdir('blurfl') ? "ok 5\n" : "not ok 5\n"); - print (rmdir('blurfl') ? "not ok 6\n" : "ok 6\n"); ---- 4,14 ---- - - print "1..7\n"; - -! `rm -r blurfl`; - - print (mkdir('blurfl',0777) ? "ok 1\n" : "not ok 1\n"); - print (mkdir('blurfl',0777) ? "not ok 2\n" : "ok 2\n"); -! print ($! =~ /denied/ ? "ok 3\n" : "not ok 3\n"); - print (-d 'blurfl' ? "ok 4\n" : "not ok 4\n"); - print (rmdir('blurfl') ? "ok 5\n" : "not ok 5\n"); - print (rmdir('blurfl') ? "not ok 6\n" : "ok 6\n"); -diff -cbBwr perl-4.019/t/op/split.t new/t/op/split.t -*** perl-4.019/t/op/split.t Wed Mar 20 08:48:24 1991 ---- new/t/op/split.t Sun Jun 16 22:04:02 1991 -*************** -*** 47,53 **** - print $_ eq '1:2:3:4:5:6:::' ? "ok 10\n" : "not ok 10 $_\n"; - - # Does assignment to a list imply split to one more field than that? -! $foo = `./perl -D1024 -e '(\$a,\$b) = split;' 2>&1`; - print $foo =~ /DEBUGGING/ || $foo =~ /num\(3\)/ ? "ok 11\n" : "not ok 11\n"; - - # Can we say how many fields to split to when assigning to a list? ---- 47,53 ---- - print $_ eq '1:2:3:4:5:6:::' ? "ok 10\n" : "not ok 10 $_\n"; - - # Does assignment to a list imply split to one more field than that? -! $foo = `perl -D1024 -e "(\$a,\$b) = split;" 2>&1`; - print $foo =~ /DEBUGGING/ || $foo =~ /num\(3\)/ ? "ok 11\n" : "not ok 11\n"; - - # Can we say how many fields to split to when assigning to a list? -diff -cbBwr perl-4.019/t/op/stat.t new/t/op/stat.t -*** perl-4.019/t/op/stat.t Fri Nov 22 22:04:46 1991 ---- new/t/op/stat.t Fri Nov 22 22:16:40 1991 -*************** -*** 4,12 **** - - print "1..56\n"; - -! chop($cwd = `pwd`); - -! $DEV = `ls -l /dev`; - - unlink "Op.stat.tmp"; - open(FOO, ">Op.stat.tmp"); ---- 4,12 ---- - - print "1..56\n"; - -! chop($cwd = `cd`); - -! $DEV = `ls -l`; - - unlink "Op.stat.tmp"; - open(FOO, ">Op.stat.tmp"); -*************** -*** 23,29 **** - - sleep 2; - -! `rm -f Op.stat.tmp2; ln Op.stat.tmp Op.stat.tmp2; chmod 644 Op.stat.tmp`; - - ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime, - $blksize,$blocks) = stat('Op.stat.tmp'); ---- 23,29 ---- - - sleep 2; - -! `del Op.stat.tmp2; ln Op.stat.tmp Op.stat.tmp2; chmod 644 Op.stat.tmp 2>nul`; - - ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime, - $blksize,$blocks) = stat('Op.stat.tmp'); -*************** -*** 73,80 **** - if (-d '.') {print "ok 23\n";} else {print "not ok 23\n";} - if (! -f '.') {print "ok 24\n";} else {print "not ok 24\n";} - -! if (`ls -l perl` =~ /^l.*->/) { -! if (-l 'perl') {print "ok 25\n";} else {print "not ok 25\n";} - } - else { - print "ok 25\n"; ---- 73,80 ---- - if (-d '.') {print "ok 23\n";} else {print "not ok 23\n";} - if (! -f '.') {print "ok 24\n";} else {print "not ok 24\n";} - -! if (`ls -l perl.exe` =~ /^l.*->/) { -! if (-l 'perl.exe') {print "ok 25\n";} else {print "not ok 25\n";} - } - else { - print "ok 25\n"; -*************** -*** 83,89 **** - if (-o 'Op.stat.tmp') {print "ok 26\n";} else {print "not ok 26\n";} - - if (-e 'Op.stat.tmp') {print "ok 27\n";} else {print "not ok 27\n";} -! `rm -f Op.stat.tmp Op.stat.tmp2`; - if (! -e 'Op.stat.tmp') {print "ok 28\n";} else {print "not ok 28\n";} - - if ($DEV !~ /\nc.* (\S+)\n/) ---- 83,89 ---- - if (-o 'Op.stat.tmp') {print "ok 26\n";} else {print "not ok 26\n";} - - if (-e 'Op.stat.tmp') {print "ok 27\n";} else {print "not ok 27\n";} -! `del Op.stat.tmp Op.stat.tmp2 2>nul`; - if (! -e 'Op.stat.tmp') {print "ok 28\n";} else {print "not ok 28\n";} - - if ($DEV !~ /\nc.* (\S+)\n/) -*************** -*** 113,119 **** - $cnt = $uid = 0; - - die "Can't run op/stat.t test 35 without pwd working" unless $cwd; -! chdir '/usr/bin' || die "Can't cd to /usr/bin"; - while (defined($_ = <*>)) { - $cnt++; - $uid++ if -u; ---- 113,119 ---- - $cnt = $uid = 0; - - die "Can't run op/stat.t test 35 without pwd working" unless $cwd; -! chdir '../os2' || die "Can't cd to ../os2"; - while (defined($_ = <*>)) { - $cnt++; - $uid++ if -u; -*************** -*** 124,138 **** - # I suppose this is going to fail somewhere... - if ($uid > 0 && $uid < $cnt) {print "ok 35\n";} else {print "not ok 35\n";} - -! unless (open(tty,"/dev/tty")) { -! print STDERR "Can't open /dev/tty--run t/TEST outside of make.\n"; - } - if (-t tty) {print "ok 36\n";} else {print "not ok 36\n";} - if (-c tty) {print "ok 37\n";} else {print "not ok 37\n";} - close(tty); - if (! -t tty) {print "ok 38\n";} else {print "not ok 38\n";} -! open(null,"/dev/null"); -! if (! -t null || -e '/xenix') {print "ok 39\n";} else {print "not ok 39\n";} - close(null); - if (-t) {print "ok 40\n";} else {print "not ok 40\n";} - ---- 124,138 ---- - # I suppose this is going to fail somewhere... - if ($uid > 0 && $uid < $cnt) {print "ok 35\n";} else {print "not ok 35\n";} - -! unless (open(tty,"con")) { -! print STDERR "Can't open con--run t/TEST outside of make.\n"; - } - if (-t tty) {print "ok 36\n";} else {print "not ok 36\n";} - if (-c tty) {print "ok 37\n";} else {print "not ok 37\n";} - close(tty); - if (! -t tty) {print "ok 38\n";} else {print "not ok 38\n";} -! open(null,"nul"); -! if (! -t null || -e 'c:/os2krnl') {print "ok 39\n";} else {print "not ok 39\n";} - close(null); - if (-t) {print "ok 40\n";} else {print "not ok 40\n";} - -*************** -*** 141,148 **** - if (-T 'op/stat.t') {print "ok 41\n";} else {print "not ok 41\n";} - if (! -B 'op/stat.t') {print "ok 42\n";} else {print "not ok 42\n";} - -! if (-B './perl') {print "ok 43\n";} else {print "not ok 43\n";} -! if (! -T './perl') {print "ok 44\n";} else {print "not ok 44\n";} - - open(FOO,'op/stat.t'); - eval { -T FOO; }; ---- 141,148 ---- - if (-T 'op/stat.t') {print "ok 41\n";} else {print "not ok 41\n";} - if (! -B 'op/stat.t') {print "ok 42\n";} else {print "not ok 42\n";} - -! if (-B 'perl.exe') {print "ok 43\n";} else {print "not ok 43\n";} -! if (! -T 'perl.exe') {print "ok 44\n";} else {print "not ok 44\n";} - - open(FOO,'op/stat.t'); - eval { -T FOO; }; -*************** -*** 172,176 **** - } - close(FOO); - -! if (-T '/dev/null') {print "ok 55\n";} else {print "not ok 55\n";} -! if (-B '/dev/null') {print "ok 56\n";} else {print "not ok 56\n";} ---- 172,176 ---- - } - close(FOO); - -! if (-T 'nul') {print "ok 55\n";} else {print "not ok 55\n";} -! if (-B 'nul') {print "ok 56\n";} else {print "not ok 56\n";} -diff -cbBwr perl-4.019/t/TEST new/t/TEST -*** perl-4.019/t/TEST Tue Jun 11 23:32:06 1991 ---- new/t/TEST Sun Jun 16 20:47:38 1991 -*************** -*** 16,22 **** - - if ($ARGV[0] eq '') { - @ARGV = split(/[ \n]/, -! `echo base/*.t comp/*.t cmd/*.t io/*.t; echo op/*.t lib/*.t`); - } - - open(CONFIG,"../config.sh"); ---- 16,22 ---- - - if ($ARGV[0] eq '') { - @ARGV = split(/[ \n]/, -! `ls base/*.t comp/*.t cmd/*.t io/*.t op/*.t lib/*.t`); - } - - open(CONFIG,"../config.sh"); -*************** -*** 35,41 **** - chop($te); - print "$te" . '.' x (15 - length($te)); - if ($sharpbang) { -! open(results,"./$test|") || (print "can't run.\n"); - } else { - open(script,"$test") || die "Can't run $test.\n"; - $_ = <script>; ---- 35,41 ---- - chop($te); - print "$te" . '.' x (15 - length($te)); - if ($sharpbang) { -! open(results,"$test|") || (print "can't run.\n"); - } else { - open(script,"$test") || die "Can't run $test.\n"; - $_ = <script>; -*************** -*** 45,51 **** - } else { - $switch = ''; - } -! open(results,"./perl$switch $test|") || (print "can't run.\n"); - } - $ok = 0; - $next = 0; ---- 45,51 ---- - } else { - $switch = ''; - } -! open(results,"perl$switch $test|") || (print "can't run.\n"); - } - $ok = 0; - $next = 0; - |