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 /msdos | |
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 'msdos')
-rw-r--r-- | msdos/Changes.dds | 57 | ||||
-rw-r--r-- | msdos/Makefile | 101 | ||||
-rw-r--r-- | msdos/README.msdos | 195 | ||||
-rw-r--r-- | msdos/Wishlist.dds | 17 | ||||
-rw-r--r-- | msdos/chdir.c | 96 | ||||
-rw-r--r-- | msdos/config.h | 938 | ||||
-rw-r--r-- | msdos/dir.h | 63 | ||||
-rw-r--r-- | msdos/directory.c | 185 | ||||
-rw-r--r-- | msdos/eg/crlf.bat | 32 | ||||
-rw-r--r-- | msdos/eg/drives.bat | 41 | ||||
-rw-r--r-- | msdos/eg/lf.bat | 33 | ||||
-rw-r--r-- | msdos/glob.c | 17 | ||||
-rw-r--r-- | msdos/msdos.c | 260 | ||||
-rw-r--r-- | msdos/popen.c | 186 | ||||
-rw-r--r-- | msdos/usage.c | 51 |
15 files changed, 0 insertions, 2272 deletions
diff --git a/msdos/Changes.dds b/msdos/Changes.dds deleted file mode 100644 index 1eed759cf9..0000000000 --- a/msdos/Changes.dds +++ /dev/null @@ -1,57 +0,0 @@ -These are the changes done by the `patches' file: - -[These patches have been applied, more or less, so I don't supply the -patches file--law] - -Compilation of some portions is done conditional on the definition -of the following symbols: - -BINARY Enables the usage of setmode under MSDOS (added binmode command) -BUGGY_MSC Adds #pragma_function(memset) to avoid internal compiler error -CHOWN Enables chown -CHROOT Enables chroot -FORK Enables fork and changes the compilation of system -GETLOGIN Enables getlogin -GETPPID Enables getppid -GROUP Enables all the group access functions -KILL Enables kill -LINK Enables link -PASSWD Enables all the password access functions -PIPE Enables the pipe function -WAIT Enables the wait function -UMASK Enables the umask function - -S_IFBLK * Enables the block special device check -S_ISGID * Enables the setgid check -S_ISUID * Enables the setuid check -S_ISVTX * Enables the vtx check -unix * Compiles globbing for Unix -MSDOS * Compiles globbing for MS-DOS - Closes stdaux and stdprn on startup - Adds a copyright message for -v - Disables the compilation of my_popen, my_pclose as the - are in a separate file. - -Symbols marked with * are defined in the compilation environment. The -rest should be added to config.h (config.h.SH). All functions when not -supported give a fatal error. - -Added documentation for the binmode function in the manual. - -Fixed the following bugs: - -In eval.c function eval if ioctl or fcntl returned something -other than 0 or -1 the result was a random number as the -double `value' variable wasn't set to `anum'. - -In doio.c function do_exec there were two errors associated with -firing up the shell when the execv fails. First argv was not freed, -secondly an attempt was made to start up the shell with the cmd -string that was now cut to pieces for the execv. Also the maxible -possible length of argv was calculated by (s - cmd). Problem was -that s was not pointing to the end of the string, but to the first -non alpha. - -[These are incorporated in patches 15 and 16--law] - -Diomidis Spinellis, March 1990 diff --git a/msdos/Makefile b/msdos/Makefile deleted file mode 100644 index eeb15e8068..0000000000 --- a/msdos/Makefile +++ /dev/null @@ -1,101 +0,0 @@ -# -# Makefile for compiling Perl under MS-DOS -# -# 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. But who would do serious development under -# MS-DOS? -# -# By Diomidis Spinellis, March 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 msdos.c popen.c directory.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 msdos.obj popen.obj \ -directory.obj - -# Files in the MS-DOS distribution -DOSFILES=config.h dir.h director.c glob.c makefile msdos.c popen.c readme.msd \ -changes.dds wishlist.dds patches manifest - -# Yacc flags -YFLAGS=-d - -# Manual pages -MAN=perlman.1 perlman.2 perlman.3 perlman.4 - -CC=cc -# Cflags for the files that break under the optimiser -CPLAIN=-AL -DCRIPPLED_CC -# Cflags for all the rest -CFLAGS=$(CPLAIN) -Ox -# Destination directory for executables -DESTDIR=\usr\bin - -# Deliverables -all: perl.exe perl.1 glob.exe - -perl.exe: $(OBJ) - echo array+cmd+cons+consarg+doarg+doio+dolist+dump+ >perl.arp - echo eval+form+hash+perl+perly+regcomp+regexec+ >>perl.arp - echo stab+str+toke+util+msdos+popen+directory+\lib\setargv >>perl.arp - echo perl.exe >>perl.arp - echo nul >>perl.arp - echo /stack:32767 /NOE >>perl.arp - link @perl.arp - -glob.exe: glob.c - $(CC) glob.c \lib\setargv.obj -link /NOE - -array.obj: 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 -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 -str.obj: str.c -toke.obj: toke.c -util.obj: util.c - $(CC) $(CPLAIN) -c util.c -perly.h: perl.obj - mv ytab.h perly.h -directory.obj: directory.c -popen.obj: popen.c -msdos.obj: msdos.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) ../msdos diff --git a/msdos/README.msdos b/msdos/README.msdos deleted file mode 100644 index 3a5c38fcae..0000000000 --- a/msdos/README.msdos +++ /dev/null @@ -1,195 +0,0 @@ - Notes on the MS-DOS Perl port - - Diomidis Spinellis - (dds@cc.ic.ac.uk) - -[0. First copy the files in the msdos directory into the parent -directory--law] - -1. Compiling. - - Perl has been compiled under MS-DOS using the Microsoft -C compiler version 5.1. Before compiling install dir.h as -<sys/dir.h>. You will need a Unix-like make program (e.g. -pdmake) and something like yacc (e.g. bison). You could get -away by running yacc and dry running make on a Unix host, -but I haven't tried it. Compilation takes 12 minutes on a -20MHz 386 machine (together with formating the manual), so -you will probably need something to do in the meantime. The -executable is 272k and the top level directory needs 1M for -sources and about the same ammount for the object code and -the executables. - - The makefile will compile glob for you which you will -need to place somewhere in your path so that perl globbing -will work correctly. I have not tried all the tests or the -examples, nor the awk and sed to Perl translators. You are -on your own with them. In the eg directory I have included -an example program that uses ioctl to display the charac- -teristics of the storage devices of the system. - -2. Using MS-DOS Perl - - The MS-DOS version of perl has most of the functional- -ity of the Unix version. Functions that can not be provided -under MS-DOS like sockets, password and host database -access, fork and wait have been ommited and will terminate -with a fatal error. Care has been taken to implement the -rest. In particular directory access, redirection (includ- -ing pipes, but excluding the pipe function), system, ioctl -and sleep have been provided. - -[Files currently can be edited in-place provided you are cre- -ating a backup. However, if the backup coincidentally has -the same name as the original, or if the resulting backup -filename is invalid, then the file will probably be trashed. -For example, don't do - - perl -i~ script makefile - perl -i.bak script file.dat - -because (1) MS-DOS treats "makefile~" and "makefile" as the -same filename, and (2) "file.dat.bak" is an invalid filename. -The files "makefile" and "file.dat" will probably be lost -forever. Moral of the story: Don't use in-place editing -under MS-DOS. --rjc] - -2.1. Interface to the MS-DOS ioctl system call. - - The function code of the ioctl function (the second -argument) is encoded as follows: - -- The lowest nibble of the function code goes to AL. -- The two middle nibbles go to CL. -- The high nibble goes to CH. - - The return code is -1 in the case of an error and if -successful: - -- for functions AL = 00, 09, 0a the value of the register DX -- for functions AL = 02 - 08, 0e the value of the register AX -- for functions AL = 01, 0b - 0f the number 0. - - See the perl manual for instruction on how to distin- -guish between the return value and the success of ioctl. - - Some ioctl functions need a number as the first argu- -ment. Provided that no other files have been opened the -number can be obtained if ioctl is called with -@fdnum[number] as the first argument after executing the -following code: - - @fdnum = ("STDIN", "STDOUT", "STDERR"); - $maxdrives = 15; - for ($i = 3; $i < $maxdrives; $i++) { - open("FD$i", "nul"); - @fdnum[$i - 1] = "FD$i"; - } - -2.2. 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 `binary' function should be used. There is -currently no way to reverse the effect of the binary func- -tion. If that is needed close and reopen the file. - -2.3. Interpreter startup. - - The effect of the Unix #!/bin/perl interpreter startup -can be obtained under MS-DOS by giving the script a .bat -extension and using the following lines on its begining: - - @REM=(" - @perl %0.bat %1 %2 %3 %4 %5 %6 %7 %8 %9 - @end ") if 0 ; - -(Note that you will probably want an absolute path name in -front of %0.bat). - - March 1990 - - Diomidis Spinellis <dds@cc.ic.ac.uk> - Myrsinis 1 - GR-145 62 Kifissia - Greece - --------------------------------------------------------------------------- - - Revisions to the MS-DOS support in Perl 4.0 - Tom Dinger, 18 March 1991 - -The DOS compatibility added to Perl sometime in release 3.x was not -maintained, and Perl as distributed could not be built without changes. - -Both myself and Len Reed more or less "rediscovered" how to get Perl built -and running reliably for MS-DOS, using the Microsoft C compiler. He and I -have communicated, and will be putting together additional patches for the -DOS version of Perl. - -1. Compiling Perl - - For now, I have not supplied a makefile, as there is no standard for - make utilities under DOS. All the files can be compiled with Microsoft - C 5.1, using the switches "-AL -Ox" for Large memory model, maximum - optimization (this turned out a few code generation bugs in MSC 5.1). - The code will also compile with MSC 6.00A, with the optimization - "-Oacegils /Gs" for all files (regcomp.c has special case code to change - the aliasing optimizations). - - Generally, you follow the instructions given above to compile and build - Perl 4.0 for DOS. I used the output of SunOS yacc run on perly.y, - without modification, but I expect both Bison and Berkeley-YACC will work - also. From inspection of the generated code, however, I believe AT&T - derived YACC produces the smallest tables, i.e. uses the least memory. - This is important for a 300K executable file. - -2. Editing in-place. - - You will need the file suffix.c from the os2 subdirectory -- it will - create a backup file with much less danger for DOS. - -3. A "Smarter" chdir() function. - - I have added to the DOS version of Perl 4.0 a replacement chdir() - function. Unlike the "normal" behavior, it is aware of drive letters - at the start of paths for DOS. So for example: - - perl_chdir( "B:" ) changes to the default directory, on drive B: - perl_chdir( "C:\FOO" ) changes to the specified directory, on drive C: - perl_chdir( "\BAR" ) changes to the specified directory on the - current drive. - -4. *.BAT Scripts as Perl scripts - - The strategy described above for turning a Perl script into a *.BAT - script do not work. I have been using the following lines at the - beginning of a Perl *.BAT script: - - @REM=(qq! - @perl -S %0.bat %1 %2 %3 %4 %5 %6 %7 %8 %9 - @goto end !) if 0 ; - - and the following at the end of the *.BAT script: - - @REM=(qq! - :end !) if 0 ; - - If you like, with the proper editor you can replace the four '!' - characters with some untypeable character, such as Ctrl-A. This will - allow you to pass any characters, including ".." strings as arguments. - -4. Things to Come - - * Better temporary file handling. - * A real Makefile -- Len Reed has one for Dmake 3.6 - * Swapping code -- swaps most of Perl out of memory (to EMS, XMS or - disk) before running a sub-program or pipe. - * MKS command line support, both into Perl, and to other programs - spawned by Perl. - * Smarter pipe functions, not using COMMAND.COM. - - - Tom Dinger - tdinger@East.Sun.COM - Martch 18, 1991 diff --git a/msdos/Wishlist.dds b/msdos/Wishlist.dds deleted file mode 100644 index d06de117ab..0000000000 --- a/msdos/Wishlist.dds +++ /dev/null @@ -1,17 +0,0 @@ -Perl in general: -Add ftw or find? -Add a parsing mechanism (user specifies parse tree, perl parses). -Arbitrary precision arithmetic. -File calculus (e.g. file1 = file2 + file3, file1 =^ s/foo/bar/g etc.) - -MS-DOS version of Perl: -Add interface to treat dBase files as associative arrays. -Add int86x function. -Handle the C preprocessor. -Provide real pipes by switching the processes. (difficult) -Provide a list of ioctl codes. -Check the ioctl errno handling. -I can't find an easy way in Perl to pass a number as the first argument - to ioctl. This is needed for some functions of ioctl. Either hack - ioctl, or change perl to ioctl interface. Another solution would be - a perl pseudo array containing the filehandles indexed by fd. diff --git a/msdos/chdir.c b/msdos/chdir.c deleted file mode 100644 index b650eb0a90..0000000000 --- a/msdos/chdir.c +++ /dev/null @@ -1,96 +0,0 @@ -/* - * (C) Copyright 1990, 1991 Tom Dinger - * - * You may distribute under the terms of either the GNU General Public - * License or the Artistic License, as specified in the README file. - * - */ - -/* - * A "DOS-aware" chdir() function, that will change current drive as well. - * - * chdir( "B:" ) -- changes to the default directory, on drive B: - * chdir( "C:\FOO" ) changes to the specified directory, on drive C: - * chdir( "\BAR" ) changes to the specified directory on the current - * drive. - */ - -#include <stdlib.h> -#include <ctype.h> -#include <direct.h> -#include <dos.h> -#include <errno.h> - -#include "config.h" -#ifdef chdir -#undef chdir -#endif - -/* We should have the line: - * - * #define chdir perl_chdir - * - * in some header for perl (I put it in config.h) so that all - * references to chdir() become references to this function. - */ - -/*------------------------------------------------------------------*/ - -#if defined(BUGGY_MSC5) /* only needed for MSC 5.1 */ - -int _chdrive( int drivenum ) -{ -unsigned int ndrives; -unsigned int tmpdrive; - - -_dos_setdrive( drivenum, &ndrives ); - -/* check for illegal drive letter */ -_dos_getdrive( &tmpdrive ); - -return (tmpdrive != drivenum) ? -1 : 0 ; -} - -#endif - -/*-----------------------------------------------------------------*/ - -int perl_chdir( char * path ) -{ -int drive_letter; -unsigned int drivenum; - - -if ( path && *path && (path[1] == ':') ) - { - /* The path starts with a drive letter */ - /* Change current drive */ - drive_letter = *path; - if ( isalpha(drive_letter) ) - { - /* Drive letter legal */ - if ( islower(drive_letter) ) - drive_letter = toupper(drive_letter); - drivenum = drive_letter - 'A' + 1; - - /* Change drive */ - if ( _chdrive( drivenum ) == -1 ) - { - /* Drive change failed -- must be illegal drive letter */ - errno = ENODEV; - return -1; - } - - /* Now see if that's all we do */ - if ( ! path[2] ) - return 0; /* no path after drive -- all done */ - } - /* else drive letter illegal -- fall into "normal" chdir */ - } - -/* Here with some path as well */ -return chdir( path ); - -/* end perl_chdir() */ -} diff --git a/msdos/config.h b/msdos/config.h deleted file mode 100644 index 7131d6338e..0000000000 --- a/msdos/config.h +++ /dev/null @@ -1,938 +0,0 @@ -#ifndef config_h -#define config_h -/* config.h - * - * This file is hand tailored for MS-DOS and MSC 5.1 and 6.00A. - * Tom Dinger, March 1991. - */ - - -/* - * BUGGY_MSC5: - * This symbol is defined if you are the unfortunate owner of the buggy - * Microsoft C compiler version 5.1. It is used as a conditional to - * guard code sections that are known to break this compiler. - * BUGGY_MSC6: - * This symbol is defined if you are the unfortunate owner of the buggy - * Microsoft C compiler version 6.0A. It is used as a conditional to - * guard code sections that are known to break this compiler. - */ -#define BUGGY_MSC5 /**/ -/*#undef BUGGY_MSC6 /**/ - - -/* 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 4 /**/ - -/* 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 "/usr/local/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 "". - */ -/* TODO: doesn't work for MSC -- it's more complicated than this */ -#define CPPSTDIN "cl " -#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. - */ -/*#undef 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(). - * If neither is defined, roll your own. - */ -/* SAFE_BCOPY - * This symbol, if defined, indicates that the bcopy routine is available - * to copy potentially overlapping copy blocks of bcopy. Otherwise you - * should probably use memmove() or memcpy(). If neither is defined, - * roll your own. - */ -/*#undef HAS_BCOPY /**/ -/*#undef SAFE_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. - */ -/*#undef 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 0 /**/ - -/* 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. - */ -/*#undef 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. - */ -#define HAS_CHSIZE /**/ - -/* HAS_CRYPT - * This symbol, if defined, indicates that the crypt routine is available - * to encrypt passwords and the like. - */ -/*#undef HAS_CRYPT /**/ - -/* CSH - * This symbol, if defined, indicates that the C-shell exists. - * If defined, contains the full pathname of csh. - */ -/*#undef CSH "/usr/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(). - */ -/*#undef 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(). - */ -/*#undef HAS_FCHOWN /**/ - -/* HAS_FCNTL - * This symbol, if defined, indicates to the C program that - * the fcntl() function exists. - */ -/*#undef HAS_FCNTL /**/ - -/* FLEXFILENAMES - * This symbol, if defined, indicates that the system supports filenames - * longer than 14 characters. - */ -/*#undef FLEXFILENAMES /**/ - -/* HAS_FLOCK - * This symbol, if defined, indicates that the flock() routine is - * available to do file locking. - */ -/*#undef 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. - */ -/*#undef 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. - */ -/*#undef 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. - */ -/*#undef 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. - */ -/*#undef HAS_HTONS /**/ -/*#undef HAS_HTONL /**/ -/*#undef HAS_NTOHS /**/ -/*#undef 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. - */ -#define 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. - */ -/*#undef HAS_KILLPG /**/ - -/* HAS_LSTAT - * This symbol, if defined, indicates that the lstat() routine is - * available to stat symbolic links. - */ -/*#undef 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. - */ -/*#undef HAS_MSG /**/ - -/* HAS_MSGCTL - * This symbol, if defined, indicates that the msgctl() routine is - * available to control message passing. - */ -/*#undef HAS_MSGCTL /**/ - -/* HAS_MSGGET - * This symbol, if defined, indicates that the msgget() routine is - * available to get messages. - */ -/*#undef HAS_MSGGET /**/ - -/* HAS_MSGRCV - * This symbol, if defined, indicates that the msgrcv() routine is - * available to receive messages. - */ -/*#undef HAS_MSGRCV /**/ - -/* HAS_MSGSND - * This symbol, if defined, indicates that the msgsnd() routine is - * available to send messages. - */ -/*#undef HAS_MSGSND /**/ - -/* HAS_NDBM - * This symbol, if defined, indicates that ndbm.h exists and should - * be included. - */ -/*#undef HAS_NDBM /**/ - -/* HAS_ODBM - * This symbol, if defined, indicates that dbm.h exists and should - * be included. - */ -/*#undef 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. - */ -/*#undef HAS_SELECT /**/ - -/* HAS_SEM - * This symbol, if defined, indicates that the entire sem*(2) library is - * supported. - */ -/*#undef HAS_SEM /**/ - -/* HAS_SEMCTL - * This symbol, if defined, indicates that the semctl() routine is - * available to control semaphores. - */ -/*#undef HAS_SEMCTL /**/ - -/* HAS_SEMGET - * This symbol, if defined, indicates that the semget() routine is - * available to get semaphores ids. - */ -/*#undef HAS_SEMGET /**/ - -/* HAS_SEMOP - * This symbol, if defined, indicates that the semop() routine is - * available to perform semaphore operations. - */ -/*#undef HAS_SEMOP /**/ - -/* HAS_SETEGID - * This symbol, if defined, indicates that the setegid routine is available - * to change the effective gid of the current program. - */ -/*#undef HAS_SETEGID /**/ - -/* HAS_SETEUID - * This symbol, if defined, indicates that the seteuid routine is available - * to change the effective uid of the current program. - */ -/*#undef HAS_SETEUID /**/ - -/* HAS_SETPGRP - * This symbol, if defined, indicates that the setpgrp() routine is - * available to set the current process group. - */ -/*#undef 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. - */ -/*#undef 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. - */ -/*#undef 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. - */ -/*#undef 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. - */ -/*#undef HAS_SETRGID /**/ - -/* HAS_SETRUID - * This symbol, if defined, indicates that the setruid routine is available - * to change the real uid of the current program. - */ -/*#undef HAS_SETRUID /**/ - -/* HAS_SHM - * This symbol, if defined, indicates that the entire shm*(2) library is - * supported. - */ -/*#undef 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*. - */ -/*#undef HAS_SHMAT /**/ - -/*#undef VOIDSHMAT /**/ - -/* HAS_SHMCTL - * This symbol, if defined, indicates that the shmctl() routine is - * available to control a shared memory segment. - */ -/*#undef HAS_SHMCTL /**/ - -/* HAS_SHMDT - * This symbol, if defined, indicates that the shmdt() routine is - * available to detach a shared memory segment. - */ -/*#undef HAS_SHMDT /**/ - -/* HAS_SHMGET - * This symbol, if defined, indicates that the shmget() routine is - * available to get a shared memory segment id. - */ -/*#undef 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. - */ -/*#undef HAS_SOCKET /**/ - -/*#undef HAS_SOCKETPAIR /**/ - -/*#undef OLDSOCKET /**/ - -/* STATBLOCKS - * This symbol is defined if this system has a stat structure declaring - * st_blksize and st_blocks. - */ -/*#undef STATBLOCKS /**/ - -/* STDSTDIO - * This symbol is defined if this system has a FILE structure declaring - * _ptr and _cnt in stdio.h. - * - * NOTE: [Tom Dinger, 23 February 1991] You also need the _filbuf() - * function, usually referred to by the getc() macro 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. - */ -#define HAS_STRERROR /**/ - -/* HAS_SYMLINK - * This symbol, if defined, indicates that the symlink routine is available - * to create symbolic links. - */ -/*#undef 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. - */ -/*#undef 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. - */ -/*#undef HAS_TRUNCATE /**/ - -/* HAS_VFORK - * This symbol, if defined, indicates that vfork() exists. - */ -/*#undef 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 int /**/ - -/* HASVOLATILE - * This symbol, if defined, indicates that this C compiler knows about - * the volatile declaration. - */ -/*#undef 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 /**/ -/*#undef CHARVSPRINTF /**/ - -/* HAS_WAIT4 - * This symbol, if defined, indicates that wait4() exists. - */ -/*#undef HAS_WAIT4 /**/ - -/* HAS_WAITPID - * This symbol, if defined, indicates that waitpid() exists. - */ -/*#undef 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>. - */ -#define I_FCNTL /**/ - -/* I_GDBM - * This symbol, if defined, indicates that gdbm.h exists and should - * be included. - */ -/*#undef I_GDBM /**/ - -/* I_GRP - * This symbol, if defined, indicates to the C program that it should - * include grp.h. - */ -/*#undef 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. - */ -/*#undef 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. - */ -/*#undef I_PWD /**/ -/*#undef PWQUOTA /**/ -/*#undef PWAGE /**/ -/*#undef PWCHANGE /**/ -/*#undef PWCLASS /**/ -/*#undef PWEXPIRE /**/ -/*#undef PWCOMMENT /**/ - -/* I_SYS_FILE - * This manifest constant tells the C program to include <sys/file.h>. - */ -/*#undef I_SYS_FILE /**/ - -/* I_SYSIOCTL - * This symbol, if defined, indicates that sys/ioctl.h exists and should - * be included. - */ -/*#undef 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 /**/ -/*#undef 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. - */ -/*#undef 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. - */ -/*#undef 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. - */ -/*#undef I_DIRENT /**/ -#define I_SYS_DIR /**/ -/*#undef I_NDIR /**/ -/*#undef I_SYS_NDIR /**/ -/*#undef I_MY_DIR /**/ -/*#undef 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 31 /**/ - -/* 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. - * - * Note: This list is specific for Microsoft C 5.1 and 6.0, which only - * support SIGINT, SIGFPE, SIGILL, SIGSEGV, and SIGABRT on - * DOS 3.x, but in addition defines SIGTERM, SIGBREAK, SIGUSR1, - * SIGUSR2, and SIGUSR3. - */ -#define SIG_NAME \ - "ZERO","HUP","INT","QUIT","ILL","TRAP","IOT","EMT","FPE","KILL",\ - "BUS","SEGV","SYS","PIPE","ALRM","TERM","USR1","USR2","TSTP","CONT",\ - "USR3","BREAK","ABRT" /**/ - -/* 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 1 -#endif -#define VOIDHAVE 1 -#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 "/usr/local/lib/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 - -#define S_ISUID 0 -#define S_ISGID 0 - -/* For MSC5.1, toke.c "runs out of heap space" unless CRIPPLED_CC is - * defined. - */ -#if defined(BUGGY_MSC5) || defined(BUGGY_MSC6) -#define CRIPPLED_CC /**/ -#endif - -/* MSC (5.1 and 6.0) doesn't know about S_IFBLK or S_IFIFO -- these are - * normally found in sys/stat.h - */ -#define S_IFBLK (S_IFDIR | S_IFCHR) -#define S_IFIFO 0010000 - -/* Define SUFFIX to get special DOS suffix-replacement code */ -#define SUFFIX /**/ - -/* Add this for the DOS-specific chdir() function */ -#define chdir perl_chdir - -#endif diff --git a/msdos/dir.h b/msdos/dir.h deleted file mode 100644 index d16bc372e0..0000000000 --- a/msdos/dir.h +++ /dev/null @@ -1,63 +0,0 @@ -/* $RCSfile: dir.h,v $$Revision: 4.1 $$Date: 92/08/07 18:24:41 $ - * - * (C) Copyright 1987, 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: dir.h,v $ - * Revision 4.1 92/08/07 18:24:41 lwall - * - * Revision 4.0.1.1 91/06/07 11:22:10 lwall - * patch4: new copyright notice - * - * Revision 4.0 91/03/20 01:34:20 lwall - * 4.0 baseline. - * - * Revision 3.0.1.1 90/03/27 16:07:08 lwall - * patch16: MSDOS support - * - * Revision 1.1 90/03/18 20:32:29 dds - * Initial revision - * - * - */ - -/* - * defines the type returned by the directory(3) functions - */ - -#ifndef __DIR_INCLUDED -#define __DIR_INCLUDED - -/*Directory entry size */ -#ifdef DIRSIZ -#undef DIRSIZ -#endif -#define DIRSIZ(rp) (sizeof(struct direct)) - -/* - * Structure of a directory entry - */ -struct direct { - ino_t d_ino; /* inode number (not used by MS-DOS) */ - int d_namlen; /* Name length */ - char d_name[13]; /* file name */ -}; - -struct _dir_struc { /* Structure used by dir operations */ - char *start; /* Starting position */ - char *curr; /* Current position */ - struct direct dirstr; /* Directory structure to return */ -}; - -typedef struct _dir_struc DIR; /* Type returned by dir operations */ - -DIR *cdecl opendir(char *filename); -struct direct *readdir(DIR *dirp); -long telldir(DIR *dirp); -void seekdir(DIR *dirp,long loc); -void rewinddir(DIR *dirp); -void closedir(DIR *dirp); - -#endif /* __DIR_INCLUDED */ diff --git a/msdos/directory.c b/msdos/directory.c deleted file mode 100644 index dd1fb64519..0000000000 --- a/msdos/directory.c +++ /dev/null @@ -1,185 +0,0 @@ -/* $RCSfile: directory.c,v $$Revision: 4.1 $$Date: 92/08/07 18:24:42 $ - * - * (C) Copyright 1987, 1988, 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: directory.c,v $ - * Revision 4.1 92/08/07 18:24:42 lwall - * - * Revision 4.0.1.1 91/06/07 11:22:24 lwall - * patch4: new copyright notice - * - * Revision 4.0 91/03/20 01:34:24 lwall - * 4.0 baseline. - * - * Revision 3.0.1.1 90/03/27 16:07:37 lwall - * patch16: MSDOS support - * - * Revision 1.3 90/03/16 22:39:40 dds - * Fixed malloc problem. - * - * Revision 1.2 88/07/23 00:08:39 dds - * Added inode non-zero filling. - * - * Revision 1.1 88/07/23 00:03:50 dds - * Initial revision - * - */ - -/* - * UNIX compatible directory access functions - */ - -#include <sys/types.h> -#include <sys/dir.h> -#include <stddef.h> -#include <stdlib.h> -#include <string.h> -#include <dos.h> -#include <ctype.h> - -/* - * File names are converted to lowercase if the - * CONVERT_TO_LOWER_CASE variable is defined. - */ -#define CONVERT_TO_LOWER_CASE - -#define PATHLEN 65 - -#ifndef lint -static char rcsid[] = "$RCSfile: directory.c,v $$Revision: 4.1 $$Date: 92/08/07 18:24:42 $"; -#endif - -DIR * -opendir(char *filename) -{ - DIR *p; - char *oldresult, *result; - union REGS srv; - struct SREGS segregs; - register reslen = 0; - char scannamespc[PATHLEN]; - char *scanname = scannamespc; /* To take address we need a pointer */ - - /* - * Structure used by the MS-DOS directory system calls. - */ - struct dir_buff { - char reserved[21]; /* Reserved for MS-DOS */ - unsigned char attribute; /* Attribute */ - unsigned int time; /* Time */ - unsigned int date; /* Date */ - long size; /* Size of file */ - char fn[13]; /* Filename */ - } buffspc, *buff = &buffspc; - - - if (!(p = (DIR *) malloc(sizeof(DIR)))) - return NULL; - - /* Initialize result to use realloc on it */ - if (!(result = malloc(1))) { - free(p); - return NULL; - } - - /* Create the search pattern */ - strcpy(scanname, filename); - if (strchr("/\\", *(scanname + strlen(scanname) - 1)) == NULL) - strcat(scanname, "/*.*"); - else - strcat(scanname, "*.*"); - - segread(&segregs); -#if ( defined(M_I86LM) || defined(M_I86CM) || defined(M_I86HM) ) - segregs.ds = FP_SEG(buff); - srv.x.dx = FP_OFF(buff); -#else - srv.x.dx = (unsigned int) buff; -#endif - srv.h.ah = 0x1a; /* Set DTA to DS:DX */ - intdosx(&srv, &srv, &segregs); - -#if ( defined(M_I86LM) || defined(M_I86CM) || defined(M_I86HM) ) - segregs.ds = FP_SEG(scanname); - srv.x.dx = FP_OFF(scanname); -#else - srv.x.dx = (unsigned int) scanname; -#endif - srv.x.cx = 0xff; /* Search mode */ - - for (srv.h.ah = 0x4e; !intdosx(&srv, &srv, &segregs); srv.h.ah = 0x4f) { - if ((result = (char *) realloc(result, reslen + strlen(buff->fn) + 1)) == - NULL) { - free(p); - free(oldresult); - return NULL; - } - oldresult = result; -#ifdef CONVERT_TO_LOWER_CASE - strcpy(result + reslen, strlwr(buff->fn)); -#else - strcpy(result + reslen, buff->fn); -#endif - reslen += strlen(buff->fn) + 1; - } - - if (!(result = realloc(result, reslen + 1))) { - free(p); - free(oldresult); - return NULL; - } else { - p->start = result; - p->curr = result; - *(result + reslen) = '\0'; - return p; - } -} - - -struct direct * -readdir(DIR *dirp) -{ - char *p; - register len; - static dummy; - - p = dirp->curr; - len = strlen(p); - if (*p) { - dirp->curr += len + 1; - strcpy(dirp->dirstr.d_name, p); - dirp->dirstr.d_namlen = len; - /* To fool programs */ - dirp->dirstr.d_ino = ++dummy; - return &(dirp->dirstr); - } else - return NULL; -} - -long -telldir(DIR *dirp) -{ - return (long) dirp->curr; /* ouch! pointer to long cast */ -} - -void -seekdir(DIR *dirp, long loc) -{ - dirp->curr = (char *) loc; /* ouch! long to pointer cast */ -} - -void -rewinddir(DIR *dirp) -{ - dirp->curr = dirp->start; -} - -void -closedir(DIR *dirp) -{ - free(dirp->start); - free(dirp); -} diff --git a/msdos/eg/crlf.bat b/msdos/eg/crlf.bat deleted file mode 100644 index 24d73661b9..0000000000 --- a/msdos/eg/crlf.bat +++ /dev/null @@ -1,32 +0,0 @@ -@REM=(" -@perl %0.bat %1 %2 %3 %4 %5 %6 %7 %8 %9 -@end ") if 0 ; - -# Convert all the files in the current directory from unix to MS-DOS -# line ending conventions. -# -# By Diomidis Spinellis -# -open(FILES, 'find . -print |'); -while ($file = <FILES>) { - $file =^ s/[\n\r]//; - if (-f $file) { - if (-B $file) { - print STDERR "Skipping binary file $file\n"; - next; - } - ($dev, $ino, $mode, $nlink, $uid, $gid, $rdev, $size, $atime, $mtime, $ctime, - $blksize, $blocks) = stat($file); - open(IFILE, "$file"); - open(OFILE, ">xl$$"); - while (<IFILE>) { - print OFILE; - } - close(OFILE) || die "close xl$$: $!\n"; - close(IFILE) || die "close $file: $!\n"; - unlink($file) || die "unlink $file: $!\n"; - rename("xl$$", $file) || die "rename(xl$$, $file): $!\n"; - chmod($mode, $file) || die "chmod($mode, $file: $!\n"; - utime($atime, $mtime, $file) || die "utime($atime, $mtime, $file): $!\n"; - } -} diff --git a/msdos/eg/drives.bat b/msdos/eg/drives.bat deleted file mode 100644 index c68306ed8d..0000000000 --- a/msdos/eg/drives.bat +++ /dev/null @@ -1,41 +0,0 @@ -@REM=(" -@perl %0.bat %1 %2 %3 %4 %5 %6 %7 %8 %9 -@end ") if 0 ; - -# -# Test the ioctl function for MS-DOS. Provide a list of drives and their -# characteristics. -# -# By Diomidis Spinellis. -# - -@fdnum = ("STDIN", "STDOUT", "STDERR"); -$maxdrives = 15; -for ($i = 3; $i < $maxdrives; $i++) { - open("FD$i", "nul"); - @fdnum[$i - 1] = "FD$i"; -} -@mediatype = ( - "320/360 k floppy drive", - "1.2M floppy", - "720K floppy", - "8'' single density floppy", - "8'' double density floppy", - "fixed disk", - "tape drive", - "1.44M floppy", - "other" -); -print "The system has the following drives:\n"; -for ($i = 1; $i < $maxdrives; $i++) { - if ($ret = ioctl(@fdnum[$i], 8, 0)) { - $type = ($ret == 0) ? "removable" : "fixed"; - $ret = ioctl(@fdnum[$i], 9, 0); - $location = ($ret & 0x800) ? "local" : "remote"; - ioctl(@fdnum[$i], 0x860d, $param); - @par = unpack("CCSSSC31S", $param); - $lock = (@par[2] & 2) ? "supporting door lock" : "not supporting door lock"; - printf "%c:$type $location @mediatype[@par[1]] @par[3] cylinders @par[6] - sectors/track $lock\n", ord('A') + $i - 1; - } -} diff --git a/msdos/eg/lf.bat b/msdos/eg/lf.bat deleted file mode 100644 index 9c13eef840..0000000000 --- a/msdos/eg/lf.bat +++ /dev/null @@ -1,33 +0,0 @@ -@REM=(" -@perl %0.bat %1 %2 %3 %4 %5 %6 %7 %8 %9 -@end ") if 0 ; - -# Convert all the files in the current directory from MS-DOS to unix -# line ending conventions. -# -# By Diomidis Spinellis -# -open(FILES, 'find . -print |'); -while ($file = <FILES>) { - $file =^ s/[\n\r]//; - if (-f $file) { - if (-B $file) { - print STDERR "Skipping binary file $file\n"; - next; - } - ($dev, $ino, $mode, $nlink, $uid, $gid, $rdev, $size, $atime, $mtime, $ctime, - $blksize, $blocks) = stat($file); - open(IFILE, "$file"); - open(OFILE, ">xl$$"); - binmode OFILE || die "binmode xl$$: $!\n"; - while (<IFILE>) { - print OFILE; - } - close(OFILE) || die "close xl$$: $!\n"; - close(IFILE) || die "close $file: $!\n"; - unlink($file) || die "unlink $file: $!\n"; - rename("xl$$", $file) || die "rename(xl$$, $file): $!\n"; - chmod($mode, $file) || die "chmod($mode, $file: $!\n"; - utime($atime, $mtime, $file) || die "utime($atime, $mtime, $file): $!\n"; - } -} diff --git a/msdos/glob.c b/msdos/glob.c deleted file mode 100644 index 19fb2ab7ba..0000000000 --- a/msdos/glob.c +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Globbing for MS-DOS. Relies on the expansion done by the library - * startup code. (dds) - */ - -#include <stdio.h> -#include <string.h> - -main(int argc, char *argv[]) -{ - register i; - - for (i = 1; i < argc; i++) { - fputs(strlwr(argv[i]), stdout); - putchar(0); - } -} diff --git a/msdos/msdos.c b/msdos/msdos.c deleted file mode 100644 index 206cf5a3a1..0000000000 --- a/msdos/msdos.c +++ /dev/null @@ -1,260 +0,0 @@ -/* $RCSfile: msdos.c,v $$Revision: 4.1 $$Date: 92/08/07 18:24:49 $ - * - * (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: msdos.c,v $ - * Revision 4.1 92/08/07 18:24:49 lwall - * - * Revision 4.0.1.1 91/06/07 11:22:37 lwall - * patch4: new copyright notice - * - * Revision 4.0 91/03/20 01:34:46 lwall - * 4.0 baseline. - * - * 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 - * - */ - -/* - * Various Unix compatibility functions for MS-DOS. - */ - -#include "EXTERN.h" -#include "perl.h" - -#include <dos.h> -#include <process.h> - -/* - * Interface to the MS-DOS ioctl system call. - * The function is encoded as follows: - * The lowest nibble of the function code goes to AL - * The two middle nibbles go to CL - * The high nibble goes to CH - * - * The return code is -1 in the case of an error and if successful - * for functions AL = 00, 09, 0a the value of the register DX - * for functions AL = 02 - 08, 0e the value of the register AX - * for functions AL = 01, 0b - 0f the number 0 - * - * Notice that this restricts the ioctl subcodes stored in AL to 00-0f - * In the Ralf Borwn interrupt list 90.1 there are no subcodes above AL=0f - * so we are ok. - * Furthermore CH is also restriced in the same area. Where CH is used as a - * code it always is between 00-0f. In the case where it forms a count - * together with CL we arbitrarily set the highest count limit to 4095. It - * sounds reasonable for an ioctl. - * The other alternative would have been to use the pointer argument to - * point the the values of CX. The problem with this approach is that - * of accessing wild regions when DX is used as a number and not as a - * pointer. - */ -int -ioctl(int handle, unsigned int function, char *data) -{ - union REGS srv; - struct SREGS segregs; - - srv.h.ah = 0x44; - srv.h.al = (unsigned char)(function & 0x0F); - srv.x.bx = handle; - srv.x.cx = function >> 4; - segread(&segregs); -#if ( defined(M_I86LM) || defined(M_I86CM) || defined(M_I86HM) ) - segregs.ds = FP_SEG(data); - srv.x.dx = FP_OFF(data); -#else - srv.x.dx = (unsigned int) data; -#endif - intdosx(&srv, &srv, &segregs); - if (srv.x.cflag & 1) { - switch(srv.x.ax ){ - case 1: - errno = EINVAL; - break; - case 2: - case 3: - errno = ENOENT; - break; - case 4: - errno = EMFILE; - break; - case 5: - errno = EPERM; - break; - case 6: - errno = EBADF; - break; - case 8: - errno = ENOMEM; - break; - case 0xc: - case 0xd: - case 0xf: - errno = EINVAL; - break; - case 0x11: - errno = EXDEV; - break; - case 0x12: - errno = ENFILE; - break; - default: - errno = EZERO; - break; - } - return -1; - } else { - switch (function & 0xf) { - case 0: case 9: case 0xa: - return srv.x.dx; - case 2: case 3: case 4: case 5: - case 6: case 7: case 8: case 0xe: - return srv.x.ax; - case 1: case 0xb: case 0xc: case 0xd: - case 0xf: - default: - return 0; - } - } -} - - -/* - * Sleep function. - */ -void -sleep(unsigned len) -{ - time_t end; - - end = time((time_t *)0) + len; - while (time((time_t *)0) < end) - ; -} - -/* - * Just pretend that everyone is a superuser - */ -#define ROOT_UID 0 -#define ROOT_GID 0 -int -getuid(void) -{ - return ROOT_UID; -} - -int -geteuid(void) -{ - return ROOT_UID; -} - -int -getgid(void) -{ - return ROOT_GID; -} - -int -getegid(void) -{ - return ROOT_GID; -} - -int -setuid(int uid) -{ return (uid==ROOT_UID?0:-1); } - -int -setgid(int gid) -{ return (gid==ROOT_GID?0:-1); } - -/* - * 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; -} - - -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 = "\\command.com"; - - /* see if there are shell metacharacters in it */ - if (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; -} diff --git a/msdos/popen.c b/msdos/popen.c deleted file mode 100644 index 0031f5e58a..0000000000 --- a/msdos/popen.c +++ /dev/null @@ -1,186 +0,0 @@ -/* $RCSfile: popen.c,v $$Revision: 4.1 $$Date: 92/08/07 18:24:50 $ - * - * (C) Copyright 1988, 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: popen.c,v $ - * Revision 4.1 92/08/07 18:24:50 lwall - * - * Revision 4.0.1.1 91/06/07 11:22:52 lwall - * patch4: new copyright notice - * - * Revision 4.0 91/03/20 01:34:50 lwall - * 4.0 baseline. - * - * Revision 3.0.1.2 90/08/09 04:04:42 lwall - * patch19: various MSDOS and OS/2 patches folded in - * - * Revision 3.0.1.1 90/03/27 16:11:57 lwall - * patch16: MSDOS support - * - * Revision 1.1 90/03/18 20:32:20 dds - * Initial revision - * - */ - -/* - * Popen and pclose for MS-DOS - */ - -#include <stdlib.h> -#include <stdio.h> -#include <process.h> - -/* - * Possible actions on an popened file - */ -enum action { - delete, /* Used for "r". Delete the tmp file */ - execute /* Used for "w". Execute the command. */ -}; - -/* - * Linked list of things to do at the end of the program execution. - */ -static struct todo { - FILE *f; /* File we are working on (to fclose) */ - const char *name; /* Name of the file (to unlink) */ - const char *command; /* Command to execute */ - enum action what; /* What to do (execute or delete) */ - struct todo *next; /* Next structure */ -} *todolist; - - -/* Clean up function */ -static int close_pipes(void); - -/* - * Add a file f running the command command on file name to the list - * of actions to be done at the end. The action is specified in what. - * Return -1 on failure, 0 if ok. - */ -static int -add(FILE *f, const char *command, const char *name, enum action what) -{ - struct todo *p; - - if ((p = (struct todo *) malloc(sizeof(struct todo))) == NULL) - return -1; - p->f = f; - p->command = command; - p->name = name; - p->what = what; - p->next = todolist; - todolist = p; - return 0; -} - -FILE * -mypopen(const char *command, const char *t) -{ - char buff[256]; - char *name; - FILE *f; - static init = 0; - - if (!init) - if (onexit(close_pipes) == NULL) - return NULL; - else - init++; - - if ((name = tempnam((char*)NULL, "pp")) == NULL) - return NULL; - - switch (*t) { - case 'r': - sprintf(buff, "%s >%s", command, name); - if (system(buff) || (f = fopen(name, "r")) == NULL) { - free(name); - return NULL; - } - if (add(f, command, name, delete)) { - (void)fclose(f); - (void)unlink(name); - free(name); - return NULL; - } - return f; - case 'w': - if ((f = fopen(name, "w")) == NULL) { - free(name); - return NULL; - } - if (add(f, command, name, execute)) { - (void)fclose(f); - (void)unlink(name); - free(name); - return NULL; - } - return f; - default: - free(name); - return NULL; - } -} - -int -mypclose(FILE *f) -{ - struct todo *p, **prev; - char buff[256]; - const char *name; - int status; - - for (p = todolist, prev = &todolist; p; prev = &(p->next), p = p->next) - if (p->f == f) { - *prev = p->next; - name = p->name; - switch (p->what) { - case delete: - free(p); - if (fclose(f) == EOF) { - (void)unlink(name); - status = EOF; - } else if (unlink(name) < 0) - status = EOF; - else - status = 0; - free((void*)name); - return status; - case execute: - (void)sprintf(buff, "%s <%s", p->command, p->name); - free(p); - if (fclose(f) == EOF) { - (void)unlink(name); - status = EOF; - } else if (system(buff)) { - (void)unlink(name); - status = EOF; - } else if (unlink(name) < 0) - status = EOF; - else - status = 0; - free((void*)name); - return status; - default: - return EOF; - } - } - return EOF; -} - -/* - * Clean up at the end. Called by the onexit handler. - */ -static int -close_pipes(void) -{ - struct todo *p; - - for (p = todolist; p; p = p->next) - (void)mypclose(p->f); - return 0; -} diff --git a/msdos/usage.c b/msdos/usage.c deleted file mode 100644 index 28991679e9..0000000000 --- a/msdos/usage.c +++ /dev/null @@ -1,51 +0,0 @@ -/* usage.c - * - * Show usage message. - */ - -#include <stdio.h> -#include <string.h> - - -usage(char *myname) -{ -char * p; -char * name_p; - -name_p = myname; -if ( p = strrchr(myname,'/') ) - name_p = p+1; /* point after final '/' */ -#ifdef MSDOS -if ( p = strrchr(name_p,'\\') ) - name_p = p+1; /* point after final '\\' */ -if ( p = strrchr(name_p,':') ) - name_p = p+1; /* point after final ':' */ - printf("\nUsage: %s [-acdnpsSvw] [-Dnumber] [-i[extension]] [-Idirectory]" -#else - printf("\nUsage: %s [-acdnpPsSuUvw] [-Dnumber] [-i[extension]] [-Idirectory]" -#endif - "\n [-e \"command\"] [-x[directory]] [filename] [arguments]\n", name_p); - - 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" -#ifndef MSDOS - "\n -P run script through C preprocessor befor compilation" -#endif - "\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 -Dnumber set debugging flags" - "\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"); -} |