cvs: /php4/ext/standard config.h.stub config.m4 dir.c php3_dir.h

From: Date: Wed, 20 Oct 1999 16:18:01 +0000
Subject: cvs: /php4/ext/standard config.h.stub config.m4 dir.c php3_dir.h
Groups: php.version4 
Request: Send a blank email to php-version4+get-5607@lists.php.net to get a copy of this message
thies Wed Oct 20 12:18:01 1999 EDT Modified files: /php4/ext/standard config.h.stub config.m4 dir.c php3_dir.h Log: (PHP getcwd()) added, needs to porting to Win32 # as we do have chdir() now we have getcwd() - i think we *should* restore the # working directory in RSHUTDOWN! Index: php4/ext/standard/config.h.stub diff -u php4/ext/standard/config.h.stub:1.2 php4/ext/standard/config.h.stub:1.3 --- php4/ext/standard/config.h.stub:1.2 Wed Apr 21 22:48:25 1999 +++ php4/ext/standard/config.h.stub Wed Oct 20 12:17:30 1999 @@ -12,3 +12,6 @@ /* Define if you have libdl (used for dynamic linking) */ #define HAVE_LIBDL 0 + +#undef HAVE_GETWD +#undef HAVE_GETCWD Index: php4/ext/standard/config.m4 diff -u php4/ext/standard/config.m4:1.7 php4/ext/standard/config.m4:1.8 --- php4/ext/standard/config.m4:1.7 Tue Sep 21 16:10:53 1999 +++ php4/ext/standard/config.m4 Wed Oct 20 12:17:30 1999 @@ -1,4 +1,4 @@ -dnl $Id: config.m4,v 1.7 1999/09/21 20:10:53 rasmus Exp $ -*- sh -*- +dnl $Id: config.m4,v 1.8 1999/10/20 16:17:30 thies Exp $ -*- sh -*- divert(1) @@ -118,6 +118,8 @@ AC_ADD_LIBRARY(crypt) AC_DEFINE(HAVE_LIBCRYPT) ], []) +AC_CHECK_FUNCS(getcwd) +AC_CHECK_FUNCS(getwd) divert(3) Index: php4/ext/standard/dir.c diff -u php4/ext/standard/dir.c:1.14 php4/ext/standard/dir.c:1.15 --- php4/ext/standard/dir.c:1.14 Tue Oct 5 12:18:40 1999 +++ php4/ext/standard/dir.c Wed Oct 20 12:17:30 1999 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: dir.c,v 1.14 1999/10/05 16:18:40 sas Exp $ */ +/* $Id: dir.c,v 1.15 1999/10/20 16:17:30 thies Exp $ */ /* {{{ includes/startup/misc */ @@ -86,6 +86,7 @@ PHP_FE(opendir, NULL) PHP_FE(closedir, NULL) PHP_FE(chdir, NULL) + PHP_FE(getcwd, NULL) PHP_FE(rewinddir, NULL) PHP_FE(readdir, NULL) PHP_FALIAS(dir, getdir, NULL) @@ -210,9 +211,10 @@ php3_list_delete(dirp->id); } + /* }}} */ /* {{{ proto int chdir(string directory) -Change the current directory */ + Change the current directory */ PHP_FUNCTION(chdir) { @@ -233,6 +235,35 @@ RETURN_TRUE; } + +/* }}} */ +/* {{{ proto string getcwd() + Gets the current directory */ + +PHP_FUNCTION(getcwd) +{ + char path[MAXPATHLEN]; + char *ret; + + if (ARG_COUNT(ht) != 0) { + WRONG_PARAM_COUNT; + } + +#if HAVE_GETCWD + ret = getcwd(path,MAXPATHLEN-1); +#elif HAVE_GETWD + ret = getwd(path); +#elif +#warning no proper getcwd support for your site +#endif + + if (ret) { + RETURN_STRING(path,1); + } else { + RETURN_FALSE; + } +} + /* }}} */ /* {{{ proto void rewinddir([int dir_handle]) Rewind dir_handle back to the start */ Index: php4/ext/standard/php3_dir.h diff -u php4/ext/standard/php3_dir.h:1.5 php4/ext/standard/php3_dir.h:1.6 --- php4/ext/standard/php3_dir.h:1.5 Tue Oct 5 10:36:00 1999 +++ php4/ext/standard/php3_dir.h Wed Oct 20 12:17:30 1999 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php3_dir.h,v 1.5 1999/10/05 14:36:00 thies Exp $ */ +/* $Id: php3_dir.h,v 1.6 1999/10/20 16:17:30 thies Exp $ */ #ifndef _PHP3_DIR_H #define _PHP3_DIR_H @@ -29,6 +29,7 @@ PHP_FUNCTION(opendir); PHP_FUNCTION(closedir); PHP_FUNCTION(chdir); +PHP_FUNCTION(getcwd); PHP_FUNCTION(rewinddir); PHP_FUNCTION(readdir); PHP_FUNCTION(getdir);

« previous php.version4 (#5607) next »