Re: cvs: php4 /ext/standard basic_functions.c basic_functions.h string.c

From: Date: Thu, 06 Dec 2001 19:26:11 +0000
Subject: Re: cvs: php4 /ext/standard basic_functions.c basic_functions.h string.c
References: 1  Groups: php.cvs 
Request: Send a blank email to php-cvs+get-8484@lists.php.net to get a copy of this message
Can we call it string_rot13()? Andi At 07:02 PM 12/6/2001 +0000, Hartmut Holzgraefe wrote:
hholzgra                Thu Dec  6 14:02:27 2001 EDT
Modified files:
    /php4/ext/standard  basic_functions.c basic_functions.h string.c
Log: ported rot13() from php3 Index: php4/ext/standard/basic_functions.c diff -u php4/ext/standard/basic_functions.c:1.424 php4/ext/standard/basic_functions.c:1.425 --- php4/ext/standard/basic_functions.c:1.424 Mon Dec 3 02:43:53 2001 +++ php4/ext/standard/basic_functions.c Thu Dec 6 14:02:25 2001 @@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
*/ -/* $Id: basic_functions.c,v 1.424 2001/12/03 07:43:53 derick Exp $ */ +/* $Id: basic_functions.c,v 1.425 2001/12/06 19:02:25 hholzgra Exp $ */ #include "php.h" #include "php_main.h" @@ -803,6 +803,7 @@
        PHP_FALIAS(ftok  , warn_not_available,      NULL)
#endif
+       PHP_FE(rot13, NULL)
        {NULL, NULL, NULL}
}; Index: php4/ext/standard/basic_functions.h diff -u php4/ext/standard/basic_functions.h:1.96 php4/ext/standard/basic_functions.h:1.97
--- php4/ext/standard/basic_functions.h:1.96    Sun Oct  7 07:52:09 2001
+++ php4/ext/standard/basic_functions.h Thu Dec 6 14:02:26 2001 @@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
*/ -/* $Id: basic_functions.h,v 1.96 2001/10/07 11:52:09 sterling Exp $ */ +/* $Id: basic_functions.h,v 1.97 2001/12/06 19:02:26 hholzgra Exp $ */ #ifndef BASIC_FUNCTIONS_H #define BASIC_FUNCTIONS_H @@ -115,6 +115,8 @@ /* From the INI parser */ PHP_FUNCTION(parse_ini_file); + +PHP_FUNCTION(rot13); #ifdef PHP_WIN32 typedef unsigned int php_stat_len; Index: php4/ext/standard/string.c diff -u php4/ext/standard/string.c:1.254 php4/ext/standard/string.c:1.255
--- php4/ext/standard/string.c:1.254    Sat Dec  1 10:45:55 2001
+++ php4/ext/standard/string.c Thu Dec 6 14:02:27 2001 @@ -18,7 +18,7 @@
    +----------------------------------------------------------------------+
*/ -/* $Id: string.c,v 1.254 2001/12/01 15:45:55 derick Exp $ */ +/* $Id: string.c,v 1.255 2001/12/06 19:02:27 hholzgra Exp $ */ /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */ @@ -398,6 +398,8 @@ } /* }}} */ +/* {{{ proto string nl_langinfo(int item) + Query language and locale information */ PHP_FUNCTION(nl_langinfo) {
        zval **item;
@@ -3860,6 +3862,30 @@
        }
} /* }}} */ + +/* {{{ proto string rot13(string str) + Perform the rot13 transform on a string */ +PHP_FUNCTION(rot13) +{
+       char *str;
+       int str_len;
+    static char xfrom[] = "abcdefghijklmnopqrstuvwxyz"
+        "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
+    static char xto[] = "nopqrstuvwxyzabcdefghijklm"
+        "NOPQRSTUVWXYZABCDEFGHIJKLM";
+
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s",
+                                                         &str, &str_len) == FAILURE) {
+               return;
+       }
+
+    php_strtr(str, str_len, xfrom, xto, 52);
+       RETURN_STRINGL(str, str_len, 1);
+} +/* }}} */ + + + /* * Local variables: -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-cvs-unsubscribe@lists.php.net For additional commands, e-mail: php-cvs-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net


« previous php.cvs (#8484) next »