X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=amandad-src%2Famandad_util.c;h=3bc5ab2b66eabe509f23367d7dcaa9e4615c0bea;hb=HEAD;hp=aef28525b2de1d21e6d48fb7b35249c711a12a78;hpb=cdbbeef9cde260e429854dd313bc0bf7560e1e24;p=debian%2Famanda diff --git a/amandad-src/amandad_util.c b/amandad-src/amandad_util.c index aef2852..3bc5ab2 100644 --- a/amandad-src/amandad_util.c +++ b/amandad-src/amandad_util.c @@ -1,6 +1,7 @@ /* * Amanda, The Advanced Maryland Automatic Network Disk Archiver * Copyright (c) 1991-1998 University of Maryland at College Park + * Copyright (c) 2007-2012 Zmanda, Inc. All Rights Reserved. * All Rights Reserved. * * Permission to use, copy, modify, distribute, and sell this software and its @@ -28,6 +29,7 @@ * */ +#include "amanda.h" #include "amandad.h" #include "util.h" @@ -64,47 +66,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(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(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(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(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(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 +118,41 @@ parse_g_options( g_options->maxdumps = new_maxdumps; } else { - dbprintf(("%s: bad maxdumps value \"%s\"\n", - debug_prefix(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(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(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(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(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 +170,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); + } }