@Added tmpfile() function (Stig)

Removed the mkstemp stuff and added tmpfile() function instead.
This commit is contained in:
Stig Bakken 1999-11-14 11:05:37 +00:00
parent 4ebf7b85ad
commit 5f8f410e51
4 changed files with 19 additions and 5 deletions

View File

@ -333,7 +333,6 @@ unsetenv \
usleep \
utime \
vsnprintf \
mkstemp \
)
AC_REPLACE_FUNCS(strlcat strlcpy)

View 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 */

View 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);

View 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 */