From: Larry Wall Date: Tue, 27 Mar 1990 20:20:03 +0000 (+0000) Subject: perl 3.0 patch #16 (combined patch) X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=21d892ea46b4eaa5d8ae1c8cd325d9940deef5b3;p=p5sagit%2Fp5-mst-13.2.git perl 3.0 patch #16 (combined patch) There is now support for compiling perl under the Microsoft C compiler on MSDOS. Special thanks go to Diomidis Spinellis for this. To compile under MSDOS, look at the readme file in the msdos subdirectory. As a part of this, six files will be renamed when you run Configure. These are config.h.SH, perl.man.[1-4] and t/op.subst. Suns (and perhaps other machines) can't cast negative floating point numbers to unsigned ints reasonably. Configure now detects this and takes appropriate action. Configure looked for optional libraries but then didn't ever use them, even if there was no config.sh value to override. System V Release 4 provides us with yet another nm format for Configure to parse. No doubt it's "better". Sigh. MIPS CPUs running under Ultrix were getting configured for volatile support, but they don't like volatile when applied to a type generated by a typedef. Configure now tests for this. I've added two new perl library routines: ctime.pl from Waldemar Kebsch and Marion Hakanson, and syslog.pl from Tom Christiansen and me. In subroutines, non-terminal blocks should never have arrays requested of them, even if the subroutine call's context is looking for an array. Formats didn't work inside eval. Now they do. Any $foo++ that doesn't return a value is now optimized to ++$foo since the latter doesn't require generation of a temporary to hold the old value. A self-referential printf pattern such as sprintf($s,...,$s,...) would end up with a null as the first character of the next field. On machines that don't support executing scripts in the kernel, perl has to emulate that when an exec fails. In this case, the do_exec() routine can lose arguments passed to the script. A memory leakage in pattern matching triggered by use of $`, $& or $' has been fixed. A splice that pulls up the front of an array such as splice(@array,0,$n) can cause a duplicate free error. The grep operator blew up on undefined array values. It now handles them reasonably, setting $_ to undef. The .. operator in an array context is used to generate number ranges. This has been generalized to allow any string ranges that can be generated with the magical increment code of ++. So you can say 'a' .. 'f', '000'..'999', etc. The ioctl function didn't return non-zero values correctly. Associative array slices from dbm files like @dbmvalues{'foo','bar'} could use the same cache entry for multiple values, causing loss of some of the values of the slice. Cache values are now not flushed until the end of a statement. The do FILE operator blew up when used inside an eval, due to trying to free the eval code it was still executing. If you did s/^prefix// on a string, and subsequently assigned a value that didn't contain a string value to the string, you could get a bad free error. One of the taint checks blew up on undefined array elements, which showed up only when taintperl was run. The final semicolon in program is supposed to be optional now. Unfortunately this wasn't true when -p or -n added extra code around your code. Now it's true all the time. A tail anchored pattern such as /foo$/ could cause grief if you searched a string that was shorter than that. --- diff --git a/Configure b/Configure index fdf3428..1fe5fe3 100755 --- a/Configure +++ b/Configure @@ -8,7 +8,16 @@ # and edit it to reflect your system. Some packages may include samples # of config.h for certain machines, so you might look for one of those.) # -# $Header: Configure,v 3.0.1.6 90/03/12 16:10:23 lwall Locked $ +# $Header: Configure,v 3.0.1.7 90/03/28 09:14:53 lwall Locked $ + +: make sure these files are renamed +test -f config_h.SH || mv -f config.h.SH config_h.SH +test -f perl_man.1 || mv -f perl.man.1 perl_man.1 +test -f perl_man.2 || mv -f perl.man.2 perl_man.2 +test -f perl_man.3 || mv -f perl.man.3 perl_man.3 +test -f perl_man.4 || mv -f perl.man.4 perl_man.4 +test -f t/op.s || mv -f t/op.subst t/op.s + # # Yes, you may rip this off to use in other distribution packages. # (Note: this Configure script was generated automatically. Rather than @@ -102,6 +111,7 @@ cppminus='' d_bcmp='' d_bcopy='' d_bzero='' +d_castneg='' d_charsprf='' d_crypt='' cryptlib='' @@ -1110,6 +1120,7 @@ rmlist="$rmlist pdp11" echo " " echo "Checking for optional libraries..." +dflt='' case "$libswanted" in '') libswanted='c_s';; esac @@ -1153,6 +1164,7 @@ set X $dflt shift dflt="$*" case "$libs" in +'') dflt="$dflt";; *) dflt="$libs";; esac case "$dflt" in @@ -1437,6 +1449,8 @@ if $contains '^printf$' libc.list >/dev/null 2>&1; then else $sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p' libc.list $contains '^printf$' libc.list >/dev/null 2>&1 || \ + $sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p' libc.list + $contains '^printf$' libc.list >/dev/null 2>&1 || \ $sed -n -e 's/^.* D __*//p' -e 's/^.* D //p' libc.list $contains '^printf$' libc.list >/dev/null 2>&1 || \ $sed -n -e 's/^_//' \ @@ -1492,6 +1506,35 @@ eval $inlibc set bzero d_bzero eval $inlibc +: check for ability to cast negative floats to unsigned +echo " " +echo 'Checking to see if your C compiler can cast negative float to unsigned' +$cat >try.c <<'EOCP' +main() +{ + double f = -123; + unsigned long along; + unsigned int aint; + unsigned short ashort; + + along = (unsigned long)f; + aint = (unsigned int)f; + ashort = (unsigned short)f; + if (along == 0L || aint == 0 || ashort == 0) + exit(1); + else + exit(0); +} +EOCP +if $cc -o try $ccflags try.c >/dev/null 2>&1 && ./try; then + d_castneg="$define" + echo "Yup, it does." +else + d_castneg="$undef" + echo "Nope, it doesn't." +fi +$rm -f try.* + : see if sprintf is declared as int or pointer to char echo " " cat >.ucbsprf.c <<'EOF' @@ -1756,6 +1799,61 @@ else echo "dbm.h not found." fi +socketlib='' +: see whether socket exists +echo " " +if $contains socket libc.list >/dev/null 2>&1; then + echo "Looks like you have Berkeley networking support." + d_socket="$define" + : now check for advanced features + if $contains setsockopt libc.list >/dev/null 2>&1; then + d_oldsock="$undef" + else + echo "...but it uses the old 4.1c interface, rather than 4.2" + d_oldsock="$define" + fi +else + : hpux, for one, puts all the socket stuff in socklib.o + if $contains socklib libc.list >/dev/null 2>&1; then + echo "Looks like you have Berkeley networking support." + d_socket="$define" + : we will have to assume that it supports the 4.2 BSD interface + d_oldsock="$undef" + else + echo "Hmmm...you don't have Berkeley networking in libc.a..." + : look for an optional networking library + if test -f /usr/lib/libnet.a; then + (ar t /usr/lib/libnet.a || + nm -g /usr/lib/libnet.a) 2>/dev/null >> libc.list + if $contains socket libc.list >/dev/null 2>&1; then + echo "but the Wollongong group seems to have hacked it in." + socketlib="-lnet" + d_socket="$define" + : now check for advanced features + if $contains setsockopt libc.list >/dev/null 2>&1; then + d_oldsock="$undef" + else + echo "...using the old 4.1c interface, rather than 4.2" + d_oldsock="$define" + fi + else + echo "or even in libnet.a, which is peculiar." + d_socket="$undef" + d_oldsock="$undef" + fi + else + echo "or anywhere else I see." + d_socket="$undef" + d_oldsock="$undef" + fi + fi +fi +if $contains socketpair libc.list >/dev/null 2>&1; then + d_sockpair="$define" +else + d_sockpair="$undef" +fi + : see if this is a pwd system echo " " if $test -r /usr/include/pwd.h ; then @@ -1850,61 +1948,6 @@ eval $inlibc set setruid d_setruid eval $inlibc -socketlib='' -: see whether socket exists -echo " " -if $contains socket libc.list >/dev/null 2>&1; then - echo "Looks like you have Berkeley networking support." - d_socket="$define" - : now check for advanced features - if $contains setsockopt libc.list >/dev/null 2>&1; then - d_oldsock="$undef" - else - echo "...but it uses the old 4.1c interface, rather than 4.2" - d_oldsock="$define" - fi -else - : hpux, for one, puts all the socket stuff in socklib.o - if $contains socklib libc.list >/dev/null 2>&1; then - echo "Looks like you have Berkeley networking support." - d_socket="$define" - : we will have to assume that it supports the 4.2 BSD interface - d_oldsock="$undef" - else - echo "Hmmm...you don't have Berkeley networking in libc.a..." - : look for an optional networking library - if test -f /usr/lib/libnet.a; then - (ar t /usr/lib/libnet.a || - nm -g /usr/lib/libnet.a) 2>/dev/null >> libc.list - if $contains socket libc.list >/dev/null 2>&1; then - echo "but the Wollongong group seems to have hacked it in." - socketlib="-lnet" - d_socket="$define" - : now check for advanced features - if $contains setsockopt libc.list >/dev/null 2>&1; then - d_oldsock="$undef" - else - echo "...using the old 4.1c interface, rather than 4.2" - d_oldsock="$define" - fi - else - echo "or even in libnet.a, which is peculiar." - d_socket="$undef" - d_oldsock="$undef" - fi - else - echo "or anywhere else I see." - d_socket="$undef" - d_oldsock="$undef" - fi - fi -fi -if $contains socketpair libc.list >/dev/null 2>&1; then - d_sockpair="$define" -else - d_sockpair="$undef" -fi - : see if stat knows about block sizes echo " " if $contains 'st_blocks;' /usr/include/sys/stat.h >/dev/null 2>&1 ; then @@ -2067,8 +2110,10 @@ echo 'Checking to see if your C compiler knows about "volatile"...' $cat >try.c <<'EOCP' main() { + typedef unsigned short foo_t; char *volatile foo; volatile int bar; + volatile foo_t blech; foo = foo; } EOCP @@ -2560,6 +2605,7 @@ cppminus='$cppminus' d_bcmp='$d_bcmp' d_bcopy='$d_bcopy' d_bzero='$d_bzero' +d_castneg='$d_castneg' d_charsprf='$d_charsprf' d_crypt='$d_crypt' cryptlib='$cryptlib' diff --git a/MANIFEST b/MANIFEST index 0472fa7..b9c7c89 100644 --- a/MANIFEST +++ b/MANIFEST @@ -16,7 +16,7 @@ client A client to test sockets cmd.c Command interpreter cmd.h Public declarations for the above config.H Sample config.h -config.h.SH Produces config.h +config_h.SH Produces config.h cons.c Routines to construct cmd nodes of a parse tree consarg.c Routines to construct arg nodes of a parse tree doarg.c Scalar expression evaluation @@ -41,6 +41,7 @@ eg/muck.man Manual page for muck eg/myrup A program to find lightly loaded machines eg/nih Script to insert #! workaround eg/rename A program to rename files +eg/relink A program to change symbolic links eg/rmfrom A program to feed doomed filenames to eg/scan/scan_df Scan for filesystem anomalies eg/scan/scan_last Scan for login anomalies @@ -51,6 +52,7 @@ eg/scan/scan_sudo Scan for sudo anomalies eg/scan/scan_suid Scan for setuid anomalies eg/scan/scanner An anomaly reporter eg/shmkill A program to remove unused shared memory +eg/travesty A program to print travesties of its input text eg/van/empty A program to empty the trashcan eg/van/unvanish A program to undo what vanish does eg/van/vanexp A program to expire vanished files @@ -68,24 +70,39 @@ ioctl.pl Sample ioctl.pl lib/abbrev.pl An abbreviation table builder lib/look.pl A "look" equivalent lib/complete.pl A command completion subroutine +lib/ctime.pl A ctime workalike lib/dumpvar.pl A variable dumper lib/getopt.pl Perl library supporting option parsing lib/getopts.pl Perl library supporting option parsing lib/importenv.pl Perl routine to get environment into variables lib/perldb.pl Perl debugging routines lib/stat.pl Perl library supporting stat function +lib/syslog.pl Perl library supporting syslogging lib/termcap.pl Perl library supporting termcap usage lib/validate.pl Perl library supporting wholesale file mode validation makedepend.SH Precursor to makedepend makedir.SH Precursor to makedir makelib.SH A thing to turn C .h file into perl .h files malloc.c A version of malloc you might not want +msdos/Changes.dds Expanation of MS-DOS patches by Diomidis Spinellis +msdos/Makefile MS-DOS makefile +msdos/README.msdos Compiling and usage information +msdos/Wishlist.dds My wishlist +msdos/config.h Definitions for msdos +msdos/dir.h MS-DOS header for directory access functions +msdos/directory.c MS-DOS directory access functions. +msdos/eg/crlf.bat Convert files from unix to MS-DOS line termination +msdos/eg/drives.bat List the system drives and their characteristics +msdos/eg/lf.bat Convert files from MS-DOS to Unix line termination +msdos/glob.c A command equivalent to csh glob +msdos/msdos.c MS-DOS ioctl, sleep, gete?[gu]if, spawn, aspawn +msdos/popen.c My_popen and my_pclose for MS-DOS patchlevel.h The current patch level of perl perl.h Global declarations -perl.man.1 The manual page(s), first fourth -perl.man.2 The manual page(s), second fourth -perl.man.3 The manual page(s), third fourth -perl.man.4 The manual page(s), fourth fourth +perl_man.1 The manual page(s), first fourth +perl_man.2 The manual page(s), second fourth +perl_man.3 The manual page(s), third fourth +perl_man.4 The manual page(s), fourth fourth perl.y Yacc grammar for perl perlsh A poor man's perl shell perly.c main() @@ -164,7 +181,7 @@ t/op.split See if split works t/op.sprintf See if sprintf works t/op.stat See if stat works t/op.study See if study works -t/op.subst See if substitutions work +t/op.s See if substitutions work t/op.substr See if substr works t/op.time See if time functions work t/op.undef See if undef works diff --git a/Makefile.SH b/Makefile.SH index b1c1eeb..122b6dc 100644 --- a/Makefile.SH +++ b/Makefile.SH @@ -25,9 +25,12 @@ esac echo "Extracting Makefile (with variable substitutions)" cat >Makefile <perl.man - cat perl.man.[1-4] >>perl.man + cat perl_man.[1-4] >>perl.man install: all # won't work with csh diff --git a/README b/README index 8de855d..5029dcf 100644 --- a/README +++ b/README @@ -1,7 +1,7 @@ Perl Kit, Version 3.0 - Copyright (c) 1989, Larry Wall + Copyright (c) 1989,1990, Larry Wall This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -76,6 +76,7 @@ Installation The 3b2 needs to turn off -O. AIX/RT may need a -a switch and -DCRIPPLED_CC. + SUNOS 4.0.[12] needs #define fputs(str,fp) fprintf(fp,"%s",str) in perl.h SGI machines may need -Ddouble="long float". Ultrix (2.3) may need to hand assemble teval.s with a -J switch. Ultrix on MIPS machines may need -DLANGUAGE_C. diff --git a/client b/client index 97ecbc2..5900c90 100644 --- a/client +++ b/client @@ -19,7 +19,7 @@ if (connect(S,$that)) { print "connect ok\n"; } else { die $!; } select(S); $| = 1; select(stdout); if ($child = fork) { - while (<>) { + while () { print S; } sleep 3; diff --git a/cmd.c b/cmd.c index fbcdc9b..4f3c13a 100644 --- a/cmd.c +++ b/cmd.c @@ -1,4 +1,4 @@ -/* $Header: cmd.c,v 3.0.1.6 90/03/12 16:21:09 lwall Locked $ +/* $Header: cmd.c,v 3.0.1.7 90/03/27 15:32:37 lwall Locked $ * * Copyright (c) 1989, Larry Wall * @@ -6,6 +6,9 @@ * as specified in the README file that comes with the perl 3.0 kit. * * $Log: cmd.c,v $ + * Revision 3.0.1.7 90/03/27 15:32:37 lwall + * patch16: non-terminal blocks should never have arrays requested of them + * * Revision 3.0.1.6 90/03/12 16:21:09 lwall * patch13: fixed some backwards VOLATILE declarations * patch13: while (s/x//) {} still caused some anomolies @@ -127,7 +130,7 @@ tail_recursion_entry: grow_dlevel(); } #endif - newsp = cmd_exec(cmd->ucmd.ccmd.cc_true,gimme,sp); + newsp = cmd_exec(cmd->ucmd.ccmd.cc_true,gimme && (cmdflags & CF_TERM),sp); st = stack->ary_array; /* possibly reallocated */ retstr = st[newsp]; } @@ -158,7 +161,7 @@ tail_recursion_entry: grow_dlevel(); } #endif - newsp = cmd_exec(cmd->ucmd.ccmd.cc_true,gimme,sp); + newsp = cmd_exec(cmd->ucmd.ccmd.cc_true,gimme && (cmdflags & CF_TERM),sp); st = stack->ary_array; /* possibly reallocated */ retstr = st[newsp]; } @@ -247,7 +250,7 @@ tail_recursion_entry: grow_dlevel(); } #endif - newsp = cmd_exec(cmd->ucmd.ccmd.cc_true,gimme,sp); + newsp = cmd_exec(cmd->ucmd.ccmd.cc_true,gimme && (cmdflags & CF_TERM),sp); st = stack->ary_array; /* possibly reallocated */ retstr = st[newsp]; } @@ -267,7 +270,7 @@ tail_recursion_entry: grow_dlevel(); } #endif - newsp = cmd_exec(cmd->ucmd.ccmd.cc_alt,gimme,sp); + newsp = cmd_exec(cmd->ucmd.ccmd.cc_alt,gimme && (cmdflags & CF_TERM),sp); st = stack->ary_array; /* possibly reallocated */ retstr = st[newsp]; } @@ -711,7 +714,7 @@ until_loop: grow_dlevel(); } #endif - newsp = cmd_exec(cmd->ucmd.ccmd.cc_true,gimme,sp); + newsp = cmd_exec(cmd->ucmd.ccmd.cc_true,gimme && (cmdflags & CF_TERM),sp); st = stack->ary_array; /* possibly reallocated */ retstr = st[newsp]; } @@ -740,7 +743,7 @@ until_loop: grow_dlevel(); } #endif - newsp = cmd_exec(cmd->ucmd.ccmd.cc_true,gimme,sp); + newsp = cmd_exec(cmd->ucmd.ccmd.cc_true,gimme && (cmdflags & CF_TERM),sp); st = stack->ary_array; /* possibly reallocated */ retstr = st[newsp]; } @@ -826,7 +829,7 @@ until_loop: grow_dlevel(); } #endif - newsp = cmd_exec(cmd->ucmd.ccmd.cc_true,gimme,sp); + newsp = cmd_exec(cmd->ucmd.ccmd.cc_true,gimme && (cmdflags & CF_TERM),sp); st = stack->ary_array; /* possibly reallocated */ retstr = st[newsp]; } @@ -846,7 +849,7 @@ until_loop: grow_dlevel(); } #endif - newsp = cmd_exec(cmd->ucmd.ccmd.cc_alt,gimme,sp); + newsp = cmd_exec(cmd->ucmd.ccmd.cc_alt,gimme && (cmdflags & CF_TERM),sp); st = stack->ary_array; /* possibly reallocated */ retstr = st[newsp]; } diff --git a/msdos/Changes.dds b/msdos/Changes.dds new file mode 100644 index 0000000..1eed759 --- /dev/null +++ b/msdos/Changes.dds @@ -0,0 +1,57 @@ +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 new file mode 100644 index 0000000..eeb15e8 --- /dev/null +++ b/msdos/Makefile @@ -0,0 +1,101 @@ +# +# 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/Wishlist.dds b/msdos/Wishlist.dds new file mode 100644 index 0000000..d06de11 --- /dev/null +++ b/msdos/Wishlist.dds @@ -0,0 +1,17 @@ +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/config.h b/msdos/config.h new file mode 100644 index 0000000..f664cda --- /dev/null +++ b/msdos/config.h @@ -0,0 +1,540 @@ +/* config.h + * This file is hand tailored for compiling under MS-DOS and MSC 5.1. + * Diomidis Spinellis, March 1990. + */ + + +/* 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 /**/ + +/* BIN: + * This symbol holds the name of the directory in which the user wants + * to put 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... + */ +/* CHECK */ +#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 -{" 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 */ +#define CPPSTDIN "cc -{" +#define CPPMINUS "" + +/* 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 BCMP /**/ + +/* BCOPY: + * This symbol, if defined, indicates that the bcopy routine is available + * to copy blocks of memory. Otherwise you should probably use memcpy(). + */ +/*#define BCOPY /**/ + +/* 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 /**/ + +/* CRYPT: + * This symbol, if defined, indicates that the crypt routine is available + * to encrypt passwords and the like. + */ +/* TODO */ +/*#define CRYPT /**/ + +/* 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. + */ +/*#define DOSUID /**/ + +/* DUP2: + * This symbol, if defined, indicates that the dup2 routine is available + * to dup file descriptors. Otherwise you should use dup(). + */ +#define DUP2 /**/ + +/* FCHMOD: + * This symbol, if defined, indicates that the fchmod routine is available + * to change mode of opened files. If unavailable, use chmod(). + */ +/*#define FCHMOD /**/ + +/* FCHOWN: + * This symbol, if defined, indicates that the fchown routine is available + * to change ownership of opened files. If unavailable, use chown(). + */ +/*#define FCHOWN /**/ + +/* FCNTL: + * This symbol, if defined, indicates to the C program that it should + * include fcntl.h. + */ +/*#define FCNTL /**/ + +/* FLOCK: + * This symbol, if defined, indicates that the flock() routine is + * available to do file locking. + */ +/*#define FLOCK /**/ + +/* 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 GETGROUPS /**/ + +/* GETHOSTENT: + * This symbol, if defined, indicates that the gethostent() routine is + * available to lookup host names in some data base or other. + */ +/*#define GETHOSTENT /**/ + +/* GETPGRP: + * This symbol, if defined, indicates that the getpgrp() routine is + * available to get the current process group. + */ +/*#define GETPGRP /**/ + +/* GETPRIORITY: + * This symbol, if defined, indicates that the getpriority() routine is + * available to get a process's priority. + */ +/*#define GETPRIORITY /**/ + +/* HTONS: + * This symbol, if defined, indicates that the htons routine (and friends) + * are available to do network order byte swapping. + */ +/* HTONL: + * This symbol, if defined, indicates that the htonl routine (and friends) + * are available to do network order byte swapping. + */ +/* NTOHS: + * This symbol, if defined, indicates that the ntohs routine (and friends) + * are available to do network order byte swapping. + */ +/* NTOHL: + * This symbol, if defined, indicates that the ntohl routine (and friends) + * are available to do network order byte swapping. + */ +/*#define HTONS /**/ +/*#define HTONL /**/ +/*#define NTOHS /**/ +/*#define 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? */ + +/* IOCTL: + * This symbol, if defined, indicates that sys/ioctl.h exists and should + * be included. + */ +/*#define IOCTL /**/ + +/* 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 KILLPG /**/ + +/* MEMCMP: + * This symbol, if defined, indicates that the memcmp routine is available + * to compare blocks of memory. If undefined, roll your own. + */ +#define MEMCMP /**/ + +/* 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. + */ +#define MEMCPY /**/ + +/* 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 MKDIR /**/ + +/* NDBM: + * This symbol, if defined, indicates that ndbm.h exists and should + * be included. + */ +/*#define NDBM /**/ + +/* ODBM: + * This symbol, if defined, indicates that dbm.h exists and should + * be included. + */ +/*#define ODBM /**/ + +/* READDIR: + * This symbol, if defined, indicates that the readdir routine is available + * from the C library to create directories. + */ +#define READDIR /**/ + +/* 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 RENAME /**/ + +/* 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 RMDIR /**/ + +/* SETEGID: + * This symbol, if defined, indicates that the setegid routine is available + * to change the effective gid of the current program. + */ +/*#define SETEGID /**/ + +/* SETEUID: + * This symbol, if defined, indicates that the seteuid routine is available + * to change the effective uid of the current program. + */ +/*#define SETEUID /**/ + +/* SETPGRP: + * This symbol, if defined, indicates that the setpgrp() routine is + * available to set the current process group. + */ +/*#define SETPGRP /**/ + +/* SETPRIORITY: + * This symbol, if defined, indicates that the setpriority() routine is + * available to set a process's priority. + */ +/*#define SETPRIORITY /**/ + +/* SETREGID: + * This symbol, if defined, indicates that the setregid routine is available + * to change the real and effective gid of the current program. + */ +/*#define SETREGID /**/ + +/* SETREUID: + * This symbol, if defined, indicates that the setreuid routine is available + * to change the real and effective uid of the current program. + */ +/*#define SETREUID /**/ + +/* SETRGID: + * This symbol, if defined, indicates that the setrgid routine is available + * to change the real gid of the current program. + */ +/*#define SETRGID /**/ + +/* SETRUID: + * This symbol, if defined, indicates that the setruid routine is available + * to change the real uid of the current program. + */ +/*#define SETRUID /**/ + +/* SOCKET: + * This symbol, if defined, indicates that the BSD socket interface is + * supported. + */ +/* 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 SOCKET /**/ + +/*#undef 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 /**/ + +/* SYMLINK: + * This symbol, if defined, indicates that the symlink routine is available + * to create symbolic links. + */ +/*#define SYMLINK /**/ + +/* SYSCALL: + * This symbol, if defined, indicates that the syscall routine is available + * to call arbitrary system calls. If undefined, that's tough. + */ +/*#define SYSCALL /**/ + +/* TMINSYS: + * This symbol is defined if this system declares "struct tm" in + * in rather than . We can't just say + * -I/usr/include/sys because some systems have both time files, and + * the -I trick gets the wrong one. + */ +/* I_SYSTIME: + * This symbol is defined if this system has the file . + */ +/* + * I_TIME: + * This symbol is defined if time this system has the file . + */ +/*#undef TMINSYS /**/ +/*#define I_SYSTIME /**/ +#define I_TIME + +/* VARARGS: + * This symbol, if defined, indicates to the C program that it should + * include varargs.h. + */ +#define VARARGS /**/ + +/* vfork: + * This symbol, if defined, remaps the vfork routine to fork if the + * vfork() routine isn't supported here. + */ +/*#undef vfork fork /**/ + +/* 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. + */ +#define VOIDSIG /**/ + +/* 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 VPRINTF /**/ +/*#undef CHARVSPRINTF /**/ + +/* GIDTYPE: + * This symbol has a value like gid_t, int, ushort, or whatever type is + * used to declare group ids in the kernel. + */ +/* TODO */ +#define GIDTYPE int /**/ + +/* I_DIRENT: + * This symbol, if defined, indicates to the C program that it should + * include dirent.h. + */ +/* 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 DIRNAMLEN /**/ + +/* I_FCNTL: + * This symbol, if defined, indicates to the C program that it should + * include fcntl.h. + */ +#define I_FCNTL /**/ + +/* I_GRP: + * This symbol, if defined, indicates to the C program that it should + * include grp.h. + */ +/*#define I_GRP /**/ + +/* 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. + */ +/*#define I_PWD /**/ +/*#define PWQUOTA /**/ +/*#undef PWAGE /**/ + +/* I_SYSDIR: + * This symbol, if defined, indicates to the C program that it should + * include sys/dir.h. + */ +#define I_SYSDIR /**/ + +/* I_SYSIOCTL: + * This symbol, if defined, indicates that sys/ioctl.h exists and should + * be included. + */ +/*#define I_SYSIOCTL /**/ + +/* I_VARARGS: + * This symbol, if defined, indicates to the C program that it should + * include varargs.h. + */ +#define I_VARARGS /**/ + +/* INTSIZE: + * This symbol contains the size of an int, so that the C preprocessor + * can make decisions based on it. + */ +#define INTSIZE 2 /**/ + +/* 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 /**/ + +/* SIG_NAME: + * This symbol contains an list of signal names in order. + */ +#define SIG_NAME + "ZERO","HUP","INT","QUIT","ILL","TRAP","IOT","EMT","FPE","KILL","BUS","SEGV","S +YS","PIPE","ALRM","TERM","URG","STOP","TSTP","CONT","CHLD","TTIN","TTOU","IO","X +CPU","XFSZ","VTALRM","PROF","WINCH","USR1","USR2" /**/ + +/* 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 /**/ + +/* VOIDFLAGS: + * 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 VOIDUSED to indicate the requirements + * of the package. This can be done either by #defining VOIDUSED before + * including config.h, or by defining defvoidused in Myinit.U. If the + * latter approach is taken, only those flags will be tested. If the + * level of void support necessary is not present, defines void to int. + */ +#ifndef VOIDUSED +#define VOIDUSED 7 +#endif +#define VOIDFLAGS 7 +#if (VOIDFLAGS & VOIDUSED) != VOIDUSED +#define void int /* is void to be avoided? */ +#define M_VOID /* Xenix strikes again */ +#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" /**/ + +/* + * BUGGY_MSC: + * This symbol is defined if you are the unfortunate owner of a buggy + * Microsoft C compiler and want to use intrinsic functions. Versions + * up to 5.1 are known conform to this definition. + */ +#define BUGGY_MSC /**/ + +/* + * 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 +#define CASTNEGFLOAT diff --git a/patchlevel.h b/patchlevel.h index 69d9c2f..29d9127 100644 --- a/patchlevel.h +++ b/patchlevel.h @@ -1 +1 @@ -#define PATCHLEVEL 15 +#define PATCHLEVEL 16