1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
| /*
* php_text.so
* Grégoire Lejeune <glejeune@aurora-linux.com>
*
* Exemple de module de gestion de chaînes de caracteres
*/
#include "php_text.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/file.h>
/*
* Points dentree du module
*/
zend_function_entry php_text_functions[] = {
ZEND_FE(text, NULL)
{NULL, NULL, NULL}
};
zend_module_entry php_text_module_entry = {
STANDARD_MODULE_HEADER,
"CustomExt Module",
php_text_functions,
NULL, NULL, NULL, NULL, NULL,
NO_VERSION_YET, STANDARD_MODULE_PROPERTIES};
#if COMPILE_DL
DLEXPORT zend_module_entry *get_module(void)
{ return &php_text_module_entry; }
#endif
DLEXPORT PHP_FUNCTION(text)
{
/** Arguments de la fonction PHP */
zval **arg;
/** Verification des parametres */
if (zend_get_parameters_ex( 1, &arg ) != SUCCESS) {
WRONG_PARAM_COUNT;
}
/** Conversion de largument */
convert_to_string( *arg );
/** Chaine renvoyee */
char sResult[256];
int Ss = 12;
Ss *= 15;
sprintf (sResult, "%d", Ss);
//
RETURN_STRING (Function (), 1);
}
har *Function ()
{
// FILE *F = fopen("/home/Amine/Bureau/EXEMPLE/TEST/nohup.out","r");
if (fopen("/home/Amine/Bureau/EXEMPLE/TEST/nohup.out","r") == NULL)
{
switch (errno)
{
case EEXIST:return ("EEXIST");break;
case ENOENT:return ("Le fichier n'existe pas !\n");break;
case EISDIR:return ("EISDIR");break;
case EACCES:return ("EACCES");break;
case ENAMETOOLONG:return ("ENAMETOOLONG");break;
case ENOTDIR:return ("ENOTDIR");break;
case ENXIO:return ("ENXIO");break;
default:return ("Erreur inconnue\n");break;
}
//return ("Chemata makedarche yecrié ");
}
else
return ("Chemata");
} |
Partager