aboutsummaryrefslogtreecommitdiff
path: root/src/main/extract.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/extract.c')
-rw-r--r--src/main/extract.c70
1 files changed, 35 insertions, 35 deletions
diff --git a/src/main/extract.c b/src/main/extract.c
index 144f2c3..5efc53a 100644
--- a/src/main/extract.c
+++ b/src/main/extract.c
@@ -70,7 +70,7 @@ ignore_sigpipe ()
70 sig.sa_flags = SA_RESTART; 70 sig.sa_flags = SA_RESTART;
71#endif 71#endif
72 if (0 != sigaction (SIGPIPE, &sig, &oldsig)) 72 if (0 != sigaction (SIGPIPE, &sig, &oldsig))
73 FPRINTF (stderr, 73 fprintf (stderr,
74 "Failed to install SIGPIPE handler: %s\n", strerror (errno)); 74 "Failed to install SIGPIPE handler: %s\n", strerror (errno));
75} 75}
76 76
@@ -290,7 +290,7 @@ print_selected_keywords (void *cls,
290 if (YES != print[type]) 290 if (YES != print[type])
291 return 0; 291 return 0;
292 if (verbose > 3) 292 if (verbose > 3)
293 FPRINTF (stdout, 293 fprintf (stdout,
294 _ ("Found by `%s' plugin:\n"), 294 _ ("Found by `%s' plugin:\n"),
295 plugin_name); 295 plugin_name);
296 mt = EXTRACTOR_metatype_to_string (type); 296 mt = EXTRACTOR_metatype_to_string (type);
@@ -298,7 +298,7 @@ print_selected_keywords (void *cls,
298 switch (format) 298 switch (format)
299 { 299 {
300 case EXTRACTOR_METAFORMAT_UNKNOWN: 300 case EXTRACTOR_METAFORMAT_UNKNOWN:
301 FPRINTF (stdout, 301 fprintf (stdout,
302 _ ("%s - (unknown, %u bytes)\n"), 302 _ ("%s - (unknown, %u bytes)\n"),
303 stype, 303 stype,
304 (unsigned int) data_len); 304 (unsigned int) data_len);
@@ -317,7 +317,7 @@ print_selected_keywords (void *cls,
317 keyword = strdup (data); 317 keyword = strdup (data);
318 if (NULL != keyword) 318 if (NULL != keyword)
319 { 319 {
320 FPRINTF (stdout, 320 fprintf (stdout,
321 "%s - %s\n", 321 "%s - %s\n",
322 stype, 322 stype,
323 keyword); 323 keyword);
@@ -329,13 +329,13 @@ print_selected_keywords (void *cls,
329#endif 329#endif
330 break; 330 break;
331 case EXTRACTOR_METAFORMAT_BINARY: 331 case EXTRACTOR_METAFORMAT_BINARY:
332 FPRINTF (stdout, 332 fprintf (stdout,
333 _ ("%s - (binary, %u bytes)\n"), 333 _ ("%s - (binary, %u bytes)\n"),
334 stype, 334 stype,
335 (unsigned int) data_len); 335 (unsigned int) data_len);
336 break; 336 break;
337 case EXTRACTOR_METAFORMAT_C_STRING: 337 case EXTRACTOR_METAFORMAT_C_STRING:
338 FPRINTF (stdout, 338 fprintf (stdout,
339 "%s - %.*s\n", 339 "%s - %.*s\n",
340 stype, 340 stype,
341 (int) data_len, 341 (int) data_len,
@@ -392,7 +392,7 @@ print_selected_keywords_grep_friendly (void *cls,
392 if (0 == data_len) 392 if (0 == data_len)
393 return 0; 393 return 0;
394 if (verbose > 1) 394 if (verbose > 1)
395 FPRINTF (stdout, 395 fprintf (stdout,
396 "%s: ", 396 "%s: ",
397 gettext (mt)); 397 gettext (mt));
398#if HAVE_ICONV 398#if HAVE_ICONV
@@ -406,7 +406,7 @@ print_selected_keywords_grep_friendly (void *cls,
406 keyword = strdup (data); 406 keyword = strdup (data);
407 if (NULL != keyword) 407 if (NULL != keyword)
408 { 408 {
409 FPRINTF (stdout, 409 fprintf (stdout,
410 "`%s' ", 410 "`%s' ",
411 keyword); 411 keyword);
412 free (keyword); 412 free (keyword);
@@ -420,10 +420,10 @@ print_selected_keywords_grep_friendly (void *cls,
420 break; 420 break;
421 case EXTRACTOR_METAFORMAT_C_STRING: 421 case EXTRACTOR_METAFORMAT_C_STRING:
422 if (verbose > 1) 422 if (verbose > 1)
423 FPRINTF (stdout, 423 fprintf (stdout,
424 "%s ", 424 "%s ",
425 gettext (mt)); 425 gettext (mt));
426 FPRINTF (stdout, 426 fprintf (stdout,
427 "`%s'", 427 "`%s'",
428 data); 428 data);
429 break; 429 break;
@@ -575,7 +575,7 @@ finish_bibtex (const char *fn)
575 if ( (NULL == btm[0].value) || 575 if ( (NULL == btm[0].value) ||
576 (NULL == btm[1].value) || 576 (NULL == btm[1].value) ||
577 (NULL == btm[2].value) ) 577 (NULL == btm[2].value) )
578 FPRINTF (stdout, 578 fprintf (stdout,
579 "@%s %s { ", 579 "@%s %s { ",
580 et, 580 et,
581 fn); 581 fn);
@@ -592,18 +592,18 @@ finish_bibtex (const char *fn)
592 temp[n] = '_'; 592 temp[n] = '_';
593 else 593 else
594 temp[n] = tolower ( (unsigned char) temp[n]); 594 temp[n] = tolower ( (unsigned char) temp[n]);
595 FPRINTF (stdout, 595 fprintf (stdout,
596 "@%s %s { ", 596 "@%s %s { ",
597 et, 597 et,
598 temp); 598 temp);
599 } 599 }
600 for (i = 0; NULL != btm[i].bibTexName; i++) 600 for (i = 0; NULL != btm[i].bibTexName; i++)
601 if (NULL != btm[i].value) 601 if (NULL != btm[i].value)
602 FPRINTF (stdout, 602 fprintf (stdout,
603 "\t%s = {%s},\n", 603 "\t%s = {%s},\n",
604 btm[i].bibTexName, 604 btm[i].bibTexName,
605 btm[i].value); 605 btm[i].value);
606 FPRINTF (stdout, "%s", "}\n\n"); 606 fprintf (stdout, "%s", "}\n\n");
607} 607}
608 608
609 609
@@ -775,7 +775,7 @@ main (int argc, char *argv[])
775#endif 775#endif
776 if (NULL == (print = malloc (sizeof (int) * EXTRACTOR_metatype_get_max ()))) 776 if (NULL == (print = malloc (sizeof (int) * EXTRACTOR_metatype_get_max ())))
777 { 777 {
778 FPRINTF (stderr, 778 fprintf (stderr,
779 "malloc failed: %s\n", 779 "malloc failed: %s\n",
780 strerror (errno)); 780 strerror (errno));
781 return 1; 781 return 1;
@@ -785,7 +785,7 @@ main (int argc, char *argv[])
785 785
786 if (0 != _get_utf8_args (argc, argv, &utf8_argc, &utf8_argv)) 786 if (0 != _get_utf8_args (argc, argv, &utf8_argc, &utf8_argv))
787 { 787 {
788 FPRINTF (stderr, "Failed to get arguments: %s\n", strerror (errno)); 788 fprintf (stderr, "Failed to get arguments: %s\n", strerror (errno));
789 return 1; 789 return 1;
790 } 790 }
791 791
@@ -821,7 +821,7 @@ main (int argc, char *argv[])
821 bibtex = YES; 821 bibtex = YES;
822 if (NULL != processor) 822 if (NULL != processor)
823 { 823 {
824 FPRINTF (stderr, 824 fprintf (stderr,
825 "%s", 825 "%s",
826 _ ( 826 _ (
827 "Illegal combination of options, cannot combine multiple styles of printing.\n")); 827 "Illegal combination of options, cannot combine multiple styles of printing.\n"));
@@ -834,7 +834,7 @@ main (int argc, char *argv[])
834 grepfriendly = YES; 834 grepfriendly = YES;
835 if (NULL != processor) 835 if (NULL != processor)
836 { 836 {
837 FPRINTF (stderr, 837 fprintf (stderr,
838 "%s", 838 "%s",
839 _ ( 839 _ (
840 "Illegal combination of options, cannot combine multiple styles of printing.\n")); 840 "Illegal combination of options, cannot combine multiple styles of printing.\n"));
@@ -869,7 +869,7 @@ main (int argc, char *argv[])
869 case 'p': 869 case 'p':
870 if (NULL == optarg) 870 if (NULL == optarg)
871 { 871 {
872 FPRINTF (stderr, 872 fprintf (stderr,
873 _ ( 873 _ (
874 "You must specify an argument for the `%s' option (option ignored).\n"), 874 "You must specify an argument for the `%s' option (option ignored).\n"),
875 "-p"); 875 "-p");
@@ -898,7 +898,7 @@ main (int argc, char *argv[])
898 } 898 }
899 if (NULL == EXTRACTOR_metatype_to_string (i)) 899 if (NULL == EXTRACTOR_metatype_to_string (i))
900 { 900 {
901 FPRINTF (stderr, 901 fprintf (stderr,
902 "Unknown keyword type `%s', use option `%s' to get a list.\n", 902 "Unknown keyword type `%s', use option `%s' to get a list.\n",
903 optarg, 903 optarg,
904 "-L"); 904 "-L");
@@ -929,7 +929,7 @@ main (int argc, char *argv[])
929 } 929 }
930 if (NULL == EXTRACTOR_metatype_to_string (i)) 930 if (NULL == EXTRACTOR_metatype_to_string (i))
931 { 931 {
932 FPRINTF (stderr, 932 fprintf (stderr,
933 "Unknown keyword type `%s', use option `%s' to get a list.\n", 933 "Unknown keyword type `%s', use option `%s' to get a list.\n",
934 optarg, 934 optarg,
935 "-L"); 935 "-L");
@@ -938,7 +938,7 @@ main (int argc, char *argv[])
938 } 938 }
939 break; 939 break;
940 default: 940 default:
941 FPRINTF (stderr, 941 fprintf (stderr,
942 "%s", 942 "%s",
943 _ ("Use --help to get a list of options.\n")); 943 _ ("Use --help to get a list of options.\n"));
944 free (utf8_argv); 944 free (utf8_argv);
@@ -947,7 +947,7 @@ main (int argc, char *argv[])
947 } /* while (1) */ 947 } /* while (1) */
948 if (optind < 0) 948 if (optind < 0)
949 { 949 {
950 FPRINTF (stderr, 950 fprintf (stderr,
951 "%s", "Unknown error parsing options\n"); 951 "%s", "Unknown error parsing options\n");
952 free (print); 952 free (print);
953 free (utf8_argv); 953 free (utf8_argv);
@@ -955,7 +955,7 @@ main (int argc, char *argv[])
955 } 955 }
956 if (utf8_argc - optind < 1) 956 if (utf8_argc - optind < 1)
957 { 957 {
958 FPRINTF (stderr, 958 fprintf (stderr,
959 "%s", "Invoke with list of filenames to extract keywords form!\n"); 959 "%s", "Invoke with list of filenames to extract keywords form!\n");
960 free (print); 960 free (print);
961 free (utf8_argv); 961 free (utf8_argv);
@@ -980,15 +980,15 @@ main (int argc, char *argv[])
980 980
981 /* extract keywords */ 981 /* extract keywords */
982 if (YES == bibtex) 982 if (YES == bibtex)
983 FPRINTF (stdout, 983 fprintf (stdout,
984 "%s", _ ("% BiBTeX file\n")); 984 "%s", _ ("% BiBTeX file\n"));
985 for (i = optind; i < utf8_argc; i++) 985 for (i = optind; i < utf8_argc; i++)
986 { 986 {
987 errno = 0; 987 errno = 0;
988 if (YES == grepfriendly) 988 if (YES == grepfriendly)
989 FPRINTF (stdout, "%s ", utf8_argv[i]); 989 fprintf (stdout, "%s ", utf8_argv[i]);
990 else if (NO == bibtex) 990 else if (NO == bibtex)
991 FPRINTF (stdout, 991 fprintf (stdout,
992 _ ("Keywords for file %s:\n"), 992 _ ("Keywords for file %s:\n"),
993 utf8_argv[i]); 993 utf8_argv[i]);
994 else 994 else
@@ -1003,15 +1003,15 @@ main (int argc, char *argv[])
1003 { 1003 {
1004 struct stat sb; 1004 struct stat sb;
1005 unsigned char *data = NULL; 1005 unsigned char *data = NULL;
1006 int f = OPEN (utf8_argv[i], O_RDONLY 1006 int f = open (utf8_argv[i], O_RDONLY
1007#if WINDOWS 1007#if WINDOWS
1008 | O_BINARY 1008 | O_BINARY
1009#endif 1009#endif
1010 ); 1010 );
1011 if ( (-1 != f) && 1011 if ( (-1 != f) &&
1012 (0 == FSTAT (f, &sb)) && 1012 (0 == fstat (f, &sb)) &&
1013 (NULL != (data = malloc ((size_t) sb.st_size))) && 1013 (NULL != (data = malloc ((size_t) sb.st_size))) &&
1014 (sb.st_size == READ (f, data, (size_t) sb.st_size) ) ) 1014 (sb.st_size == read (f, data, (size_t) sb.st_size) ) )
1015 { 1015 {
1016 EXTRACTOR_extract (plugins, 1016 EXTRACTOR_extract (plugins,
1017 NULL, 1017 NULL,
@@ -1022,7 +1022,7 @@ main (int argc, char *argv[])
1022 else 1022 else
1023 { 1023 {
1024 if (verbose > 0) 1024 if (verbose > 0)
1025 FPRINTF (stderr, 1025 fprintf (stderr,
1026 "%s: %s: %s\n", 1026 "%s: %s: %s\n",
1027 utf8_argv[0], utf8_argv[i], strerror (errno)); 1027 utf8_argv[0], utf8_argv[i], strerror (errno));
1028 ret = 1; 1028 ret = 1;
@@ -1030,18 +1030,18 @@ main (int argc, char *argv[])
1030 if (NULL != data) 1030 if (NULL != data)
1031 free (data); 1031 free (data);
1032 if (-1 != f) 1032 if (-1 != f)
1033 (void) CLOSE (f); 1033 (void) close (f);
1034 } 1034 }
1035 if (YES == grepfriendly) 1035 if (YES == grepfriendly)
1036 FPRINTF (stdout, "%s", "\n"); 1036 fprintf (stdout, "%s", "\n");
1037 continue; 1037 continue;
1038 } 1038 }
1039 if (YES == grepfriendly) 1039 if (YES == grepfriendly)
1040 FPRINTF (stdout, "%s", "\n"); 1040 fprintf (stdout, "%s", "\n");
1041 if (bibtex) 1041 if (bibtex)
1042 finish_bibtex (utf8_argv[i]); 1042 finish_bibtex (utf8_argv[i]);
1043 if (verbose > 0) 1043 if (verbose > 0)
1044 FPRINTF (stdout, "%s", "\n"); 1044 fprintf (stdout, "%s", "\n");
1045 free (print); 1045 free (print);
1046 free (utf8_argv); 1046 free (utf8_argv);
1047 EXTRACTOR_plugin_remove_all (plugins); 1047 EXTRACTOR_plugin_remove_all (plugins);