Question.
| From: | Andy Witrisna | Date: | Fri, 07 Apr 2000 23:01:40 +0000 |
| Subject: | Question. | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-17721@lists.php.net to get a copy of this message | ||
I am really interest in develop php, I am trying to add my simple function to
php, but its not work for me. I am using php-3.0.15.
I add a file call strcase.c and php3_strcase.h in functions dir.
Here is my strcase.c
#include "php.h"
#include "internal_functions.h"
#include "fopen-wrappers.h"
#include "php3_list.h"
#include "php3_strcase.h"
#ifdef HAVE_DIRENT_H
# include <dirent.h>
#endif
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#include <errno.h>
function_entry php3_strcase_functions[] = {
{"strtoupper", php3_touppercase, NULL},
{"strtolower", php3_tolowercase, NULL},
{NULL, NULL, NULL}
};
php3_module_entry php3_strcase_module_entry = {
"PHP_case", php3_strcase_functions, NULL, NULL, NULL, NULL, NULL,
STANDARD_MODULE_PROPERTIES
};
static char *strtoupper(char *s)
{
char *c;
int ch;
c = s;
while (*c) {
ch = toupper((unsigned char)*c);
*c++ = ch;
}
return (s);
}
void php3_touppercase(INTERNAL_FUNCTION_PARAMETERS)
{
pval *arg;
char *ret;
TLS_VARS;
if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg) == FAILURE) {
WRONG_PARAM_COUNT;
}
convert_to_string(arg);
ret = strtoupper(arg->value.str.val);
RETVAL_STRING(ret,1);
}
static char *strtolower(char *s)
{
register int ch;
char *c;
c = s;
while (*c) {
ch = tolower((unsigned char)*c);
*c++ = ch;
}
return (s);
}
void php3_tolowercase(INTERNAL_FUNCTION_PARAMETERS)
{
pval *arg;
char *ret;
TLS_VARS;
if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg) == FAILURE) {
WRONG_PARAM_COUNT;
}
convert_to_string(arg);
ret = strtolower(arg->value.str.val);
RETVAL_STRING(ret,1);
}
I compile it and try to run tolowercase() it doesn't work.
Following is the step I build php.
-make
-make install
go to apache dir and do make
-make install
then run the httpd
Did I missed some step?
Thank you.
Andy