From: Gurusamy Sarathy Date: Fri, 10 Sep 1999 17:49:35 +0000 (+0000) Subject: dos-djgpp update (from Laszlo Molnar ) X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=933fea7ffa6c794a1a2b8e713eb2b30851598bc8;p=p5sagit%2Fp5-mst-13.2.git dos-djgpp update (from Laszlo Molnar ) p4raw-id: //depot/perl@4121 --- diff --git a/AUTHORS b/AUTHORS index ed52400..3ed8133 100644 --- a/AUTHORS +++ b/AUTHORS @@ -39,7 +39,7 @@ mbiggar Mark A Biggar mab@wdl.loral.com mbligh Martin J. Bligh mbligh@sequent.com mike Mike Stok mike@stok.co.uk millert Todd Miller millert@openbsd.org -molnarl Laszlo Molnar molnarl@cdata.tvnet.hu +laszlo.molnar Laszlo Molnar Laszlo.Molnar@eth.ericsson.se mpeix Mark Bixby markb@cccd.edu muir David Muir Sharnoff muir@idiom.com neale Neale Ferguson neale@VMA.TABNSW.COM.AU @@ -86,7 +86,7 @@ cygwin win32 dec_osf jhi,spider dgux roderick doc tchrist -dos lmolnarl +dos laszlo.molnar dynix/ptx mbligh ebcdic vms,vmesa,posixbc filespec kjahds @@ -99,7 +99,6 @@ locale jhi,domo lynxos lynxos machten domo mm makemaker -msdos molnarl mvs pvhp netbsd jhi openbsd millert diff --git a/Changes b/Changes index 8f41f2f..6fd3e3c 100644 --- a/Changes +++ b/Changes @@ -31,7 +31,7 @@ current addresses (as of July 1998): Doug MacEachern Paul Marquess Stephen McCamant - Laszlo Molnar + Laszlo Molnar Hans Mulder Matthias Neeracher Jeff Okamoto diff --git a/README.dos b/README.dos index 56d78df..95ab911 100644 --- a/README.dos +++ b/README.dos @@ -266,7 +266,7 @@ variable does NOT point to bash). =head1 AUTHOR -Laszlo Molnar, F +Laszlo Molnar, F =head1 SEE ALSO diff --git a/djgpp/config.over b/djgpp/config.over index 4895cf1..c624386 100644 --- a/djgpp/config.over +++ b/djgpp/config.over @@ -25,7 +25,10 @@ repair() -e 's/posix/POSIX/'\ -e 's/sdbm_fil/SDBM_File/'\ -e 's/socket/Socket/'\ - -e 's/thread/Thread/' + -e 's/thread/Thread/'\ + -e 's/byteload/ByteLoader/'\ + -e 's=devel/peek=Devel/Peek='\ + -e 's=devel/dprof=Devel/DProf=' } static_ext=$(repair "$static_ext") extensions=$(repair "$extensions") diff --git a/djgpp/configure.bat b/djgpp/configure.bat index e7d41d7..6073f44 100644 --- a/djgpp/configure.bat +++ b/djgpp/configure.bat @@ -29,6 +29,7 @@ goto end sh -c 'if test ! -d /tmp; then mkdir /tmp; fi' cp djgpp.c config.over .. cd .. +mv ext/B/defsu* ext/B/defsubsh.PL echo Running sed... sh djgpp/djgppsed.sh diff --git a/djgpp/djgpp.c b/djgpp/djgpp.c index 5c1d3c4..5a8fc5f 100644 --- a/djgpp/djgpp.c +++ b/djgpp/djgpp.c @@ -123,7 +123,7 @@ convretcode (pTHX_ int rc,char *prog,int fl) Perl_warner(aTHX_ WARN_EXEC,"Can't %s \"%s\": %s", fl ? "exec" : "spawn",prog,Strerror (errno)); if (rc > 0) - return rc <<= 8; + return rc << 8; if (rc < 0) return 255 << 8; return 0; @@ -252,6 +252,7 @@ struct globinfo int fd; char *matches; size_t size; + fpos_t pos; }; #define MAXOPENGLOBS 10 @@ -286,6 +287,7 @@ glob_handler (__FSEXT_Fnumber n,int *rv,va_list args) if ((gi=searchfd (-1)) == NULL) break; + gi->pos=0; pattern=alloca (strlen (name+=13)+1); strcpy (pattern,name); if (!_USE_LFN) @@ -332,11 +334,10 @@ glob_handler (__FSEXT_Fnumber n,int *rv,va_list args) if ((gi=searchfd (fd))==NULL) break; - ic=tell (fd); - if (siz+ic>=gi->size) - siz=gi->size-ic; - memcpy (buf,ic+gi->matches,siz); - lseek (fd,siz,1); + if (siz+gi->pos > gi->size) + siz = gi->size - gi->pos; + memcpy (buf,gi->pos+gi->matches,siz); + gi->pos += siz; *rv=siz; return 1; } diff --git a/djgpp/djgppsed.sh b/djgpp/djgppsed.sh index 5276f4f..a25e894 100644 --- a/djgpp/djgppsed.sh +++ b/djgpp/djgppsed.sh @@ -17,13 +17,15 @@ SCOR='s=c\\\.c|=c\_c|=g' SHSED='s=\.\(hsed\)=_\1=g' SDEPTMP='s=\.\(deptmp\)=_\1=g' SCPP='s=\.\(cpp\.\)=_\1=g' -SARGV='s=\.\(argv\.\)=_\1=g' +SARGV='s=\.\(argv\)\.=_\1_=g' SABC='s=\.\([abc][^a]\)=_\1=g' SDBMX='s=\.\(dbmx\)=_\1=g' SDBHASH='s=dbhash\.tmp=dbhash_tmp=g' SSTAT='s=\.\(stat\.\)=_\1=g' STMP2='s=tmp2=tm2=g' SPACKLIST='s=\.\(packlist\)=_\1=g' +SDEFSUB='s=defsubs\.h=defsubsh=g' +SPLPLI='s=PL/;=PL/i;=g' sed -e $SCONFIG -e $SGREPTMP -e $SECHOTMP -e $SDDC -e $SOUT -e 's=\.\( \./\$file\)$=sh\1=g' Configure |tr -d '\r' >s; mv -f s Configure sed -e $SEXISTS -e $SLIST -e $SCONFIG Makefile.SH |tr -d '\r' >s; mv -f s Makefile.SH @@ -47,3 +49,6 @@ sed -e $SPACKLIST lib/ExtUtils/Installed.pm >s; mv -f s lib/ExtUtils/Installed.p sed -e $SPACKLIST lib/ExtUtils/Packlist.pm >s; mv -f s lib/ExtUtils/Packlist.pm sed -e $SPACKLIST lib/ExtUtils/inst >s; mv -f s lib/ExtUtils/inst sed -e $SABC t/io/iprefix.t >s; mv -f s t/io/iprefix.t +sed -e $SDEFSUB ext/B/Makefile.PL >s; mv -f s ext/B/Makefile.PL +sed -e $SDEFSUB ext/B/B.xs >s; mv -f s ext/B/B.xs +sed -e $SDEFSUB -e $SPLPLI ext/B/defsubsh.PL >s; mv -f s ext/B/defsubsh.PL diff --git a/dosish.h b/dosish.h index 822182d..7e72d67 100644 --- a/dosish.h +++ b/dosish.h @@ -8,6 +8,7 @@ # define BIT_BUCKET "nul" # define OP_BINARY O_BINARY # define PERL_SYS_INIT(c,v) Perl_DJGPP_init(c,v) +# define init_os_extras Perl_init_os_extras # include # define HAS_UTIME # define HAS_KILL diff --git a/lib/ExtUtils/MM_Unix.pm b/lib/ExtUtils/MM_Unix.pm index 7c9657a..0909cc1 100644 --- a/lib/ExtUtils/MM_Unix.pm +++ b/lib/ExtUtils/MM_Unix.pm @@ -1391,9 +1391,9 @@ sub init_dirscan { # --- File and Directory Lists (.xs .pm .pod etc) $h{$name} = 1; } elsif ($name =~ /\.PL$/) { ($pl_files{$name} = $name) =~ s/\.PL$// ; - } elsif ($Is_VMS && $name =~ /[._]pl$/i) { + } elsif (($Is_VMS || $Is_Dos) && $name =~ /[._]pl$/i) { # case-insensitive filesystem, one dot per name, so foo.h.PL - # under Unix appears as foo.h_pl under VMS + # under Unix appears as foo.h_pl under VMS or fooh.pl on Dos local($/); open(PL,$name); my $txt = ; close PL; if ($txt =~ /Extracting \S+ \(with variable substitutions/) { ($pl_files{$name} = $name) =~ s/[._]pl$//i ; diff --git a/pod/pod2usage.PL b/pod/pod2usage.PL index fdaa955..adf49bd 100644 --- a/pod/pod2usage.PL +++ b/pod/pod2usage.PL @@ -2,6 +2,7 @@ use Config; use File::Basename qw(&basename &dirname); +use Cwd; # List explicitly here the variables you want Configure to # generate. Metaconfig only looks for shell variables, so you @@ -12,10 +13,11 @@ use File::Basename qw(&basename &dirname); # This forces PL files to create target in same directory as PL file. # This is so that make depend always knows where to find PL derivatives. +$origdir = cwd; chdir(dirname($0)); ($file = basename($0)) =~ s/\.PL$//; $file =~ s/\.pl$// - if ($^O eq 'VMS' or $^O eq 'os2'); # "case-forgiving" + if ($^O eq 'VMS' or $^O eq 'os2' or $^O eq 'dos'); # "case-forgiving" open OUT,">$file" or die "Can't create $file: $!"; @@ -177,3 +179,4 @@ pod2usage(\%usage); close OUT or die "Can't close $file: $!"; chmod 0755, $file or die "Can't reset permissions for $file: $!\n"; exec("$Config{'eunicefix'} $file") if $Config{'eunicefix'} ne ':'; +chdir $origdir; diff --git a/pod/podchecker.PL b/pod/podchecker.PL index 1ca0d79..0d31763 100644 --- a/pod/podchecker.PL +++ b/pod/podchecker.PL @@ -2,6 +2,7 @@ use Config; use File::Basename qw(&basename &dirname); +use Cwd; # List explicitly here the variables you want Configure to # generate. Metaconfig only looks for shell variables, so you @@ -12,10 +13,11 @@ use File::Basename qw(&basename &dirname); # This forces PL files to create target in same directory as PL file. # This is so that make depend always knows where to find PL derivatives. +$origdir = cwd; chdir(dirname($0)); ($file = basename($0)) =~ s/\.PL$//; $file =~ s/\.pl$// - if ($^O eq 'VMS' or $^O eq 'os2'); # "case-forgiving" + if ($^O eq 'VMS' or $^O eq 'os2' or $^O eq 'dos'); # "case-forgiving" open OUT,">$file" or die "Can't create $file: $!"; @@ -128,3 +130,4 @@ if(@ARGV) { close OUT or die "Can't close $file: $!"; chmod 0755, $file or die "Can't reset permissions for $file: $!\n"; exec("$Config{'eunicefix'} $file") if $Config{'eunicefix'} ne ':'; +chdir $origdir; diff --git a/pod/podselect.PL b/pod/podselect.PL index 0df8304..a76f6a0 100644 --- a/pod/podselect.PL +++ b/pod/podselect.PL @@ -2,6 +2,7 @@ use Config; use File::Basename qw(&basename &dirname); +use Cwd; # List explicitly here the variables you want Configure to # generate. Metaconfig only looks for shell variables, so you @@ -12,10 +13,11 @@ use File::Basename qw(&basename &dirname); # This forces PL files to create target in same directory as PL file. # This is so that make depend always knows where to find PL derivatives. +$origdir = cwd; chdir(dirname($0)); ($file = basename($0)) =~ s/\.PL$//; $file =~ s/\.pl$// - if ($^O eq 'VMS' or $^O eq 'os2'); # "case-forgiving" + if ($^O eq 'VMS' or $^O eq 'os2' or $^O eq 'dos'); # "case-forgiving" open OUT,">$file" or die "Can't create $file: $!"; @@ -140,3 +142,4 @@ else { close OUT or die "Can't close $file: $!"; chmod 0755, $file or die "Can't reset permissions for $file: $!\n"; exec("$Config{'eunicefix'} $file") if $Config{'eunicefix'} ne ':'; +chdir $origdir; diff --git a/sv.h b/sv.h index 476c941..1aab997 100644 --- a/sv.h +++ b/sv.h @@ -692,12 +692,5 @@ struct xpvio { #define isGV(sv) (SvTYPE(sv) == SVt_PVGV) -#if !defined(DOSISH) || defined(WIN32) || defined(OS2) -# define SvGROW(sv,len) (SvLEN(sv) < (len) ? sv_grow(sv,len) : SvPVX(sv)) -# define Sv_Grow sv_grow -#else - /* extra parentheses intentionally NOT placed around "len"! */ -# define SvGROW(sv,len) ((SvLEN(sv) < (unsigned long)len) \ - ? sv_grow(sv,(unsigned long)len) : SvPVX(sv)) -# define Sv_Grow(sv,len) sv_grow(sv,(unsigned long)(len)) -#endif /* DOSISH */ +#define SvGROW(sv,len) (SvLEN(sv) < (len) ? sv_grow(sv,len) : SvPVX(sv)) +#define Sv_Grow sv_grow diff --git a/t/io/openpid.t b/t/io/openpid.t index 21ec083..0e8b934 100755 --- a/t/io/openpid.t +++ b/t/io/openpid.t @@ -10,6 +10,10 @@ BEGIN { chdir 't' if -d 't'; unshift @INC, '../lib'; + if ($^O eq 'dos') { + print "1..0 # Skip: no multitasking\n"; + exit 0; + } } diff --git a/util.c b/util.c index 628b956..552c092 100644 --- a/util.c +++ b/util.c @@ -1822,28 +1822,13 @@ Perl_my_setenv(pTHX_ char *nam, char *val) safesysfree(environ[i]); environ[i] = (char*)safesysmalloc((strlen(nam)+strlen(val)+2) * sizeof(char)); -#ifndef MSDOS (void)sprintf(environ[i],"%s=%s",nam,val);/* all that work just for this */ -#else - /* MS-DOS requires environment variable names to be in uppercase */ - /* [Tom Dinger, 27 August 1990: Well, it doesn't _require_ it, but - * some utilities and applications may break because they only look - * for upper case strings. (Fixed strupr() bug here.)] - */ - strcpy(environ[i],nam); strupr(environ[i]); - (void)sprintf(environ[i] + strlen(nam),"=%s",val); -#endif /* MSDOS */ #else /* PERL_USE_SAFE_PUTENV */ char *new_env; new_env = (char*)safesysmalloc((strlen(nam) + strlen(val) + 2) * sizeof(char)); -#ifndef MSDOS (void)sprintf(new_env,"%s=%s",nam,val);/* all that work just for this */ -#else - strcpy(new_env,nam); strupr(new_env); - (void)sprintf(new_env + strlen(nam),"=%s",val); -#endif (void)putenv(new_env); #endif /* PERL_USE_SAFE_PUTENV */ } @@ -2635,6 +2620,9 @@ Perl_my_pclose(pTHX_ PerlIO *ptr) /* Needs work for PerlIO ! */ FILE *f = PerlIO_findFILE(ptr); I32 result = pclose(f); +#if defined(DJGPP) + result = (result << 8) & 0xff00; +#endif PerlIO_releaseFILE(ptr,f); return result; }