]> git.decadent.org.uk Git - nfs-utils.git/commitdiff
mount.nfs: Support double-wide characters in printed strings
authorChuck Lever <chuck.lever@oracle.com>
Fri, 3 Aug 2007 17:23:29 +0000 (13:23 -0400)
committerNeil Brown <neilb@suse.de>
Fri, 3 Aug 2007 22:27:39 +0000 (08:27 +1000)
Previous NLS changes missed a spot or two.  This patch tries to get
most of them, but probably misses a few more.

In errors.c:mount_errors() I've removed a period at the end of the error
messages; this is consistent with other error messages I've examined.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Neil Brown <neilb@suse.de>
utils/mount/error.c
utils/mount/mount.c
utils/mount/nfs4mount.c
utils/mount/nfsmount.c
utils/mount/nfsumount.c

index bf056af8eb38d1cabe3996b918f30b7883c21a8c..cab84c97125ab88df4921fc995c7d4b20f2eaea6 100644 (file)
@@ -67,9 +67,11 @@ static int rpc_strerror(int spos)
                tmp = &errbuf[spos];
                if (cf_stat == RPC_SYSTEMERROR)
                        pos = snprintf(tmp, (erreob - tmp),
-                               "System Error: %s", strerror(cf_errno));
+                                       _("System Error: %s"),
+                                               strerror(cf_errno));
                else
-                       pos = snprintf(tmp, (erreob - tmp), "RPC Error:%s", estr);
+                       pos = snprintf(tmp, (erreob - tmp),
+                                       _("RPC Error:%s"), estr);
        }
        return pos;
 }
@@ -83,30 +85,40 @@ void mount_errors(char *server, int will_retry, int bg)
        tmp = &errbuf[pos];
        if (bg)
                pos = snprintf(tmp, (erreob - tmp),
-                       "mount to NFS server '%s' failed: ", server);
+                               _("mount to NFS server '%s' failed: "),
+                                       server);
        else
                pos = snprintf(tmp, (erreob - tmp),
-                              "%s: mount to NFS server '%s' failed: ",
-                              progname, server);
+                               _("%s: mount to NFS server '%s' failed: "),
+                                       progname, server);
 
        tmp = &errbuf[pos];
        if (rpc_createerr.cf_stat == RPC_TIMEDOUT) {
-               pos = snprintf(tmp, (erreob - tmp), "timed out %s",
-                       will_retry ? "(retrying)" : "(giving up)");
+               if (will_retry)
+                       pos = snprintf(tmp, (erreob - tmp),
+                                       _("timed out, retrying"));
+               else
+                       pos = snprintf(tmp, (erreob - tmp),
+                                       _("timed out, giving up"));
        } else {
                pos += rpc_strerror(pos);
                tmp = &errbuf[pos];
                if (bg) {
-                       pos = snprintf(tmp, (erreob - tmp), " %s",
-                               will_retry ? "(retrying)" : "(giving up)");
+                       if (will_retry)
+                               pos = snprintf(tmp, (erreob - tmp),
+                                               _(", retrying"));
+                       else
+                               pos = snprintf(tmp, (erreob - tmp),
+                                               _(", giving up"));
                }
        }
+
        if (bg) {
                if (onlyonce++ < 1)
                        openlog("mount", LOG_CONS|LOG_PID, LOG_AUTH);
-               syslog(LOG_ERR, "%s.", errbuf);
+               syslog(LOG_ERR, "%s", errbuf);
        } else
-               fprintf(stderr, "%s.\n", errbuf);
+               fprintf(stderr, "%s\n", errbuf);
 }
 
 void mount_error(const char *spec, const char *mount_point, int error)
index d6d527cc5cb7d5d531c72123dbd51e461dcab1dc..a7ad035237b464fd269a2f0b1cf6fb3de968b797 100644 (file)
@@ -174,14 +174,13 @@ static void discover_nfs_mount_data_version(void)
 
 static void print_one(char *spec, char *node, char *type, char *opts)
 {
-       if (verbose) {
-               printf("%s on %s type %s", spec, node, type);
+       if (!verbose)
+               return;
 
-               if (opts != NULL)
-                       printf(" (%s)", opts);
-
-               printf("\n");
-       }
+       if (opts)
+               printf(_("%s on %s type %s (%s)\n"), spec, node, type, opts);
+       else
+               printf(_("%s on %s type %s\n"), spec, node, type);
 }
 
 /*
@@ -268,18 +267,18 @@ fail_unlock:
 
 void mount_usage(void)
 {
-       printf("usage: %s remotetarget dir [-rvVwfnh] [-o nfsoptions]\n",
+       printf(_("usage: %s remotetarget dir [-rvVwfnh] [-o nfsoptions]\n"),
                progname);
-       printf("options:\n");
-       printf("\t-r\t\tMount file system readonly\n");
-       printf("\t-v\t\tVerbose\n");
-       printf("\t-V\t\tPrint version\n");
-       printf("\t-w\t\tMount file system read-write\n");
-       printf("\t-f\t\tFake mount, do not actually mount\n");
-       printf("\t-n\t\tDo not update /etc/mtab\n");
-       printf("\t-s\t\tTolerate sloppy mount options rather than failing.\n");
-       printf("\t-h\t\tPrint this help\n");
-       printf("\tnfsoptions\tRefer to mount.nfs(8) or nfs(5)\n\n");
+       printf(_("options:\n"));
+       printf(_("\t-r\t\tMount file system readonly\n"));
+       printf(_("\t-v\t\tVerbose\n"));
+       printf(_("\t-V\t\tPrint version\n"));
+       printf(_("\t-w\t\tMount file system read-write\n"));
+       printf(_("\t-f\t\tFake mount, do not actually mount\n"));
+       printf(_("\t-n\t\tDo not update /etc/mtab\n"));
+       printf(_("\t-s\t\tTolerate sloppy mount options rather than failing.\n"));
+       printf(_("\t-h\t\tPrint this help\n"));
+       printf(_("\tnfsoptions\tRefer to mount.nfs(8) or nfs(5)\n\n"));
 }
 
 static void parse_opt(const char *opt, int *mask, char *extra_opts, int len)
index e1b2c3b557eb2fa0372e72746d77257c9f3fc626..94f1b4bdb27a3abcfd95a80ff00a2a25aee199c2 100644 (file)
@@ -321,8 +321,8 @@ int nfs4mount(const char *spec, const char *node, int flags,
                        else if (!strcmp(opt, "sharecache"))
                                unshared = !val;
                        else if (!sloppy) {
-                               printf(_("unknown nfs mount option: "
-                                        "%s%s\n"), val ? "" : "no", opt);
+                               printf(_("unknown nfs mount option: %s%s\n"),
+                                               val ? "" : "no", opt);
                                goto fail;
                        }
                }
index bd3403c33ec4c8cacf7f8ce0d40dc2444d6d643c..a56bfe1ff2e66e4b280b258e830eaf2ca443c757 100644 (file)
@@ -190,7 +190,6 @@ parse_options(char *old_opts, struct nfs_mount_data *data,
                if ((opteq = strchr(opt, '=')) && isdigit(opteq[1])) {
                        int val = atoi(opteq + 1);      
                        *opteq = '\0';
-/* printf("opt=%s\n", opt); */
                        if (!strcmp(opt, "rsize"))
                                data->rsize = val;
                        else if (!strcmp(opt, "wsize"))
@@ -432,7 +431,7 @@ parse_options(char *old_opts, struct nfs_mount_data *data,
                                                val ? "" : "no", opt);
                                goto out_bad;
                        }
-                       sprintf(cbuf, val ? "%s,":"no%s,", opt);
+                       sprintf(cbuf, val ? "%s," : "no%s,", opt);
                }
                len += strlen(cbuf);
                if (len >= opt_size) {
index 0c667176f7ca325b84e99930c87517c19c13f649..e8814a37e7ad896450bc738c4695eb3179782eda 100644 (file)
@@ -67,7 +67,7 @@ static int del_mtab(const char *spec, const char *node)
                 res = umount2 (node, MNT_FORCE);
                 if (res == -1) {
                         int errsv = errno;
-                        perror("umount2");
+                        perror(_("umount2"));
                         errno = errsv;
                         if (errno == ENOSYS) {
                                 if (verbose)
@@ -93,7 +93,7 @@ static int del_mtab(const char *spec, const char *node)
                                 update_mtab(node, &remnt);
                         return 0;
                 } else if (errno != EBUSY) {    /* hmm ... */
-                        perror("remount");
+                        perror(_("remount"));
                         nfs_error(_("%s: could not remount %s read-only"),
                                        progname, spec);
                 }
@@ -102,7 +102,7 @@ static int del_mtab(const char *spec, const char *node)
         if (res >= 0) {
                 /* Umount succeeded */
                 if (verbose)
-                        printf (_("%s umounted\n"), spec ? spec : node);
+                        printf(_("%s umounted\n"), spec ? spec : node);
         }
 
  writemtab:
@@ -212,13 +212,13 @@ static struct option umount_longopts[] =
 
 static void umount_usage(void)
 {
-       printf("usage: %s dir [-fvnrlh]\n", progname);
-       printf("options:\n\t-f\t\tforce unmount\n");
-       printf("\t-v\t\tverbose\n");
-       printf("\t-n\t\tDo not update /etc/mtab\n");
-       printf("\t-r\t\tremount\n");
-       printf("\t-l\t\tlazy unmount\n");
-       printf("\t-h\t\tprint this help\n\n");
+       printf(_("usage: %s dir [-fvnrlh]\n"), progname);
+       printf(_("options:\n\t-f\t\tforce unmount\n"));
+       printf(_("\t-v\tverbose\n"));
+       printf(_("\t-n\tDo not update /etc/mtab\n"));
+       printf(_("\t-r\tremount\n"));
+       printf(_("\t-l\tlazy unmount\n"));
+       printf(_("\t-h\tprint this help\n\n"));
 }
 
 int nfsumount(int argc, char *argv[])
@@ -282,7 +282,7 @@ int nfsumount(int argc, char *argv[])
 
        if (mc && strcmp(mc->m.mnt_type, "nfs") != 0 &&
            strcmp(mc->m.mnt_type, "nfs4") != 0) {
-               nfs_error(_("%s: %s on %s it not an nfs filesystem"),
+               nfs_error(_("%s: %s on %s is not an NFS filesystem"),
                                progname, mc->m.mnt_fsname, mc->m.mnt_dir);
                return EX_USAGE;
        }