]> granicus.if.org Git - php/commitdiff
@Added tmpfile() function (Stig)
authorStig Bakken <ssb@php.net>
Sun, 14 Nov 1999 11:05:37 +0000 (11:05 +0000)
committerStig Bakken <ssb@php.net>
Sun, 14 Nov 1999 11:05:37 +0000 (11:05 +0000)
Removed the mkstemp stuff and added tmpfile() function instead.

configure.in
ext/standard/file.c
ext/standard/file.h
main/php.h

index 78651a51d87ff19962be10522226c04395b65733..1161c9e7f0781028a2a3413fc154e2cc8cf02f61 100644 (file)
@@ -333,7 +333,6 @@ unsetenv \
 usleep \
 utime \
 vsnprintf \
-mkstemp \
 )
 
 AC_REPLACE_FUNCS(strlcat strlcpy)
index 3d35389e0811d7df13c91a1b73f88ee25d3d668f..2a9d98a2ccebb8b1363493a40dc323e5ec9c8d7c 100644 (file)
@@ -232,6 +232,7 @@ function_entry file_functions[] = {
        PHP_FE(rename,                          NULL)
        PHP_FE(copy,                            NULL)
        PHP_FE(tempnam,                         NULL)
+       PHP_FE(tmpfile,                         NULL)
        PHP_FE(file,                            NULL)
        PHP_FE(fgetcsv,                         NULL)
     PHP_FE(flock,                              NULL)
@@ -591,6 +592,23 @@ PHP_FUNCTION(tempnam)
 }
 
 /* }}} */
+/* {{{ proto int tmpfile()
+   Create a temporary file that will be deleted automatically after use. */
+PHP_FUNCTION(tmpfile)
+{
+       FILE *fp;
+       if (ARG_COUNT(ht) != 0) {
+               WRONG_PARAM_COUNT;
+       }
+       fp = tmpfile();
+       if (fp == NULL) {
+               php_error(E_WARNING, "tmpfile: %s", strerror(errno));
+               RETURN_FALSE;
+       }
+       ZEND_REGISTER_RESOURCE(return_value, fp, le_fopen);
+}
+/* }}} */
+
 /* {{{ proto int fopen(string filename, string mode [, int use_include_path])
    Open a file or a URL and return a file pointer */
 
index 072e7ae534c6eee5d667601b627188b9bef69941..10824638ebf490323220c9e3ebb78f471fdae305 100644 (file)
@@ -40,6 +40,7 @@ extern zend_module_entry file_module_entry;
 extern PHP_MINIT_FUNCTION(file);
 
 PHP_FUNCTION(tempnam);
+PHP_FUNCTION(tmpfile);
 PHP_FUNCTION(fopen);
 PHP_FUNCTION(fclose);
 PHP_FUNCTION(popen);
index b0dd5cb7b4f9c578c622f970ea83ddc4767626ea..d732b42c8926342d4a4a4506d62d6e1ae4216fe9 100644 (file)
@@ -168,10 +168,6 @@ typedef zval pval;
 extern char *strerror(int);
 #endif
 
-#ifdef HAVE_MKSTEMP
-# define mktemp mkstemp
-#endif
-
 #include "fopen-wrappers.h"
 
 #if APACHE /* apache httpd */