summaryrefslogtreecommitdiff
path: root/wince/wince.c
diff options
context:
space:
mode:
authorVadim Konovalov <vkonovalov@lucent.com>2003-07-03 19:57:55 +0400
committerJarkko Hietaniemi <jhi@iki.fi>2003-07-03 11:10:21 +0000
commit8100305834564f2a5793a855edb3f71da87df3d7 (patch)
tree13b5c926ac757a8bf6f9528759e7c5cab3e9b2e2 /wince/wince.c
parent9c9c2da3914070cb0928a8f1a30a1c8367b80a39 (diff)
downloadperl-8100305834564f2a5793a855edb3f71da87df3d7.tar.gz
Re: maint @ 19923
Message-ID: <048e01c3415b$da0fe510$7c5ec3d9@vad> p4raw-id: //depot/perl@19954
Diffstat (limited to 'wince/wince.c')
-rw-r--r--wince/wince.c47
1 files changed, 44 insertions, 3 deletions
diff --git a/wince/wince.c b/wince/wince.c
index 16bf2d2990..cec2facf94 100644
--- a/wince/wince.c
+++ b/wince/wince.c
@@ -908,12 +908,46 @@ win32_rewind(FILE *pf)
return;
}
+DllExport int
+win32_tmpfd(void)
+{
+ dTHX;
+ char prefix[MAX_PATH+1];
+ char filename[MAX_PATH+1];
+ DWORD len = GetTempPath(MAX_PATH, prefix);
+ if (len && len < MAX_PATH) {
+ if (GetTempFileName(prefix, "plx", 0, filename)) {
+ HANDLE fh = CreateFile(filename,
+ DELETE | GENERIC_READ | GENERIC_WRITE,
+ 0,
+ NULL,
+ CREATE_ALWAYS,
+ FILE_ATTRIBUTE_NORMAL
+ | FILE_FLAG_DELETE_ON_CLOSE,
+ NULL);
+ if (fh != INVALID_HANDLE_VALUE) {
+ int fd = win32_open_osfhandle((intptr_t)fh, 0);
+ if (fd >= 0) {
+#if defined(__BORLANDC__)
+ setmode(fd,O_BINARY);
+#endif
+ DEBUG_p(PerlIO_printf(Perl_debug_log,
+ "Created tmpfile=%s\n",filename));
+ return fd;
+ }
+ }
+ }
+ }
+ return -1;
+}
+
DllExport FILE*
win32_tmpfile(void)
{
- Perl_croak(aTHX_ PL_no_func, "tmpfile");
-
- return NULL;
+ int fd = win32_tmpfd();
+ if (fd >= 0)
+ return win32_fdopen(fd, "w+b");
+ return NULL;
}
DllExport void
@@ -1521,6 +1555,13 @@ Perl_win32_init(int *argcp, char ***argvp)
MALLOC_INIT;
}
+void
+Perl_win32_term(void)
+{
+ OP_REFCNT_TERM;
+ MALLOC_TERM;
+}
+
DllExport int
win32_flock(int fd, int oper)
{