Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.sbin/sysinst Make sysinst use the catalog files installe...



details:   https://anonhg.NetBSD.org/src/rev/3a002f150265
branches:  trunk
changeset: 797988:3a002f150265
user:      martin <martin%NetBSD.org@localhost>
date:      Wed Aug 06 09:11:46 2014 +0000

description:
Make sysinst use the catalog files installed in /usr/share/sysinst (if
available), fall back to . if not, or use build-in english otherwise.

diffstat:

 usr.sbin/sysinst/main.c |  20 +++++++++++++++++---
 1 files changed, 17 insertions(+), 3 deletions(-)

diffs (62 lines):

diff -r a33791d126b5 -r 3a002f150265 usr.sbin/sysinst/main.c
--- a/usr.sbin/sysinst/main.c   Wed Aug 06 08:23:43 2014 +0000
+++ b/usr.sbin/sysinst/main.c   Wed Aug 06 09:11:46 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: main.c,v 1.2 2014/08/03 16:09:38 martin Exp $  */
+/*     $NetBSD: main.c,v 1.3 2014/08/06 09:11:46 martin Exp $  */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -36,6 +36,7 @@
 
 #include <sys/types.h>
 #include <sys/stat.h>
+#include <sys/syslimits.h>
 #include <sys/uio.h>
 #include <stdio.h>
 #include <signal.h>
@@ -275,13 +276,24 @@
        DIR *dir;
        struct dirent *dirent;
        char **lang_msg, **fnames;
+       char prefix[PATH_MAX], fname[PATH_MAX];
        int max_lang = 16, num_lang = 0;
        const char *cp;
        menu_ent *opt = 0;
        int lang_menu = -1;
        int lang;
 
+#ifdef CATALOG_DIR
+       strcpy(prefix, CATALOG_DIR "/");
+       dir = opendir(CATALOG_DIR);
+       if (!dir) {
+               strcpy(prefix, "./");
+               dir = opendir(".");
+       }
+#else
        dir = opendir(".");
+       strcpy(prefix, "./");
+#endif
        if (!dir)
                return;
 
@@ -297,7 +309,9 @@
        while ((dirent = readdir(dir)) != 0) {
                if (memcmp(dirent->d_name, "sysinstmsgs.", 12))
                        continue;
-               if (msg_file(dirent->d_name))
+               strcpy(fname, prefix);
+               strcat(fname, dirent->d_name);
+               if (msg_file(fname))
                        continue;
                cp = msg_string(MSG_sysinst_message_language);
                if (!strcmp(cp, lang_msg[0]))
@@ -314,7 +328,7 @@
                                break;
                        fnames = new;
                }
-               fnames[num_lang] = strdup(dirent->d_name);
+               fnames[num_lang] = strdup(fname);
                lang_msg[num_lang++] = strdup(cp);
        }
        msg_file(0);



Home | Main Index | Thread Index | Old Index