CVS update: php3/functions
| From: | thies | Date: | Thu, 14 Jan 1999 17:57:10 +0000 |
| Subject: | CVS update: php3/functions | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-3540@lists.php.net to get a copy of this message | ||
Date: Thursday January 14, 1999 @ 12:57
Author: thies
Update of /repository/php3/functions
In directory asf:/u/temp/cvs-serv4880/functions
Modified Files:
filestat.c
Log Message:
added dskfree(string path) function. this currently is tested under solaris (uses statvfs)
it returns the number of KB free in the given path.
the return value is a double, 'cause moden drives sometimes blow-away an int.
could please somebody check the autoconf stuff, as this is my first contact with it????
Index: php3/functions/filestat.c
diff -c php3/functions/filestat.c:1.81 php3/functions/filestat.c:1.82
*** php3/functions/filestat.c:1.81 Mon Jan 4 09:25:20 1999
--- php3/functions/filestat.c Thu Jan 14 12:57:09 1999
***************
*** 27,33 ****
+----------------------------------------------------------------------+
*/
! /* $Id: filestat.c,v 1.81 1999/01/04 14:25:20 jah Exp $ */
#ifdef THREAD_SAFE
#include "tls.h"
#endif
--- 27,33 ----
+----------------------------------------------------------------------+
*/
! /* $Id: filestat.c,v 1.82 1999/01/14 17:57:09 thies Exp $ */
#ifdef THREAD_SAFE
#include "tls.h"
#endif
***************
*** 47,52 ****
--- 47,56 ----
# include <unistd.h>
#endif
+ #if HAVE_SYS_STATVFS_H
+ # include <sys/statvfs.h>
+ #endif
+
#if HAVE_PWD_H
# if MSVC5
# include "win32/pwd.h"
***************
*** 115,120 ****
--- 119,151 ----
return SUCCESS;
}
+ /* {{{ proto bool diskfree(string path)
+ return number of kilobytes free in path */
+ void php3_diskfree(INTERNAL_FUNCTION_PARAMETERS)
+ {
+ #if defined(HAVE_STATVFS) && defined(HAVE_STATVFS)
+ pval *path;
+ struct statvfs buf;
+ double bytesfree;
+ TLS_VARS;
+
+ if (ARG_COUNT(ht)!=1 || getParameters(ht,1,&path)==FAILURE) {
+ WRONG_PARAM_COUNT;
+ }
+
+ convert_to_string(path);
+
+ 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
+ }
+ /* }}} */
+
/* {{{ proto bool chgrp(string filename, mixed group)
Change file group */
void php3_chgrp(INTERNAL_FUNCTION_PARAMETERS)
***************
*** 578,583 ****
--- 609,615 ----
{"chgrp", php3_chgrp, NULL},
{"chmod", php3_chmod, NULL},
{"touch", php3_touch, NULL},
+ {"diskfree", php3_diskfree, 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