X-Git-Url: http://jsfdemo.indexdata.com/?a=blobdiff_plain;f=src%2Ficu_chain_test.c;h=873551c948bd3f3edd3c5cdfbacae0f0e90abe2c;hb=114d66d26b884f967c940bab3e2f16cd6399ed60;hp=192d28cc4e2b341d29679837a058c5e43933c86d;hpb=941107ab62dc3972a050c569b7b4e657dcc582a5;p=pazpar2-moved-to-github.git diff --git a/src/icu_chain_test.c b/src/icu_chain_test.c index 192d28c..873551c 100644 --- a/src/icu_chain_test.c +++ b/src/icu_chain_test.c @@ -1,7 +1,5 @@ -/* $Id: icu_chain_test.c,v 1.6 2007-07-05 18:40:24 adam Exp $ - Copyright (c) 2006-2007, Index Data. - -This file is part of Pazpar2. +/* This file is part of Pazpar2. + Copyright (C) 2006-2008 Index Data Pazpar2 is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free @@ -14,13 +12,13 @@ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License -along with Pazpar2; see the file LICENSE. If not, write to the -Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. - */ +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +*/ #if HAVE_CONFIG_H -#include "cconfig.h" +#include #endif #include @@ -64,6 +62,17 @@ void print_option_error(const struct config_t *p_config) "./icu_chain_test -p c\n" "./icu_chain_test -p l -x\n" "./icu_chain_test -p t -x\n" + "\n" + "Example ICU chain XML configuration file:\n" + "\n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + "\n" ); exit(1); } @@ -139,12 +148,14 @@ static void print_icu_converters(const struct config_t *p_config) count, ucnv_getDefaultName()); else { fprintf(config.outfile, "Available ICU converters: %d\n", count); - fprintf(config.outfile, "Default ICU Converter is: '%s'\n", ucnv_getDefaultName()); + fprintf(config.outfile, "Default ICU Converter is: '%s'\n", + ucnv_getDefaultName()); } for(i=0;ixmloutput) - fprintf(config.outfile, "\n", ucnv_getAvailableName(i)); + fprintf(config.outfile, "\n", + ucnv_getAvailableName(i)); else fprintf(config.outfile, "%s ", ucnv_getAvailableName(i)); } @@ -440,12 +451,23 @@ static void process_text_file(const struct config_t *p_config) UErrorCode status = U_ZERO_ERROR; int success = 0; + if (! xml_node) { + printf("Could not parse XML config file '%s' \n", + config.conffile); + exit (1); + } + config.chain = icu_chain_xml_config(xml_node, &status); if (config.chain && U_SUCCESS(status)) success = 1; - + else { + printf("Could not set up ICU chain from config file '%s' \n", + config.conffile); + exit (1); + } + if (p_config->xmloutput) fprintf(config.outfile, "\n"