CVS update: php3/functions
| From: | thies | Date: | Fri, 15 Jan 1999 10:55:18 +0000 |
| Subject: | CVS update: php3/functions | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-3564@lists.php.net to get a copy of this message | ||
Date: Friday January 15, 1999 @ 5:55
Author: thies
Update of /repository/php3/functions
In directory asf:/u/temp/cvs-serv13273/functions
Modified Files:
filestat.c
Log Message:
remaned diskfree
added statfs support for "old" systems - couldn't check myself.....
Index: php3/functions/filestat.c
diff -c php3/functions/filestat.c:1.83 php3/functions/filestat.c:1.84
*** php3/functions/filestat.c:1.83 Thu Jan 14 14:12:42 1999
--- php3/functions/filestat.c Fri Jan 15 05:55:17 1999
***************
*** 27,33 ****
+----------------------------------------------------------------------+
*/
! /* $Id: filestat.c,v 1.83 1999/01/14 19:12:42 thies Exp $ */
#ifdef THREAD_SAFE
#include "tls.h"
#endif
--- 27,33 ----
+----------------------------------------------------------------------+
*/
! /* $Id: filestat.c,v 1.84 1999/01/15 10:55:17 thies Exp $ */
#ifdef THREAD_SAFE
#include "tls.h"
#endif
***************
*** 47,54 ****
# include <unistd.h>
#endif
! #if HAVE_SYS_STATVFS_H
# include <sys/statvfs.h>
#endif
#if HAVE_PWD_H
--- 47,56 ----
# include <unistd.h>
#endif
! #if defined(HAVE_SYS_STATVFS_H) && defined(HAVE_STATVFS)
# include <sys/statvfs.h>
+ #elif defined(HAVE_SYS_STATFS_H) && defined(HAVE_STATFS)
+ # include <sys/statfs.h>
#endif
#if HAVE_PWD_H
***************
*** 121,131 ****
/* {{{ proto bool diskfree(string path)
return number of kilobytes free in path */
! void php3_diskfree(INTERNAL_FUNCTION_PARAMETERS)
{
- #if defined(HAVE_SYS_STATVFS_H) && defined(HAVE_STATVFS)
pval *path;
struct statvfs buf;
double bytesfree;
TLS_VARS;
--- 123,136 ----
/* {{{ proto bool diskfree(string path)
return number of kilobytes free in path */
! void php3_diskfreespace(INTERNAL_FUNCTION_PARAMETERS)
{
pval *path;
+ #if defined(HAVE_SYS_STATVFS_H) && defined(HAVE_STATVFS)
struct statvfs buf;
+ #elif defined(HAVE_SYS_STATFS_H) && defined(HAVE_STATFS)
+ struct statfs buf;
+ #endif
double bytesfree;
TLS_VARS;
***************
*** 137,148 ****
if (_php3_check_open_basedir(path->value.str.val)) RETURN_FALSE;
if (statvfs(path->value.str.val,&buf)) RETURN_FALSE;
!
! bytesfree = (((double)buf.f_bavail) * ((double)buf.f_frsize)) / 1024;
RETURN_DOUBLE(bytesfree);
- #endif
}
/* }}} */
--- 142,156 ----
if (_php3_check_open_basedir(path->value.str.val)) RETURN_FALSE;
+ #if defined(HAVE_SYS_STATVFS_H) && defined(HAVE_STATVFS)
if (statvfs(path->value.str.val,&buf)) RETURN_FALSE;
! bytesfree = (((double)buf.f_bavail) * ((double)buf.f_frsize));
! #elif defined(HAVE_SYS_STATFS_H) && defined(HAVE_STATFS)
! if (statfs(path->value.str.val,&buf)) RETURN_FALSE;
! bytesfree = (((double)buf.f_bsize) * ((double)buf.f_bavail));
! #endif
RETURN_DOUBLE(bytesfree);
}
/* }}} */
***************
*** 609,615 ****
{"chgrp", php3_chgrp, NULL},
{"chmod", php3_chmod, NULL},
{"touch", php3_touch, NULL},
! {"diskfree", php3_diskfree, NULL},
{NULL, NULL, NULL}
};
--- 617,623 ----
{"chgrp", php3_chgrp, NULL},
{"chmod", php3_chmod, NULL},
{"touch", php3_touch, NULL},
! {"diskfreespace",php3_diskfreespace,NULL},
{NULL, NULL, NULL}
};
--
PHP Development Mailing List http://www.php.net/
To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net
For help: php-dev-help@lists.php.net