martin 98/03/25 07:12:07
Modified: src/modules/proxy proxy_util.c
Log:
Hex conversion for EBCDIC hosts added
Revision Changes Path
1.53 +12 -0 apache-1.3/src/modules/proxy/proxy_util.c
Index: proxy_util.c
===================================================================
RCS file: /home/cvs/apache-1.3/src/modules/proxy/proxy_util.c,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -u -r1.52 -r1.53
--- proxy_util.c 1998/03/22 22:21:02 1.52
+++ proxy_util.c 1998/03/25 15:12:05 1.53
@@ -70,6 +70,7 @@
{
int i, ch;
+#ifndef CHARSET_EBCDIC
ch = x[0];
if (isdigit(ch))
i = ch - '0';
@@ -87,10 +88,14 @@
else
i += ch - ('a' - 10);
return i;
+#else /*CHARSET_EBCDIC*/
+ return (1 == sscanf(x, "%2x", &i)) ? i : 0;
+#endif /*CHARSET_EBCDIC*/
}
void proxy_c2hex(int ch, char *x)
{
+#ifndef CHARSET_EBCDIC
int i;
x[0] = '%';
@@ -105,6 +110,13 @@
x[2] = ('A' - 10) + i;
else
x[2] = '0' + i;
+#else /*CHARSET_EBCDIC*/
+ static const char ntoa[] = { "0123456789ABCDEF" };
+ x[0] = '%';
+ x[1] = ntoa[(ch>>4)&0x0F];
+ x[2] = ntoa[ch&0x0F];
+ x[3] = '\0';
+#endif /*CHARSET_EBCDIC*/
}
/*