cvs: php4 /ext/standard file.c filestat.c

From: Date: Fri, 11 May 2001 01:47:46 +0000
Subject: cvs: php4 /ext/standard file.c filestat.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-5655@lists.php.net to get a copy of this message
jason Thu May 10 18:47:46 2001 EDT Modified files: /php4/ext/standard file.c filestat.c Log: @fstat() and stat() now return identical output by returning a numerical and @string indexed array (Jason) (Andrei's suggestion to still allow backwords compatibility.) Index: php4/ext/standard/file.c diff -u php4/ext/standard/file.c:1.155 php4/ext/standard/file.c:1.156 --- php4/ext/standard/file.c:1.155 Mon Apr 30 05:43:39 2001 +++ php4/ext/standard/file.c Thu May 10 18:47:46 2001 @@ -20,7 +20,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: file.c,v 1.155 2001/04/30 12:43:39 andi Exp $ */ +/* $Id: file.c,v 1.156 2001/05/11 01:47:46 jason Exp $ */ /* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */ @@ -1801,6 +1801,32 @@ array_init(return_value); + add_next_index_long(return_value, stat_sb.st_dev); + add_next_index_long(return_value, stat_sb.st_ino); + add_next_index_long(return_value, stat_sb.st_mode); + add_next_index_long(return_value, stat_sb.st_nlink); + add_next_index_long(return_value, stat_sb.st_uid); + add_next_index_long(return_value, stat_sb.st_gid); +#ifdef HAVE_ST_RDEV + add_next_index_long(return_value, stat_sb.st_rdev); +#else + add_next_index_long(return_value, -1); +#endif + add_next_index_long(return_value, stat_sb.st_size); + add_next_index_long(return_value, stat_sb.st_atime); + add_next_index_long(return_value, stat_sb.st_mtime); + add_next_index_long(return_value, stat_sb.st_ctime); +#ifdef HAVE_ST_BLKSIZE + add_next_index_long(return_value, stat_sb.st_blksize); +#else + add_next_index_long(return_value, -1); +#endif +#ifdef HAVE_ST_BLOCKS + add_next_index_long(return_value, stat_sb.st_blocks); +#else + add_next_index_long(return_value, -1); +#endif + /* Support string references as well as numerical*/ add_assoc_long ( return_value , "dev" , stat_sb.st_dev ); add_assoc_long ( return_value , "ino" , stat_sb.st_ino ); add_assoc_long ( return_value , "mode" , stat_sb.st_mode ); Index: php4/ext/standard/filestat.c diff -u php4/ext/standard/filestat.c:1.62 php4/ext/standard/filestat.c:1.63 --- php4/ext/standard/filestat.c:1.62 Mon Apr 30 05:43:39 2001 +++ php4/ext/standard/filestat.c Thu May 10 18:47:46 2001 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: filestat.c,v 1.62 2001/04/30 12:43:39 andi Exp $ */ +/* $Id: filestat.c,v 1.63 2001/05/11 01:47:46 jason Exp $ */ #include "php.h" #include "safe_mode.h" @@ -618,6 +618,30 @@ #else add_next_index_long(return_value, -1); #endif + /* Support string references as well as numerical*/ + add_assoc_long ( return_value , "dev" , stat_sb->st_dev ); + add_assoc_long ( return_value , "ino" , stat_sb->st_ino ); + add_assoc_long ( return_value , "mode" , stat_sb->st_mode ); + add_assoc_long ( return_value , "nlink" , stat_sb->st_nlink ); + add_assoc_long ( return_value , "uid" , stat_sb->st_uid ); + add_assoc_long ( return_value , "gid" , stat_sb->st_gid ); + +#ifdef HAVE_ST_RDEV + add_assoc_long ( return_value, "rdev" , stat_sb->st_rdev ); +#endif +#ifdef HAVE_ST_BLKSIZE + add_assoc_long ( return_value , "blksize" , stat_sb->st_blksize ); +#endif + + add_assoc_long ( return_value , "size" , stat_sb->st_size ); + add_assoc_long ( return_value , "atime" , stat_sb->st_atime ); + add_assoc_long ( return_value , "mtime" , stat_sb->st_mtime ); + add_assoc_long ( return_value , "ctime" , stat_sb->st_ctime ); + +#ifdef HAVE_ST_BLOCKS + add_assoc_long ( return_value , "blocks" , stat_sb->st_blocks ); +#endif + return; } php_error(E_WARNING, "didn't understand stat call");

« previous php.cvs (#5655) next »