aboutsummaryrefslogtreecommitdiff
path: root/kitten.c
diff options
context:
space:
mode:
Diffstat (limited to 'kitten.c')
-rw-r--r--kitten.c37
1 files changed, 35 insertions, 2 deletions
diff --git a/kitten.c b/kitten.c
index 3a6901e..3e7f9d9 100644
--- a/kitten.c
+++ b/kitten.c
@@ -164,6 +164,21 @@ const char *kittengets(int setnum, int msgnum, const char *message)
/**
+ * Obtains path to current exec.
+ */
+static char * get_cmd_path(char *buf)
+{
+ char cmd_drive[_MAX_DRIVE];
+ char cmd_dir[_MAX_DIR];
+
+ _splitpath(__argv[0], cmd_drive, cmd_dir, NULL, NULL);
+ _makepath(buf, cmd_drive, cmd_dir, "", NULL);
+
+ return buf;
+}
+
+
+/**
* Initialize kitten for program (name).
*/
@@ -220,8 +235,26 @@ nl_catd kittenopen(char *name)
/* we copy the full LANG value or the part before "-" if "-" found */
catlang[2] = '\0';
- /* step through NLSPATH */
-
+ /* first try to find catalog file in the same path as exe */
+ get_cmd_path(catfile);
+ strcat(catfile, name);
+ strcat(catfile, ".");
+ strcat(catfile, catlang);
+ _kitten_catalog = catread (catfile);
+ if (_kitten_catalog)
+ return (_kitten_catalog);
+
+ /* maybe exe_path\nls\cat.%LANG% ? */
+ get_cmd_path(catfile);
+ strcat(catfile, "NLS\\");
+ strcat(catfile, name);
+ strcat(catfile, ".");
+ strcat(catfile, catlang);
+ _kitten_catalog = catread (catfile);
+ if (_kitten_catalog)
+ return (_kitten_catalog);
+
+ /* otherwise step through NLSPATH */
nlsptr = getenv ("NLSPATH");
if (nlsptr == NULL) {