XXX: prep_string should translate the string into unicode, * such that it is compatible with whatever codepage the client * will read characters 80-ff. For the moment, use the unicode * values 0080-00ff. This isn't trivial, since the code page * varies between msdos and Windows applications. * For subsystem 2 [GUI] the default is the system Ansi CP. * For subsystem 3 [CLI] the default is t
| 103 | * For subsystem 3 [CLI] the default is the system OEM CP. |
| 104 | */ |
| 105 | static void prep_string(const char ** str, apr_pool_t *p) |
| 106 | { |
| 107 | const char *ch = *str; |
| 108 | char *ch2; |
| 109 | apr_size_t widen = 0; |
| 110 | |
| 111 | if (!ch) { |
| 112 | return; |
| 113 | } |
| 114 | while (*ch) { |
| 115 | if (*(ch++) & 0x80) { |
| 116 | ++widen; |
| 117 | } |
| 118 | } |
| 119 | if (!widen) { |
| 120 | return; |
| 121 | } |
| 122 | widen += (ch - *str) + 1; |
| 123 | ch = *str; |
| 124 | *str = ch2 = apr_palloc(p, widen); |
| 125 | while (*ch) { |
| 126 | if (*ch & 0x80) { |
| 127 | /* sign extension won't hurt us here */ |
| 128 | *(ch2++) = 0xC0 | ((*ch >> 6) & 0x03); |
| 129 | *(ch2++) = 0x80 | (*(ch++) & 0x3f); |
| 130 | } |
| 131 | else { |
| 132 | *(ch2++) = *(ch++); |
| 133 | } |
| 134 | } |
| 135 | *(ch2++) = '\0'; |
| 136 | } |
| 137 | |
| 138 | /* Somewhat more exciting ... figure out where the registry has stashed the |
| 139 | * ExecCGI or Open command - it may be nested one level deep (or more???) |
no outgoing calls
no test coverage detected