X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=amandad-src%2Famandad_util.c;h=1721a3220f78ac363240c8e3b4525a84d487415a;hb=b116e9366c7b2ea2c2eb53b0a13df4090e176235;hp=9ce31fdebddaeb3dc5ac68228b3befff300a1d63;hpb=d3b2175e084f88c8736ad7073eacbf4670147aec;p=debian%2Famanda diff --git a/amandad-src/amandad_util.c b/amandad-src/amandad_util.c index 9ce31fd..1721a32 100644 --- a/amandad-src/amandad_util.c +++ b/amandad-src/amandad_util.c @@ -28,6 +28,7 @@ * */ +#include "amanda.h" #include "amandad.h" #include "util.h" @@ -64,47 +65,48 @@ parse_g_options( while (tok != NULL) { if(strncmp(tok,"features=", 9) == 0) { + char *t = tok+9; + char *u = strchr(t, ';'); + if (u) + *u = '\0'; if(g_options->features != NULL) { - dbprintf(("%s: multiple features option\n", - debug_prefix_time(NULL))); + dbprintf(_("multiple features option\n")); if(verbose) { - printf("ERROR [multiple features option]\n"); + g_printf(_("ERROR [multiple features option]\n")); } } - if((g_options->features = am_string_to_feature(tok+9)) == NULL) { - dbprintf(("%s: bad features value \"%s\n", - debug_prefix_time(NULL), tok+10)); + if((g_options->features = am_string_to_feature(t)) == NULL) { + dbprintf(_("bad features value \"%s\"\n"), t); if(verbose) { - printf("ERROR [bad features value \"%s\"]\n", tok+10); + g_printf(_("ERROR [bad features value \"%s\"]\n"), t); } } + if (u) + *u = ';'; } else if(strncmp(tok,"hostname=", 9) == 0) { if(g_options->hostname != NULL) { - dbprintf(("%s: multiple hostname option\n", - debug_prefix_time(NULL))); + dbprintf(_("multiple hostname option\n")); if(verbose) { - printf("ERROR [multiple hostname option]\n"); + g_printf(_("ERROR [multiple hostname option]\n")); } } g_options->hostname = stralloc(tok+9); } else if(strncmp(tok,"auth=", 5) == 0) { if(g_options->auth != NULL) { - dbprintf(("%s: multiple auth option\n", - debug_prefix_time(NULL))); + dbprintf(_("multiple auth option\n")); if(verbose) { - printf("ERROR [multiple auth option]\n"); + g_printf(_("ERROR [multiple auth option]\n")); } } g_options->auth = stralloc(tok+5); } else if(strncmp(tok,"maxdumps=", 9) == 0) { if(g_options->maxdumps != 0) { - dbprintf(("%s: multiple maxdumps option\n", - debug_prefix_time(NULL))); + dbprintf(_("multiple maxdumps option\n")); if(verbose) { - printf("ERROR [multiple maxdumps option]\n"); + g_printf(_("ERROR [multiple maxdumps option]\n")); } } if(sscanf(tok+9, "%d;", &new_maxdumps) == 1) { @@ -115,46 +117,41 @@ parse_g_options( g_options->maxdumps = new_maxdumps; } else { - dbprintf(("%s: bad maxdumps value \"%s\"\n", - debug_prefix_time(NULL), tok+9)); + dbprintf(_("bad maxdumps value \"%s\"\n"), tok+9); if(verbose) { - printf("ERROR [bad maxdumps value \"%s\"]\n", + g_printf(_("ERROR [bad maxdumps value \"%s\"]\n"), tok+9); } } } else { - dbprintf(("%s: bad maxdumps value \"%s\"\n", - debug_prefix_time(NULL), tok+9)); + dbprintf(_("bad maxdumps value \"%s\"\n"), tok+9); if(verbose) { - printf("ERROR [bad maxdumps value \"%s\"]\n", + g_printf(_("ERROR [bad maxdumps value \"%s\"]\n"), tok+9); } } } else if(strncmp(tok,"config=", 7) == 0) { if(g_options->config != NULL) { - dbprintf(("%s: multiple config option\n", - debug_prefix_time(NULL))); + dbprintf(_("multiple config option\n")); if(verbose) { - printf("ERROR [multiple config option]\n"); + g_printf(_("ERROR [multiple config option]\n")); } } g_options->config = stralloc(tok+7); if (strchr(g_options->config, '/')) { amfree(g_options->config); - dbprintf(("%s: invalid character in config option\n", - debug_prefix_time(NULL))); + dbprintf(_("invalid character in config option\n")); if(verbose) { - printf("ERROR [invalid character in config option]\n"); + g_printf(_("ERROR [invalid character in config option]\n")); } } } else { - dbprintf(("%s: unknown option \"%s\"\n", - debug_prefix_time(NULL), tok)); + dbprintf(_("unknown option \"%s\"\n"), tok); if(verbose) { - printf("ERROR [unknown option \"%s\"]\n", tok); + g_printf(_("ERROR [unknown option \"%s\"]\n"), tok); } } tok = strtok(NULL, ";"); @@ -172,10 +169,12 @@ void free_g_options( g_option_t * g_options) { - amfree(g_options->str); - am_release_feature_set(g_options->features); - amfree(g_options->hostname); - amfree(g_options->auth); - amfree(g_options->config); - amfree(g_options); + if (g_options != NULL) { + amfree(g_options->str); + am_release_feature_set(g_options->features); + amfree(g_options->hostname); + amfree(g_options->auth); + amfree(g_options->config); + amfree(g_options); + } }