From: Peter Verthez Date: Fri, 3 Jan 2003 19:56:50 +0000 (+0000) Subject: Program to check gedcom files. X-Git-Url: https://git.dlugolecki.net.pl/?a=commitdiff_plain;h=0a370b7945bb1d77f609a1732b9e90c69f2c7dd4;p=gedcom-parse.git Program to check gedcom files. --- diff --git a/bin/.cvsignore b/bin/.cvsignore new file mode 100644 index 0000000..70845e0 --- /dev/null +++ b/bin/.cvsignore @@ -0,0 +1 @@ +Makefile.in diff --git a/bin/Makefile.am b/bin/Makefile.am new file mode 100644 index 0000000..53e9b07 --- /dev/null +++ b/bin/Makefile.am @@ -0,0 +1,12 @@ +## Process this file with automake to produce Makefile.in +# $Id$ +# $Name$ + +localedir = $(datadir)/locale +INCLUDES = -I$(srcdir)/../intl -I$(srcdir)/../include -I$(srcdir)/../utf8 +CFLAGS = -O2 -W -Wall -pedantic -Wno-long-long @EXTRA_CFLAGS@ + +bin_PROGRAMS = gedcom-check +gedcom_check_SOURCES = gedcom-check.c +gedcom_check_LDFLAGS = -L../gedcom/.libs -L../utf8/.libs @ICONV_LIBPATH@ +gedcom_check_LDADD = $(LIBICONV) -lgedcom -lutf8tools $(LIBICONV) diff --git a/bin/gedcom-check.c b/bin/gedcom-check.c new file mode 100644 index 0000000..f81e27f --- /dev/null +++ b/bin/gedcom-check.c @@ -0,0 +1,118 @@ +/* Check program using the Gedcom library. + Copyright (C) 2001, 2002 The Genes Development Team + This file is part of the Gedcom parser library. + Contributed by Peter Verthez , 2001. + + The Gedcom parser library is free software; you can redistribute it + and/or modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The Gedcom parser library is distributed in the hope that it will be + useful, but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the Gedcom parser library; if not, write to the + Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* $Id$ */ +/* $Name$ */ + +#include "gedcom.h" +#include "utf8tools.h" +#include +#include +#include +#ifdef HAVE_CONFIG_H +#include +#endif +#include + +#define _(string) dgettext(PACKAGE, string) +#define N_(string) (string) + +#ifdef __GNUC__ +#define UNUSED __attribute__((unused)) +#else +#define UNUSED +#endif + +void show_help () +{ + printf("Checks a GEDCOM file on standards compliancy\n\n"); + printf("Usage: gedcom-check [options] file\n"); + printf("Options:\n"); + printf(" -h Show this help text\n"); + printf(" -c Enable compatibility mode\n"); + printf("Errors, warnings, ... are sent to stdout\n"); +} + +void default_cb(Gedcom_elt elt UNUSED, Gedcom_ctxt ctxt UNUSED, + int level UNUSED, char *tag UNUSED, + char *raw_value UNUSED, int tag_value UNUSED) +{ + /* do nothing */ +} + +void gedcom_message_handler(Gedcom_msg_type type UNUSED, char *msg) +{ + char *converted = NULL; + int conv_fails = 0; + converted = convert_utf8_to_locale(msg, &conv_fails); + printf("%s\n", converted); +} + +int main(int argc, char* argv[]) +{ + Gedcom_err_mech mech = DEFER_FAIL; + int compat_enabled = 0; + char* file_name = NULL; + int result; + + if (argc > 1) { + int i; + for (i=1; i