Imported Upstream version 3.3.2
[debian/amanda] / oldrecover-src / set_commands.c
index 812e181c003742b5716328ca5722557c3e090cc7..7a52122a29746e4368a3f3075736cab8468fbc37 100644 (file)
@@ -30,6 +30,7 @@
  */
 
 #include "amanda.h"
+#include "match.h"
 #include "util.h"
 #include "amrecover.h"
 
@@ -63,8 +64,8 @@ set_date(
        }
        else
        {
-           printf("No index records for cwd on new date\n");
-           printf("Setting cwd to mount point\n");
+           g_printf(_("No index records for cwd on new date\n"));
+           g_printf(_("Setting cwd to mount point\n"));
            disk_path = newstralloc(disk_path, "/");    /* fake it */
            clear_dir_list();
        }
@@ -86,7 +87,7 @@ set_host(
 
     if (is_extract_list_nonempty())
     {
-       printf("Must clear extract list before changing host\n");
+       g_printf(_("Must clear extract list before changing host\n"));
        return;
     }
 
@@ -105,7 +106,7 @@ set_host(
         */
        if ((hp = gethostbyname(uqhost)) != NULL) {
            host = hp->h_name;
-           printf("Trying host %s ...\n", host);
+           g_printf(_("Trying host %s ...\n"), host);
            cmd = newstralloc2(cmd, "HOST ", host);
            if (converse(cmd) == -1)
                exit(1);
@@ -117,7 +118,7 @@ set_host(
            {
                for (hostp = hp->h_aliases; (host = *hostp) != NULL; hostp++)
                {
-                   printf("Trying host %s ...\n", host);
+                   g_printf(_("Trying host %s ...\n"), host);
                    cmd = newstralloc2(cmd, "HOST ", host);
                    if (converse(cmd) == -1)
                        exit(1);
@@ -165,7 +166,7 @@ set_disk(
 
     if (is_extract_list_nonempty())
     {
-       printf("Must clear extract list before changing disk\n");
+       g_printf(_("Must clear extract list before changing disk\n"));
        return;
     }
 
@@ -173,7 +174,7 @@ set_disk(
     if (mtpt != NULL) {
        uqmtpt = unquote_string(mtpt);
        if (*mtpt != '/') {
-           printf("Mount point \"%s\" invalid - must start with /\n", uqmtpt);
+           g_printf(_("Mount point \"%s\" invalid - must start with /\n"), uqmtpt);
            amfree(uqmtpt);
            return;
        }
@@ -224,8 +225,8 @@ set_disk(
     }
     else
     {
-       printf("No index records for disk for specified date\n");
-       printf("If date correct, notify system administrator\n");
+       g_printf(_("No index records for disk for specified date\n"));
+       g_printf(_("If date correct, notify system administrator\n"));
        disk_path = newstralloc(disk_path, "/");        /* fake it */
        clear_dir_list();
     }
@@ -279,15 +280,15 @@ cd_glob(
     char *path_on_disk = NULL;
 
     if (disk_name == NULL) {
-       printf("Must select disk before changing directory\n");
+       g_printf(_("Must select disk before changing directory\n"));
        return;
     }
 
     uqglob = unquote_string(glob);
     regex = glob_to_regex(uqglob);
-    dbprintf(("cd_glob (%s) -> %s\n", uqglob, regex));
+    dbprintf(_("cd_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);
        amfree(regex);
         return;
@@ -309,7 +310,7 @@ cd_glob(
     if (strcmp(disk_path, "/") == 0)
         path_on_disk = stralloc2("/", regex_path);
     else {
-        char *clean_disk_path = clean_regex(disk_path);
+        char *clean_disk_path = clean_regex(disk_path, 0);
         path_on_disk = vstralloc(clean_disk_path, "/", regex_path, NULL);
         amfree(clean_disk_path);
     }
@@ -331,13 +332,13 @@ cd_regex(
     char *path_on_disk = NULL;
 
     if (disk_name == NULL) {
-       printf("Must select disk before changing directory\n");
+       g_printf(_("Must select disk before changing directory\n"));
        return;
     }
 
     uqregex = unquote_string(regex);
     if ((s = validate_regexp(uqregex)) != NULL) {
-       printf("\"%s\" is not a valid regular expression: ", uqregex);
+       g_printf(_("\"%s\" is not a valid regular expression: "), uqregex);
        amfree(uqregex);
        puts(s);
        return;
@@ -347,7 +348,7 @@ cd_regex(
     if (strcmp(disk_path, "/") == 0)
         path_on_disk = stralloc2("/", regex);
     else {
-        char *clean_disk_path = clean_regex(disk_path);
+        char *clean_disk_path = clean_regex(disk_path, 0);
         path_on_disk = vstralloc(clean_disk_path, "/", regex, NULL);
         amfree(clean_disk_path);
     }
@@ -391,7 +392,7 @@ cd_dir(
                if(dir[strlen(dir)-1] == '/')
                    dir[strlen(dir)-1] = '\0'; /* remove last / */
                /* remove everything before the last / */
-               dir1 = rindex(dir,'/');
+               dir1 = strrchr(dir,'/');
                if (dir1) {
                    dir1++;
                    dir2 = stralloc(dir1);
@@ -410,7 +411,7 @@ cd_dir(
        set_directory(dir);
     }
     else {
-       printf("Too many directory\n");
+       g_printf(_("Too many directory\n"));
     }
     amfree(dir);
 }
@@ -432,7 +433,7 @@ set_directory(
     }
 
     if (disk_name == NULL) {
-       printf("Must select disk before setting directory\n");
+       g_printf(_("Must select disk before setting directory\n"));
        return;
        /*NOTREACHED*/
     }
@@ -452,7 +453,7 @@ set_directory(
        {
            if (strncmp(mount_point, ldir, strlen(mount_point)) != 0)
            {
-               printf("Invalid directory - Can't cd outside mount point \"%s\"\n",
+               g_printf(_("Invalid directory - Can't cd outside mount point \"%s\"\n"),
                       mount_point);
                amfree(ldir);
                return;
@@ -488,7 +489,7 @@ set_directory(
        if (strcmp(dp, "..") == 0) {
            if (strcmp(new_dir, "/") == 0) {
                /* at top of disk */
-               printf("Invalid directory - Can't cd outside mount point \"%s\"\n",
+               g_printf(_("Invalid directory - Can't cd outside mount point \"%s\"\n"),
                       mount_point);
                /*@ignore@*/
                amfree(new_dir);
@@ -532,7 +533,7 @@ set_directory(
     }
     else
     {
-       printf("Invalid directory - %s\n", dir);
+       g_printf(_("Invalid directory - %s\n"), dir);
     }
 
     /*@ignore@*/
@@ -547,13 +548,13 @@ void
 show_directory(void)
 {
     if (mount_point == NULL || disk_path == NULL)
-        printf("Must select disk first\n");
+        g_printf(_("Must select disk first\n"));
     else if (strcmp(mount_point, "/") == 0)
-       printf("%s\n", disk_path);
+       g_printf("%s\n", disk_path);
     else if (strcmp(disk_path, "/") == 0)
-       printf("%s\n", mount_point);
+       g_printf("%s\n", mount_point);
     else
-       printf("%s%s\n", mount_point, disk_path);
+       g_printf("%s%s\n", mount_point, disk_path);
 }
 
 
@@ -596,14 +597,14 @@ set_tape(
     }
 
     if (tape_device_name)
-       printf ("Using tape \"%s\"", tape_device_name);
+       g_printf (_("Using tape \"%s\""), tape_device_name);
     else
-       printf ("Using default tape");
+       g_printf (_("Using default tape"));
 
     if (tape_server_name)
-       printf (" from server %s.\n", tape_server_name);
+       g_printf (_(" from server %s.\n"), tape_server_name);
     else
-       printf (".\nTape server unspecified, assumed to be %s.\n",
+       g_printf (_(".\nTape server unspecified, assumed to be %s.\n"),
                server_name);
 }
 
@@ -613,11 +614,11 @@ set_mode(
 {
 #ifdef SAMBA_CLIENT
   if (mode == SAMBA_SMBCLIENT) {
-    printf ("SAMBA dumps will be extracted using smbclient\n");
+    g_printf (_("SAMBA dumps will be extracted using smbclient\n"));
     samba_extract_method = SAMBA_SMBCLIENT;
   } else {
     if (mode == SAMBA_TAR) {
-      printf ("SAMBA dumps will be extracted as TAR dumps\n");
+      g_printf (_("SAMBA dumps will be extracted as TAR dumps\n"));
       samba_extract_method = SAMBA_TAR;
     }
   }
@@ -630,12 +631,12 @@ void
 show_mode(void) 
 {
 #ifdef SAMBA_CLIENT
-  printf ("SAMBA dumps are extracted ");
+  g_printf (_("SAMBA dumps are extracted "));
 
   if (samba_extract_method == SAMBA_TAR) {
-    printf (" as TAR dumps\n");
+    g_printf (_(" as TAR dumps\n"));
   } else {
-    printf ("using smbclient\n");
+    g_printf (_("using smbclient\n"));
   }
 #endif /* SAMBA_CLIENT */
 }