X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=oldrecover-src%2Fextract_list.c;h=61c9a6aa695e2e6aa2f33785560ea9496d08713b;hb=94a044f90357edefa6f4ae9f0b1d5885b0e34aee;hp=a952ac0d0a9e2ea78f4531ca0d096115fcb350fb;hpb=d3b2175e084f88c8736ad7073eacbf4670147aec;p=debian%2Famanda diff --git a/oldrecover-src/extract_list.c b/oldrecover-src/extract_list.c index a952ac0..61c9a6a 100644 --- a/oldrecover-src/extract_list.c +++ b/oldrecover-src/extract_list.c @@ -30,6 +30,7 @@ */ #include "amanda.h" +#include "conffile.h" #include "version.h" #include "amrecover.h" #include "fileheader.h" @@ -169,7 +170,7 @@ read_buffer( nfound = select(datafd+1, &readset, NULL, NULL, &timeout); if(nfound < 0 ) { /* Select returned an error. */ - fprintf(stderr,"select error: %s\n", strerror(errno)); + g_fprintf(stderr,_("select error: %s\n"), strerror(errno)); size = -1; break; } @@ -178,8 +179,8 @@ read_buffer( /* Select timed out. */ if (timeout_s != 0) { /* Not polling: a real read timeout */ - fprintf(stderr,"timeout waiting for restore\n"); - fprintf(stderr,"increase READ_TIMEOUT in recover-src/extract_list.c if your tape is slow\n"); + g_fprintf(stderr,_("timeout waiting for restore\n")); + g_fprintf(stderr,_("increase READ_TIMEOUT in recover-src/extract_list.c if your tape is slow\n")); } errno = ETIMEDOUT; size = -1; @@ -196,7 +197,7 @@ read_buffer( continue; } if (errno != EPIPE) { - fprintf(stderr, "read_buffer: read error - %s", + g_fprintf(stderr, _("read_buffer: read error - %s"), strerror(errno)); break; } @@ -345,8 +346,8 @@ clean_tape_list( } if (remove_fn2) { - dbprintf(("removing path %s, it is included in %s\n", - fn2->path, fn1->path)); + dbprintf(_("removing path %s, it is included in %s\n"), + fn2->path, fn1->path); ofn2 = fn2; fn2 = fn2->next; amfree(ofn2->path); @@ -360,8 +361,8 @@ clean_tape_list( if(remove_fn1 != 0) { /* fn2->path is always valid */ - /*@i@*/ dbprintf(("removing path %s, it is included in %s\n", - /*@i@*/ fn1->path, fn2->path)); + /*@i@*/ dbprintf(_("removing path %s, it is included in %s\n"), + /*@i@*/ fn1->path, fn2->path); ofn1 = fn1; fn1 = fn1->next; amfree(ofn1->path); @@ -535,9 +536,9 @@ add_glob( char *uqglob = unquote_string(glob); regex = glob_to_regex(uqglob); - dbprintf(("add_glob (%s) -> %s\n", uqglob, regex)); + dbprintf(_("add_glob (%s) -> %s\n"), uqglob, regex); if ((s = validate_regexp(regex)) != NULL) { - printf("%s is not a valid shell wildcard pattern: ", glob); + g_printf(_("%s is not a valid shell wildcard pattern: "), glob); puts(s); } else { /* @@ -565,7 +566,7 @@ add_regex( char *uqregex = unquote_string(regex); if ((s = validate_regexp(uqregex)) != NULL) { - printf("%s is not a valid regular expression: ", regex); + g_printf(_("%s is not a valid regular expression: "), regex); puts(s); } else { add_file(uqregex, regex); @@ -594,12 +595,12 @@ void add_file( int dir_entries; if (disk_path == NULL) { - printf("Must select directory before adding files\n"); + g_printf(_("Must select directory before adding files\n")); return; } memset(&lditem, 0, sizeof(lditem)); /* Prevent use of bogus data... */ - dbprintf(("add_file: Looking for \"%s\"\n", regex)); + dbprintf(_("add_file: Looking for \"%s\"\n"), regex); if(strcmp(regex, "/[/]*$") == 0) { /* "/" behave like "." */ regex = "\\.[/]*$"; @@ -630,8 +631,8 @@ void add_file( path_on_disk_slash = stralloc2(path_on_disk, "/"); - dbprintf(("add_file: Converted path=\"%s\" to path_on_disk=\"%s\"\n", - regex, path_on_disk)); + dbprintf(_("add_file: Converted path=\"%s\" to path_on_disk=\"%s\"\n"), + regex, path_on_disk); found_one = 0; dir_entries = 0; @@ -639,7 +640,7 @@ void add_file( { dir_entries++; quoted = quote_string(ditem->path); - dbprintf(("add_file: Pondering ditem->path=%s\n", quoted)); + dbprintf(_("add_file: Pondering ditem->path=%s\n"), quoted); amfree(quoted); if (match(path_on_disk, ditem->path) || match(path_on_disk_slash, ditem->path)) @@ -652,7 +653,7 @@ void add_file( ditem_path = newstralloc(ditem_path, ditem->path); clean_pathname(ditem_path); - cmd = stralloc2("ORLD ", ditem_path); + cmd = newstralloc2(cmd, "ORLD ", ditem_path); if(send_command(cmd) == -1) { amfree(cmd); amfree(ditem_path); @@ -674,7 +675,7 @@ void add_file( amfree(path_on_disk); amfree(path_on_disk_slash); l = reply_line(); - printf("%s\n", l); + g_printf(_("%s\n"), l); return; } dir_undo = NULL; @@ -705,14 +706,14 @@ void add_file( s = l; if(strncmp_const_skip(l, "201-", s, ch) != 0) { - err = "bad reply: not 201-"; + err = _("bad reply: not 201-"); continue; } ch = *s++; skip_whitespace(s, ch); if(ch == '\0') { - err = "bad reply: missing date field"; + err = _("bad reply: missing date field"); continue; } fp = s-1; @@ -723,14 +724,14 @@ void add_file( skip_whitespace(s, ch); if(ch == '\0' || sscanf(s - 1, "%d", &lditem.level) != 1) { - err = "bad reply: cannot parse level field"; + err = _("bad reply: cannot parse level field"); continue; } skip_integer(s, ch); skip_whitespace(s, ch); if(ch == '\0') { - err = "bad reply: missing tape field"; + err = _("bad reply: missing tape field"); continue; } fp = s-1; @@ -740,11 +741,11 @@ void add_file( s[-1] = (char)ch; if(am_has_feature(indexsrv_features, fe_amindexd_fileno_in_ORLD)) { - OFF_T_FMT_TYPE fileno_ = (OFF_T_FMT_TYPE)0; + long long fileno_ = (long long)0; skip_whitespace(s, ch); if(ch == '\0' || - sscanf(s - 1, OFF_T_FMT, &fileno_) != 1) { - err = "bad reply: cannot parse fileno field"; + sscanf(s - 1, "%lld", &fileno_) != 1) { + err = _("bad reply: cannot parse fileno field"); continue; } lditem.fileno = (off_t)fileno_; @@ -753,7 +754,7 @@ void add_file( skip_whitespace(s, ch); if(ch == '\0') { - err = "bad reply: missing directory field"; + err = _("bad reply: missing directory field"); continue; } dir = s - 1; @@ -764,16 +765,16 @@ void add_file( switch(add_extract_item(&lditem)) { case -1: - printf("System error\n"); - dbprintf(("add_file: (Failed) System error\n")); + g_printf(_("System error\n")); + dbprintf(_("add_file: (Failed) System error\n")); break; case 0: quoted = quote_string(lditem.path); - printf("Added dir %s at date %s\n", + g_printf(_("Added dir %s at date %s\n"), quoted, lditem.date); - dbprintf(("add_file: (Successful) Added dir %s at date %s\n", - quoted, lditem.date)); + dbprintf(_("add_file: (Successful) Added dir %s at date %s\n"), + quoted, lditem.date); amfree(quoted); added=1; break; @@ -791,8 +792,8 @@ void add_file( puts(cmd); } else if(added == 0) { quoted = quote_string(ditem_path); - printf("dir %s already added\n", quoted); - dbprintf(("add_file: dir %s already added\n", quoted)); + g_printf(_("dir %s already added\n"), quoted); + dbprintf(_("add_file: dir %s already added\n"), quoted); amfree(quoted); } } @@ -800,21 +801,21 @@ void add_file( { switch(add_extract_item(ditem)) { case -1: - printf("System error\n"); - dbprintf(("add_file: (Failed) System error\n")); + g_printf(_("System error\n")); + dbprintf(_("add_file: (Failed) System error\n")); break; case 0: quoted = quote_string(ditem->path); - printf("Added file %s\n", quoted); - dbprintf(("add_file: (Successful) Added %s\n", quoted)); + g_printf(_("Added file %s\n"), quoted); + dbprintf(_("add_file: (Successful) Added %s\n"), quoted); amfree(quoted); break; case 1: quoted = quote_string(ditem->path); - printf("File %s already added\n", quoted); - dbprintf(("add_file: file %s already added\n", quoted)); + g_printf(_("File %s already added\n"), quoted); + dbprintf(_("add_file: file %s already added\n"), quoted); amfree(quoted); break; } @@ -829,9 +830,9 @@ void add_file( if(! found_one) { quoted = quote_string(path); - printf("File %s doesn't exist in directory\n", quoted); - dbprintf(("add_file: (Failed) File %s doesn't exist in directory\n", - quoted)); + g_printf(_("File %s doesn't exist in directory\n"), quoted); + dbprintf(_("add_file: (Failed) File %s doesn't exist in directory\n"), + quoted); amfree(quoted); } } @@ -847,9 +848,9 @@ delete_glob( char *uqglob = unquote_string(glob); regex = glob_to_regex(uqglob); - dbprintf(("delete_glob (%s) -> %s\n", uqglob, regex)); + dbprintf(_("delete_glob (%s) -> %s\n"), uqglob, regex); if ((s = validate_regexp(regex)) != NULL) { - printf("\"%s\" is not a valid shell wildcard pattern: ", glob); + g_printf(_("\"%s\" is not a valid shell wildcard pattern: "), glob); puts(s); } else { /* @@ -877,7 +878,7 @@ delete_regex( char *uqregex = unquote_string(regex); if ((s = validate_regexp(regex)) != NULL) { - printf("\"%s\" is not a valid regular expression: ", regex); + g_printf(_("\"%s\" is not a valid regular expression: "), regex); puts(s); } else { delete_file(uqregex, uqregex); @@ -911,12 +912,12 @@ delete_file( char *quoted; if (disk_path == NULL) { - printf("Must select directory before deleting files\n"); + g_printf(_("Must select directory before deleting files\n")); return; } memset(&lditem, 0, sizeof(lditem)); /* Prevent use of bogus data... */ - dbprintf(("delete_file: Looking for \"%s\"\n", path)); + dbprintf(_("delete_file: Looking for \"%s\"\n"), path); if (strcmp(regex, "[^/]*[/]*$") == 0) { /* Looking for * find everything but single . */ @@ -949,13 +950,13 @@ delete_file( path_on_disk_slash = stralloc2(path_on_disk, "/"); - dbprintf(("delete_file: Converted path=\"%s\" to path_on_disk=\"%s\"\n", - regex, path_on_disk)); + dbprintf(_("delete_file: Converted path=\"%s\" to path_on_disk=\"%s\"\n"), + regex, path_on_disk); found_one = 0; for (ditem=get_dir_list(); ditem!=NULL; ditem=get_next_dir_item(ditem)) { quoted = quote_string(ditem->path); - dbprintf(("delete_file: Pondering ditem->path=%s\n", quoted)); + dbprintf(_("delete_file: Pondering ditem->path=%s\n"), quoted); amfree(quoted); if (match(path_on_disk, ditem->path) || match(path_on_disk_slash, ditem->path)) @@ -968,7 +969,7 @@ delete_file( ditem_path = newstralloc(ditem_path, ditem->path); clean_pathname(ditem_path); - cmd = stralloc2("ORLD ", ditem_path); + cmd = newstralloc2(cmd, "ORLD ", ditem_path); if(send_command(cmd) == -1) { amfree(cmd); amfree(ditem_path); @@ -990,7 +991,7 @@ delete_file( amfree(path_on_disk); amfree(path_on_disk_slash); l = reply_line(); - printf("%s\n", l); + g_printf("%s\n", l); return; } deleted=0; @@ -1023,14 +1024,14 @@ delete_file( s = l; if(strncmp_const_skip(l, "201-", s, ch) != 0) { - err = "bad reply: not 201-"; + err = _("bad reply: not 201-"); continue; } ch = *s++; skip_whitespace(s, ch); if(ch == '\0') { - err = "bad reply: missing date field"; + err = _("bad reply: missing date field"); continue; } date = s - 1; @@ -1039,14 +1040,14 @@ delete_file( skip_whitespace(s, ch); if(ch == '\0' || sscanf(s - 1, "%d", &level) != 1) { - err = "bad reply: cannot parse level field"; + err = _("bad reply: cannot parse level field"); continue; } skip_integer(s, ch); skip_whitespace(s, ch); if(ch == '\0') { - err = "bad reply: missing tape field"; + err = _("bad reply: missing tape field"); continue; } tape = s - 1; @@ -1056,11 +1057,11 @@ delete_file( *tape_undo = '\0'; if(am_has_feature(indexsrv_features, fe_amindexd_fileno_in_ORLD)) { - OFF_T_FMT_TYPE fileno_ = (OFF_T_FMT_TYPE)0; + long long fileno_ = (long long)0; skip_whitespace(s, ch); if(ch == '\0' || - sscanf(s - 1, OFF_T_FMT, &fileno_) != 1) { - err = "bad reply: cannot parse fileno field"; + sscanf(s - 1, "%lld", &fileno_) != 1) { + err = _("bad reply: cannot parse fileno field"); continue; } fileno = (off_t)fileno_; @@ -1069,7 +1070,7 @@ delete_file( skip_whitespace(s, ch); if(ch == '\0') { - err = "bad reply: missing directory field"; + err = _("bad reply: missing directory field"); continue; } skip_non_whitespace(s, ch); @@ -1082,13 +1083,13 @@ delete_file( lditem.tape = newstralloc(lditem.tape, tape); switch(delete_extract_item(&lditem)) { case -1: - printf("System error\n"); - dbprintf(("delete_file: (Failed) System error\n")); + g_printf(_("System error\n")); + dbprintf(_("delete_file: (Failed) System error\n")); break; case 0: - printf("Deleted dir %s at date %s\n", ditem_path, date); - dbprintf(("delete_file: (Successful) Deleted dir %s at date %s\n", - ditem_path, date)); + g_printf(_("Deleted dir %s at date %s\n"), ditem_path, date); + dbprintf(_("delete_file: (Successful) Deleted dir %s at date %s\n"), + ditem_path, date); deleted=1; break; case 1: @@ -1103,29 +1104,29 @@ delete_file( if (cmd) puts(cmd); } else if(deleted == 0) { - printf("Warning - dir '%s' not on tape list\n", + g_printf(_("Warning - dir '%s' not on tape list\n"), ditem_path); - dbprintf(("delete_file: dir '%s' not on tape list\n", - ditem_path)); + dbprintf(_("delete_file: dir '%s' not on tape list\n"), + ditem_path); } } else { switch(delete_extract_item(ditem)) { case -1: - printf("System error\n"); - dbprintf(("delete_file: (Failed) System error\n")); + g_printf(_("System error\n")); + dbprintf(_("delete_file: (Failed) System error\n")); break; case 0: - printf("Deleted %s\n", ditem->path); - dbprintf(("delete_file: (Successful) Deleted %s\n", - ditem->path)); + g_printf(_("Deleted %s\n"), ditem->path); + dbprintf(_("delete_file: (Successful) Deleted %s\n"), + ditem->path); break; case 1: - printf("Warning - file '%s' not on tape list\n", + g_printf(_("Warning - file '%s' not on tape list\n"), ditem->path); - dbprintf(("delete_file: file '%s' not on tape list\n", - ditem->path)); + dbprintf(_("delete_file: file '%s' not on tape list\n"), + ditem->path); break; } } @@ -1137,9 +1138,9 @@ delete_file( amfree(path_on_disk_slash); if(! found_one) { - printf("File %s doesn't exist in directory\n", path); - dbprintf(("delete_file: (Failed) File %s doesn't exist in directory\n", - path)); + g_printf(_("File %s doesn't exist in directory\n"), path); + dbprintf(_("delete_file: (Failed) File %s doesn't exist in directory\n"), + path); } } @@ -1169,7 +1170,7 @@ display_extract_list( pager_command = stralloc2(pager, " ; /bin/cat > /dev/null"); if ((fp = popen(pager_command, "w")) == NULL) { - printf("Warning - can't pipe through %s\n", pager); + g_printf(_("Warning - can't pipe through %s\n"), pager); fp = stdout; } amfree(pager_command); @@ -1179,7 +1180,7 @@ display_extract_list( uqfile = unquote_string(file); if ((fp = fopen(uqfile, "w")) == NULL) { - printf("Can't open file %s to print extract list into\n", file); + g_printf(_("Can't open file %s to print extract list into\n"), file); amfree(uqfile); return; } @@ -1188,16 +1189,16 @@ display_extract_list( for (this = extract_list; this != NULL; this = this->next) { - fprintf(fp, "TAPE %s LEVEL %d DATE %s\n", + g_fprintf(fp, _("TAPE %s LEVEL %d DATE %s\n"), this->tape, this->level, this->date); for (that = this->files; that != NULL; that = that->next) - fprintf(fp, "\t%s\n", that->path); + g_fprintf(fp, "\t%s\n", that->path); } if (file == NULL) { apclose(fp); } else { - printf("Extract list written to file %s\n", file); + g_printf(_("Extract list written to file %s\n"), file); afclose(fp); } } @@ -1229,15 +1230,15 @@ okay_to_continue( get_tape = 0; while (ret < 0) { if (get_tape) { - prompt = "New tape device [?]: "; + prompt = _("New tape device [?]: "); } else if (allow_tape && allow_skip) { - prompt = "Continue [?/Y/n/s/t]? "; + prompt = _("Continue [?/Y/n/s/t]? "); } else if (allow_tape && !allow_skip) { - prompt = "Continue [?/Y/n/t]? "; + prompt = _("Continue [?/Y/n/t]? "); } else if (allow_retry) { - prompt = "Continue [?/Y/n/r]? "; + prompt = _("Continue [?/Y/n/r]? "); } else { - prompt = "Continue [?/Y/n]? "; + prompt = _("Continue [?/Y/n]? "); } fputs(prompt, stdout); fflush(stdout); fflush(stderr); @@ -1258,17 +1259,17 @@ okay_to_continue( } if (ch == '?') { if (get_tape) { - printf("Enter a new device ([host:]device) or \"default\"\n"); + g_printf(_("Enter a new device ([host:]device) or \"default\"\n")); } else { - printf("Enter \"y\"es to continue, \"n\"o to stop"); + g_printf(_("Enter \"y\"es to continue, \"n\"o to stop")); if(allow_skip) { - printf(", \"s\"kip this tape"); + g_printf(_(", \"s\"kip this tape")); } if(allow_retry) { - printf(" or \"r\"etry this tape"); + g_printf(_(" or \"r\"etry this tape")); } if (allow_tape) { - printf(" or \"t\"ape to change tape drives"); + g_printf(_(" or \"t\"ape to change tape drives")); } putchar('\n'); } @@ -1302,7 +1303,7 @@ send_to_tape_server( if (fullwrite(tss, msg, strlen(msg)) < 0) { - error("Error writing to tape server"); + error(_("Error writing to tape server")); /*NOTREACHED*/ } amfree(msg); @@ -1332,7 +1333,7 @@ extract_files_setup( /* get tape server details */ if ((sp = getservbyname(service_name, "tcp")) == NULL) { - printf("%s/tcp unknown protocol - config error?\n", service_name); + g_printf(_("%s/tcp unknown protocol - config error?\n"), service_name); amfree(service_name); return -1; } @@ -1347,12 +1348,12 @@ extract_files_setup( 0); if (tape_control_sock < 0) { - printf("cannot connect to %s: %s\n", tape_server_name, strerror(errno)); + g_printf(_("cannot connect to %s: %s\n"), tape_server_name, strerror(errno)); return -1; } if (my_port >= IPPORT_RESERVED) { aclose(tape_control_sock); - printf("did not get a reserved port: %u\n", (unsigned)my_port); + g_printf(_("did not get a reserved port: %u\n"), (unsigned)my_port); return -1; } @@ -1431,7 +1432,7 @@ extract_files_setup( tt = newstralloc2(tt, "FEATURES=", our_feature_string); send_to_tape_server(tape_control_sock, tt); if (read(tape_control_sock, buffer, sizeof(buffer)) <= 0) { - error("Could not read features from control socket\n"); + error(_("Could not read features from control socket\n")); /*NOTREACHED*/ } tapesrv_features = am_string_to_feature(buffer); @@ -1446,7 +1447,7 @@ extract_files_setup( am_has_feature(indexsrv_features, fe_amidxtaped_datestamp)) { if(am_has_feature(indexsrv_features, fe_amidxtaped_config)) { - tt = newstralloc2(tt, "CONFIG=", config); + tt = newstralloc2(tt, "CONFIG=", config_name); send_to_tape_server(tape_control_sock, tt); } if(am_has_feature(indexsrv_features, fe_amidxtaped_label) && @@ -1456,7 +1457,7 @@ extract_files_setup( } if(am_has_feature(indexsrv_features, fe_amidxtaped_fsf)) { char v_fsf[100]; - snprintf(v_fsf, 99, OFF_T_FMT, (OFF_T_FMT_TYPE)fsf); + g_snprintf(v_fsf, 99, "%lld", (long long)fsf); tt = newstralloc2(tt, "FSF=",v_fsf); send_to_tape_server(tape_control_sock, tt); } @@ -1490,8 +1491,8 @@ extract_files_setup( send_to_tape_server(tape_control_sock, disk_regex); send_to_tape_server(tape_control_sock, clean_datestamp); - dbprintf(("Started amidxtaped with arguments \"6 -h -p %s %s %s %s\"\n", - dump_device_name, host_regex, disk_regex, clean_datestamp)); + dbprintf(_("Started amidxtaped with arguments \"6 -h -p %s %s %s %s\"\n"), + dump_device_name, host_regex, disk_regex, clean_datestamp); } /* @@ -1508,7 +1509,7 @@ extract_files_setup( nread = read(tape_control_sock, buffer, sizeof(buffer)); if (nread <= 0) { - error("Could not read from control socket: %s\n", + error(_("Could not read from control socket: %s\n"), strerror(errno)); /*NOTREACHED*/ } @@ -1516,7 +1517,7 @@ extract_files_setup( buffer[nread] = '\0'; if (sscanf(buffer, "CONNECT %hu\n", (unsigned short *)&data_port) != 1) { - error("Recieved invalid port number message from control socket: %s\n", + error(_("Recieved invalid port number message from control socket: %s\n"), buffer); /*NOTREACHED*/ } @@ -1528,7 +1529,7 @@ extract_files_setup( &my_data_port, 0); if(tape_data_sock == -1){ - error("Unable to make data connection to server: %s\n", + error(_("Unable to make data connection to server: %s\n"), strerror(errno)); /*NOTREACHED*/ } @@ -1565,16 +1566,17 @@ read_file_header( bytes_read = read_buffer(tapedev, buffer, buflen, READ_TIMEOUT); if(bytes_read < 0) { - error("error reading header (%s), check amidxtaped.*.debug on server", + error(_("error reading header (%s), check amidxtaped.*.debug on server"), strerror(errno)); /*NOTREACHED*/ } if((size_t)bytes_read < buflen) { - fprintf(stderr, "%s: short block %d byte%s\n", - get_pname(), (int)bytes_read, (bytes_read == 1) ? "" : "s"); + g_fprintf(stderr, plural(_("%s: short block %d byte\n"), + _("%s: short block %d bytes\n"), bytes_read), + get_pname(), (int)bytes_read); print_header(stdout, file); - error("Can't read file header"); + error(_("Can't read file header")); /*NOTREACHED*/ } @@ -1618,7 +1620,7 @@ extract_files_child( /* make in_fd be our stdin */ if (dup2(in_fd, STDIN_FILENO) == -1) { - error("dup2 failed in extract_files_child: %s", strerror(errno)); + error(_("dup2 failed in extract_files_child: %s"), strerror(errno)); /*NOTREACHED*/ } @@ -1628,7 +1630,7 @@ extract_files_child( if(file.type != F_DUMPFILE) { print_header(stdout, &file); - error("bad header"); + error(_("bad header")); /*NOTREACHED*/ } @@ -1798,7 +1800,7 @@ extract_files_child( case IS_GNUTAR: case IS_SAMBA_TAR: #ifndef GNUTAR - fprintf(stderr, "warning: GNUTAR program not available.\n"); + g_fprintf(stderr, _("warning: GNUTAR program not available.\n")); cmd = stralloc("tar"); #else cmd = stralloc(GNUTAR); @@ -1828,19 +1830,20 @@ extract_files_child( } #endif if (cmd == NULL) { - fprintf(stderr, "warning: restore program for %s not available.\n", + g_fprintf(stderr, _("warning: restore program for %s not available.\n"), file.program); cmd = stralloc("restore"); } } if (cmd) { - dbprintf(("Exec'ing %s with arguments:\n", cmd)); + dbprintf(_("Exec'ing %s with arguments:\n"), cmd); for (i = 0; i < j; i++) { if( i == passwd_field) - dbprintf(("\tXXXXX\n")); + dbprintf("\tXXXXX\n"); else - dbprintf(("\t%s\n", restore_args[i])); + dbprintf("\t%s\n", restore_args[i]); } + safe_fd(-1, 0); (void)execv(cmd, restore_args); /* only get here if exec failed */ save_errno = errno; @@ -1849,8 +1852,8 @@ extract_files_child( } amfree(restore_args); errno = save_errno; - perror("amrecover couldn't exec"); - fprintf(stderr, " problem executing %s\n", cmd); + perror(_("amrecover couldn't exec")); + g_fprintf(stderr, _(" problem executing %s\n"), cmd); amfree(cmd); } exit(1); @@ -1888,7 +1891,7 @@ writer_intermediary( } if(pipe(child_pipe) == -1) { - error("extract_list - error setting up pipe to extractor: %s\n", + error(_("extract_list - error setting up pipe to extractor: %s\n"), strerror(errno)); /*NOTREACHED*/ } @@ -1904,7 +1907,7 @@ writer_intermediary( /* This is the parent */ if (pid == -1) { - error("writer_intermediary - error forking child"); + error(_("writer_intermediary - error forking child")); /*NOTREACHED*/ } @@ -1924,14 +1927,14 @@ writer_intermediary( nfound = select(max_fd, &selectset, NULL, NULL, &timeout); if(nfound < 0) { - fprintf(stderr,"select error: %s\n", strerror(errno)); + g_fprintf(stderr,_("select error: %s\n"), strerror(errno)); break; } if (nfound == 0) { /* timeout */ - fprintf(stderr, "timeout waiting %d seconds for restore\n", + g_fprintf(stderr, _("timeout waiting %d seconds for restore\n"), READ_TIMEOUT); - fprintf(stderr, "increase READ_TIMEOUT in recover-src/extract_list.c if your tape is slow\n"); + g_fprintf(stderr, _("increase READ_TIMEOUT in recover-src/extract_list.c if your tape is slow\n")); break; } @@ -1941,7 +1944,7 @@ writer_intermediary( case -1: if ((errno != EINTR) && (errno != EAGAIN)) { if (errno != EPIPE) { - fprintf(stderr,"writer ctl fd read error: %s", + g_fprintf(stderr,_("writer ctl fd read error: %s"), strerror(errno)); } FD_CLR(ctl_fd, &readset); @@ -1961,7 +1964,7 @@ writer_intermediary( int done = 0; while (!done) { char *input = NULL; - printf("Please insert tape %s. Continue? [Y|n]: ", + g_printf(_("Please insert tape %s. Continue? [Y|n]: "), desired_tape); fflush(stdout); @@ -1981,7 +1984,7 @@ writer_intermediary( amfree(input); } } else { - fprintf(stderr, "Strange message from tape server: %s", buffer); + g_fprintf(stderr, _("Strange message from tape server: %s"), buffer); break; } } @@ -1995,7 +1998,7 @@ writer_intermediary( case -1: if ((errno != EINTR) && (errno != EAGAIN)) { if (errno != EPIPE) { - fprintf(stderr,"writer data fd read error: %s", + g_fprintf(stderr,_("writer data fd read error: %s"), strerror(errno)); } FD_CLR(data_fd, &readset); @@ -2013,11 +2016,11 @@ writer_intermediary( */ if(fullwrite(child_pipe[1], buffer, (size_t)bytes_read) < 0) { if(errno == EPIPE) { - error("%s: pipe data reader has quit: %s\n", - get_pname(), strerror(errno)); + error(_("pipe data reader has quit: %s\n"), + strerror(errno)); /* NOTREACHED */ } - error("Write error to extract child: %s\n", + error(_("Write error to extract child: %s\n"), strerror(errno)); /* NOTREACHED */ } @@ -2032,7 +2035,7 @@ writer_intermediary( if(WEXITSTATUS(extractor_status) != 0){ int ret = WEXITSTATUS(extractor_status); if(ret == 255) ret = -1; - error("Extractor child exited with status %d\n", ret); + error(_("Extractor child exited with status %d\n"), ret); /*NOTREACHED*/ } @@ -2072,7 +2075,7 @@ extract_files(void) if (!is_extract_list_nonempty()) { - printf("Extract list empty - No files to extract!\n"); + g_printf(_("Extract list empty - No files to extract!\n")); return; } @@ -2090,7 +2093,7 @@ extract_files(void) l = reply_line(); if (!server_happy()) { - printf("%s\n", l); + g_printf("%s\n", l); exit(1); } /* skip reply number */ @@ -2099,7 +2102,7 @@ extract_files(void) if (strcmp(tape_device_name, "/dev/null") == 0) { - printf("amrecover: warning: using %s as the tape device will not work\n", + g_printf(_("amrecover: warning: using %s as the tape device will not work\n"), tape_device_name); } @@ -2107,17 +2110,17 @@ extract_files(void) for (elist = first_tape_list(); elist != NULL; elist = next_tape_list(elist)) if(elist->tape[0]!='/') { if(first) { - printf("\nExtracting files using tape drive %s on host %s.\n", + g_printf(_("\nExtracting files using tape drive %s on host %s.\n"), tape_device_name, tape_server_name); - printf("The following tapes are needed:"); + g_printf(_("The following tapes are needed:")); first=0; } else - printf(" "); + g_printf(" "); tlist = unmarshal_tapelist_str(elist->tape); for( ; tlist != NULL; tlist = tlist->next) - printf(" %s", tlist->label); - printf("\n"); + g_printf(" %s", tlist->label); + g_printf("\n"); amfree(tlist); } first=1; @@ -2125,52 +2128,52 @@ extract_files(void) { if(elist->tape[0]=='/') { if(first) { - printf("\nExtracting files from holding disk on host %s.\n", + g_printf(_("\nExtracting files from holding disk on host %s.\n"), tape_server_name); - printf("The following files are needed:"); + g_printf(_("The following files are needed:")); first=0; } else - printf(" "); + g_printf(" "); tlist = unmarshal_tapelist_str(elist->tape); for( ; tlist != NULL; tlist = tlist->next) - printf(" %s", tlist->label); - printf("\n"); + g_printf(" %s", tlist->label); + g_printf("\n"); amfree(tlist); } } - printf("\n"); + g_printf("\n"); if (getcwd(buf, sizeof(buf)) == NULL) { - perror("extract_list: Current working directory unavailable"); + perror(_("extract_list: Cannot determine current working directory")); exit(1); } - printf("Restoring files into directory %s\n", buf); + g_printf(_("Restoring files into directory %s\n"), buf); #ifdef SAMBA_CLIENT if (samba_extract_method == SAMBA_SMBCLIENT) - printf("(unless it is a Samba backup, that will go through to the SMB server)\n"); + g_printf(_("(unless it is a Samba backup, that will go through to the SMB server)\n")); #endif if (!okay_to_continue(0,0,0)) return; - printf("\n"); + g_printf("\n"); while ((elist = first_tape_list()) != NULL) { if(elist->tape[0]=='/') { dump_device_name = newstralloc(dump_device_name, elist->tape); - printf("Extracting from file "); + g_printf(_("Extracting from file ")); tlist = unmarshal_tapelist_str(dump_device_name); for( ; tlist != NULL; tlist = tlist->next) - printf(" %s", tlist->label); - printf("\n"); + g_printf(" %s", tlist->label); + g_printf("\n"); amfree(tlist); } else { - printf("Extracting files using tape drive %s on host %s.\n", + g_printf(_("Extracting files using tape drive %s on host %s.\n"), tape_device_name, tape_server_name); tlist = unmarshal_tapelist_str(elist->tape); - printf("Load tape %s now\n", tlist->label); + g_printf(_("Load tape %s now\n"), tlist->label); amfree(tlist); otc = okay_to_continue(1,1,0); if (otc == 0) @@ -2186,7 +2189,7 @@ extract_files(void) /* connect to the tape handler daemon on the tape drive server */ if ((tape_control_sock = extract_files_setup(elist->tape, elist->fileno)) == -1) { - fprintf(stderr, "amrecover - can't talk to tape server\n"); + g_fprintf(stderr, _("amrecover - can't talk to tape server\n")); return; } @@ -2201,7 +2204,7 @@ extract_files(void) /* this is the parent */ if (pid == -1) { - perror("extract_list - error forking child"); + perror(_("extract_list - error forking child")); aclose(tape_control_sock); exit(1); } @@ -2212,7 +2215,7 @@ extract_files(void) /* wait for the child process to finish */ if ((pid = waitpid(-1, &child_stat, 0)) == (pid_t)-1) { - perror("extract_list - error waiting for child"); + perror(_("extract_list - error waiting for child")); exit(1); } @@ -2226,13 +2229,13 @@ extract_files(void) } else { - fprintf(stderr, "extract list - unknown child terminated?\n"); + g_fprintf(stderr, _("extract list - unknown child terminated?\n")); exit(1); } if ((WIFEXITED(child_stat) != 0) && (WEXITSTATUS(child_stat) != 0)) { - fprintf(stderr, - "extract_list - child returned non-zero status: %d\n", + g_fprintf(stderr, + _("extract_list - child returned non-zero status: %d\n"), WEXITSTATUS(child_stat)); otc = okay_to_continue(0,0,1); if(otc == 0)