/* local functions */
static char *upcase(char *st);
static int parse_diskline(disklist_t *, const char *, FILE *, int *, char **);
static void disk_parserror(const char *, int, const char *, ...)
/* local functions */
static char *upcase(char *st);
static int parse_diskline(disklist_t *, const char *, FILE *, int *, char **);
static void disk_parserror(const char *, int, const char *, ...)
disk->tape_splitsize = (off_t)0;
disk->split_diskbuffer = NULL;
disk->fallback_splitsize = (off_t)0;
disk->tape_splitsize = (off_t)0;
disk->split_diskbuffer = NULL;
disk->fallback_splitsize = (off_t)0;
free_sl(dp->exclude_file);
free_sl(dp->exclude_list);
free_sl(dp->include_file);
free_sl(dp->exclude_file);
free_sl(dp->exclude_list);
free_sl(dp->include_file);
} else {
hostname = stralloc(host->hostname);
if (strcmp(host->hostname, fp) != 0) {
} else {
hostname = stralloc(host->hostname);
if (strcmp(host->hostname, fp) != 0) {
shost = sanitise_filename(hostname);
for (p = hostlist; p != NULL; p = p->next) {
char *shostp = sanitise_filename(p->hostname);
shost = sanitise_filename(hostname);
for (p = hostlist; p != NULL; p = p->next) {
char *shostp = sanitise_filename(p->hostname);
- if (!strcmp(hostname, p->hostname) &&
- strcmp(shost, shostp)) {
- disk_parserror(filename, line_num, "Two host are mapping to the same name: \"%s\" and \"%s\"", p->hostname, hostname);
+ if (strcmp(hostname, p->hostname) &&
+ !strcmp(shost, shostp)) {
+ disk_parserror(filename, line_num, "Two hosts are mapping to the same name: \"%s\" and \"%s\"", p->hostname, hostname);
return(-1);
}
else if (strcasecmp(hostname, p->hostname) &&
match_host(hostname, p->hostname) &&
match_host(p->hostname, hostname)) {
return(-1);
}
else if (strcasecmp(hostname, p->hostname) &&
match_host(hostname, p->hostname) &&
match_host(p->hostname, hostname)) {
- disk_parserror(filename, line_num, "Duplicate host name: \"%s\" and \"%s\"", p->hostname, hostname);
+ disk_parserror(filename, line_num, _("Duplicate host name: \"%s\" and \"%s\""), p->hostname, hostname);
skip_whitespace(s, ch);
if(ch == '\0' || ch == '#') {
disk_parserror(filename, line_num,
skip_whitespace(s, ch);
if(ch == '\0' || ch == '#') {
disk_parserror(filename, line_num,
if (strcmp(diskname, dp->name) != 0 &&
strcmp(sdisk, sdiskp) == 0) {
disk_parserror(filename, line_num,
if (strcmp(diskname, dp->name) != 0 &&
strcmp(sdisk, sdiskp) == 0) {
disk_parserror(filename, line_num,
- "Two disk are mapping to the same name: \"%s\" and \"%s\""
- ", you must use different diskname",
+ _("Two disks are mapping to the same name: \"%s\" and \"%s\"; you must use different diskname"),
skip_whitespace(s, ch);
if (ch != '\0' && ch != '#') {
disk_parserror(filename, line_num,
skip_whitespace(s, ch);
if (ch != '\0' && ch != '#') {
disk_parserror(filename, line_num,
}
if (strchr(s-1, '}') &&
(strchr(s-1, '#') == NULL ||
strchr(s-1, '}') < strchr(s-1, '#'))) {
}
if (strchr(s-1, '}') &&
(strchr(s-1, '#') == NULL ||
strchr(s-1, '}') < strchr(s-1, '#'))) {
dtype = read_dumptype(vstralloc("custom(", hostname,
":", disk->name, ")", NULL),
diskf, (char*)filename, line_num_p);
if (dtype == NULL || dup) {
disk_parserror(filename, line_num,
dtype = read_dumptype(vstralloc("custom(", hostname,
":", disk->name, ")", NULL),
diskf, (char*)filename, line_num_p);
if (dtype == NULL || dup) {
disk_parserror(filename, line_num,
*line_p = line = agets(diskf);
line_num = *line_num_p; /* no incr, read_dumptype did it already */
*line_p = line = agets(diskf);
line_num = *line_num_p; /* no incr, read_dumptype did it already */
- disk_parserror(filename, line_num, "undefined dumptype `%s'", qdt);
+ disk_parserror(filename, line_num, _("undefined dumptype `%s'"), qdt);
disk->program = dumptype_get_program(dtype);
disk->exclude_list = duplicate_sl(dumptype_get_exclude(dtype).sl_list);
disk->exclude_file = duplicate_sl(dumptype_get_exclude(dtype).sl_file);
disk->program = dumptype_get_program(dtype);
disk->exclude_list = duplicate_sl(dumptype_get_exclude(dtype).sl_list);
disk->exclude_file = duplicate_sl(dumptype_get_exclude(dtype).sl_file);
disk->bumpsize = dumptype_get_bumpsize(dtype);
disk->bumpdays = dumptype_get_bumpdays(dtype);
disk->bumpmult = dumptype_get_bumpmult(dtype);
disk->bumpsize = dumptype_get_bumpsize(dtype);
disk->bumpdays = dumptype_get_bumpdays(dtype);
disk->bumpmult = dumptype_get_bumpmult(dtype);
disk->estimate = dumptype_get_estimate(dtype);
disk->compress = dumptype_get_compress(dtype);
disk->srvcompprog = dumptype_get_srvcompprog(dtype);
disk->estimate = dumptype_get_estimate(dtype);
disk->compress = dumptype_get_compress(dtype);
disk->srvcompprog = dumptype_get_srvcompprog(dtype);
- disk_parserror(filename, line_num, "non-integer spindle `%s'", fp);
+ disk_parserror(filename, line_num, _("non-integer spindle `%s'"), fp);
if(ch && ch != '#') { /* get optional network interface */
skip_non_whitespace(s, ch);
s[-1] = '\0';
if(ch && ch != '#') { /* get optional network interface */
skip_non_whitespace(s, ch);
s[-1] = '\0';
- netif = lookup_interface("default");
+ cfg_if = lookup_interface("default");
+ }
+
+ /* see if we already have a netif_t for this interface */
+ for (netif = all_netifs; netif != NULL; netif = netif->next) {
+ if (netif->config == cfg_if)
+ break;
+ }
+
+ /* nope; make up a new one */
+ if (!netif) {
+ netif = alloc(sizeof(*netif));
+ netif->next = all_netifs;
+ all_netifs = netif;
+ netif->config = cfg_if;
+ netif->curusage = 0;
}
/* success, add disk to lists */
if(host == NULL) { /* new host */
host = alloc(SIZEOF(am_host_t));
}
/* success, add disk to lists */
if(host == NULL) { /* new host */
host = alloc(SIZEOF(am_host_t));
int, line_num, const char *, format)
{
va_list argp;
int, line_num, const char *, format)
{
va_list argp;
- fprintf(stderr, "\"%s\", line %d: ", filename, line_num);
+ g_fprintf(stderr, "\"%s\", line %d: ", filename, line_num);
for(pos = 0, d = q.head, p = NULL; d != NULL; p = d, d = d->next, pos++) {
qname = quote_string(d->name);
for(pos = 0, d = q.head, p = NULL; d != NULL; p = d, d = d->next, pos++) {
qname = quote_string(d->name);
- fprintf(f, "%3d: %-10s %-4s\n", pos-2, d->host->hostname, d->name);
+ g_fprintf(f, "%3d: %-10s %-4s\n", pos-2, d->host->hostname, d->name);
- fprintf(f, "%3d: %-10s %-4s\n", pos-1, d->host->hostname, d->name);
+ g_fprintf(f, "%3d: %-10s %-4s\n", pos-1, d->host->hostname, d->name);
if(am_has_feature(dp->host->features, fe_options_bsd_auth))
auth_opt = stralloc("bsd-auth;");
else if(fdout) {
if(am_has_feature(dp->host->features, fe_options_bsd_auth))
auth_opt = stralloc("bsd-auth;");
else if(fdout) {
dp->host->hostname, qdpname);
}
} else if(strcasecmp(dp->security_driver, "krb4") == 0) {
if(am_has_feature(dp->host->features, fe_options_krb4_auth))
auth_opt = stralloc("krb4-auth;");
else if(fdout) {
dp->host->hostname, qdpname);
}
} else if(strcasecmp(dp->security_driver, "krb4") == 0) {
if(am_has_feature(dp->host->features, fe_options_krb4_auth))
auth_opt = stralloc("krb4-auth;");
else if(fdout) {
compress_opt = vstralloc("comp-cust=", dp->clntcompprog, ";", NULL);
if (BSTRNCMP(compress_opt, "comp-cust=;") == 0){
if(fdout) {
compress_opt = vstralloc("comp-cust=", dp->clntcompprog, ";", NULL);
if (BSTRNCMP(compress_opt, "comp-cust=;") == 0){
if(fdout) {
if(am_has_feature(their_features, fe_options_srvcomp_fast)) {
compress_opt = "srvcomp-fast;";
}
break;
if(am_has_feature(their_features, fe_options_srvcomp_fast)) {
compress_opt = "srvcomp-fast;";
}
break;
if(am_has_feature(their_features, fe_options_srvcomp_best)) {
compress_opt = "srvcomp-best;";
}
break;
if(am_has_feature(their_features, fe_options_srvcomp_best)) {
compress_opt = "srvcomp-best;";
}
break;
if(am_has_feature(their_features, fe_options_srvcomp_cust)) {
compress_opt = vstralloc("srvcomp-cust=", dp->srvcompprog, ";", NULL);
if (BSTRNCMP(compress_opt, "srvcomp-cust=;") == 0){
if(fdout) {
if(am_has_feature(their_features, fe_options_srvcomp_cust)) {
compress_opt = vstralloc("srvcomp-cust=", dp->srvcompprog, ";", NULL);
if (BSTRNCMP(compress_opt, "srvcomp-cust=;") == 0){
if(fdout) {
dp->clnt_encrypt, ";", NULL);
if (BSTRNCMP(encrypt_opt, "encrypt-cust=;") == 0) {
if(fdout) {
dp->clnt_encrypt, ";", NULL);
if (BSTRNCMP(encrypt_opt, "encrypt-cust=;") == 0) {
if(fdout) {
- if ( dp->compress == COMP_SERV_FAST ||
- dp->compress == COMP_SERV_BEST ||
- dp->compress == COMP_SERV_CUST ) {
+ if ( dp->compress == COMP_SERVER_FAST ||
+ dp->compress == COMP_SERVER_BEST ||
+ dp->compress == COMP_SERVER_CUST ) {
- fprintf(fdout,
- "ERROR: %s:Client encryption with server compression is not supported. See amanda.conf(5) for detail.\n", dp->host->hostname);
+ g_fprintf(fdout,
+ _("ERROR: %s:Client encryption with server compression is "
+ "not supported. See amanda.conf(5) for detail.\n"),
+ dp->host->hostname);
dp->srv_encrypt, ";", NULL);
if (BSTRNCMP(encrypt_opt, "encrypt-serv-cust=;") == 0){
if(fdout) {
dp->srv_encrypt, ";", NULL);
if (BSTRNCMP(encrypt_opt, "encrypt-serv-cust=;") == 0){
if(fdout) {
exc = newvstralloc(exc, "exclude-file=", qname, ";", NULL);
strappend(exclude_file, exc);
if(fdout) {
exc = newvstralloc(exc, "exclude-file=", qname, ";", NULL);
strappend(exclude_file, exc);
if(fdout) {
exc = newvstralloc(exc, "exclude-list=", qname, ";", NULL);
strappend(exclude_list, exc);
if(fdout) {
exc = newvstralloc(exc, "exclude-list=", qname, ";", NULL);
strappend(exclude_list, exc);
if(fdout) {
exc = newvstralloc(exc, "include-file=", qname, ";", NULL);
strappend(include_file, exc);
if(fdout) {
exc = newvstralloc(exc, "include-file=", qname, ";", NULL);
strappend(include_file, exc);
if(fdout) {
exc = newvstralloc(exc, "include-list=", qname, ";", NULL);
strappend(include_list, exc);
if(fdout) {
exc = newvstralloc(exc, "include-list=", qname, ";", NULL);
strappend(include_list, exc);
if(fdout) {
(match_disk(sargv[i], dp->name) ||
(dp->device && match_disk(sargv[i], dp->device)))) {
if(match_a_host) {
(match_disk(sargv[i], dp->name) ||
(dp->device && match_disk(sargv[i], dp->device)))) {
if(match_a_host) {
- vstrextend(&errstr, "Argument '", sargv[i], "' match neither a host nor a disk.\n", NULL);
+ char *errstr1 = vstrallocf(_("Argument '%s' matches neither a host nor a disk.\n"), sargv[i]);
+ vstrextend(&errstr, errstr1, NULL);
+ prev_match = 0;
dp->name, dp->host->hostname, dp->line, dp->dtype_name,
dp->name == NULL? "(null)": dp->name,
dp->spindle);
dp->name, dp->host->hostname, dp->line, dp->dtype_name,
dp->name == NULL? "(null)": dp->name,
dp->spindle);
- printf("HOST %s INTERFACE %s\n",
+ char *if_name = NULL;
+ if (hp->netif && hp->netif->config)
+ if_name = interface_name(hp->netif->config);
+
+ g_printf(_("HOST %s INTERFACE %s\n"),
- if(dp->prev != prev) printf("*** prev pointer mismatch!\n");
- if(dp->next == NULL && lst->tail != dp) printf("tail mismatch!\n");
+ if(dp->prev != prev) g_printf(_("*** prev pointer mismatch!\n"));
+ if(dp->next == NULL && lst->tail != dp) g_printf(_("tail mismatch!\n"));
- unsigned long malloc_hist_1, malloc_size_1;
- unsigned long malloc_hist_2, malloc_size_2;
+
+ /*
+ * Configure program for internationalization:
+ * 1) Only set the message locale for now.
+ * 2) Set textdomain for all amanda related programs to "amanda"
+ * We don't want to be forced to support dozens of message catalogs.
+ */
+ setlocale(LC_MESSAGES, "C");
+ textdomain("amanda");
/* Don't die when child closes pipe */
signal(SIGPIPE, SIG_IGN);
/* Don't die when child closes pipe */
signal(SIGPIPE, SIG_IGN);
}
conffile = stralloc2(config_dir, CONFFILE_NAME);
if((result = read_conffile(conffile)) == 0) {
}
conffile = stralloc2(config_dir, CONFFILE_NAME);
if((result = read_conffile(conffile)) == 0) {
- conf_diskfile = getconf_str(CNF_DISKFILE);
- if (*conf_diskfile == '/') {
- conf_diskfile = stralloc(conf_diskfile);
- } else {
- conf_diskfile = stralloc2(config_dir, conf_diskfile);
- }
+ conf_diskfile = config_dir_relative(getconf_str(CNF_DISKFILE));