CVS update: php31/ext/standard
| From: | shane | Date: | Thu, 27 Aug 1998 21:24:39 +0000 |
| Subject: | CVS update: php31/ext/standard | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-624@lists.php.net to get a copy of this message | ||
Date: Thursday August 27, 1998 @ 17:24
Author: shane
Update of /repository/php31/ext/standard
In directory asf:/u2/tmp/cvs-serv2042/ext/standard
Modified Files:
dl.c
Log Message:
added ability to leave off extensions when loading dl's
Index: php31/ext/standard/dl.c
diff -c php31/ext/standard/dl.c:2.1 php31/ext/standard/dl.c:2.2
*** php31/ext/standard/dl.c:2.1 Fri Aug 14 00:32:02 1998
--- php31/ext/standard/dl.c Thu Aug 27 17:24:38 1998
***************
*** 48,58 ****
#else
#include <strings.h>
#endif
! #if MSVC5
#include "os/nt/param.h"
#include "os/nt/winutil.h"
#else
#include <sys/param.h>
#endif
#ifdef THREAD_SAFE
--- 48,60 ----
#else
#include <strings.h>
#endif
! #if (WIN32|WINNT)
#include "os/nt/param.h"
#include "os/nt/winutil.h"
+ #define DL_EXT ".dll"
#else
#include <sys/param.h>
+ #define DL_EXT ".so"
#endif
#ifdef THREAD_SAFE
***************
*** 87,99 ****
WRONG_PARAM_COUNT;
}
- convert_to_string(file);
-
if (!GLOBAL(php3_ini)->enable_dl) {
php3_error(E_ERROR, "Dynamically loaded extentions aren't enabled.");
} else if (GLOBAL(php3_ini)->safe_mode) {
php3_error(E_ERROR, "Dynamically loaded extensions aren't allowed when running in SAFE
MODE.");
} else {
php3_dl(file->value.str.val,MODULE_TEMPORARY,return_value);
}
}
--- 89,100 ----
WRONG_PARAM_COUNT;
}
if (!GLOBAL(php3_ini)->enable_dl) {
php3_error(E_ERROR, "Dynamically loaded extentions aren't enabled.");
} else if (GLOBAL(php3_ini)->safe_mode) {
php3_error(E_ERROR, "Dynamically loaded extensions aren't allowed when running in SAFE
MODE.");
} else {
+ convert_to_string(file);
php3_dl(file->value.str.val,MODULE_TEMPORARY,return_value);
}
}
***************
*** 104,109 ****
--- 105,111 ----
void php3_dl(char *file,int type,pval *return_value)
{
void *handle;
+ char filename[MAXPATHLEN + 1];
char libpath[MAXPATHLEN + 1];
php3_module_entry *module_entry;
php3_module_entry *(*get_module)(void);
***************
*** 111,130 ****
if (cfg_get_string("extension_dir",&GLOBAL(php3_ini)->extension_dir)==SUCCESS
&& GLOBAL(php3_ini)->extension_dir){
int extension_dir_len = strlen(GLOBAL(php3_ini)->extension_dir);
if (GLOBAL(php3_ini)->extension_dir[extension_dir_len-1]=='/' ||
GLOBAL(php3_ini)->extension_dir[extension_dir_len-1]=='\\') {
! sprintf(libpath,"%s%s",GLOBAL(php3_ini)->extension_dir,file); /* SAFE */
} else {
! sprintf(libpath,"%s/%s",GLOBAL(php3_ini)->extension_dir,file); /* SAFE */
}
} else {
! sprintf(libpath,"%s",file); /* SAFE */
}
/* load dynamic symbol */
handle = dlopen(libpath, RTLD_LAZY);
if (!handle) {
! #if MSVC5
php3_error(E_ERROR,"Unable to load dynamic library
'%s'<br>\n%s",libpath,php3_win_err());
#else
php3_error(E_ERROR,"Unable to load dynamic library '%s' -
%s",libpath,dlerror());
--- 113,139 ----
if (cfg_get_string("extension_dir",&GLOBAL(php3_ini)->extension_dir)==SUCCESS
&& GLOBAL(php3_ini)->extension_dir){
int extension_dir_len = strlen(GLOBAL(php3_ini)->extension_dir);
+
+ if (!strstr(file,DL_EXT)){
+ /*add the extension on*/
+ snprintf(filename,MAXPATHLEN + 1,"%s%s",file,DL_EXT);
+ }else{
+ snprintf(filename,MAXPATHLEN + 1,"%s",file);
+ }
if (GLOBAL(php3_ini)->extension_dir[extension_dir_len-1]=='/' ||
GLOBAL(php3_ini)->extension_dir[extension_dir_len-1]=='\\') {
! snprintf(libpath,MAXPATHLEN + 1,"%s%s",GLOBAL(php3_ini)->extension_dir,filename);
/* SAFE */
} else {
! snprintf(libpath,MAXPATHLEN + 1,"%s/%s",GLOBAL(php3_ini)->extension_dir,filename);
/* SAFE */
}
} else {
! snprintf(libpath,MAXPATHLEN + 1,"%s",filename); /* SAFE */
}
/* load dynamic symbol */
handle = dlopen(libpath, RTLD_LAZY);
if (!handle) {
! #if (WIN32|WINNT)
php3_error(E_ERROR,"Unable to load dynamic library
'%s'<br>\n%s",libpath,php3_win_err());
#else
php3_error(E_ERROR,"Unable to load dynamic library '%s' -
%s",libpath,dlerror());
--
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