Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042 #include <stdio.h>
00043 #include <curl/curl.h>
00044
00045 CURLcode my_conv_from_ascii_to_ebcdic(char *buffer, size_t length)
00046 {
00047 char *tempptrin, *tempptrout;
00048 size_t bytes = length;
00049 int rc;
00050 tempptrin = tempptrout = buffer;
00051 rc = platform_a2e(&tempptrin, &bytes, &tempptrout, &bytes);
00052 if(rc == PLATFORM_CONV_OK) {
00053 return CURLE_OK;
00054 }
00055 else {
00056 return CURLE_CONV_FAILED;
00057 }
00058 }
00059
00060 CURLcode my_conv_from_ebcdic_to_ascii(char *buffer, size_t length)
00061 {
00062 char *tempptrin, *tempptrout;
00063 size_t bytes = length;
00064 int rc;
00065 tempptrin = tempptrout = buffer;
00066 rc = platform_e2a(&tempptrin, &bytes, &tempptrout, &bytes);
00067 if(rc == PLATFORM_CONV_OK) {
00068 return CURLE_OK;
00069 }
00070 else {
00071 return CURLE_CONV_FAILED;
00072 }
00073 }
00074
00075 CURLcode my_conv_from_utf8_to_ebcdic(char *buffer, size_t length)
00076 {
00077 char *tempptrin, *tempptrout;
00078 size_t bytes = length;
00079 int rc;
00080 tempptrin = tempptrout = buffer;
00081 rc = platform_u2e(&tempptrin, &bytes, &tempptrout, &bytes);
00082 if(rc == PLATFORM_CONV_OK) {
00083 return CURLE_OK;
00084 }
00085 else {
00086 return CURLE_CONV_FAILED;
00087 }
00088 }
00089
00090 int main(void)
00091 {
00092 CURL *curl;
00093 CURLcode res;
00094
00095 curl = curl_easy_init();
00096 if(curl) {
00097 curl_easy_setopt(curl, CURLOPT_URL, "http://example.com");
00098
00099
00100 curl_easy_setopt(curl, CURLOPT_CONV_FROM_NETWORK_FUNCTION,
00101 my_conv_from_ascii_to_ebcdic);
00102 curl_easy_setopt(curl, CURLOPT_CONV_TO_NETWORK_FUNCTION,
00103 my_conv_from_ebcdic_to_ascii);
00104 curl_easy_setopt(curl, CURLOPT_CONV_FROM_UTF8_FUNCTION,
00105 my_conv_from_utf8_to_ebcdic);
00106
00107 res = curl_easy_perform(curl);
00108
00109
00110 curl_easy_cleanup(curl);
00111 }
00112 return 0;
00113 }