MCPcopy Create free account
hub / github.com/acl-dev/acl / main

Function main

lib_acl_cpp/samples/rfc2047/main.cpp:193–388  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

191}
192
193int main(int argc, char* argv[])
194{
195 acl::rfc2047 rfc2047;
196
197 int ch;
198
199 while ((ch = getopt(argc, argv, "hd:e:f:")) > 0)
200 {
201 switch (ch)
202 {
203 case 'h':
204 usage(argv[0]);
205 return (0);
206 case 'd':
207 rfc2047_test(rfc2047, optarg);
208 return (0);
209 case 'e':
210 rfc2047_test_encode(optarg);
211 return (0);
212 case 'f':
213 rfc2047_test_file(rfc2047, optarg);
214 return (0);
215 default:
216 break;
217 }
218 }
219
220 /////////////////////////////////////////////////////////////////////
221
222 const char* s = "[=?UTF-8?Q?=E7=BC=BA=E9=99=B7=20602?=]=?UTF-8?Q?=20=E6=89=80=E5=B1=9E=E9=83=A8=E9=97=A8=E5=BA=94=E4=B8=BA=E4=B8=AD=E6=96=87?=";
223 acl::string out;
224 const char* ptr = s, *end = s + strlen(s);
225
226 while (ptr < end)
227 {
228 rfc2047.decode_update(ptr, 1);
229 ptr++;
230 }
231
232 if (rfc2047.decode_finish("gb2312", &out))
233 {
234 printf(">>ok\n");
235 printf("%s\n", out.c_str());
236 }
237 else
238 printf(">>error: %s\n", out.c_str());
239
240 /////////////////////////////////////////////////////////////////////
241
242 s = "=?GB2312?B?yO28/r+qt6IyLjC087vh\r\n"
243 " IM3FubrT\r\n"
244 " xbvd1tA=?=";
245 rfc2047_test(rfc2047, s);
246
247 /////////////////////////////////////////////////////////////////////
248
249 s = "Re: [hiphop-php-dev] Why does hiphop delete my output directory?";
250 rfc2047_test(rfc2047, s);

Callers

nothing calls this directly

Calls 9

rfc2047_testFunction · 0.85
rfc2047_test_encodeFunction · 0.85
rfc2047_test_fileFunction · 0.85
rfc2047_test2Function · 0.85
usageFunction · 0.70
getoptFunction · 0.50
decode_updateMethod · 0.45
decode_finishMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…