Mercurial > hg > sidinfo
comparison sidinfo.c @ 90:2ab9ab4b59eb
Some fixes.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Fri, 12 Feb 2016 01:37:25 +0200 |
parents | d9cb7c635e7b |
children | 5ec395268fd3 |
comparison
equal
deleted
inserted
replaced
89:d9cb7c635e7b | 90:2ab9ab4b59eb |
---|---|
623 { | 623 { |
624 optParsable = FALSE; | 624 optParsable = FALSE; |
625 optNoNamePrefix = TRUE; | 625 optNoNamePrefix = TRUE; |
626 } | 626 } |
627 | 627 |
628 // Check paths | |
628 if (setHVSCPath != NULL) | 629 if (setHVSCPath != NULL) |
629 { | 630 { |
630 if (setSLDBPath == NULL) | 631 if (setSLDBPath == NULL) |
631 setSLDBPath = th_strdup_printf("%s%c%s", setHVSCPath, TH_DIR_SEPARATOR, SET_SLDB_FILENAME); | 632 setSLDBPath = th_strdup_printf("%s%c%s", setHVSCPath, TH_DIR_SEPARATOR, SET_SLDB_FILENAME); |
632 } | 633 } |
636 // Initialize SLDB | 637 // Initialize SLDB |
637 int ret; | 638 int ret; |
638 th_ioctx *ctx = th_io_new(&th_stdio_io_ops); | 639 th_ioctx *ctx = th_io_new(&th_stdio_io_ops); |
639 if (ctx == NULL || th_io_open(ctx, setSLDBPath, "r") != THERR_OK) | 640 if (ctx == NULL || th_io_open(ctx, setSLDBPath, "r") != THERR_OK) |
640 { | 641 { |
641 THERR("Ululu!\n"); | 642 THERR("Could not open SLDB '%s'.\n", setSLDBPath); |
642 goto out; | 643 goto out; |
643 } | 644 } |
644 | 645 |
645 if ((sidSLDB = si_sldb_new()) == NULL || | 646 if ((sidSLDB = si_sldb_new()) == NULL || |
646 si_sldb_read(ctx, sidSLDB) != THERR_OK) | 647 si_sldb_read(ctx, sidSLDB) != THERR_OK) |
647 { | 648 { |
648 THERR("Error parsing SLDB.\n"); | 649 THERR("Error parsing SLDB.\n"); |
650 th_io_close(ctx); | |
649 goto out; | 651 goto out; |
650 } | 652 } |
653 th_io_close(ctx); | |
651 | 654 |
652 if ((ret = si_sldb_build_index(sidSLDB)) != THERR_OK) | 655 if ((ret = si_sldb_build_index(sidSLDB)) != THERR_OK) |
653 { | 656 { |
654 THERR("Error building SLDB index: %s.\n", | 657 THERR("Error building SLDB index: %s.\n", |
655 th_error_str(ret)); | 658 th_error_str(ret)); |