From 28d3e3b08a856a66cb90ebf08787f8fa27a772eb Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Thu, 4 Dec 2014 14:58:08 +0100 Subject: [PATCH] Enable yaz backtrace for programs YAZ-802 --- client/client.c | 4 +++- util/json-parse.c | 3 +++ util/marcdump.c | 2 ++ util/yaz-icu.c | 2 ++ util/yaz-record-conv.c | 3 +++ util/yaz-url.c | 2 ++ util/yaz-xmlquery.c | 3 ++- util/yaziconv.c | 2 ++ zoom/zoomsh.c | 6 +++++- 9 files changed, 24 insertions(+), 3 deletions(-) diff --git a/client/client.c b/client/client.c index 596b76a..898234b 100644 --- a/client/client.c +++ b/client/client.c @@ -44,7 +44,7 @@ #endif #include - +#include #include #include @@ -5401,6 +5401,8 @@ int main(int argc, char **argv) if (codeset) outputCharset = xstrdup(codeset); + yaz_enable_panic_backtrace(prog); + ODR_MASK_SET(&z3950_options, Z_Options_search); ODR_MASK_SET(&z3950_options, Z_Options_present); ODR_MASK_SET(&z3950_options, Z_Options_namedResultSets); diff --git a/util/json-parse.c b/util/json-parse.c index ea32ccd..99a766c 100644 --- a/util/json-parse.c +++ b/util/json-parse.c @@ -13,6 +13,7 @@ #include #include #include +#include void usage(const char *prog) { @@ -50,6 +51,8 @@ int main(int argc, char **argv) int print = 0; int ret; char *arg; + + yaz_enable_panic_backtrace(*argv); while ((ret = options("p", argv, argc, &arg)) != YAZ_OPTIONS_EOF) { switch (ret) diff --git a/util/marcdump.c b/util/marcdump.c index 940ed4d..adfc015 100644 --- a/util/marcdump.c +++ b/util/marcdump.c @@ -46,6 +46,7 @@ #include #include #include +#include #ifndef SEEK_SET #define SEEK_SET 0 @@ -522,6 +523,7 @@ int main (int argc, char **argv) #endif prog = *argv; + yaz_enable_panic_backtrace(prog); while ((r = options("i:o:C:npc:xOeXIf:t:s:l:Vv", argv, argc, &arg)) != -2) { no++; diff --git a/util/yaz-icu.c b/util/yaz-icu.c index 8cb5143..1386a16 100644 --- a/util/yaz-icu.c +++ b/util/yaz-icu.c @@ -26,6 +26,7 @@ #include #include +#include /* commando line and config parameters */ struct config_t { @@ -552,6 +553,7 @@ int main(int argc, char **argv) #if YAZ_HAVE_ICU struct config_t config; + yaz_enable_panic_backtrace(*argv); read_params(argc, argv, &config); if (config.conffile && strlen(config.conffile)) diff --git a/util/yaz-record-conv.c b/util/yaz-record-conv.c index 71f2f46..fed037f 100644 --- a/util/yaz-record-conv.c +++ b/util/yaz-record-conv.c @@ -10,6 +10,7 @@ #include #include #include +#include const char *prog = "yaz-record-conv"; @@ -24,6 +25,8 @@ int main (int argc, char **argv) char *arg; yaz_record_conv_t p = 0; int no_errors = 0; + + yaz_enable_panic_backtrace(*argv); while ((r = options("V", argv, argc, &arg)) != -2) { switch (r) diff --git a/util/yaz-url.c b/util/yaz-url.c index 7a78e67..cebf2ba 100644 --- a/util/yaz-url.c +++ b/util/yaz-url.c @@ -13,6 +13,7 @@ #include #include #include +#include static void usage(void) { @@ -74,6 +75,7 @@ int main(int argc, char **argv) int no_urls = 0; const char *outfname = 0; + yaz_enable_panic_backtrace(*argv); while ((ret = options("h{help}H:m:O:p:R{max-redirs}:u:vx:", argv, argc, &arg)) != YAZ_OPTIONS_EOF) { diff --git a/util/yaz-xmlquery.c b/util/yaz-xmlquery.c index 7ad6804..4428f46 100644 --- a/util/yaz-xmlquery.c +++ b/util/yaz-xmlquery.c @@ -13,7 +13,7 @@ #include #include #include -#include +#include #if YAZ_HAVE_XML2 #include @@ -183,6 +183,7 @@ int main (int argc, char **argv) int r; int active = 0; + yaz_enable_panic_backtrace(*argv); while ((r = options("-p:x:", argv, argc, &arg)) != -2) { switch(r) diff --git a/util/yaziconv.c b/util/yaziconv.c index ffb0a21..57de6e1 100644 --- a/util/yaziconv.c +++ b/util/yaziconv.c @@ -12,6 +12,7 @@ #include #include +#include #define CHUNK_IN 64 #define CHUNK_OUT 64 @@ -138,6 +139,7 @@ int main(int argc, char **argv) yaz_iconv_t cd; FILE *inf = stdin; + yaz_enable_panic_backtrace(*argv); while ((ret = options("vf:t:", argv, argc, &arg)) != -2) { switch (ret) diff --git a/zoom/zoomsh.c b/zoom/zoomsh.c index fa4c0f8..37f5452 100644 --- a/zoom/zoomsh.c +++ b/zoom/zoomsh.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #if HAVE_READLINE_READLINE_H @@ -1004,7 +1005,10 @@ static int zoomsh(int argc, char **argv) int main(int argc, char **argv) { - int ret = zoomsh(argc, argv); + int ret; + + yaz_enable_panic_backtrace(*argv); + ret = zoomsh(argc, argv); exit(ret); } /* -- 1.7.10.4