CVS update: php3/functions

From: Date: Mon, 14 Sep 1998 15:55:09 +0000
Subject: CVS update: php3/functions
Groups: php.dev 
Request: Send a blank email to php-dev+get-1055@lists.php.net to get a copy of this message
Date: Monday September 14, 1998 @ 11:55 Author: martin Update of /repository/php3/functions In directory asf:/u2/tmp/cvs-serv11483 Modified Files: url.c Log Message: For the Apache-integrated version of PHP3, add EBCDIC conversion for those parts of urldecode()/urlencode() which are codeset-specific. Index: php3/functions/url.c diff -c php3/functions/url.c:1.36 php3/functions/url.c:1.37 *** php3/functions/url.c:1.36 Fri May 22 08:54:46 1998 --- php3/functions/url.c Mon Sep 14 11:55:08 1998 *************** *** 26,32 **** | Author: Jim Winstead (jimw@php.net) | +----------------------------------------------------------------------+ */ ! /* $Id: url.c,v 1.36 1998/05/22 12:54:46 zeev Exp $ */ #include <stdlib.h> #include <string.h> --- 26,32 ---- | Author: Jim Winstead (jimw@php.net) | +----------------------------------------------------------------------+ */ ! /* $Id: url.c,v 1.37 1998/09/14 15:55:08 martin Exp $ */ #include <stdlib.h> #include <string.h> *************** *** 41,47 **** --- 41,51 ---- #include "internal_functions.h" #include "url.h" + #ifdef CHARSET_EBCDIC + #include "ebcdic.h" + #endif /*CHARSET_EBCDIC*/ + void free_url(url * theurl) { if (theurl->scheme) *************** *** 222,227 **** --- 226,232 ---- str[y] = (unsigned char) s[x]; if (str[y] == ' ') { str[y] = '+'; + #ifndef CHARSET_EBCDIC } else if ((str[y] < '0' && str[y] != '-' && str[y] != '.') || (str[y] < 'A' && str[y] > '9') || (str[y] > 'Z' && str[y] < 'a' && str[y] != '_') || *************** *** 230,235 **** --- 235,247 ---- str[y++] = hexchars[(unsigned char) s[x] >> 4]; str[y] = hexchars[(unsigned char) s[x] & 15]; } + #else /*CHARSET_EBCDIC*/ + } else if (!isalnum(str[y]) && strchr("_-.", str[y]) != NULL) { + str[y++] = '%'; + str[y++] = hexchars[os_toascii[(unsigned char) s[x]] >> 4]; + str[y] = hexchars[os_toascii[(unsigned char) s[x]] & 0x0F]; + } + #endif /*CHARSET_EBCDIC*/ } str[y] = '\0'; return ((char *) str); *************** *** 282,288 **** --- 294,304 ---- if (*data == '+') *dest = ' '; else if (*data == '%' && len >= 2 && isxdigit((int) *(data + 1)) && isxdigit((int) *(data + 2))) { + #ifndef CHARSET_EBCDIC *dest = (char) php3_htoi(data + 1); + #else + *dest = os_toebcdic[(char) php3_htoi(data + 1)]; + #endif data += 2; len -= 2; } else *************** *** 302,307 **** --- 318,324 ---- str = (unsigned char *) emalloc(3 * len + 1); for (x = 0, y = 0; len--; x++, y++) { str[y] = (unsigned char) s[x]; + #ifndef CHARSET_EBCDIC if ((str[y] < '0' && str[y] != '-' && str[y] != '.') || (str[y] < 'A' && str[y] > '9') || (str[y] > 'Z' && str[y] < 'a' && str[y] != '_') || *************** *** 309,314 **** --- 326,337 ---- str[y++] = '%'; str[y++] = hexchars[(unsigned char) s[x] >> 4]; str[y] = hexchars[(unsigned char) s[x] & 15]; + #else /*CHARSET_EBCDIC*/ + if (!isalnum(str[y]) && strchr("_-.", str[y]) != NULL) { + str[y++] = '%'; + str[y++] = hexchars[os_toascii[(unsigned char) s[x]] >> 4]; + str[y] = hexchars[os_toascii[(unsigned char) s[x]] & 15]; + #endif /*CHARSET_EBCDIC*/ } } str[y] = '\0'; *************** *** 360,366 **** --- 383,393 ---- while (len--) { if (*data == '%' && len >= 2 && isxdigit((int) *(data + 1)) && isxdigit((int) *(data + 2))) { + #ifndef CHARSET_EBCDIC *dest = (char) php3_htoi(data + 1); + #else + *dest = os_toebcdic[(char) php3_htoi(data + 1)]; + #endif data += 2; len -= 2; } else -- 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

« previous php.dev (#1055) next »