summaryrefslogtreecommitdiff
path: root/win32
diff options
context:
space:
mode:
authorPerl 5 Porters <perl5-porters@africa.nicoh.com>1997-05-16 10:15:00 +1200
committerChip Salzenberg <chip@atlantic.net>1997-05-16 10:15:00 +1200
commitc90c0ff485be15aaf3ee20121299cb014ee6b1ff (patch)
tree2c69d15977fd7b00642d5daa2115ae1fa27e75f7 /win32
parent7b05b7e32c22894360c5332cd30232bdea49f5a8 (diff)
downloadperl-c90c0ff485be15aaf3ee20121299cb014ee6b1ff.tar.gz
[inseparable changes from match from perl-5.003_99a to perl5.004]
BUILD PROCESS Subject: Don't use 'unset' in Configure From: Chip Salzenberg <chip@perl.com> Files: Configure Subject: Protect against having no such command as 'cc' Date: Mon, 12 May 1997 16:35:34 -0400 (EDT) From: Hans Mulder <hansm@icgned.nl> Files: Configure Msg-ID: 1997May12.163534.2006434@hmivax.humgen.upenn.edu (applied based on p5p patch as commit 3bf198a5e20d135d4136d3233d58cf49a70772d9) Subject: minor wording enhancement for Configure Date: Sat, 10 May 1997 13:38:31 +0300 (EET DST) From: Jarkko Hietaniemi <Jarkko.Hietaniemi@cc.hut.fi> Files: Configure private-msgid: 199705101038.NAA00471@alpha.hut.fi CORE LANGUAGE CHANGES Subject: Make C<m//g> reset pos on failure; make C<m//gc> not reset From: Chip Salzenberg <chip@perl.com> Files: dump.c op.c op.h pod/perldelta.pod pod/perlfaq6.pod pod/perlop.pod pod/perlre.pod pp_ctl.c pp_hot.c regcomp.c t/op/pat.t toke.c Subject: SECURITY: Forbid exec() if $ENV{BASH_ENV} is tainted From: Chip Salzenberg <chip@perl.com> Files: pod/perldelta.pod pod/perlrun.pod pod/perlsec.pod t/op/taint.t taint.c Subject: Allow exec() if $ENV{TERM} is tainted but innocuous From: Chip Salzenberg <chip@perl.com> Files: pod/perldelta.pod pod/perlrun.pod pod/perlsec.pod t/op/taint.t taint.c Subject: Allow globbing when tainted under VMS (no external program) From: Chip Salzenberg <chip@perl.com> Files: pp_sys.c t/op/taint.t CORE PORTABILITY Subject: Win32 update (three patches) From: Gurusamy Sarathy <gsar@engin.umich.edu> Files: README.win32 perl.c win32/Makefile win32/config.H win32/config_h.PL win32/config_sh.PL win32/makedef.pl win32/win32.c win32/win32.h win32/win32io.c win32/win32io.h win32/win32iop.h Subject: Don't require executable bit on perl -S if DOSISH Date: Fri, 09 May 1997 12:33:18 -0400 From: Danny Sadinoff <sadinoff@olf.com> Files: perl.c Msg-ID: 337351CE.79B28DE3@olf.com (applied based on p5p patch as commit 7596f71a28f72f9e3abd6d3962d29a7752cd9303) DOCUMENTATION Subject: Tweaks for perldelta Date: Sun, 11 May 97 01:46:00 +0200 From: Unknown Contributor <hansm@euronet.nl> Files: pod/perldelta.pod Msg-ID: 199705102346.BAA17300@mail.euronet.nl (applied based on p5p patch as commit 3e10809228cc961223b894e1639b44f8e2b64de0) Subject: Mention perlfaq.pod and perlmodlib.pod in perldelta.pod From: Chip Salzenberg <chip@perl.com> Files: pod/perldelta.pod Subject: Fix example of use of lexicals with formats From: Chip Salzenberg <chip@perl.com> Files: pod/perldelta.pod OTHER CORE CHANGES Subject: In C<eval &func>, always call &func in scalar context From: Chip Salzenberg <chip@perl.com> Files: op.c Subject: Fix recursive substitution From: Chip Salzenberg <chip@perl.com> Files: cop.h global.sym pp_ctl.c proto.h scope.c Subject: Fix core dump from get*() functions returning no alias array From: Chip Salzenberg <chip@perl.com> Files: pp_sys.c Subject: Fix typo Date: Sat, 10 May 1997 17:28:35 -0500 From: Mark K Trettin <mkt@lucent.com> Files: pp_sys.c private-msgid: 199705102228.RAA11163@gv18c.ih.lucent.com
Diffstat (limited to 'win32')
-rw-r--r--win32/Makefile28
-rw-r--r--win32/config.H5
-rw-r--r--win32/config_h.PL6
-rw-r--r--win32/config_sh.PL6
-rw-r--r--win32/makedef.pl1
-rw-r--r--win32/win32.c41
-rw-r--r--win32/win32.h9
-rw-r--r--win32/win32io.c47
-rw-r--r--win32/win32io.h1
-rw-r--r--win32/win32iop.h10
10 files changed, 93 insertions, 61 deletions
diff --git a/win32/Makefile b/win32/Makefile
index 80e37e397f..8c99ef7550 100644
--- a/win32/Makefile
+++ b/win32/Makefile
@@ -9,11 +9,20 @@
#
# Set these to wherever you want "nmake install" to put your
# newly built perl.
-#
-
INST_DRV=c:
INST_TOP=$(INST_DRV)\perl
+#
+# uncomment next line if you wish perl to run on Windows95 also
+#RUNTIME=-MT
+
+#
+# uncomment next line if you are using Visual C++ 2.x
+#CCTYPE=MSVC20
+
+#
+# uncomment next line if you want debug version of perl (big,slow)
+#CFG=Debug
##################### CHANGE THESE ONLY IF YOU MUST #####################
@@ -28,7 +37,9 @@ LIB32=$(LINK32) -lib
# Options
#
PERLDLL = -D "PERLDLL"
+!IF "$(RUNTIME)" == ""
RUNTIME = -MD
+!ENDIF
INCLUDES = -I ".\include" -I "." -I ".."
#PCHFLAGS = -Fp"$(INTDIR)/modules.pch" -YX
DEFINES = -D "WIN32" -D "_CONSOLE" -D "PERLDLL"
@@ -98,7 +109,8 @@ MINIMOD=..\lib\ExtUtils\Miniperl.pm
PL2BAT=bin\PL2BAT.BAT
MAKE=nmake -nologo
-XCOPY=xcopy /i /d /f /r
+XCOPY=xcopy /f /r /i /d
+RCOPY=xcopy /f /r /i /e /d
NULL=
#
@@ -256,11 +268,11 @@ perlglob.obj : perlglob.c
$(CONFIGPM) : $(MINIPERL) ..\config.sh config_h.PL ..\minimod.pl
cd .. && miniperl configpm
- if exist lib\* $(XCOPY) /e lib\*.* ..\lib\$(NULL)
+ if exist lib\* $(RCOPY) lib\*.* ..\lib\$(NULL)
$(XCOPY) ..\*.h ..\lib\CORE\*.*
$(XCOPY) *.h ..\lib\CORE\*.*
- $(XCOPY) /S include ..\lib\CORE\*.*
- $(MINIPERL) -I..\lib config_h.PL || $(MAKE) RUNTIME=$(RUNTIME) CFG=$(CFG) $(CONFIGPM)
+ $(RCOPY) include ..\lib\CORE\*.*
+ $(MINIPERL) -I..\lib config_h.PL || $(MAKE) CCTYPE=$(CCTYPE) RUNTIME=$(RUNTIME) CFG=$(CFG) $(CONFIGPM)
$(MINIPERL) : ..\miniperlmain.obj $(CORE_OBJ) $(WIN32_OBJ)
$(LINK32) -subsystem:console -out:$@ @<<
@@ -374,7 +386,7 @@ install : ALL doc utils
$(XCOPY) $(GLOBEXE) $(INST_BIN)\*.*
$(XCOPY) $(PERLDLL) $(INST_BIN)\*.*
$(XCOPY) bin\*.* $(INST_BIN)\*.*
- $(XCOPY) /e ..\lib $(INST_LIB)\*.*
+ $(RCOPY) ..\lib $(INST_LIB)\*.*
$(XCOPY) ..\pod\*.bat $(INST_BIN)\*.*
$(XCOPY) ..\pod\*.pod $(INST_POD)\*.*
$(XCOPY) ..\pod\*.html $(INST_HTML)\*.*
@@ -382,7 +394,7 @@ install : ALL doc utils
inst_lib : $(CONFIGPM)
copy splittree.pl ..
$(MINIPERL) -I..\lib ..\splittree.pl "../LIB" "../LIB/auto"
- $(XCOPY) /e ..\lib $(INST_LIB)\*.*
+ $(RCOPY) ..\lib $(INST_LIB)\*.*
minitest : $(MINIPERL) $(GLOBEXE) $(CONFIGPM)
$(XCOPY) $(MINIPERL) ..\t\perl.exe
diff --git a/win32/config.H b/win32/config.H
index e375c5692d..2018198084 100644
--- a/win32/config.H
+++ b/win32/config.H
@@ -1414,7 +1414,7 @@
* in programs that are not prepared to deal with ~ expansion at run-time.
*/
#define ARCHLIB "c:\\perl\\lib" /**/
-#define ARCHLIB_EXP "c:\\perl\\lib" /**/
+#define ARCHLIB_EXP (win32PerlLibPath()) /**/
/* BINCOMPAT3:
* This symbol, if defined, indicates that Perl 5.004 should be
@@ -1776,5 +1776,6 @@
#endif
#include <win32.h>
-#define ARCHLIBEXP (win32PerlLibPath())
+#ifndef DEBUGGING
#define DEBUGGING
+#endif
diff --git a/win32/config_h.PL b/win32/config_h.PL
index d266f6557f..98b474a144 100644
--- a/win32/config_h.PL
+++ b/win32/config_h.PL
@@ -35,14 +35,16 @@ while (<SH>)
munge();
s/\\\$/\$/g;
s#/[ *\*]*\*/#/**/#;
- if (/#define\s+ARCHLIBEXP/)
+ if (/^\s*#define\s+ARCHLIB_EXP/)
{
+ $_ = "#define ARCHLIB_EXP (win32PerlLibPath())\t/**/\n";
}
print H;
}
print H "#include <win32.h>
-#define ARCHLIBEXP (win32PerlLibPath())
+#ifndef DEBUGGING
#define DEBUGGING
+#endif
";
close(H);
close(SH);
diff --git a/win32/config_sh.PL b/win32/config_sh.PL
index e62e47f4f7..020485d66a 100644
--- a/win32/config_sh.PL
+++ b/win32/config_sh.PL
@@ -5,7 +5,11 @@ while (@ARGV && $ARGV[0] =~ /^([\w_]+)=(.*)$/)
shift(@ARGV);
}
-@opt{'PATCHLEVEL','SUBVERSION'} = ($] =~ /\.0*([1-9]+)(\d\d)$/);
+if ($] =~ /\.(\d\d\d)?(\d\d)?$/) { # should always be true
+ $opt{PATCHLEVEL} = int($1 || 0);
+ $opt{SUBVERSION} = $2 || '00';
+}
+
while (<>)
{
s/~([\w_]+)~/$opt{$1}/g;
diff --git a/win32/makedef.pl b/win32/makedef.pl
index a0a05361a2..f868203ba4 100644
--- a/win32/makedef.pl
+++ b/win32/makedef.pl
@@ -264,6 +264,7 @@ win32_spawnle
win32_mkdir
win32_rmdir
win32_chdir
+win32_flock
win32_htons
win32_ntohs
win32_htonl
diff --git a/win32/win32.c b/win32/win32.c
index 9a0f910b42..7fb04166c2 100644
--- a/win32/win32.c
+++ b/win32/win32.c
@@ -1121,56 +1121,17 @@ stolen_get_osfhandle(int fd)
return pIOSubSystem->pfn_get_osfhandle(fd);
}
-
/*
* Extras.
*/
-/* simulate flock by locking a range on the file */
-
-#define LK_ERR(f,i) ((f) ? (i = 0) : (errno = GetLastError()))
-#define LK_LEN 0xffff0000
-
DllExport int
win32_flock(int fd, int oper)
{
- OVERLAPPED o;
- int i = -1;
- HANDLE fh;
-
if (!IsWinNT()) {
croak("flock() unimplemented on this platform");
return -1;
}
-
- fh = (HANDLE)stolen_get_osfhandle(fd);
- memset(&o, 0, sizeof(o));
-
- switch(oper) {
- case LOCK_SH: /* shared lock */
- LK_ERR(LockFileEx(fh, 0, 0, LK_LEN, 0, &o),i);
- break;
- case LOCK_EX: /* exclusive lock */
- LK_ERR(LockFileEx(fh, LOCKFILE_EXCLUSIVE_LOCK, 0, LK_LEN, 0, &o),i);
- break;
- case LOCK_SH|LOCK_NB: /* non-blocking shared lock */
- LK_ERR(LockFileEx(fh, LOCKFILE_FAIL_IMMEDIATELY, 0, LK_LEN, 0, &o),i);
- break;
- case LOCK_EX|LOCK_NB: /* non-blocking exclusive lock */
- LK_ERR(LockFileEx(fh,
- LOCKFILE_EXCLUSIVE_LOCK|LOCKFILE_FAIL_IMMEDIATELY,
- 0, LK_LEN, 0, &o),i);
- break;
- case LOCK_UN: /* unlock lock */
- LK_ERR(UnlockFileEx(fh, 0, LK_LEN, 0, &o),i);
- break;
- default: /* unknown */
- errno = EINVAL;
- break;
- }
- return i;
+ return pIOSubSystem->pfnflock(fd, oper);
}
-#undef LK_ERR
-#undef LK_LEN
-
diff --git a/win32/win32.h b/win32/win32.h
index 711403315c..ec9eb7cc53 100644
--- a/win32/win32.h
+++ b/win32/win32.h
@@ -65,20 +65,13 @@ extern FILE *myfdopen(int, char *);
#undef alarm
#define alarm myalarm
-#undef flock
-#define flock(fd,o) win32_flock(fd,o)
-#define LOCK_SH 1
-#define LOCK_EX 2
-#define LOCK_NB 4
-#define LOCK_UN 8
-
struct tms {
long tms_utime;
long tms_stime;
long tms_cutime;
long tms_cstime;
};
-
+
unsigned int sleep(unsigned int);
char *win32PerlLibPath();
int mytimes(struct tms *timebuf);
diff --git a/win32/win32io.c b/win32/win32io.c
index e75754abb9..db156cf133 100644
--- a/win32/win32io.c
+++ b/win32/win32io.c
@@ -190,6 +190,52 @@ my_get_osfhandle( int filehandle )
return _get_osfhandle(filehandle);
}
+
+/* simulate flock by locking a range on the file */
+
+
+#define LK_ERR(f,i) ((f) ? (i = 0) : (errno = GetLastError()))
+#define LK_LEN 0xffff0000
+
+int
+my_flock(int fd, int oper)
+{
+ OVERLAPPED o;
+ int i = -1;
+ HANDLE fh;
+
+ fh = (HANDLE)my_get_osfhandle(fd);
+ memset(&o, 0, sizeof(o));
+
+ switch(oper) {
+ case LOCK_SH: /* shared lock */
+ LK_ERR(LockFileEx(fh, 0, 0, LK_LEN, 0, &o),i);
+ break;
+ case LOCK_EX: /* exclusive lock */
+ LK_ERR(LockFileEx(fh, LOCKFILE_EXCLUSIVE_LOCK, 0, LK_LEN, 0, &o),i);
+ break;
+ case LOCK_SH|LOCK_NB: /* non-blocking shared lock */
+ LK_ERR(LockFileEx(fh, LOCKFILE_FAIL_IMMEDIATELY, 0, LK_LEN, 0, &o),i);
+ break;
+ case LOCK_EX|LOCK_NB: /* non-blocking exclusive lock */
+ LK_ERR(LockFileEx(fh,
+ LOCKFILE_EXCLUSIVE_LOCK|LOCKFILE_FAIL_IMMEDIATELY,
+ 0, LK_LEN, 0, &o),i);
+ break;
+ case LOCK_UN: /* unlock lock */
+ LK_ERR(UnlockFileEx(fh, 0, LK_LEN, 0, &o),i);
+ break;
+ default: /* unknown */
+ errno = EINVAL;
+ break;
+ }
+ return i;
+}
+
+#undef LK_ERR
+#undef LK_LEN
+
+
#ifdef PERLDLL
__declspec(dllexport)
#endif
@@ -247,6 +293,7 @@ WIN32_IOSUBSYSTEM win32stdio = {
_mkdir,
_rmdir,
_chdir,
+ my_flock, /* (*pfunc_flock)(int fd, int oper) */
87654321L, /* end of structure */
};
diff --git a/win32/win32io.h b/win32/win32io.h
index 4955973564..45a31f7a48 100644
--- a/win32/win32io.h
+++ b/win32/win32io.h
@@ -55,6 +55,7 @@ int (*pfnspawnvpe)(int mode, const char *cmdname, const char *const *argv, const
int (*pfnmkdir)(const char *path);
int (*pfnrmdir)(const char *path);
int (*pfnchdir)(const char *path);
+int (*pfnflock)(int fd, int oper);
int signature_end;
} WIN32_IOSUBSYSTEM;
diff --git a/win32/win32iop.h b/win32/win32iop.h
index f630000630..c33d944307 100644
--- a/win32/win32iop.h
+++ b/win32/win32iop.h
@@ -63,6 +63,7 @@ EXT int win32_spawnle(int mode, const char *cmdname, const char *,...);
EXT int win32_mkdir(const char *dir, int mode);
EXT int win32_rmdir(const char *dir);
EXT int win32_chdir(const char *dir);
+EXT int win32_flock(int fd, int oper);
/*
* these two are win32 specific but still io related
@@ -70,6 +71,14 @@ EXT int win32_chdir(const char *dir);
int stolen_open_osfhandle(long handle, int flags);
long stolen_get_osfhandle(int fd);
+/*
+ * defines for flock emulation
+ */
+#define LOCK_SH 1
+#define LOCK_EX 2
+#define LOCK_NB 4
+#define LOCK_UN 8
+
#include <win32io.h> /* pull in the io sub system structure */
void * SetIOSubSystem(void *piosubsystem);
@@ -140,6 +149,7 @@ void * SetIOSubSystem(void *piosubsystem);
#define mkdir win32_mkdir
#define rmdir win32_rmdir
#define chdir win32_chdir
+#define flock(fd,o) win32_flock(fd,o)
#endif /* WIN32IO_IS_STDIO */
#endif /* WIN32IOP_H */