OverviewFilesCommitsIssuesDocsReleasesPeers

opencog-link-grammar commits / bfd69dd

link-parser.c: Be really silent on --quite
bfd69dddf09b60f094c8aea19bb6d30f9a4c26ec
by ampli <amirpli@gmail.com> · 2024-05-29T00:50:53.000Z

Changed files (1) +39 -18

link-parser/link-parser.c +39 -18
……@@ -497,6 +497,43 @@ static const char *fbasename(const char *fpath)
497497 return progf + 1;
498498}
499499
500/**
501 * Return a dictionary handle for \p languege. Return NULL on failure.
502 * silence library verbose output if needed.
503 */
504static Dictionary dictionary_setup(const char *language, bool quiet,
505 Parse_Options opts)
506{
507 Dictionary dict;
508 int save_verbosity = parse_options_get_verbosity(opts);
509
510 if (quiet && (save_verbosity == 1))
511 parse_options_set_verbosity(opts, 0);
512
513 if (language && *language)
514 {
515 dict = dictionary_create_lang(language);
516 if (dict == NULL)
517 {
518 prt_error("Fatal error: Unable to open dictionary.\n");
519 return NULL;
520 }
521 }
522 else
523 {
524 dict = dictionary_create_default_lang();
525 if (dict == NULL)
526 {
527 prt_error("Fatal error: Unable to open default dictionary.\n");
528 return NULL;
529 }
530 }
531
532 parse_options_set_verbosity(opts, save_verbosity);
533
534 return dict;
535}
536
500537static void print_usage(FILE *out, char *argv0, Command_Options *copts, int exit_value)
501538{
502539
……@@ -599,24 +636,8 @@ int main(int argc, char * argv[])
599636 }
600637 /* End of debug options setup. */
601638
602 if (language && *language)
603 {
604 dict = dictionary_create_lang(language);
605 if (dict == NULL)
606 {
607 prt_error("Fatal error: Unable to open dictionary.\n");
608 exit(-1);
609 }
610 }
611 else
612 {
613 dict = dictionary_create_default_lang();
614 if (dict == NULL)
615 {
616 prt_error("Fatal error: Unable to open default dictionary.\n");
617 exit(-1);
618 }
619 }
639 dict = dictionary_setup(language, quiet_start > 0, opts);
640 if (dict == NULL) exit(-1);
620641
621642 set_default_parse_options(opts);
622643