summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Bunce <TimBunce@ig.ac.uk>1998-04-10 14:35:34 +0000
committerTim Bunce <TimBunce@ig.ac.uk>1998-04-10 14:35:34 +0000
commit6dba07070c2cb08ffbc6e00eff60e8f5fc9a7ee8 (patch)
treef0c8179a105cc9ac4db87a37823b2d885f2afec1
parent615ce5d1ebccaed1a73dbc9960124b9f74139808 (diff)
downloadperl-6dba07070c2cb08ffbc6e00eff60e8f5fc9a7ee8.tar.gz
[inseperable changes between Change 872 and Change 886]
Changes relating primarily to portability. ------ LIBRARY AND EXTENSIONS ------ Title: "ExtUtils/MM_Unix.pm changed to use ld -rpath on IRIX" From: "W. Phillip Moore" <wpm@ms.com> Msg-ID: <199712011738.MAA21139@zappa.morgan.com> Files: lib/ExtUtils/MM_Unix.pm Title: ""ODBM_File.c", line 275: NULL undefined" From: pmarquess@bfsec.bt.co.uk (Paul Marquess) Msg-ID: <9803091310.AA23264@claudius.bfsec.bt.co.uk> Files: ext/ODBM_File/ODBM_File.xs ------ PORTABILITY - GENERAL ------ Title: "osname=unixware, osvers=2.03, archname=i386-unixware d_casti32=undef" From: Tom Hughes <tom@compton.demon.co.uk> Msg-ID: <465398da47%tom@compton.demon.co.uk> Files: hints/svr4.sh Title: "hints/bsdos.sh patch for BSDI 3.1" From: Jan-Pieter Cornet <johnpc@xs4all.nl> Msg-ID: <6fbip6$3cp$1@xs1.xs4all.nl> Files: hints/bsdos.sh Title: "Remove BIND_NOSTART from DynaLoader for HP" From: Keong Lim <Keong.Lim@sr.com.au> Msg-ID: <01BD1D03.53B65E90@sieplan2.sr.com.au> Files: ext/DynaLoader/dl_hpux.xs Title: "5.004_(04|63)] Close VMS security hole" From: Charles Bailey <BAILEY@newman.upenn.edu> Msg-ID: <01IV6LRJCSSC0009C4@cor.newman.upenn.edu> Files: vms/vms.c Title: "Perl5.004_04m4t4 *almost* makes it for VMS", "Updated vms/perly_c.vms and vms/perly_h.vms" From: Andy Dougherty <doughera@newton.phys.lafayette.edu>, Dan Sugalski <sugalskd@osshe.edu>, larry@wall.org (Larry Wall) Msg-ID: <199710151650.JAA29185@wall.org>, <3.0.3.32.19971014150404.02fdef78@osshe.edu>, <Pine.SUN.3.96.971015121704.28456F-100000@newton.phys> Files: vms/perly_c.vms Title: "VMS patches to 5.004_03 (excluding installperl and timelocal.t)" From: Charles Bailey <BAILEY@newman.upenn.edu> Msg-ID: <01INZT9G2LZS0006YW@cor.newman.upenn.edu> Files: lib/File/Basename.pm lib/File/Path.pm vms/config.vms vms/descrip.mms vms/genconfig.pl vms/test.com vms/vms.c vms/ext/Filespec.pm vms/ext/filespec.t Title: "hints/linux.sh (MkLinux / PPC)" From: pudge@pobox.com (Chris Nandor) Msg-ID: <v0213050cb06c19682a25@[205.228.240.28]> Files: hints/linux.sh Title: "new hints/solaris_2.sh" From: "M.J.T. Guy" <mjtg@cus.cam.ac.uk> Msg-ID: <E0xw80h-0005SV-00@ursa.cus.cam.ac.uk> Files: hints/solaris_2.sh p4raw-link: @872 on //depot/maint-5.004/perl: 0b85608df162729d39cb0f96c9f88c7de0a3ceab p4raw-id: //depot/maint-5.004/perl@886
-rw-r--r--cop.h1
-rw-r--r--ext/DynaLoader/dl_hpux.xs7
-rw-r--r--ext/ODBM_File/ODBM_File.xs4
-rw-r--r--ext/POSIX/hints/linux.pl2
-rw-r--r--hints/aix.sh4
-rw-r--r--hints/bsdos.sh8
-rw-r--r--hints/linux.sh17
-rw-r--r--hints/solaris_2.sh2
-rw-r--r--hints/svr4.sh9
-rw-r--r--lib/ExtUtils/MM_Unix.pm4
-rw-r--r--lib/File/Basename.pm4
-rw-r--r--lib/File/Path.pm5
-rw-r--r--lib/FileHandle.pm4
-rw-r--r--op.c1
-rw-r--r--perl.c3
-rw-r--r--perl.h6
-rw-r--r--pp_ctl.c18
-rw-r--r--pp_hot.c42
-rw-r--r--vms/config.vms2
-rw-r--r--vms/descrip.mms22
-rw-r--r--vms/ext/Filespec.pm1
-rw-r--r--[-rwxr-xr-x]vms/ext/filespec.t2
-rw-r--r--vms/genconfig.pl4
-rw-r--r--vms/test.com17
-rw-r--r--vms/vms.c213
25 files changed, 300 insertions, 102 deletions
diff --git a/cop.h b/cop.h
index 767ae00bc7..d2f7525770 100644
--- a/cop.h
+++ b/cop.h
@@ -275,3 +275,4 @@ struct context {
#define G_EVAL 4 /* Assume eval {} around subroutine call. */
#define G_NOARGS 8 /* Don't construct a @_ array. */
#define G_KEEPERR 16 /* Append errors to $@, don't overwrite it */
+#define G_NODEBUG 32 /* Disable debugging at toplevel. */
diff --git a/ext/DynaLoader/dl_hpux.xs b/ext/DynaLoader/dl_hpux.xs
index 51d464e6de..a82e0eac11 100644
--- a/ext/DynaLoader/dl_hpux.xs
+++ b/ext/DynaLoader/dl_hpux.xs
@@ -65,6 +65,9 @@ dl_load_file(filename, flags=0)
* unresolved references in situations like this. */
/* bind_type = BIND_IMMEDIATE|BIND_NONFATAL; */
}
+ /* BIND_NOSTART removed from bind_type because it causes the shared library's */
+ /* initialisers not to be run. This causes problems with all of the static objects */
+ /* in the library. */
#ifdef DEBUGGING
if (dl_debug)
bind_type |= BIND_VERBOSE;
@@ -74,14 +77,14 @@ dl_load_file(filename, flags=0)
for (i = 0; i <= max; i++) {
char *sym = SvPVX(*av_fetch(dl_resolve_using, i, 0));
DLDEBUG(1,PerlIO_printf(PerlIO_stderr(), "dl_load_file(%s) (dependent)\n", sym));
- obj = shl_load(sym, bind_type | BIND_NOSTART, 0L);
+ obj = shl_load(sym, bind_type, 0L);
if (obj == NULL) {
goto end;
}
}
DLDEBUG(1,PerlIO_printf(PerlIO_stderr(), "dl_load_file(%s): ", filename));
- obj = shl_load(filename, bind_type | BIND_NOSTART, 0L);
+ obj = shl_load(filename, bind_type, 0L);
DLDEBUG(2,PerlIO_printf(PerlIO_stderr(), " libref=%x\n", obj));
end:
diff --git a/ext/ODBM_File/ODBM_File.xs b/ext/ODBM_File/ODBM_File.xs
index b57e560bd3..7dbf3f14be 100644
--- a/ext/ODBM_File/ODBM_File.xs
+++ b/ext/ODBM_File/ODBM_File.xs
@@ -46,6 +46,10 @@ static int dbmrefcnt;
MODULE = ODBM_File PACKAGE = ODBM_File PREFIX = odbm_
+#ifndef NULL
+# define NULL 0
+#endif
+
ODBM_File
odbm_TIEHASH(dbtype, filename, flags, mode)
char * dbtype
diff --git a/ext/POSIX/hints/linux.pl b/ext/POSIX/hints/linux.pl
index 7994f24023..f1d19814ae 100644
--- a/ext/POSIX/hints/linux.pl
+++ b/ext/POSIX/hints/linux.pl
@@ -2,4 +2,4 @@
# Thanks to Bart Schuller <schuller@Lunatech.com>
# See Message-ID: <19971009002636.50729@tanglefoot>
# XXX A Configure test is needed.
-$self->{CCFLAGS} = $Config{ccflags} . ' -DSTRUCT_TM_HASZONE' ;
+$self->{CCFLAGS} = $Config{ccflags} . ' -DSTRUCT_TM_HASZONE -DHINT_SC_EXIST' ;
diff --git a/hints/aix.sh b/hints/aix.sh
index fb8d4ab7cc..63204242eb 100644
--- a/hints/aix.sh
+++ b/hints/aix.sh
@@ -34,6 +34,10 @@ case "$osvers" in
;;
*) # These hints at least work for 4.x, possibly other systems too.
ccflags='-D_ALL_SOURCE -D_ANSI_C_SOURCE -D_POSIX_SOURCE'
+ case "$cc" in
+ *gcc*) ;;
+ *) ccflags="-qmaxmem=8192 $ccflags" ;;
+ esac
nm_opt='-B'
;;
esac
diff --git a/hints/bsdos.sh b/hints/bsdos.sh
index 15f8212a49..0896e264ba 100644
--- a/hints/bsdos.sh
+++ b/hints/bsdos.sh
@@ -3,7 +3,7 @@
# hints file for BSD/OS (adapted from bsd386.sh)
# Original by Neil Bowers <neilb@khoros.unm.edu>; Tue Oct 4 12:01:34 EDT 1994
# Updated by Tony Sanders <sanders@bsdi.com>; Sat Aug 23 12:47:45 MDT 1997
-# Added 3.1 with ELF dynamic libraries
+# Added 3.1 with ELF dynamic libraries (NOT in 3.1 yet. Estimated for 4.0)
# SYSV IPC tested Ok so I re-enabled.
#
# To override the compiler on the command line:
@@ -88,14 +88,14 @@ case "$osvers" in
libswanted="Xpm Xaw Xmu Xt SM ICE Xext X11 $libswanted"
libswanted="rpc curses termcap $libswanted"
;;
-3.2*)
- # ELF dynamic link libraries starting in 3.2
+4.0*)
+ # ELF dynamic link libraries starting in 4.0 (???)
useshrplib='true'
so='so'
dlext='so'
case "$cc" in
- '') cc='cc' # cc is gcc2 in 3.1
+ '') cc='cc' # cc is gcc2 in 4.0
cccdlflags="-fPIC"
ccdlflags=" " ;;
esac
diff --git a/hints/linux.sh b/hints/linux.sh
index 5bd2d280cc..b6fb277d12 100644
--- a/hints/linux.sh
+++ b/hints/linux.sh
@@ -187,11 +187,12 @@ fi
# Shimpei Yamashita <shimpei@socrates.patnet.caltech.edu>
# Message-Id: <33EF1634.B36B6500@pobox.com>
#
-# MkLinux (osname=linux,archname=ppc-linux), which differs slightly from other
-# linuces, needs special flags passed in order for dynamic loading to work.
-# instead of the recommended:
-# ccdlflags='-rdynamic'
-#
-# it should be:
-# ccdlflags='-Wl,-E'
-
+# Date: Thu, 16 Oct 1997
+# From: Chris Nandor <pudge@pobox.com>
+#
+# MkLinux for PPC needs special flags passed in order for dynamic
+# loading to work. NOTE: Older versions of MkLinux might not
+# support dynamic loading at all.
+case "`uname -r | sed 's/^[0-9.-]*//'``arch`" in
+'osfmach3ppc') ccdlflags='-Wl,-E' ;;
+esac
diff --git a/hints/solaris_2.sh b/hints/solaris_2.sh
index 82c8f1ffc0..2fc8924849 100644
--- a/hints/solaris_2.sh
+++ b/hints/solaris_2.sh
@@ -129,7 +129,7 @@ echo 'main() { return 0; }' > try.c
verbose=`${cc:-cc} -v -o try try.c 2>&1`
rm -f try try.c
-if echo "$verbose" | grep '^Reading specs from' >/devv/null 2>&1; then
+if echo "$verbose" | grep '^Reading specs from' >/dev/null 2>&1; then
#
# Using gcc.
#
diff --git a/hints/svr4.sh b/hints/svr4.sh
index 922736aa48..eb875e1707 100644
--- a/hints/svr4.sh
+++ b/hints/svr4.sh
@@ -34,9 +34,16 @@ d_lstat=define
# UnixWare has a broken csh. The undocumented -X argument to uname is probably
# a reasonable way of detecting UnixWare. Also in 2.1.1 the fields in
-# FILE* got renamed!
+# FILE* got renamed! Plus 1.1 can't cast large floats to 32-bit ints.
uw_ver=`uname -v`
uw_isuw=`uname -X 2>&1 | grep Release`
+if [ "$uw_isuw" = "Release = 4.2" ]; then
+ case $uw_ver in
+ 1.1)
+ d_casti32='undef'
+ ;;
+ esac
+fi
if [ "$uw_isuw" = "Release = 4.2MP" ]; then
case $uw_ver in
2.1)
diff --git a/lib/ExtUtils/MM_Unix.pm b/lib/ExtUtils/MM_Unix.pm
index ca7f86209e..524c53de39 100644
--- a/lib/ExtUtils/MM_Unix.pm
+++ b/lib/ExtUtils/MM_Unix.pm
@@ -1007,6 +1007,10 @@ $(INST_DYNAMIC): $(OBJECT) $(MYEXTLIB) $(BOOTSTRAP) $(INST_ARCHAUTODIR)/.exists
$ldrun = join ' ', map "-R$_", split /:/, $self->{LD_RUN_PATH}
if ($^O eq 'solaris');
+ # The IRIX linker also doesn't use LD_RUN_PATH
+ $ldrun = "-rpath $self->{LD_RUN_PATH}"
+ if ($^O eq 'irix');
+
push(@m,' LD_RUN_PATH="$(LD_RUN_PATH)" $(LD) -o $@ '.$ldrun.' $(LDDLFLAGS) '.$ldfrom.
' $(OTHERLDFLAGS) $(MYEXTLIB) $(PERL_ARCHIVE) $(LDLOADLIBS) $(EXPORT_LIST)');
push @m, '
diff --git a/lib/File/Basename.pm b/lib/File/Basename.pm
index e4863f8911..edc736d968 100644
--- a/lib/File/Basename.pm
+++ b/lib/File/Basename.pm
@@ -175,6 +175,10 @@ sub fileparse {
}
elsif ($fstype !~ /^VMS/i) { # default to Unix
($dirpath,$basename) = ($fullname =~ m#^(.*/)?(.*)#);
+ if ($^O eq 'VMS' and $fullname =~ m:/[^/]+/000000/?:) {
+ # dev:[000000] is top of VMS tree, similar to Unix '/'
+ ($basename,$dirpath) = ('',$fullname);
+ }
$dirpath = './' unless $dirpath;
}
diff --git a/lib/File/Path.pm b/lib/File/Path.pm
index cd70c98f71..37a0231b51 100644
--- a/lib/File/Path.pm
+++ b/lib/File/Path.pm
@@ -129,7 +129,10 @@ sub mkpath {
# Logic wants Unix paths, so go with the flow.
$path = VMS::Filespec::unixify($path) if $Is_VMS;
my $parent = File::Basename::dirname($path);
- push(@created,mkpath($parent, $verbose, $mode)) unless (-d $parent);
+ # Allow for creation of new logical filesystems under VMS
+ if (not $Is_VMS or $parent !~ m:/[^/]+/000000/?:) {
+ push(@created,mkpath($parent, $verbose, $mode)) unless (-d $parent);
+ }
print "mkdir $path\n" if $verbose;
unless (mkdir($path,$mode)) {
# allow for another process to have created it meanwhile
diff --git a/lib/FileHandle.pm b/lib/FileHandle.pm
index 455fc63917..72ecdac1b6 100644
--- a/lib/FileHandle.pm
+++ b/lib/FileHandle.pm
@@ -249,6 +249,10 @@ It will also croak() if accidentally called in a scalar context.
=back
+There are many other functions available since FileHandle is descended
+from IO::File, IO::Seekable, and IO::Handle. Please see those
+respective pages for documentation on more functions.
+
=head1 SEE ALSO
The B<IO> extension,
diff --git a/op.c b/op.c
index ce3f806eaf..b8841ffbef 100644
--- a/op.c
+++ b/op.c
@@ -3456,7 +3456,6 @@ OP *block;
ENTER;
SAVESPTR(compiling.cop_filegv);
SAVEI16(compiling.cop_line);
- SAVEI32(perldb);
save_svref(&rs);
sv_setsv(rs, nrs);
diff --git a/perl.c b/perl.c
index 86e4178310..1993c81197 100644
--- a/perl.c
+++ b/perl.c
@@ -1063,7 +1063,8 @@ I32 flags; /* See G_* flags in cop.h */
&& (DBcv || (DBcv = GvCV(DBsub)))
/* Try harder, since this may have been a sighandler, thus
* curstash may be meaningless. */
- && (SvTYPE(sv) != SVt_PVCV || CvSTASH((CV*)sv) != debstash))
+ && (SvTYPE(sv) != SVt_PVCV || CvSTASH((CV*)sv) != debstash)
+ && !(flags & G_NODEBUG))
op->op_private |= OPpENTERSUB_DB;
if (flags & G_EVAL) {
diff --git a/perl.h b/perl.h
index c1a8e9c4c1..771ee19ccc 100644
--- a/perl.h
+++ b/perl.h
@@ -2171,7 +2171,7 @@ enum {
#endif /* OVERLOAD */
-#define PERLDB_ALL 0xff
+#define PERLDB_ALL 0x3f /* No _NONAME, _GOTO */
#define PERLDBf_SUB 0x01 /* Debug sub enter/exit. */
#define PERLDBf_LINE 0x02 /* Keep line #. */
#define PERLDBf_NOOPT 0x04 /* Switch off optimizations. */
@@ -2179,6 +2179,8 @@ enum {
later inspections. */
#define PERLDBf_SUBLINE 0x10 /* Keep subr source lines. */
#define PERLDBf_SINGLE 0x20 /* Start with single-step on. */
+#define PERLDBf_NONAME 0x40 /* For _SUB: no name of the subr. */
+#define PERLDBf_GOTO 0x80 /* Report goto: call DB::goto. */
#define PERLDB_SUB (perldb && (perldb & PERLDBf_SUB))
#define PERLDB_LINE (perldb && (perldb & PERLDBf_LINE))
@@ -2186,6 +2188,8 @@ enum {
#define PERLDB_INTER (perldb && (perldb & PERLDBf_INTER))
#define PERLDB_SUBLINE (perldb && (perldb & PERLDBf_SUBLINE))
#define PERLDB_SINGLE (perldb && (perldb & PERLDBf_SINGLE))
+#define PERLDB_SUB_NN (perldb && (perldb & (PERLDBf_NONAME)))
+#define PERLDB_GOTO (perldb && (perldb & PERLDBf_GOTO))
#ifdef USE_LOCALE_COLLATE
EXT U32 collation_ix; /* Collation generation index */
diff --git a/pp_ctl.c b/pp_ctl.c
index ad7ecfff66..a328f4ccc8 100644
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -1871,14 +1871,26 @@ PP(pp_goto)
mark++;
}
}
- if (PERLDB_SUB && curstash != debstash) {
+ if (PERLDB_SUB) { /* Checking curstash breaks DProf. */
/*
* We do not care about using sv to call CV;
* it's for informational purposes only.
*/
SV *sv = GvSV(DBsub);
- save_item(sv);
- gv_efullname3(sv, CvGV(cv), Nullch);
+ CV *gotocv;
+
+ if (PERLDB_SUB_NN) {
+ SvIVX(sv) = (IV)cv; /* Already upgraded, saved */
+ } else {
+ save_item(sv);
+ gv_efullname3(sv, CvGV(cv), Nullch);
+ }
+ if ( PERLDB_GOTO
+ && (gotocv = perl_get_cv("DB::goto", FALSE)) ) {
+ PUSHMARK( stack_sp );
+ perl_call_sv((SV*)gotocv, G_SCALAR | G_NODEBUG);
+ stack_sp--;
+ }
}
RETURNOP(CvSTART(cv));
}
diff --git a/pp_hot.c b/pp_hot.c
index 5092a134e4..8093fefc9f 100644
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -1780,23 +1780,33 @@ PP(pp_entersub)
gimme = GIMME_V;
if ((op->op_private & OPpENTERSUB_DB) && GvCV(DBsub) && !CvNODEBUG(cv)) {
- SV *oldsv = sv;
- sv = GvSV(DBsub);
- save_item(sv);
- gv = CvGV(cv);
- if ( (CvFLAGS(cv) & (CVf_ANON | CVf_CLONED))
- || strEQ(GvNAME(gv), "END")
- || ((GvCV(gv) != cv) && /* Could be imported, and old sub redefined. */
- !( (SvTYPE(oldsv) == SVt_PVGV) && (GvCV((GV*)oldsv) == cv)
- && (gv = (GV*)oldsv) ))) { /* Use GV from the stack as a fallback. */
- /* GV is potentially non-unique, or contain different CV. */
- sv_setsv(sv, newRV((SV*)cv));
- }
- else {
- gv_efullname3(sv, gv, Nullch);
- }
+ SV *dbsv = GvSV(DBsub);
+
+ if (!PERLDB_SUB_NN) {
+ GV *gv = CvGV(cv);
+
+ save_item(dbsv);
+ if ( (CvFLAGS(cv) & (CVf_ANON | CVf_CLONED))
+ || strEQ(GvNAME(gv), "END")
+ || ((GvCV(gv) != cv) && /* Could be imported, and old sub redefined. */
+ !( (SvTYPE(sv) == SVt_PVGV) && (GvCV((GV*)sv) == cv)
+ && (gv = (GV*)sv) ))) {
+ /* Use GV from the stack as a fallback. */
+ /* GV is potentially non-unique, or contain different CV. */
+ sv_setsv(dbsv, newRV((SV*)cv));
+ }
+ else {
+ gv_efullname3(dbsv, gv, Nullch);
+ }
+ } else {
+ SvUPGRADE(dbsv, SVt_PVIV);
+ SvIOK_on(dbsv);
+ SAVEIV(SvIVX(dbsv));
+ SvIVX(dbsv) = (IV)cv; /* Do it the quickest way */
+ }
+ if (CvXSUB(cv))
+ curcopdb = curcop;
cv = GvCV(DBsub);
- if (CvXSUB(cv)) curcopdb = curcop;
if (!cv)
DIE("No DBsub routine");
}
diff --git a/vms/config.vms b/vms/config.vms
index d6453ba34a..48103310ac 100644
--- a/vms/config.vms
+++ b/vms/config.vms
@@ -987,7 +987,7 @@
* have select(), of course.
*/
#if defined(__DECC) && defined(__DECC_VER) && (__DECC_VER >= 50200000) && defined(DECCRTL_SOCKETS)
-#define Select_fd_set_t fd_set * /**/
+#define Select_fd_set_t fd_set * /* config-skip */
#else
#define Select_fd_set_t int * /* config-skip */
#endif
diff --git a/vms/descrip.mms b/vms/descrip.mms
index 7681f21586..1834a121a3 100644
--- a/vms/descrip.mms
+++ b/vms/descrip.mms
@@ -564,14 +564,14 @@ IO : [.lib]IO.pm [.lib.IO]File.pm [.lib.IO]Handle.pm [.lib.IO]Pipe.pm [.lib.IO]S
[.lib]perlbug.com : [.utils]perlbug.PL $(ARCHDIR)Config.pm
$(MINIPERL) $(MMS$SOURCE)
- Rename/Log [.utils]perlbug.com $(MMS$TARGET)
+ Copy/Log [.utils]perlbug.com $(MMS$TARGET)
[.utils]pl2pm.com : [.utils]pl2pm.PL $(ARCHDIR)Config.pm
$(MINIPERL) $(MMS$SOURCE)
[.lib]splain.com : [.utils]splain.PL $(ARCHDIR)Config.pm
$(MINIPERL) $(MMS$SOURCE)
- Rename/Log [.utils]splain.com $(MMS$TARGET)
+ Copy/Log [.utils]splain.com $(MMS$TARGET)
[.x2p]find2perl.com : [.x2p]find2perl.PL $(ARCHDIR)Config.pm
$(MINIPERL) $(MMS$SOURCE)
@@ -611,22 +611,22 @@ IO : [.lib]IO.pm [.lib.IO]File.pm [.lib.IO]Handle.pm [.lib.IO]Pipe.pm [.lib.IO]S
[.lib.pod]pod2html.com : [.pod]pod2html.PL $(ARCHDIR)Config.pm
@ If F$Search("[.lib]pod.dir").eqs."" Then Create/Directory [.lib.pod]
$(MINIPERL) $(MMS$SOURCE)
- Rename/Log [.pod]pod2html.com $(MMS$TARGET)
+ Copy/Log [.pod]pod2html.com $(MMS$TARGET)
[.lib.pod]pod2latex.com : [.pod]pod2latex.PL $(ARCHDIR)Config.pm
@ If F$Search("[.lib]pod.dir").eqs."" Then Create/Directory [.lib.pod]
$(MINIPERL) $(MMS$SOURCE)
- Rename/Log [.pod]pod2latex.com $(MMS$TARGET)
+ Copy/Log [.pod]pod2latex.com $(MMS$TARGET)
[.lib.pod]pod2man.com : [.pod]pod2man.PL $(ARCHDIR)Config.pm
@ If F$Search("[.lib]pod.dir").eqs."" Then Create/Directory [.lib.pod]
$(MINIPERL) $(MMS$SOURCE)
- Rename/Log [.pod]pod2man.com $(MMS$TARGET)
+ Copy/Log [.pod]pod2man.com $(MMS$TARGET)
[.lib.pod]pod2text.com : [.pod]pod2text.PL $(ARCHDIR)Config.pm
@ If F$Search("[.lib]pod.dir").eqs."" Then Create/Directory [.lib.pod]
$(MINIPERL) $(MMS$SOURCE)
- Rename/Log [.pod]pod2text.com $(MMS$TARGET)
+ Copy/Log [.pod]pod2text.com $(MMS$TARGET)
preplibrary : $(MINIPERL_EXE) $(LIBPREREQ) $(SOCKPM)
@ Write Sys$Output "Autosplitting Perl library . . ."
@@ -851,6 +851,9 @@ perly$(O) : perly.c, perly.h, $(h)
test : all [.t.lib]vmsfspec.t [.t.lib]vmsish.t
- @[.VMS]Test.Com "$(E)"
+install :
+ $(MINIPERL) installperl
+
archify : all
@ Write Sys$Output "Moving files to architecture-specific locations for $(ARCH)"
archroot = "$(ARCHAUTO)" - "]" + "...]"
@@ -1719,6 +1722,7 @@ tidy : cleanlis
- If F$Search("Perlshr_Gbl*.Mar;-1") .nes."" Then Purge/NoConfirm/Log Perlshr_Gbl*.Mar
- If F$Search("[.Ext.DynaLoader]DL_VMS$(O);-1").nes."" Then Purge/NoConfirm/Log [.Ext.DynaLoader]DL_VMS$(O)
- If F$Search("[.Ext.DynaLoader]DL_VMS.C;-1").nes."" Then Purge/NoConfirm/Log [.Ext.DynaLoader]DL_VMS.C
+ - If F$Search("[.Ext.Socket]Socket.C;-1").nes."" Then Purge/NoConfirm/Log [.Ext.DynaLoader]DL_VMS.C
- If F$Search("[.Ext.Opcode...];-1").nes."" Then Purge/NoConfirm/Log [.Ext.Opcode]
- If F$Search("[.VMS.Ext...]*.C;-1").nes."" Then Purge/NoConfirm/Log [.VMS.Ext...]*.C
- If F$Search("[.VMS.Ext...]*$(O);-1").nes."" Then Purge/NoConfirm/Log [.VMS.Ext...]*$(O)
@@ -1728,12 +1732,13 @@ tidy : cleanlis
- If F$Search("[.Lib]Socket.pm;-1").nes."" Then Purge/NoConfirm/Log [.Lib]Socket.pm
- If F$Search("[.Lib]Config.pm;-1").nes."" Then Purge/NoConfirm/Log [.Lib]Config.pm
- If F$Search("$(ARCHDIR)Config.pm;-1").nes."" Then Purge/NoConfirm/Log $(ARCHDIR)Config.pm
- - If F$Search("[.lib.ExtUtils]Miniperl.pm").nes."" Then Purge/NoConfirm/Log [.lib.ExtUtils]Miniperl.pm;*
- - If F$Search("[.lib.ExtUtils]XSSymSet.pm").nes."" Then Purge/NoConfirm/Log [.lib.ExtUtils]XSSymSet.pm;*
+ - If F$Search("[.lib.ExtUtils]Miniperl.pm").nes."" Then Purge/NoConfirm/Log [.lib.ExtUtils]Miniperl.pm
+ - If F$Search("[.lib.ExtUtils]XSSymSet.pm").nes."" Then Purge/NoConfirm/Log [.lib.ExtUtils]XSSymSet.pm
- If F$Search("[.Lib.VMS]*.*;-1").nes."" Then Purge/NoConfirm/Log [.Lib.VMS]*.*
- If F$Search("[.Lib.Pod]*.Pod;-1").nes."" Then Purge/NoConfirm/Log [.Lib.Pod]*.Pod
- If F$Search("$(ARCHCORE)*.*").nes."" Then Purge/NoConfirm/Log $(ARCHCORE)*.*
- If F$Search("[.lib]*.com;-1").nes."" Then Purge/NoConfirm/Log [.lib]*.com
+ - If F$Search("[.pod]*.com;-1").nes."" Then Purge/NoConfirm/Log [.pod]*.com
- If F$Search("[.utils]*.com;-1").nes."" Then Purge/NoConfirm/Log [.utils]*.com
- If F$Search("[.x2p]*.com;-1").nes."" Then Purge/NoConfirm/Log [.x2p]*.com
- If F$Search("[.lib.pod]*.com;-1").nes."" Then Purge/NoConfirm/Log [.lib.pod]*.com
@@ -1772,6 +1777,7 @@ clean : tidy
- If F$Search("[.Ext.Socket]Socket.C").nes."" Then Delete/NoConfirm/Log [.Ext.Socket]Socket.C;*
- If F$Search("[.VMS.Ext...]*.C").nes."" Then Delete/NoConfirm/Log [.VMS.Ext...]*.C;*
- If F$Search("[.VMS.Ext...]*$(O)").nes."" Then Delete/NoConfirm/Log [.VMS.Ext...]*$(O);*
+ - If F$Search("[.pod]*.com").nes."" Then Delete/NoConfirm/Log [.pod]*.com;*
realclean : clean
Set Default [.ext.Fcntl]
diff --git a/vms/ext/Filespec.pm b/vms/ext/Filespec.pm
index db3283c571..8ae44c84cc 100644
--- a/vms/ext/Filespec.pm
+++ b/vms/ext/Filespec.pm
@@ -264,6 +264,7 @@ sub fileify ($) {
my($path) = @_;
if (!$path) { return undef }
+ if ($path eq '/') { return 'sys$disk:[000000]'; }
if ($path =~ /(.+)\.([^:>\]]*)$/) {
$path = $1;
if ($2 !~ /^dir(?:;1)?$/i) { return undef }
diff --git a/vms/ext/filespec.t b/vms/ext/filespec.t
index 6201a42dc6..8fb50b77cb 100755..100644
--- a/vms/ext/filespec.t
+++ b/vms/ext/filespec.t
@@ -84,6 +84,7 @@ some/where/... vmsify [.some.where...]
.. vmsify [-]
../.. vmsify [--]
.../ vmsify [...]
+/ vmsify sys$disk:[000000]
# Fileifying directory specs
down:[the.garden.path] fileify down:[the.garden]path.dir;1
@@ -123,6 +124,7 @@ down:[the.garden.path...] unixpath /down/the/garden/path/.../
[.down.the.garden]path.dir unixpath down/the/garden/path/
down/the/garden/path vmspath [.down.the.garden.path]
path vmspath [.path]
+/ vmspath sys$disk:[000000]
# Redundant characters in Unix paths
//some/where//over/../the.rainbow vmsify some:[where]the.rainbow
diff --git a/vms/genconfig.pl b/vms/genconfig.pl
index d2e514b1c9..e92316a3a5 100644
--- a/vms/genconfig.pl
+++ b/vms/genconfig.pl
@@ -156,6 +156,10 @@ foreach (@ARGV) {
print OUT "d_select=",$dosock ? "'define'\n" : "'undef'\n";
print OUT "i_niin=",$dosock ? "'define'\n" : "'undef'\n";
print OUT "i_neterrno=",$dosock ? "'define'\n" : "'undef'\n";
+ if ($dosock and $cctype eq 'decc' and $ccflags =~ /DECCRTL_SOCKETS/) {
+ print OUT "selecttype=fd_set\n";
+ }
+ else { print OUT "selecttype=int\n"; }
if ($cctype eq 'decc') { $rtlhas = 'define'; }
else { $rtlhas = 'undef'; }
diff --git a/vms/test.com b/vms/test.com
index 114cb24a40..7e94630150 100644
--- a/vms/test.com
+++ b/vms/test.com
@@ -21,8 +21,17 @@ $ EndIf
$ EndIf
$ Set Message /Facility/Severity/Identification/Text
$
-$ exe = ".Exe"
-$ If p1.nes."" Then exe = p1
+$ exe = ".Exe"
+$ If p1.nes."" Then exe = p1
+$ If F$Extract(0,1,exe) .nes. "."
+$ Then
+$ Write Sys$Error ""
+$ Write Sys$Error "The first parameter passed to Test.Com must be the file type used for the"
+$ Write Sys$Error "images produced when you built Perl (i.e. "".Exe"", unless you edited"
+$ Write Sys$Error "Descrip.MMS or used the AXE=1 macro in the MM[SK] command line."
+$ Write Sys$Error ""
+$ Exit 44
+$ EndIf
$! Pick up a copy of perl to use for the tests
$ Delete/Log/NoConfirm Perl.;*
$ Copy/Log/NoConfirm [-]Perl'exe' []Perl.
@@ -103,7 +112,7 @@ use Config;
# insists on stat()ing a file descriptor before it'll use it.
push(@libexcl,'io_xs.t') if $Config{'vms_cc_type'} ne 'decc';
-@opexcl=('exec.t','fork.t','glob.t','groups.t','magic.t','misc.t','stat.t');
+@opexcl=('die_exit.t','exec.t','fork.t','glob.t','groups.t','magic.t','misc.t','stat.t');
@exclist=(@compexcl,@ioexcl,@libexcl,@opexcl);
foreach $file (@exclist) { $skip{$file}++; }
@@ -111,7 +120,7 @@ $| = 1;
@ARGV = grep($_,@ARGV); # remove empty elements due to "''p1'" syntax
-if ($ARGV[0] eq '-v') {
+if (lc $ARGV[0] eq '-v') {
$verbose = 1;
shift;
}
diff --git a/vms/vms.c b/vms/vms.c
index 841307929e..96add896a7 100644
--- a/vms/vms.c
+++ b/vms/vms.c
@@ -2,8 +2,8 @@
*
* VMS-specific routines for perl5
*
- * Last revised: 11-Apr-1997 by Charles Bailey bailey@genetics.upenn.edu
- * Version: 5.3.97c
+ * Last revised: 23-Sep-1997 by Charles Bailey bailey@newman.upenn.edu
+ * Version: 5.4.4
*/
#include <acedef.h>
@@ -11,6 +11,7 @@
#include <armdef.h>
#include <atrdef.h>
#include <chpdef.h>
+#include <clidef.h>
#include <climsgdef.h>
#include <descrip.h>
#include <dvidef.h>
@@ -19,6 +20,7 @@
#include <fscndef.h>
#include <iodef.h>
#include <jpidef.h>
+#include <kgbdef.h>
#include <libdef.h>
#include <lib$routines.h>
#include <lnmdef.h>
@@ -162,7 +164,9 @@ my_getenv(char *lnm)
} /* end of my_getenv() */
/*}}}*/
-static FILE *safe_popen(char *, char *);
+static void create_mbx(unsigned short int *, struct dsc$descriptor_s *);
+
+static void riseandshine(unsigned long int dummy) { sys$wake(0,0); }
/*{{{ void prime_env_iter() */
void
@@ -173,14 +177,23 @@ prime_env_iter(void)
{
static int primed = 0; /* XXX Not thread-safe!!! */
HV *envhv = GvHVn(envgv);
- FILE *sholog;
- char eqv[LNM$C_NAMLENGTH+1],*start,*end;
+ PerlIO *sholog;
+ char eqv[LNM$C_NAMLENGTH+1],mbxnam[LNM$C_NAMLENGTH+1],*start,*end;
+ unsigned short int chan;
+#ifndef CLI$M_TRUSTED
+# define CLI$M_TRUSTED 0x40 /* Missing from VAXC headers */
+#endif
+ unsigned long int flags = CLI$M_NOWAIT | CLI$M_NOCLISYM | CLI$M_NOKEYPAD | CLI$M_TRUSTED;
+ unsigned long int retsts, substs = 0, wakect = 0;
STRLEN eqvlen;
SV *oldrs, *linesv, *eqvsv;
+ $DESCRIPTOR(cmddsc,"Show Logical *"); $DESCRIPTOR(nldsc,"_NLA0:");
+ $DESCRIPTOR(clidsc,"DCL"); $DESCRIPTOR(tabdsc,"DCLTABLES");
+ $DESCRIPTOR(mbxdsc,mbxnam);
if (primed) return;
/* Perform a dummy fetch as an lval to insure that the hash table is
- * set up. Otherwise, the hv_store() will turn into a nullop */
+ * set up. Otherwise, the hv_store() will turn into a nullop. */
(void) hv_fetch(envhv,"DEFAULT",7,TRUE);
/* Also, set up the four "special" keys that the CRTL defines,
* whether or not underlying logical names exist. */
@@ -190,18 +203,38 @@ prime_env_iter(void)
(void) hv_fetch(envhv,"USER",4,TRUE);
/* Now, go get the logical names */
- if ((sholog = safe_popen("$ Show Logical *","r")) == Nullfp)
- _ckvmssts(vaxc$errno);
- /* We use Perl's sv_gets to read from the pipe, since safe_popen is
+ create_mbx(&chan,&mbxdsc);
+ if ((sholog = PerlIO_open(mbxnam,"r")) != Nullfp) {
+ if ((retsts = sys$dassgn(chan)) & 1) {
+ /* Be certain that subprocess is using the CLI and command tables we
+ * expect, and don't pass symbols through so that we insure that
+ * "Show Logical" can't be subverted.
+ */
+ do {
+ retsts = lib$spawn(&cmddsc,&nldsc,&mbxdsc,&flags,0,0,&substs,
+ 0,&riseandshine,0,0,&clidsc,&tabdsc);
+ flags &= ~CLI$M_TRUSTED; /* Just in case we hit a really old version */
+ } while (retsts == LIB$_INVARG && (flags | CLI$M_TRUSTED));
+ }
+ }
+ if (sholog == Nullfp || !(retsts & 1)) {
+ if (sholog != Nullfp) PerlIO_close(sholog);
+ _ckvmssts(sholog == Nullfp ? vaxc$errno : retsts);
+ }
+ /* We use Perl's sv_gets to read from the pipe, since PerlIO_open is
* tied to Perl's I/O layer, so it may not return a simple FILE * */
oldrs = rs;
rs = newSVpv("\n",1);
linesv = newSVpv("",0);
while (1) {
if ((start = sv_gets(linesv,sholog,0)) == Nullch) {
- my_pclose(sholog);
+ PerlIO_close(sholog);
SvREFCNT_dec(linesv); SvREFCNT_dec(rs); rs = oldrs;
primed = 1;
+ /* Wait for subprocess to clean up (we know subproc won't return 0) */
+ while (substs == 0) { sys$hiber(); wakect++;}
+ if (wakect > 1) sys$wake(0,0); /* Stole someone else's wake */
+ _ckvmssts(substs);
return;
}
while (*start != '"' && *start != '=' && *start) start++;
@@ -557,7 +590,7 @@ popen_completion_ast(struct pipe_details *thispipe)
}
}
-static FILE *
+static PerlIO *
safe_popen(char *cmd, char *mode)
{
static int handler_set_up = FALSE;
@@ -924,17 +957,20 @@ static char *do_fileify_dirspec(char *dir,char *buf,int ts)
static char __fileify_retbuf[NAM$C_MAXRSS+1];
unsigned long int dirlen, retlen, addmfd = 0, hasfilename = 0;
char *retspec, *cp1, *cp2, *lastdir;
- char trndir[NAM$C_MAXRSS+1], vmsdir[NAM$C_MAXRSS+1];
+ char trndir[NAM$C_MAXRSS+2], vmsdir[NAM$C_MAXRSS+1];
if (!dir || !*dir) {
set_errno(EINVAL); set_vaxc_errno(SS$_BADPARAM); return NULL;
}
dirlen = strlen(dir);
- if (dir[dirlen-1] == '/') --dirlen;
- if (!dirlen) {
- set_errno(ENOTDIR);
- set_vaxc_errno(RMS$_DIR);
- return NULL;
+ while (dir[dirlen-1] == '/') --dirlen;
+ if (!dirlen) { /* We had Unixish '/' -- substitute top of current tree */
+ strcpy(trndir,"/sys$disk/000000");
+ dir = trndir;
+ dirlen = 16;
+ }
+ if (dirlen > NAM$C_MAXRSS) {
+ set_errno(ENAMETOOLONG); set_vaxc_errno(RMS$_SYN); return NULL;
}
if (!strpbrk(dir+1,"/]>:")) {
strcpy(trndir,*dir == '/' ? dir + 1: dir);
@@ -1009,6 +1045,14 @@ static char *do_fileify_dirspec(char *dir,char *buf,int ts)
cp1++;
} while ((cp1 = strstr(cp1,"/.")) != NULL);
}
+ else if (!strcmp(&dir[dirlen-7],"/000000")) {
+ /* Ditto for specs that end in an MFD -- let the VMS code
+ * figure out whether it's a real device or a rooted logical. */
+ dir[dirlen] = '/'; dir[dirlen+1] = '\0';
+ if (do_tovmsspec(dir,vmsdir,0) == NULL) return NULL;
+ if (do_fileify_dirspec(vmsdir,trndir,0) == NULL) return NULL;
+ return do_tounixspec(trndir,buf,ts);
+ }
else {
if ( !(lastdir = cp1 = strrchr(dir,'/')) &&
!(lastdir = cp1 = strrchr(dir,']')) &&
@@ -1552,6 +1596,11 @@ static char *do_tovmsspec(char *path, char *buf, int ts) {
STRLEN trnend;
while (*(cp2+1) == '/') cp2++; /* Skip multiple /s */
+ if (!*(cp2+1)) {
+ if (!buf & ts) Renew(rslt,18,char);
+ strcpy(rslt,"sys$disk:[000000]");
+ return rslt;
+ }
while (*(++cp2) != '/' && *cp2) *(cp1++) = *cp2;
*cp1 = '\0';
islnm = my_trnlnm(rslt,trndev,0);
@@ -2231,26 +2280,61 @@ unsigned long int flags = 17, one = 1, retsts;
/* OS-specific initialization at image activation (not thread startup) */
+/* Older VAXC header files lack these constants */
+#ifndef JPI$_RIGHTS_SIZE
+# define JPI$_RIGHTS_SIZE 817
+#endif
+#ifndef KGB$M_SUBSYSTEM
+# define KGB$M_SUBSYSTEM 0x8
+#endif
+
/*{{{void vms_image_init(int *, char ***)*/
void
vms_image_init(int *argcp, char ***argvp)
{
- unsigned long int *mask, iosb[2], i;
- unsigned short int dummy;
- union prvdef iprv;
- struct itmlst_3 jpilist[2] = { {sizeof iprv, JPI$_IMAGPRIV, &iprv, &dummy},
- { 0, 0, 0, 0} };
+ unsigned long int *mask, iosb[2], i, rlst[128], rsz;
+ unsigned long int iprv[(sizeof(union prvdef) + sizeof(unsigned long int) - 1) / sizeof(unsigned long int)];
+ unsigned short int dummy, rlen;
+ struct itmlst_3 jpilist[4] = { {sizeof iprv, JPI$_IMAGPRIV, iprv, &dummy},
+ {sizeof rlst, JPI$_RIGHTSLIST, rlst, &rlen},
+ { sizeof rsz, JPI$_RIGHTS_SIZE, &rsz, &dummy},
+ { 0, 0, 0, 0} };
_ckvmssts(sys$getjpiw(0,NULL,NULL,jpilist,iosb,NULL,NULL));
_ckvmssts(iosb[0]);
- mask = (unsigned long int *) &iprv; /* Quick change of view */;
- for (i = 0; i < (sizeof iprv + sizeof(unsigned long int) - 1) / sizeof(unsigned long int); i++) {
- if (mask[i]) { /* Running image installed with privs? */
- _ckvmssts(sys$setprv(0,&iprv,0,NULL)); /* Turn 'em off. */
+ for (i = 0; i < sizeof iprv / sizeof(unsigned long int); i++) {
+ if (iprv[i]) { /* Running image installed with privs? */
+ _ckvmssts(sys$setprv(0,iprv,0,NULL)); /* Turn 'em off. */
tainting = TRUE;
break;
}
}
+ /* Rights identifiers might trigger tainting as well. */
+ if (!tainting && (rlen || rsz)) {
+ while (rlen < rsz) {
+ /* We didn't get all the identifiers on the first pass. Allocate a
+ * buffer much larger than $GETJPI wants (rsz is size in bytes that
+ * were needed to hold all identifiers at time of last call; we'll
+ * allocate that many unsigned long ints), and go back and get 'em.
+ */
+ if (jpilist[1].bufadr != rlst) Safefree(jpilist[1].bufadr);
+ jpilist[1].bufadr = New(1320,mask,rsz,unsigned long int);
+ jpilist[1].buflen = rsz * sizeof(unsigned long int);
+ _ckvmssts(sys$getjpiw(0,NULL,NULL,&jpilist[1],iosb,NULL,NULL));
+ _ckvmssts(iosb[0]);
+ }
+ mask = jpilist[1].bufadr;
+ /* Check attribute flags for each identifier (2nd longword); protected
+ * subsystem identifiers trigger tainting.
+ */
+ for (i = 1; i < (rlen + sizeof(unsigned long int) - 1) / sizeof(unsigned long int); i += 2) {
+ if (mask[i] & KGB$M_SUBSYSTEM) {
+ tainting = TRUE;
+ break;
+ }
+ }
+ if (mask != rlst) Safefree(mask);
+ }
getredirection(argcp,argvp);
return;
}
@@ -3205,9 +3289,39 @@ static long int utc_offset_secs;
#undef localtime
#undef time
+static time_t toutc_dst(time_t loc) {
+ struct tm *rsltmp;
+
+ if ((rsltmp = localtime(&loc)) == NULL) return -1;
+ loc -= utc_offset_secs;
+ if (rsltmp->tm_isdst) loc -= 3600;
+ return loc;
+}
+#define _toutc(secs) ((secs) == -1 ? -1 : \
+ ((gmtime_emulation_type || my_time(NULL)), \
+ (gmtime_emulation_type == 1 ? toutc_dst(secs) : \
+ ((secs) - utc_offset_secs))))
+
+static time_t toloc_dst(time_t utc) {
+ struct tm *rsltmp;
+
+ utc += utc_offset_secs;
+ if ((rsltmp = localtime(&utc)) == NULL) return -1;
+ if (rsltmp->tm_isdst) utc += 3600;
+ return utc;
+}
+#define _toloc(secs) ((secs) == -1 ? -1 : \
+ ((gmtime_emulation_type || my_time(NULL)), \
+ (gmtime_emulation_type == 1 ? toloc_dst(secs) : \
+ ((secs) + utc_offset_secs))))
+
+
/* my_time(), my_localtime(), my_gmtime()
- * By default traffic in UTC time values, suing CRTL gmtime() or
+ * By default traffic in UTC time values, using CRTL gmtime() or
* SYS$TIMEZONE_DIFFERENTIAL to determine offset from local time zone.
+ * Note: We need to use these functions even when the CRTL has working
+ * UTC support, since they also handle C<use vmsish qw(times);>
+ *
* Contributed by Chuck Lane <lane@duphy4.physics.drexel.edu>
* Modified by Charles Bailey <bailey@genetics.upenn.edu>
*/
@@ -3216,10 +3330,12 @@ static long int utc_offset_secs;
time_t my_time(time_t *timep)
{
time_t when;
+ struct tm *tm_p;
if (gmtime_emulation_type == 0) {
- struct tm *tm_p;
- time_t base = 15 * 86400; /* 15jan71; to avoid month ends */
+ time_t base = 15 * 86400; /* 15jan71; to avoid month/year ends between */
+ /* results of calls to gmtime() and localtime() */
+ /* for same &base */
gmtime_emulation_type++;
if ((tm_p = gmtime(&base)) == NULL) { /* CRTL gmtime() is a fake */
@@ -3246,11 +3362,9 @@ time_t my_time(time_t *timep)
}
when = time(NULL);
- if (
-# ifdef VMSISH_TIME
- !VMSISH_TIME &&
-# endif
- when != -1) when -= utc_offset_secs;
+# ifdef VMSISH_TIME
+ if (!VMSISH_TIME) when = _toutc(when);
+# endif
if (timep != NULL) *timep = when;
return when;
@@ -3264,21 +3378,22 @@ my_gmtime(const time_t *timep)
{
char *p;
time_t when;
+ struct tm *rsltmp;
if (timep == NULL) {
set_errno(EINVAL); set_vaxc_errno(LIB$_INVARG);
return NULL;
}
if (*timep == 0) gmtime_emulation_type = 0; /* possibly reset TZ */
- if (gmtime_emulation_type == 0) (void) my_time(NULL); /* Init UTC */
when = *timep;
# ifdef VMSISH_TIME
- if (VMSISH_TIME) when -= utc_offset_secs; /* Input was local time */
-# endif
+ if (VMSISH_TIME) when = _toutc(when); /* Input was local time */
+# endif
/* CRTL localtime() wants local time as input, so does no tz correction */
- return localtime(&when);
-
+ rsltmp = localtime(&when);
+ if (rsltmp) rsltmp->tm_isdst = 0; /* We already took DST into account */
+ return rsltmp;
} /* end of my_gmtime() */
/*}}}*/
@@ -3288,6 +3403,7 @@ struct tm *
my_localtime(const time_t *timep)
{
time_t when;
+ struct tm *rsltmp;
if (timep == NULL) {
set_errno(EINVAL); set_vaxc_errno(LIB$_INVARG);
@@ -3298,10 +3414,12 @@ my_localtime(const time_t *timep)
when = *timep;
# ifdef VMSISH_TIME
- if (!VMSISH_TIME) when += utc_offset_secs; /* Input was UTC */
+ if (!VMSISH_TIME) when = _toloc(when); /* Input was UTC */
# endif
/* CRTL localtime() wants local time as input, so does no tz correction */
- return localtime(&when);
+ rsltmp = localtime(&when);
+ if (rsltmp && gmtime_emulation_type != 1) rsltmp->tm_isdst = -1;
+ return rsltmp;
} /* end of my_localtime() */
/*}}}*/
@@ -3376,10 +3494,8 @@ int my_utime(char *file, struct utimbuf *utimes)
lowbit = (utimes->modtime & 1) ? secscale : 0;
unixtime = (long int) utimes->modtime;
#if defined(VMSISH_TIME) && (__VMS_VER < 70000000 || __DECC_VER < 50200000)
- if (!VMSISH_TIME) { /* Input was UTC; convert to local for sys svc */
- if (!gmtime_emulation_type) (void) time(NULL); /* Initialize UTC */
- unixtime += utc_offset_secs;
- }
+ /* If input was UTC; convert to local for sys svc */
+ if (!VMSISH_TIME) unixtime = _toloc(unixtime);
# endif
unixtime >> 1; secscale << 1;
retsts = lib$emul(&secscale, &unixtime, &lowbit, bintime);
@@ -3726,10 +3842,9 @@ flex_fstat(int fd, struct mystat *statbufp)
if (1) {
# endif
#if __VMS_VER < 70000000 || __DECC_VER < 50200000
- if (!gmtime_emulation_type) (void)time(NULL);
- statbufp->st_mtime -= utc_offset_secs;
- statbufp->st_atime -= utc_offset_secs;
- statbufp->st_ctime -= utc_offset_secs;
+ statbufp->st_mtime = _toutc(statbufp->st_mtime);
+ statbufp->st_atime = _toutc(statbufp->st_atime);
+ statbufp->st_ctime = _toutc(statbufp->st_ctime);
#endif
}
return 0;