diff options
Diffstat (limited to 'src/main/extract.c')
-rw-r--r-- | src/main/extract.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/main/extract.c b/src/main/extract.c index 61f2e21..95a2170 100644 --- a/src/main/extract.c +++ b/src/main/extract.c | |||
@@ -245,7 +245,9 @@ print_help () | |||
245 | 245 | ||
246 | } | 246 | } |
247 | 247 | ||
248 | #if HAVE_ICONV | ||
248 | #include "iconv.c" | 249 | #include "iconv.c" |
250 | #endif | ||
249 | 251 | ||
250 | /** | 252 | /** |
251 | * Print a keyword list to a file. | 253 | * Print a keyword list to a file. |
@@ -273,7 +275,9 @@ print_selected_keywords (void *cls, | |||
273 | size_t data_len) | 275 | size_t data_len) |
274 | { | 276 | { |
275 | char *keyword; | 277 | char *keyword; |
278 | #if HAVE_ICONV | ||
276 | iconv_t cd; | 279 | iconv_t cd; |
280 | #endif | ||
277 | const char *stype; | 281 | const char *stype; |
278 | const char *mt; | 282 | const char *mt; |
279 | 283 | ||
@@ -294,12 +298,14 @@ print_selected_keywords (void *cls, | |||
294 | (unsigned int) data_len); | 298 | (unsigned int) data_len); |
295 | break; | 299 | break; |
296 | case EXTRACTOR_METAFORMAT_UTF8: | 300 | case EXTRACTOR_METAFORMAT_UTF8: |
301 | #if HAVE_ICONV | ||
297 | cd = iconv_open (nl_langinfo(CODESET), "UTF-8"); | 302 | cd = iconv_open (nl_langinfo(CODESET), "UTF-8"); |
298 | if (((iconv_t) -1) != cd) | 303 | if (((iconv_t) -1) != cd) |
299 | keyword = iconv_helper (cd, | 304 | keyword = iconv_helper (cd, |
300 | data, | 305 | data, |
301 | data_len); | 306 | data_len); |
302 | else | 307 | else |
308 | #endif | ||
303 | keyword = strdup (data); | 309 | keyword = strdup (data); |
304 | if (NULL != keyword) | 310 | if (NULL != keyword) |
305 | { | 311 | { |
@@ -309,8 +315,10 @@ print_selected_keywords (void *cls, | |||
309 | keyword); | 315 | keyword); |
310 | free (keyword); | 316 | free (keyword); |
311 | } | 317 | } |
318 | #if HAVE_ICONV | ||
312 | if (((iconv_t) -1) != cd) | 319 | if (((iconv_t) -1) != cd) |
313 | iconv_close (cd); | 320 | iconv_close (cd); |
321 | #endif | ||
314 | break; | 322 | break; |
315 | case EXTRACTOR_METAFORMAT_BINARY: | 323 | case EXTRACTOR_METAFORMAT_BINARY: |
316 | fprintf (stdout, | 324 | fprintf (stdout, |
@@ -358,7 +366,9 @@ print_selected_keywords_grep_friendly (void *cls, | |||
358 | size_t data_len) | 366 | size_t data_len) |
359 | { | 367 | { |
360 | char *keyword; | 368 | char *keyword; |
369 | #if HAVE_ICONV | ||
361 | iconv_t cd; | 370 | iconv_t cd; |
371 | #endif | ||
362 | const char *mt; | 372 | const char *mt; |
363 | 373 | ||
364 | if (YES != print[type]) | 374 | if (YES != print[type]) |
@@ -375,12 +385,14 @@ print_selected_keywords_grep_friendly (void *cls, | |||
375 | fprintf (stdout, | 385 | fprintf (stdout, |
376 | "%s: ", | 386 | "%s: ", |
377 | gettext(mt)); | 387 | gettext(mt)); |
388 | #if HAVE_ICONV | ||
378 | cd = iconv_open (nl_langinfo (CODESET), "UTF-8"); | 389 | cd = iconv_open (nl_langinfo (CODESET), "UTF-8"); |
379 | if (((iconv_t) -1) != cd) | 390 | if (((iconv_t) -1) != cd) |
380 | keyword = iconv_helper (cd, | 391 | keyword = iconv_helper (cd, |
381 | data, | 392 | data, |
382 | data_len); | 393 | data_len); |
383 | else | 394 | else |
395 | #endif | ||
384 | keyword = strdup (data); | 396 | keyword = strdup (data); |
385 | if (NULL != keyword) | 397 | if (NULL != keyword) |
386 | { | 398 | { |
@@ -389,8 +401,10 @@ print_selected_keywords_grep_friendly (void *cls, | |||
389 | keyword); | 401 | keyword); |
390 | free (keyword); | 402 | free (keyword); |
391 | } | 403 | } |
404 | #if HAVE_ICONV | ||
392 | if (((iconv_t) -1) != cd) | 405 | if (((iconv_t) -1) != cd) |
393 | iconv_close (cd); | 406 | iconv_close (cd); |
407 | #endif | ||
394 | break; | 408 | break; |
395 | case EXTRACTOR_METAFORMAT_BINARY: | 409 | case EXTRACTOR_METAFORMAT_BINARY: |
396 | break; | 410 | break; |