aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--kitten.c696
-rw-r--r--kitten.h78
-rw-r--r--makefile10
-rw-r--r--mousmain.c101
-rw-r--r--nls/vbmouse.en54
-rw-r--r--nls/vbmouse.es56
-rw-r--r--nls/vbsf.en58
-rw-r--r--nls/vbsf.es61
-rw-r--r--sfmain.c129
9 files changed, 1130 insertions, 113 deletions
diff --git a/kitten.c b/kitten.c
new file mode 100644
index 0000000..f63cd96
--- /dev/null
+++ b/kitten.c
@@ -0,0 +1,696 @@
+/* Functions that emulate UNIX catgets */
+
+/* Copyright (C) 1999,2000,2001 Jim Hall <jhall@freedos.org> */
+/* Kitten version 2003 by Tom Ehlert, heavily modified by Eric Auer 2003 */
+
+/*
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+
+#ifndef NO_KITTEN
+
+#include <stdio.h> /* sprintf */
+#ifndef _MICROC_
+#include <stdlib.h> /* getenv */
+#include <string.h> /* strchr */
+#include <dos.h>
+#ifndef __PACIFIC__
+#include <fcntl.h>
+#else
+#define O_RDONLY 0
+#define O_TEXT 0
+#endif
+#else
+#include <intr.h>
+#include <file.h>
+#define O_RDONLY READONLY
+#define O_TEXT 0
+#endif
+/* assert we are running in small model */
+/* else pointer below has to be done correctly */
+/* char verify_small_pointers[sizeof(void*) == 2 ? 1 : -1]; */
+
+#include "kitten.h"
+
+char catcontents[8192];
+
+struct catstring
+{
+ char key1;
+ char key2;
+ char *text;
+};
+
+/* Micro-C does not support typedef */
+#define catstring_t struct catstring
+
+catstring_t catpoints[128];
+
+
+/* Local prototypes */
+
+int catread (char *catfile); /* Reads a catfile into the hash */
+char *processEscChars (char *line); /* Converts c escape sequences to chars */
+
+int get_char (int file); /* not meant for external use */
+/* external use would cause consistency problems if */
+/* value or related file of the file handle changes */
+
+int mystrtoul (char *src, int base, int size);
+
+
+/* Globals */
+
+nl_catd _kitten_catalog = 0; /* _kitten_catalog descriptor or 0 */
+char catfile[128]; /* full path to _kitten_catalog */
+
+char getlbuf[8192]; /* read buffer for better speed */
+char *getlp; /* current point in buffer */
+int getlrem = -1; /* remaining bytes in buffer */
+char lastcr = 0; /* for 2byte CR LF sequences */
+
+
+#ifndef _MICROC_
+#ifndef __DJGPP__
+
+/* DOS handle based file usage */
+
+int
+dos_open (char *filename)
+{
+ union REGS r;
+ struct SREGS s;
+
+ r.h.ah = 0x3d;
+ r.h.al = 0; /* read mode only supoported now !! */
+ r.x.dx = FP_OFF (filename);
+ s.ds = FP_SEG (filename);
+ intdosx (&r, &r, &s);
+ return ((r.x.cflag) ? -1 : (int) r.x.ax);
+}
+
+
+int
+dos_read (int file, void *ptr, unsigned count)
+{
+ union REGS r;
+ struct SREGS s;
+ r.h.ah = 0x3f;
+ r.x.bx = file;
+ r.x.cx = count;
+ r.x.dx = FP_OFF (ptr);
+ s.ds = FP_SEG (ptr);
+ intdosx (&r, &r, &s);
+ return ((r.x.cflag) ? 0 : r.x.ax);
+}
+
+
+int
+dos_write (int file, void *ptr, unsigned count)
+{
+ union REGS r;
+ struct SREGS s;
+ r.h.ah = 0x40;
+ r.x.bx = file;
+ r.x.cx = count;
+ r.x.dx = FP_OFF (ptr);
+ s.ds = FP_SEG (ptr);
+ intdosx (&r, &r, &s);
+ return ((r.x.cflag) ? 0 : r.x.ax);
+}
+
+
+void
+dos_close (int file)
+{
+ union REGS r;
+ r.h.ah = 0x3e;
+ r.x.bx = file;
+ intdos (&r, &r);
+}
+
+#endif /*DJGPP*/
+#endif /*Micro-C */
+/* Functions */
+/**
+ * On success, catgets() returns a pointer to an internal
+ * buffer area containing the null-terminated message string.
+ * On failure, catgets() returns the value 'message'.
+ */
+char *
+kittengets (int setnum, int msgnum, char *message)
+{
+/* In Micro-C, variables must be defined at the start of the
+ * function and may not be immediately assigned a value
+ */
+#ifdef _MICROC_
+ int i;
+ i = 0;
+#else
+ int i = 0;
+#endif
+
+ while ((catpoints[i].key1 != setnum) || (catpoints[i].key2 != msgnum))
+ {
+ if ((catpoints[i].text == NULL) || (i > 127)) /* at EOF */
+ return message;
+ i++;
+ }
+
+ if (catpoints[i].text == NULL)
+ return message;
+ else
+ return (catpoints[i].text);
+}
+
+
+/**
+ * Initialize kitten for program (name).
+ */
+
+nl_catd
+kittenopen (char *name)
+{
+ /* catopen() returns a message _kitten_catalog descriptor *
+ * of type nl_catd on success. On failure, it returns -1. */
+
+ char catlang[3]; /* from LANG environment var. */
+ char *nlsptr; /* ptr to NLSPATH */
+ char *lang; /* ptr to LANG */
+ int i;
+#ifdef _MICROC_
+ char *tok;
+ int toklen;
+#endif
+
+ /* Open the _kitten_catalog file */
+ /* The value of `_kitten_catalog' will be set based on catread */
+
+ if (_kitten_catalog)
+ { /* Already one open */
+ write (1, "cat already open\r\n", strlen ("cat already open\r\n"));
+ return (-1);
+ }
+
+ for (i = 0; i < 128; i++)
+ catpoints[i].text = NULL;
+
+ if (strchr (name, '\\'))
+ {
+ /* unusual case: 'name' is a filename */
+ write (1, "found \\\r\n", 9);
+ _kitten_catalog = catread (name);
+ if (_kitten_catalog)
+ return (_kitten_catalog);
+ }
+
+ /* If the message _kitten_catalog file name does not contain a directory *
+ * separator, then we need to try to locate the message _kitten_catalog. */
+
+ /* We will need the value of LANG, and may need a 2-letter abbrev of
+ LANG later on, so get it now. */
+
+ lang = getenv ("LANG");
+
+ if (lang == NULL)
+ {
+ /* printf("no lang= found\n"); *//* not fatal, though */
+ /* Return failure - we won't be able to locate the cat file */
+ return (-1);
+ }
+
+ if ((strlen (lang) < 2) || ((strlen (lang) > 2) && (lang[2] != '-')))
+ {
+ /* Return failure - we won't be able to locate the cat file */
+ return (-1);
+ }
+
+ memcpy (catlang, lang, 2);
+ /* we copy the full LANG value or the part before "-" if "-" found */
+ catlang[2] = '\0';
+
+ /* step through NLSPATH */
+
+ nlsptr = getenv ("NLSPATH");
+
+ if (nlsptr == NULL)
+ {
+ /* printf("no NLSPATH= found\n"); *//* not fatal either */
+ /* Return failure - we won't be able to locate the cat file */
+ return (-1);
+ }
+
+ catfile[0] = '\0';
+
+ while (nlsptr && nlsptr[0])
+ {
+#ifdef _MICROC_
+ tok = strchr (nlsptr, ';');
+#else
+ char *tok = strchr (nlsptr, ';');
+ int toklen;
+#endif
+
+ if (tok == NULL)
+ toklen = strlen (nlsptr); /* last segment */
+ else
+ toklen = tok - nlsptr; /* segment terminated by ';' */
+
+ /* catfile = malloc(toklen+1+strlen(name)+1+strlen(lang)+1); */
+ /* Try to find the _kitten_catalog file in each path from NLSPATH */
+
+ if ((toklen + 6 + strlen (name)) > sizeof (catfile))
+ {
+ write (1, "NLSPATH overflow\r\n", strlen ("NLSPATH overflow\r\n"));
+ return 0; /* overflow in NLSPATH, should never happen */
+ }
+
+ /* Rule #1: %NLSPATH%\%LANG%\cat */
+
+ memcpy (catfile, nlsptr, toklen);
+ strcpy (catfile + toklen, "\\");
+ strcat (catfile, catlang);
+ strcat (catfile, "\\");
+ strcat (catfile, name);
+ _kitten_catalog = catread (catfile);
+ if (_kitten_catalog)
+ return (_kitten_catalog);
+
+ /* Rule #2: %NLSPATH%\cat.%LANG% */
+
+ /* memcpy(catfile, nlsptr, toklen); */
+ strcpy (catfile + toklen, "\\");
+ strcat (catfile, name);
+ strcat (catfile, ".");
+ strcat (catfile, catlang);
+ _kitten_catalog = catread (catfile);
+ if (_kitten_catalog)
+ return (_kitten_catalog);
+
+ /* Grab next tok for the next while iteration */
+
+ nlsptr = tok;
+ if (nlsptr)
+ nlsptr++;
+
+ } /* while tok */
+
+ /* We could not find it. Return failure. */
+
+ return (-1);
+}
+
+
+/**
+ * Load a message catalog into memory.
+ */
+
+int
+catread (char *catfile)
+{
+ int file; /* pointer to the catfile */
+ int i;
+ char *where;
+ char *tok;
+#ifdef _MICROC_
+ char *msg;
+ char *key;
+ int key1;
+ int key2;
+#endif
+
+ /* Get the whole catfile into a buffer and parse it */
+
+ file = open (catfile, O_RDONLY | O_TEXT);
+ if (file < 0)
+ /* Cannot open the file. Return failure */
+ return 0;
+
+ for (i = 0; i < 128; i++)
+ catpoints[i].text = NULL;
+
+ for (i = 0; (unsigned int) i < sizeof (catcontents); i++)
+ catcontents[i] = '\0';
+
+ /* Read the file into memory */
+ i = read (file, catcontents, sizeof (catcontents) - 1);
+
+ if ((i == sizeof (catcontents) - 1) || (i < 1))
+ return 0; /* file was too big or too small */
+
+ where = catcontents;
+ i = 0; /* catpoints entry */
+
+ do
+ {
+#ifndef _MICROC_
+ char *msg;
+ char *key;
+ int key1 = 0;
+ int key2 = 0;
+#else
+ key1 = 0;
+ key2 = 0;
+#endif
+
+ tok = strchr (where, '\n');
+
+ if (tok == NULL)
+ { /* done? */
+ close (file);
+ return 1; /* success */
+ }
+
+ tok[0] = '\0'; /* terminate here */
+ tok--; /* guess: \r before \n */
+ if (tok[0] != '\r')
+ tok++; /* if not, go back */
+ else
+ {
+ tok[0] = '\0'; /* terminate here already */
+ tok++;
+ }
+ tok++; /* this is where the next line starts */
+
+ if ((where[0] >= '0') && (where[0] <= '9') &&
+ ((msg = strchr (where, ':')) != NULL))
+ {
+ /* Skip everything which starts with # or with no digit */
+ /* Entries look like "1.2:This is a message" */
+
+ msg[0] = '\0'; /* remove : */
+ msg++; /* go past the : */
+
+ if ((key = strchr (where, '.')) != NULL)
+ {
+ key[0] = '\0'; /* turn . into terminator */
+ key++; /* go past the . */
+ key1 = mystrtoul (where, 10, strlen (where));
+ key2 = mystrtoul (key, 10, strlen (key));
+
+ if ((key1 >= 0) && (key2 >= 0))
+ {
+ catpoints[i].key1 = key1;
+ catpoints[i].key2 = key2;
+ catpoints[i].text = processEscChars (msg);
+ if (catpoints[i].text == NULL) /* ESC parse error */
+ catpoints[i].text = msg;
+ i++; /* next entry! */
+ } /* valid keys */
+
+ } /* . found */
+
+ } /* : and digit found */
+
+ where = tok; /* go to next line */
+
+ }
+ while (1);
+#ifdef __PACIFIC__
+ return 0;
+#endif
+}
+
+
+void
+kittenclose (void)
+{
+ /* close a message _kitten_catalog */
+ _kitten_catalog = 0;
+}
+
+
+/**
+ * Parse a string that represents an unsigned integer.
+ * Returns -1 if an error is found. The first size
+ * chars of the string are parsed.
+ */
+
+int
+mystrtoul (char *src, int base, int size)
+{
+#ifdef _MICROC_
+ int ret;
+ int digit;
+ int ch;
+ ret = 0;
+#else
+ int ret = 0;
+#endif
+
+ for (; size > 0; size--)
+ {
+#ifdef _MICROC_
+ ch = *src;
+#else
+ int digit;
+ int ch = *src;
+#endif
+ src++;
+
+ if (ch >= '0' && ch <= '9')
+ digit = ch - '0';
+ else if (ch >= 'A' && ch <= 'Z')
+ digit = ch - 'A' + 10;
+ else if (ch >= 'a' && ch <= 'z')
+ digit = ch - 'a' + 10;
+ else
+ return -1;
+
+ if (digit >= base)
+ return -1;
+
+ ret = ret * base + digit;
+ } /* for */
+
+ return ret;
+}
+
+
+/**
+ * Process strings, converting \n, \t, \v, \b, \r, \f, \\,
+ * \ddd, \xdd and \x0dd to actual chars.
+ * (Note: \x is an extension to support hexadecimal)
+ * This is used to allow the messages to use c escape sequences.
+ * Modifies the line in-place (always same size or shorter).
+ * Returns a pointer to input string.
+ */
+
+char *
+processEscChars (char *line)
+{
+ /* used when converting \xdd and \ddd (hex or octal) characters */
+ char ch;
+#ifdef _MICROC_
+ char *src;
+ char *dst;
+ int chx;
+ src = line;
+ dst = line;
+#else
+ char *src = line;
+ char *dst = line; /* possible as dst is shorter than src */
+#endif
+
+ if (line == NULL)
+ return line;
+
+ /* cycle through copying characters, except when a \ is encountered. */
+ while (*src != '\0')
+ {
+ ch = *src;
+ src++;
+
+ if (ch == '\\')
+ {
+ ch = *src; /* what follows slash? */
+ src++;
+
+ switch (ch)
+ {
+ case '\\': /* a single slash */
+ *dst = '\\';
+ dst++;
+ break;
+ case 'n': /* a newline (linefeed) */
+ *dst = '\n';
+ dst++;
+ break;
+ case 'r': /* a carriage return */
+ *dst = '\r';
+ dst++;
+ break;
+ case 't': /* a horizontal tab */
+ *dst = '\t';
+ dst++;
+ break;
+ case 'v': /* a vertical tab */
+ *dst = '\v';
+ dst++;
+ break;
+ case 'b': /* a backspace */
+ *dst = '\b';
+ dst++;
+ break;
+ case 'a': /* alert */
+ *dst = '\a';
+ dst++;
+ break;
+ case 'f': /* formfeed */
+ *dst = '\f';
+ dst++;
+ break;
+ case 'x': /* extension supporting hex numbers \xdd or \x0dd */
+ {
+#ifdef _MICROC_
+ chx = mystrtoul (src, 16, 2); /* get value */
+#else
+ int chx = mystrtoul (src, 16, 2); /* get value */
+#endif
+ if (chx >= 0)
+ { /* store character */
+ *dst = chx;
+ dst++;
+ src += 2;
+ }
+ else /* error so just store x (loose slash) */
+ {
+ *dst = *src;
+ dst++;
+ }
+ }
+ break;
+ default: /* just store letter (loose slash) or handle octal */
+ {
+#ifdef _MICROC_
+ chx = mystrtoul (src, 8, 3); /* get value */
+#else
+ int chx = mystrtoul (src, 8, 3); /* get value */
+#endif
+ if (chx >= 0)
+ { /* store character */
+ *dst = chx;
+ dst++;
+ src += 3;
+ }
+ else
+ {
+ *dst = *src;
+ dst++;
+ }
+ }
+ break;
+ } /* switch */
+ } /* if backslash */
+ else
+ {
+ *dst = ch;
+ dst++;
+ }
+ } /* while */
+
+ /* ensure '\0' terminated */
+ *dst = '\0';
+
+ return line;
+}
+
+
+int
+get_char (int file)
+{
+#ifdef _MICROC_
+ int rval;
+ rval = -1;
+#else
+ int rval = -1;
+#endif
+
+ if (getlrem <= 0)
+ { /* (re)init buffer */
+ getlrem = read (file, getlbuf, sizeof (getlbuf));
+ if (getlrem <= 0)
+ return -1; /* fail: read error / EOF */
+ getlp = getlbuf; /* init pointer */
+ }
+
+ if (getlrem > 0)
+ { /* consume byte from buffer */
+ rval = getlp[0];
+ getlp++;
+ getlrem--;
+ }
+
+ return rval;
+}
+
+
+/**
+ * Read a line of text from file. You must call this with
+ * a null buffer or null size to flush buffers when you are
+ * done with a file before using it on the next file. Cannot
+ * be used for 2 files at the same time.
+ */
+
+int
+get_line (int file, char *str, int size)
+{
+ int ch;
+#ifdef _MICROC_
+ int success;
+ success = 0;
+#else
+ int success = 0;
+#endif
+
+ if ((size == 0) || (str == NULL))
+ { /* re-init get_line buffers */
+ getlp = getlbuf;
+ getlrem = -1;
+ lastcr = 0;
+ return 0;
+ }
+
+ str[0] = '\0';
+
+ while ((size > 0) && (success == 0))
+ {
+ ch = get_char (file);
+ if (ch < 0)
+ break; /* (can cause fail if no \n found yet) */
+
+ if (ch == '\r')
+ ch = get_char (file); /* ignore \r */
+
+ str[0] = ch;
+
+ if ((ch == '\n') || (ch == '\r'))
+ { /* done? */
+ str[0] = '\0';
+ return 1; /* success */
+ }
+
+ str++;
+ size--;
+
+ } /* while */
+
+ str[0] = '\0'; /* terminate buffer */
+
+ return success;
+
+}
+
+#endif /*NO_KITTEN */
diff --git a/kitten.h b/kitten.h
new file mode 100644
index 0000000..6a39def
--- /dev/null
+++ b/kitten.h
@@ -0,0 +1,78 @@
+/* Functions that emulate UNIX catgets, some small DOS file functions */
+
+/* Copyright (C) 1999,2000 Jim Hall <jhall@freedos.org> */
+/* Kitten version by Tom Ehlert, heavily modified by Eric Auer 2003 */
+
+/*
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+
+
+#ifndef _CATGETS_H
+#define _CATGETS_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#ifdef NO_KITTEN
+
+#define kittengets(x,y,z) (z)
+#define kittenclose()
+#define kittenopen(a)
+
+#else
+
+/* Data types */
+
+#define nl_catd int
+
+/* Functions */
+
+#define catgets(catalog, set,message_number,message) kittengets(set,message_number,message)
+#define catopen(name,flag) kittenopen(name)
+#define catclose(catalog) kittenclose()
+
+
+ char *kittengets (int set_number, int message_number, char *message);
+ nl_catd kittenopen (char *name);
+ void kittenclose (void);
+
+ int get_line (int file, char *buffer, int size);
+
+#ifndef _MICROC_
+#ifndef __DJGPP__
+
+ int dos_open (char *filename);
+#define open(filename,mode) dos_open(filename)
+
+ int dos_read (int file, void *ptr, unsigned count);
+#define read(file, ptr, count) dos_read(file,ptr,count)
+
+ int dos_write (int file, void *ptr, unsigned count);
+#define write(file, ptr, count) dos_write(file,ptr,count)
+
+ void dos_close (int file);
+#define close(file) dos_close(file)
+
+#endif /*DJGPP*/
+#endif /*Micro-C */
+#endif /*NO_KITTEN */
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _CATGETS_H */
diff --git a/makefile b/makefile
index 9711282..5c9872f 100644
--- a/makefile
+++ b/makefile
@@ -2,11 +2,11 @@
# Assuming you have sourced `owsetenv` beforehand.
# Object files for vbmouse
-mousedosobjs = mousetsr.obj mousmain.obj vbox.obj
+mousedosobjs = mousetsr.obj mousmain.obj kitten.obj vbox.obj
mousew16objs = mousew16.obj
# Object files for vbsf
-sfdosobjs = sftsr.obj sfmain.obj vbox.obj
+sfdosobjs = sftsr.obj sfmain.obj kitten.obj vbox.obj
doscflags = -bt=dos -ms -6 -osi -w3 -wcd=202
# -ms to use small memory model (though sometimes ss != ds...)
@@ -56,6 +56,9 @@ vbsf.exe: vbsf.lnk $(sfdosobjs)
sfmain.obj: sfmain.c .AUTODEPEND
*wcc -fo=$^@ $(doscflags) $[@
+kitten.obj: kitten.c .AUTODEPEND
+ *wcc -fo=$^@ $(doscflags) $[@
+
sftsr.obj: sftsr.c .AUTODEPEND
*wcc -fo=$^@ $(doscflags) $(dostsrcflags) $[@
@@ -65,6 +68,7 @@ clean: .SYMBOLIC
vbados.flp:
mformat -C -f 1440 -v VBADOS -i $^@ ::
mcopy -i $^@ nls/*.tbl ::
+ mcopy -i $^@ nls/vbsf.* nls/vbmouse.* ::
# Build a floppy image containing the driver
flp: vbados.flp vbmouse.exe vbmouse.drv oemsetup.inf vbsf.exe .SYMBOLIC
@@ -72,5 +76,5 @@ flp: vbados.flp vbmouse.exe vbmouse.drv oemsetup.inf vbsf.exe .SYMBOLIC
# Build a zip with the driver binaries
zip: vbmouse.exe vbmouse.drv oemsetup.inf vbsf.exe .SYMBOLIC
- zip --DOS-names -fz- -j vbados.zip nls/*.tbl
+ zip --DOS-names -fz- -j vbados.zip nls/*.tbl nls/vbsf.* nls/vbmouse.*
zip --DOS-names -fz- vbados.zip vbmouse.exe vbmouse.drv oemsetup.inf vbsf.exe
diff --git a/mousmain.c b/mousmain.c
index 90e5e5c..cdb4183 100644
--- a/mousmain.c
+++ b/mousmain.c
@@ -22,6 +22,7 @@
#include <string.h>
#include <dos.h>
+#include "kitten.h"
#include "version.h"
#include "dlog.h"
#include "int33.h"
@@ -32,25 +33,27 @@
#include "dostsr.h"
#include "mousetsr.h"
+nl_catd cat;
+
#if USE_WHEEL
static void detect_wheel(LPTSRDATA data)
{
// Do a quick check for a mouse wheel here.
// The TSR will do its own check when it is reset anyway
if (data->haswheel = ps2m_detect_wheel()) {
- printf("Wheel mouse found and enabled\n");
+ printf(kittengets(1, 0, "Wheel mouse found and enabled\n"));
}
}
static int set_wheel(LPTSRDATA data, bool enable)
{
- printf("Setting wheel support to %s\n", enable ? "enabled" : "disabled");
+ printf(kittengets(1, 1, "Setting wheel support to %s\n"), enable ? kittengets(1, 2, "enabled") : kittengets(1, 3, "disabled"));
data->usewheel = enable;
if (data->usewheel) {
detect_wheel(data);
if (!data->haswheel) {
- fprintf(stderr, "Could not find PS/2 wheel mouse\n");
+ fprintf(stderr, kittengets(3, 0, "Could not find PS/2 wheel mouse\n"));
}
} else {
data->haswheel = false;
@@ -62,24 +65,24 @@ static int set_wheel(LPTSRDATA data, bool enable)
static int set_wheel_key(LPTSRDATA data, const char *keyname)
{
if (!data->usewheel || !data->haswheel) {
- fprintf(stderr, "Wheel not detected or support not enabled\n");
+ fprintf(stderr, kittengets(3, 1, "Wheel not detected or support not enabled\n"));
return EXIT_FAILURE;
}
if (keyname) {
if (stricmp(keyname, "updn") == 0) {
data->wheel_up_key = 0x4800;
data->wheel_down_key = 0x5000;
- printf("Generate Up Arrow / Down Arrow key presses on wheel movement\n");
+ printf(kittengets(1, 4, "Generate Up Arrow / Down Arrow key presses on wheel movement\n"));
} else if (stricmp(keyname, "pageupdn") == 0) {
data->wheel_up_key = 0x4900;
data->wheel_down_key = 0x5100;
- printf("Generate PageUp / PageDown key presses on wheel movement\n");
+ printf(kittengets(1, 5, "Generate PageUp / PageDown key presses on wheel movement\n"));
} else {
- fprintf(stderr, "Unknown key '%s'\n", keyname);
+ fprintf(stderr, kittengets(3, 2, "Unknown key '%s'\n"), keyname);
return EXIT_FAILURE;
}
} else {
- printf("Disabling wheel keystroke generation\n");
+ printf(kittengets(1, 6, "Disabling wheel keystroke generation\n"));
data->wheel_up_key = 0;
data->wheel_down_key = 0;
}
@@ -97,23 +100,23 @@ static int set_virtualbox_integration(LPTSRDATA data, bool enable)
err = vbox_init_device(&data->vb);
if (err) {
- fprintf(stderr, "Cannot find VirtualBox PCI device, err=%d\n", err);
+ fprintf(stderr, kittengets(3, 3, "Cannot find VirtualBox PCI device, err=%d\n"), err);
return err;
}
err = vbox_init_buffer(&data->vb, VBOX_BUFFER_SIZE);
if (err) {
- fprintf(stderr, "Cannot lock buffer used for VirtualBox communication, err=%d\n", err);
+ fprintf(stderr, kittengets(3, 4, "Cannot lock buffer used for VirtualBox communication, err=%d\n"), err);
return err;
}
err = vbox_report_guest_info(&data->vb, VBOXOSTYPE_DOS);
if (err) {
- fprintf(stderr, "VirtualBox communication is not working, err=%d\n", err);
+ fprintf(stderr, kittengets(3, 5, "VirtualBox communication is not working, err=%d\n"), err);
return err;
}
- printf("VirtualBox integration enabled\n");
+ printf(kittengets(1, 7, "VirtualBox integration enabled\n"));
data->vbavail = true;
data->vbhaveabs = true;
} else {
@@ -122,11 +125,11 @@ static int set_virtualbox_integration(LPTSRDATA data, bool enable)
vbox_release_buffer(&data->vb);
- printf("Disabled VirtualBox integration\n");
+ printf(kittengets(1, 8, "Disabled VirtualBox integration\n"));
data->vbavail = false;
data->vbhaveabs = false;
} else {
- printf("VirtualBox integration already disabled or not available\n");
+ printf(kittengets(1, 9, "VirtualBox integration already disabled or not available\n"));
}
}
@@ -135,7 +138,7 @@ static int set_virtualbox_integration(LPTSRDATA data, bool enable)
static int set_virtualbox_host_cursor(LPTSRDATA data, bool enable)
{
- printf("Setting host cursor to %s\n", enable ? "enabled" : "disabled");
+ printf(kittengets(1, 10, "Setting host cursor to %s\n"), enable ? kittengets(1, 2, "enabled") : kittengets(1, 3, "disabled"));
data->vbwantcursor = enable;
return 0;
@@ -154,18 +157,18 @@ static int set_vmware_integration(LPTSRDATA data, bool enable)
version = vmware_get_version();
if (version < 0) {
- fprintf(stderr, "Could not detect VMware, err=%ld\n", version);
+ fprintf(stderr, kittengets(3, 6, "Could not detect VMware, err=%ld\n"), version);
return -1;
}
- printf("Found VMware protocol version %ld\n", version);
+ printf(kittengets(1, 11, "Found VMware protocol version %ld\n"), version);
vmware_abspointer_cmd(VMWARE_ABSPOINTER_CMD_ENABLE);
status = vmware_abspointer_status();
if ((status & VMWARE_ABSPOINTER_STATUS_MASK_ERROR)
== VMWARE_ABSPOINTER_STATUS_MASK_ERROR) {
- fprintf(stderr, "VMware absolute pointer error, err=0x%lx\n",
+ fprintf(stderr, kittengets(3, 7, "VMware absolute pointer error, err=0x%lx\n"),
status & VMWARE_ABSPOINTER_STATUS_MASK_ERROR);
return -1;
}
@@ -174,7 +177,7 @@ static int set_vmware_integration(LPTSRDATA data, bool enable)
// TSR part will enable the absolute mouse when reset
- printf("VMware integration enabled\n");
+ printf(kittengets(1, 12, "VMware integration enabled\n"));
data->vmwavail = true;
} else {
if (data->vmwavail) {
@@ -182,9 +185,9 @@ static int set_vmware_integration(LPTSRDATA data, bool enable)
vmware_abspointer_cmd(VMWARE_ABSPOINTER_CMD_DISABLE);
data->vmwavail = false;
- printf("Disabled VMware integration\n");
+ printf(kittengets(1, 13, "Disabled VMware integration\n"));
} else {
- printf("VMware integration already disabled or not available\n");
+ printf(kittengets(1, 14, "VMware integration already disabled or not available\n"));
}
}
@@ -210,7 +213,7 @@ static int set_integration(LPTSRDATA data, bool enable)
if (!err) return 0;
#endif
- printf("Neither VirtualBox nor VMware integration available\n");
+ printf(kittengets(1, 15, "Neither VirtualBox nor VMware integration available\n"));
return err;
} else {
#if USE_VIRTUALBOX
@@ -234,7 +237,7 @@ static int set_host_cursor(LPTSRDATA data, bool enable)
return set_virtualbox_host_cursor(data, enable);
}
#endif
- printf("VirtualBox integration not available\n");
+ printf(kittengets(1, 16, "VirtualBox integration not available\n"));
return -1;
}
@@ -247,7 +250,7 @@ static int configure_driver(LPTSRDATA data)
// Check for PS/2 mouse BIOS availability
if ((err = ps2m_init(PS2M_PACKET_SIZE_PLAIN))) {
- fprintf(stderr, "Cannot init PS/2 mouse BIOS, err=%d\n", err);
+ fprintf(stderr, kittengets(3, 8, "Cannot init PS/2 mouse BIOS, err=%d\n"), err);
// Can't do anything without PS/2
return err;
}
@@ -303,7 +306,7 @@ static __declspec(aborts) int install_driver(LPTSRDATA data, bool high)
_dos_setvect(0x2f, data:>int2f_isr);
#endif
- printf("Driver installed\n");
+ printf(kittengets(1, 17, "Driver installed\n"));
// If we reallocated ourselves to UMB,
// it's time to free our initial conventional memory allocation
@@ -311,6 +314,7 @@ static __declspec(aborts) int install_driver(LPTSRDATA data, bool high)
finish_reallocation(_psp, FP_SEG(data));
}
+ kittenclose();
_dos_keep(EXIT_SUCCESS, get_paragraphs(resident_size));
// Shouldn't reach this part
@@ -324,7 +328,7 @@ static bool check_if_driver_uninstallable(LPTSRDATA data)
// Compare the segment of the installed handler to see if its ours
// or someone else's
if (FP_SEG(cur_int33_handler) != FP_SEG(data)) {
- fprintf(stderr, "INT33 has been hooked by someone else, cannot safely remove\n");
+ fprintf(stderr, kittengets(3, 9, "INT33 has been hooked by someone else, cannot safely remove\n"));
return false;
}
@@ -333,7 +337,7 @@ static bool check_if_driver_uninstallable(LPTSRDATA data)
void (__interrupt __far *cur_int2f_handler)() = _dos_getvect(0x2f);
if (FP_SEG(cur_int2f_handler) != FP_SEG(data)) {
- fprintf(stderr, "INT2F has been hooked by someone else, cannot safely remove\n");
+ fprintf(stderr, kittengets(3, 10, "INT2F has been hooked by someone else, cannot safely remove\n"));
return false;
}
}
@@ -366,55 +370,54 @@ static int uninstall_driver(LPTSRDATA data)
// it is always 256 bytes (16 paragraphs) before the TSR segment
dos_free(FP_SEG(data) - (DOS_PSP_SIZE/16));
- printf("Driver uninstalled\n");
+ printf(kittengets(1, 18, "Driver uninstalled\n"));
return 0;
}
static int driver_reset(void)
{
- printf("Reset mouse driver\n");
+ printf(kittengets(1, 19, "Reset mouse driver\n"));
return int33_reset() == 0xFFFF;
}
static int driver_not_found(void)
{
- fprintf(stderr, "Driver data not found (driver not installed?)\n");
+ fprintf(stderr, kittengets(3, 11, "Driver data not found (driver not installed?)\n"));
return EXIT_FAILURE;
}
static void print_help(void)
{
- printf("\n"
- "Usage: \n"
- " VBMOUSE <ACTION> <ARGS..>\n\n"
- "Supported actions:\n"
- " install install the driver (default)\n"
- " low install in conventional memory (otherwise UMB)\n"
- " uninstall uninstall the driver from memory\n"
+ puts(kittengets(0, 0, "\n"
+ "Usage: "));
+ puts(kittengets(0, 1, " VBMOUSE <ACTION> <ARGS..>\n"));
+ puts(kittengets(0, 2, "Supported actions:"));
+ puts(kittengets(0, 3, " install install the driver (default)"));
+ puts(kittengets(0, 4, " low install in conventional memory (otherwise UMB)"));
+ puts(kittengets(0, 5, " uninstall uninstall the driver from memory"));
#if USE_WHEEL
- " wheel <ON|OFF> enable/disable wheel API support\n"
- " wheelkey <KEY|OFF> emulate a specific keystroke on wheel scroll\n"
- " supported keys: updn, pageupdn\n"
+ puts(kittengets(0, 6, " wheel <ON|OFF> enable/disable wheel API support"));
+ puts(kittengets(0, 7, " wheelkey <KEY|OFF> emulate a specific keystroke on wheel scroll"));
+ puts(kittengets(0, 8, " supported keys: updn, pageupdn"));
#endif
#if USE_INTEGRATION
- " integ <ON|OFF> enable/disable virtualbox integration\n"
- " hostcur <ON|OFF> enable/disable mouse cursor rendering in host\n"
+ puts(kittengets(0, 9, " integ <ON|OFF> enable/disable virtualbox integration"));
+ puts(kittengets(0, 10, " hostcur <ON|OFF> enable/disable mouse cursor rendering in host"));
#endif
- " reset reset mouse driver settings\n"
- );
+ puts(kittengets(0, 11, " reset reset mouse driver settings"));
}
static int invalid_arg(const char *s)
{
- fprintf(stderr, "Invalid argument '%s'\n", s);
+ fprintf(stderr, kittengets(3, 12, "Invalid argument '%s'\n"), s);
print_help();
return EXIT_FAILURE;
}
static int arg_required(const char *s)
{
- fprintf(stderr, "Argument required for '%s'\n", s);
+ fprintf(stderr, kittengets(3, 13, "Argument required for '%s'\n"), s);
print_help();
return EXIT_FAILURE;
}
@@ -446,7 +449,9 @@ int main(int argc, const char *argv[])
LPTSRDATA data = get_tsr_data(true);
int err, argi = 1;
- printf("\nVBMouse %x.%x (like MSMOUSE %x.%x)\n", VERSION_MAJOR, VERSION_MINOR, REPORTED_VERSION_MAJOR, REPORTED_VERSION_MINOR);
+ cat = kittenopen("vbmouse");
+
+ printf(kittengets(1, 20, "\nVBMouse %x.%x (like MSMOUSE %x.%x)\n"), VERSION_MAJOR, VERSION_MINOR, REPORTED_VERSION_MAJOR, REPORTED_VERSION_MINOR);
if (argi >= argc || stricmp(argv[argi], "install") == 0) {
bool high = true;
@@ -463,7 +468,7 @@ int main(int argc, const char *argv[])
}
if (data) {
- printf("VBMouse already installed\n");
+ printf(kittengets(1, 21, "VBMouse already installed\n"));
print_help();
return EXIT_SUCCESS;
}
diff --git a/nls/vbmouse.en b/nls/vbmouse.en
new file mode 100644
index 0000000..feab00b
--- /dev/null
+++ b/nls/vbmouse.en
@@ -0,0 +1,54 @@
+# Language: English
+# Codepage: 437
+#
+# Spaces before text must be kept. Be sure that no spaces are
+# added to the end of the lines.
+#
+0.0:\nUsage:
+0.1: VBMOUSE <ACTION> <ARGS..>\n
+0.2:Supported actions:
+0.3: install install the driver (default)
+0.4: low install in conventional memory (otherwise UMB)
+0.5: uninstall uninstall the driver from memory
+0.6: wheel <ON|OFF> enable/disable wheel API support
+0.7: wheelkey <KEY|OFF> emulate a specific keystroke on wheel scroll
+0.8: supported keys: updn, pageupdn
+0.9: integ <ON|OFF> enable/disable virtualbox integration
+0.10: hostcur <ON|OFF> enable/disable mouse cursor rendering in host
+0.11: reset reset mouse driver settings
+1.0:Wheel mouse found and enabled\n
+1.1:Setting wheel support to %s\n
+1.2:enabled
+1.3:disabled
+1.4:Generate Up Arrow / Down Arrow key presses on wheel movement\n
+1.5:Generate PageUp / PageDown key presses on wheel movement\n
+1.6:Disabling wheel keystroke generation\n
+1.7:VirtualBox integration enabled\n
+1.8:Disabled VirtualBox integration\n
+1.9:VirtualBox integration already disabled or not available\n
+1.10:Setting host cursor to %s\n
+1.11:Found VMware protocol version %ld\n
+1.12:VMware integration enabled\n
+1.13:Disabled VMware integration\n
+1.14:VMware integration already disabled or not available\n
+1.15:Neither VirtualBox nor VMware integration available\n
+1.16:VirtualBox integration not available\n
+1.17:Driver installed\n
+1.18:Driver uninstalled\n
+1.19:Reset mouse driver\n
+1.20:\nVBMouse %x.%x (like MSMOUSE %x.%x)\n
+1.21:VBMouse already installed\n
+3.0:Could not find PS/2 wheel mouse\n
+3.1:Wheel not detected or support not enabled\n
+3.2:Unknown key '%s'\n
+3.3:Cannot find VirtualBox PCI device, err=%d\n
+3.4:Cannot lock buffer used for VirtualBox communication, err=%d\n
+3.5:VirtualBox communication is not working, err=%d\n
+3.6:Could not detect VMware, err=%ld\n
+3.7:VMware absolute pointer error, err=0x%lx\n
+3.8:Cannot init PS/2 mouse BIOS, err=%d\n
+3.9:INT33 has been hooked by someone else, cannot safely remove\n
+3.10:INT2F has been hooked by someone else, cannot safely remove\n
+3.11:Driver data not found (driver not installed?)\n
+3.12:Invalid argument '%s'\n
+3.13:Argument required for '%s'\n
diff --git a/nls/vbmouse.es b/nls/vbmouse.es
new file mode 100644
index 0000000..11f30a7
--- /dev/null
+++ b/nls/vbmouse.es
@@ -0,0 +1,56 @@
+# Language: Spanish
+# Codepage: 850/858
+#
+# Translator: Eduardo Casino
+#
+# Spaces before text must be kept. Be sure that no spaces are
+# added to the end of the lines.
+#
+0.0:\nUso:
+0.1: VBMOUSE <ACCIàN> <ARGS..>\n
+0.2:Acciones soportadas:
+0.3: install instala el controlador (por defecto)
+0.4: low instala en memoria convencional (UMB si no)
+0.5: uninstall desinstala el controlador de la memoria
+0.6: wheel <ON|OFF> habilita/deshabilita soporte para la rueda
+0.7: wheelkey <KEY|OFF> emula una tecla espec¡fica para el scroll por rueda
+0.8: valores soportados para KEY: updn, pageupdn
+0.9: integ <ON|OFF> habilita/deshabilita integraci¢n con virtualbox
+0.10: hostcur <ON|OFF> habilita/deshabilita pintado del cursor en el anfitri¢n
+0.11: reset reinicia ajustes del controlador del rat¢n
+1.0:Rueda de rat¢n encontrada y activada\n
+1.1:Soporte para rueda %s\n
+1.2:habilitado
+1.3:deshabilitado
+1.4:Emula las teclas Flecha Arriba / Flecha Abajo con el movimiento de la rueda\n
+1.5:Emula las teclas P gina Arriba / P gina Abajo con el movimiento de la rueda\n
+1.6:Deshabilitando emulaci¢n de teclas para el movimiento de la rueda\n
+1.7:Integraci¢n con VirtualBox habilitada\n
+1.8:Integraci¢n con VirtualBox deshabilitada\n
+1.9:Integraci¢n con VirtualBox ya deshabilitada o no disponible\n
+1.10:Pintado del cursor en el anfitri¢n %s\n
+1.11:Encontrada versi¢n %ld del protocolo de VMware\n
+1.12:Integraci¢n con VMware habilitada\n
+1.13:Integraci¢n con VMware deshabilitada\n
+1.14:Integraci¢n con VMware ya deshabilitada o no disponible\n
+1.15:No est n disponibles las integraciones con VirtualBox ni VMware\n
+1.16:Integraci¢n con VirtualBox no disponible\n
+1.17:Controlador instalado\n
+1.18:Controlador desinstalado\n
+1.19:Reiniciados ajustes del controlador del rat¢n\n
+1.20:\nVBMouse %x.%x (como MSMOUSE %x.%x)\n
+1.21:VBMouse ya instalado\n
+3.0:No se pudo encontrar rat¢n PS/2 con rueda\n
+3.1:Rueda no detectada o soporte no habilitado\n
+3.2:Tecla desconocida '%s'\n
+3.3:No puedo encontrar el dispositivo PCI de VirtualBox, err=%d\n
+3.4:No puedo reserver el b£fer para la comunicaci¢n con VirtualBox, err=%ld\n
+3.5:La comunicaci¢n con VirtualBox no funciona, err=%d\n
+3.6:No se pudo detectar VMware, err=%ld\n
+3.7:Error al habilitar dispositivo apuntador absoluto en VMware, err=0x%lx\n
+3.8:No puedo iniciar la BIOS del rat¢n PS/2, err=%d\n
+3.9:Alguien m s enganchado a INT33, no puedo desinstalar de forma segura\n
+3.10:Alguien m s enganchado a INT2F, no puedo desinstalar de forma segura\n
+3.11:No encuentro los datos del controlador (¨No est  instalado?)\n
+3.12:Argumento no v lido '%s'\n
+3.13:Se requiere argumento para '%s'\n
diff --git a/nls/vbsf.en b/nls/vbsf.en
new file mode 100644
index 0000000..a3e25a1
--- /dev/null
+++ b/nls/vbsf.en
@@ -0,0 +1,58 @@
+# Language: English
+# Codepage: 437
+#
+# Spaces before text must be kept. Be sure that no spaces are
+# added to the end of the lines.
+#
+0.0:\nUsage:
+0.1: VBSF <ACTION> <ARGS..>\n
+0.2:Supported actions:
+0.3: install install the driver (default)
+0.4: low install in conventional memory (otherwise UMB)
+0.5: short use short file names from windows hosts
+0.6: hash <n> number of hash generated chars following the '~'
+0.7: for generating DOS valid files
+0.8: (%d min, %d max, %d default)\n
+0.9: uninstall uninstall the driver from memory
+0.10: list list available shared folders
+0.11: mount <FOLD> <X:> mount a shared folder into drive X:
+0.12: umount <X:> unmount shared folder from drive X:
+0.13: rescan unmount everything and recreate automounts
+1.0:Mounted drives:\n
+1.1: %s on %c:\n
+1.2:Available shared folders:\n
+1.3:Shared folder '%s' mounted as drive %c:\n
+1.4:Drive %c: unmounted\n
+1.5:Using timezone from TZ variable (%s)\n
+1.6:Connected to VirtualBox shared folder service\n
+1.7:Driver installed\n
+1.8:Driver uninstalled\n
+1.9:\nVBSharedFolders %x.%x\n
+1.10:VBSF already installed\n
+2.0:Warning: Active code page not found
+2.1:Warning: Can't find Unicode table: %s
+2.2:Warning: Can't load Unicode table: %s
+2.3:Warning: Invalid file format: %s
+2.4:. Defaulting to cp437\n
+3.0:Error on Query Map Name, err=%ld\n
+3.1:Error on Query Mappings, err=%ld\n
+3.2:Error on Close File, err=%ld\n
+3.3:Cannot mount shared folder '%s', err=%d\n
+3.4:Error on Query Map Info for mounted drive, err=%ld\n
+3.5:Cannot unmount shared folder, err=%d\n
+3.6:Invalid drive %c:\n
+3.7:Drive %c: is after LASTDRIVE\n
+3.8:Drive %c already mounted\n
+3.9:Drive %c: already exists\n
+3.11:Drive %c not mounted\n
+3.12:Error en Query Map Info
+3.13:Cannot get the NLS tables
+3.14:Cannot find VirtualBox PCI device, err=%ld\n
+3.15:Cannot lock buffer used for VirtualBox communication, err=%ld\n
+3.16:VirtualBox communication is not working, err=%ld\n
+3.17:Cannot connect to shared folder service, err=%ld\n
+3.18:Cannot configure UTF-8 on shared folder service, err=%ld\n
+3.19:INT2F has been hooked by someone else, cannot safely remove\n
+3.20:Driver data not found (driver not installed?)\n
+3.21:Invalid argument '%s'\n
+3.22:Argument required for '%s'\n
diff --git a/nls/vbsf.es b/nls/vbsf.es
new file mode 100644
index 0000000..f8fb119
--- /dev/null
+++ b/nls/vbsf.es
@@ -0,0 +1,61 @@
+# Language: Spanish
+# Codepage: 850/858
+#
+# Translator: Eduardo Casino
+#
+# Spaces before text must be kept. Be sure that no spaces are
+# added to the end of the lines.
+#
+0.0:\nUso:
+0.1: VBSF <ACCIàN> <ARGS..>\n
+0.2:Acciones soportadas:
+0.3: install instala el controlador (por defecto)
+0.4: low instala en memoria convencional (UMB si no)
+0.5: short nombres cortos de archivos en anfitriones windows
+0.6: hash <n> n£mero de caracteres generados por hash tras la '~'
+0.7: para generar nombres de archivo v lidos en DOS
+0.8: (%d m¡n, %d m x, %d por defecto)\n
+0.9: uninstall desinstala el controlador de la memoria
+0.10: list lista carpetas compartidas disponibles
+0.11: mount <CARP> <X:> monta una carpeta compartida en la unidad X:
+0.12: umount <X:> desmonta la carpeta compartida de la unidad X:
+0.13: rescan desmonta todo y recrea los automounts
+1.0:Unidades montadas:\n
+1.1: %s en %c:\n
+1.2:Carpetas compartidas disponibles:\n
+1.3:Carpeta compartida '%s' montada en la unidad %c:\n
+1.4:Unidad %c: desmontada\n
+1.5:Usando zona horaria de la variable TZ (%s)\n
+1.6:Conectado al servicio de carpetas compartidas de VirtualBox\n
+1.7:Controlador instalado\n
+1.8:Controlador desinstalado\n
+1.9:\nVBSharedFolders %x.%x\n
+1.10:VBSF ya instalado\n
+2.0:Aviso: P gina de c¢digos activa no encontrada
+2.1:Aviso: No se encuentra la tabla Unicode: %s
+2.2:Aviso: No se puede cargar la tabla Unicode: %s
+2.3:Aviso: Formato de archivo no v lido: %s
+2.4:. Usando cp437\n
+3.0:Error en Query Map Name, err=%ld\n
+3.1:Error en Query Mappings, err=%ld\n
+3.2:Error en Close File, err=%ld\n
+3.3:No puedo montar la carpeta compartida '%s', err=%d\n
+3.4:Error en Query Map Info para la unidad montada, err=%ld\n
+3.5:No puedo desmontar la carpeta compartida, err=%d\n
+3.6:Unidad no v lida %c:\n
+3.7:La unidad %c: est  despu‚s de LASTDRIVE\n
+3.8:La unidad %c ya est  montada\n
+3.9:La unidad %c: ya existe\n
+3.10:No se puede montar la unidad %c:\n
+3.11:La unidad %c no est  montada\n
+3.12:Error en Query Map Info, err=%ld\n
+3.13:No puedo obtener las tablas NLS
+3.14:No puedo encontrar el dispositivo PCI de VirtualBox, err=%ld\n
+3.15:No puedo reservar el b£fer para la comunicaci¢n con VirtualBox, err=%ld\n
+3.16:La comunicaci¢n con VirtualBox no funciona, err=%ld\n
+3.17:No puedo conectar al servicio de carpetas compartidas, err=%ld\n
+3.18:No puedo configurar UTF-8 en servicio de carpetas compartidas, err=%ld\n
+3.19:Alguien m s enganchado a INT2F, no puedo desinstalar de forma segura\n
+3.20:No encuentro los datos del controlador (¨No est  instalado?)\n
+3.21:Argumento no v lido '%s'\n
+3.22:Se requiere argumento para '%s'\n
diff --git a/sfmain.c b/sfmain.c
index 0bedbea..9b85da5 100644
--- a/sfmain.c
+++ b/sfmain.c
@@ -26,6 +26,7 @@
#include <sys/stat.h>
#include <ctype.h>
+#include "kitten.h"
#include "version.h"
#include "dlog.h"
#include "vboxshfl.h"
@@ -34,6 +35,8 @@
#include "unicode.h"
#include "lfn.h"
+nl_catd cat;
+
static char get_drive_letter(const char *path) {
if (!path || path[0] == '\0') return '\0';
if (path[1] == '\0' || (path[1] == ':' && path[2] == '\0')) {
@@ -68,7 +71,7 @@ static int list_folders(LPTSRDATA data)
unsigned num_maps = sizeof(maps) / sizeof(SHFLMAPPING);
unsigned i;
- printf("Mounted drives:\n");
+ printf(kittengets(1, 0, "Mounted drives:\n"));
for (i = 0; i < NUM_DRIVES; i++) {
if (data->drives[i].root == SHFL_ROOT_NIL) {
@@ -78,26 +81,26 @@ static int list_folders(LPTSRDATA data)
err = vbox_shfl_query_map_name(&data->vb, data->hgcm_client_id, data->drives[i].root, &str.shflstr);
if (err) {
- printf("Error on Query Map Name, err=%ld\n", err);
+ printf(kittengets(3, 0, "Error on Query Map Name, err=%ld\n"), err);
continue;
}
(void)utf8_to_local(data, str.buf, str.buf, NULL);
- printf(" %s on %c:\n", str.buf, drive_index_to_letter(i));
+ printf(kittengets(1, 1, " %s on %c:\n"), str.buf, drive_index_to_letter(i));
}
err = vbox_shfl_query_mappings(&data->vb, data->hgcm_client_id, 0, &num_maps, maps);
if (err) {
- printf("Error on Query Mappings, err=%ld\n", err);
+ printf(kittengets(3, 1, "Error on Query Mappings, err=%ld\n"), err);
return err;
}
- printf("Available shared folders:\n");
+ printf(kittengets(1, 2, "Available shared folders:\n"));
for (i = 0 ; i < num_maps; i++) {
err = vbox_shfl_query_map_name(&data->vb, data->hgcm_client_id, maps[i].root, &str.shflstr);
if (err) {
- printf("Error on Query Map Name, err=%ld\n", err);
+ printf(kittengets(3, 0, "Error on Query Map Name, err=%ld\n"), err);
continue;
}
@@ -133,7 +136,7 @@ static void close_openfiles(LPTSRDATA data, int drive)
err = vbox_shfl_close(&data->vb, data->hgcm_client_id, data->files[i].root, data->files[i].handle);
if (err) {
- printf("Error on Close File, err=%ld\n", err);
+ printf(kittengets(3, 2, "Error on Close File, err=%ld\n"), err);
// Ignore it
}
@@ -153,7 +156,7 @@ static int mount_shfl(LPTSRDATA data, int drive, const char *folder)
err = vbox_shfl_map_folder(&data->vb, data->hgcm_client_id, &str.shflstr, &root);
if (err) {
- fprintf(stderr, "Cannot mount shared folder '%s', err=%d\n", folder, err);
+ fprintf(stderr, kittengets(3, 3, "Cannot mount shared folder '%s', err=%d\n"), folder, err);
return -1;
}
@@ -162,7 +165,7 @@ static int mount_shfl(LPTSRDATA data, int drive, const char *folder)
err = vbox_shfl_query_map_info(&data->vb, data->hgcm_client_id, root,
&str.shflstr, &str.shflstr, &flags, &version);
if (err) {
- printf("Error on Query Map Info for mounted drive, err=%ld\n", err);
+ printf(kittengets(3, 4, "Error on Query Map Info for mounted drive, err=%ld\n"), err);
return -1;
}
@@ -181,7 +184,7 @@ static int unmount_shfl(LPTSRDATA data, int drive)
err = vbox_shfl_unmap_folder(&data->vb, data->hgcm_client_id,
data->drives[drive].root);
if (err) {
- fprintf(stderr, "Cannot unmount shared folder, err=%d\n", err);
+ fprintf(stderr, kittengets(3, 5, "Cannot unmount shared folder, err=%d\n"), err);
return -1;
}
@@ -197,29 +200,29 @@ static int mount(LPTSRDATA data, char *folder, char drive_letter)
DOSCDS __far *cds;
if (drive < 0) {
- fprintf(stderr, "Invalid drive %c:\n", drive_letter);
+ fprintf(stderr, kittengets(3, 6, "Invalid drive %c:\n"), drive_letter);
return EXIT_FAILURE;
}
if (drive >= lol->last_drive || drive >= NUM_DRIVES) {
- fprintf(stderr, "Drive %c: is after LASTDRIVE\n", drive_letter);
+ fprintf(stderr, kittengets(3, 7, "Drive %c: is after LASTDRIVE\n"), drive_letter);
return EXIT_FAILURE;
}
if (data->drives[drive].root != SHFL_ROOT_NIL) {
- fprintf(stderr, "Drive %c already mounted\n", drive_letter);
+ fprintf(stderr, kittengets(3, 8, "Drive %c already mounted\n"), drive_letter);
return EXIT_FAILURE;
}
cds = &lol->cds[drive];
if (cds->flags) {
- fprintf(stderr, "Drive %c: already exists\n", drive_letter);
+ fprintf(stderr, kittengets(3, 9, "Drive %c: already exists\n"), drive_letter);
return EXIT_FAILURE;
}
if (mount_shfl(data, drive, folder) != 0) {
- fprintf(stderr, "Cannot mount drive %c:\n", drive_letter);
+ fprintf(stderr, kittengets(3, 10, "Cannot mount drive %c:\n"), drive_letter);
return EXIT_FAILURE;
}
@@ -228,7 +231,7 @@ static int mount(LPTSRDATA data, char *folder, char drive_letter)
cds->flags = DOS_CDS_FLAG_NETWORK | DOS_CDS_FLAG_PHYSICAL;
(void)utf8_to_local(data, folder, folder, NULL);
- printf("Shared folder '%s' mounted as drive %c:\n", folder, drive_letter);
+ printf(kittengets(1, 3, "Shared folder '%s' mounted as drive %c:\n"), folder, drive_letter);
return EXIT_SUCCESS;
}
@@ -240,19 +243,19 @@ static int unmount(LPTSRDATA data, char drive_letter)
DOSCDS __far *cds;
if (drive < 0) {
- fprintf(stderr, "Invalid drive %c:\n", drive_letter);
+ fprintf(stderr, kittengets(3, 6, "Invalid drive %c:\n"), drive_letter);
return EXIT_FAILURE;
}
if (drive >= lol->last_drive || drive >= NUM_DRIVES) {
- fprintf(stderr, "Drive %c: is after LASTDRIVE\n", drive_letter);
+ fprintf(stderr, kittengets(3, 7, "Drive %c: is after LASTDRIVE\n"), drive_letter);
return EXIT_FAILURE;
}
cds = &lol->cds[drive];
if (data->drives[drive].root == SHFL_ROOT_NIL) {
- fprintf(stderr, "Drive %c not mounted\n", drive_letter);
+ fprintf(stderr, kittengets(3, 11, "Drive %c not mounted\n"), drive_letter);
return EXIT_FAILURE;
}
@@ -265,7 +268,7 @@ static int unmount(LPTSRDATA data, char drive_letter)
// TODO Clear current directory ?
- printf("Drive %c: unmounted\n", drive_letter);
+ printf(kittengets(1, 4, "Drive %c: unmounted\n"), drive_letter);
return EXIT_SUCCESS;
}
@@ -283,7 +286,7 @@ static int automount(LPTSRDATA data)
err = vbox_shfl_query_mappings(&data->vb, data->hgcm_client_id,
SHFL_MF_AUTOMOUNT, &num_maps, maps);
if (err) {
- printf("Error on Query Mappings, err=%ld\n", err);
+ printf(kittengets(3, 1, "Error on Query Mappings, err=%ld\n"), err);
return err;
}
@@ -294,7 +297,7 @@ static int automount(LPTSRDATA data)
err = vbox_shfl_query_map_info(&data->vb, data->hgcm_client_id, maps[i].root,
&name.shflstr, &mountPoint.shflstr, &flags, &version);
if (err) {
- printf("Error on Query Map Info, err=%ld\n", err);
+ printf(kittengets(3, 12, "Error on Query Map Info, err=%ld\n"), err);
continue;
}
@@ -418,7 +421,7 @@ static void load_unicode_table(uint16_t far *unicode_table)
if (r.x.cflag) {
// Can't get codepage. Use ASCII only
//
- fputs("Warning: Active code page not found", stderr);
+ fputs(kittengets(2, 0, "Warning: Active code page not found"), stderr);
goto error;
}
@@ -426,31 +429,31 @@ static void load_unicode_table(uint16_t far *unicode_table)
_searchenv(filename, "PATH", fullpath);
if ( '\0' == fullpath[0] ) {
- fprintf(stderr, "Warning: Can't find Unicode table: %s", filename);
+ fprintf(stderr, kittengets(2, 1, "Warning: Can't find Unicode table: %s"), filename);
goto error;
}
f = fopen(fullpath, "rb");
if ( NULL == f ) {
- fprintf(stderr, "Warning: Can't load Unicode table: %s", filename);
+ fprintf(stderr, kittengets(2, 2, "Warning: Can't load Unicode table: %s"), filename);
goto error;
}
if ( EOF == fscanf_s(f, "Unicode (%s)", buffer, sizeof(buffer)) ) {
- fprintf(stderr, "Warning: Invalid file format: %s", filename);
+ fprintf(stderr, kittengets(2, 3, "Warning: Invalid file format: %s"), filename);
goto close;
}
ret = fread(buffer, 1, 3, f);
if ( ret != 3 || buffer[0] != '\r' || buffer[1] != '\n' || buffer[2] != 1 ) {
- fprintf(stderr, "Warning: Invalid file format: %s", filename);
+ fprintf(stderr, kittengets(2, 3, "Warning: Invalid file format: %s"), filename);
goto close;
}
if ( 256 != (ret = fread( buffer, 1, 256, f )) ) {
- fprintf(stderr, "Warning: Can't load Unicode table: %s", filename);
+ fprintf(stderr, kittengets(2, 2, "Warning: Can't load Unicode table: %s"), filename);
goto close;
}
@@ -461,7 +464,7 @@ static void load_unicode_table(uint16_t far *unicode_table)
close:
fclose(f);
error:
- fputs( ". Defaulting to cp437\n", stderr );
+ fputs(kittengets(2, 4, ". Defaulting to cp437\n"), stderr );
}
@@ -488,7 +491,7 @@ static int configure_driver(LPTSRDATA data, bool short_fnames, uint8_t hash_char
// Get the current timezone offset
if (getenv("TZ")) {
tzset();
- printf("Using timezone from TZ variable (%s)\n", tzname[0]);
+ printf(kittengets(1, 5, "Using timezone from TZ variable (%s)\n"), tzname[0]);
data->tz_offset = timezone / 2;
} else {
data->tz_offset = 0;
@@ -497,7 +500,7 @@ static int configure_driver(LPTSRDATA data, bool short_fnames, uint8_t hash_char
// Get uppercase and valid file char tables
err = get_nls(&data->file_upper_case, &data->file_char);
if (err) {
- puts("Cannot get the NLS tables.");
+ puts(kittengets(3, 13, "Cannot get the NLS tables"));
return -1;
}
@@ -510,37 +513,37 @@ static int configure_driver(LPTSRDATA data, bool short_fnames, uint8_t hash_char
// Now try to initialize VirtualBox communication
err = vbox_init_device(&data->vb);
if (err) {
- fprintf(stderr, "Cannot find VirtualBox PCI device, err=%ld\n", err);
+ fprintf(stderr, kittengets(3, 14, "Cannot find VirtualBox PCI device, err=%ld\n"), err);
return -1;
}
err = vbox_init_buffer(&data->vb, VBOX_BUFFER_SIZE);
if (err) {
- fprintf(stderr, "Cannot lock buffer used for VirtualBox communication, err=%ld\n", err);
+ fprintf(stderr, kittengets(3, 15, "Cannot lock buffer used for VirtualBox communication, err=%ld\n"), err);
return -1;
}
err = vbox_report_guest_info(&data->vb, VBOXOSTYPE_DOS);
if (err) {
- fprintf(stderr, "VirtualBox communication is not working, err=%ld\n", err);
+ fprintf(stderr, kittengets(3, 16, "VirtualBox communication is not working, err=%ld\n"), err);
return -1;
}
err = vbox_hgcm_connect_existing(&data->vb, "VBoxSharedFolders", &data->hgcm_client_id);
if (err) {
- printf("Cannot connect to shared folder service, err=%ld\n", err);
+ printf(kittengets(3, 17, "Cannot connect to shared folder service, err=%ld\n"), err);
return -1;
}
err = vbox_shfl_set_utf8(&data->vb, data->hgcm_client_id);
if (err) {
- printf("Cannot configure UTF-8 on shared folder service, err=%ld\n", err);
+ printf(kittengets(3, 18, "Cannot configure UTF-8 on shared folder service, err=%ld\n"), err);
return -1;
}
load_unicode_table( &data->unicode_table);
- printf("Connected to VirtualBox shared folder service\n");
+ printf(kittengets(1, 6, "Connected to VirtualBox shared folder service\n"));
return 0;
}
@@ -570,7 +573,7 @@ static __declspec(aborts) int install_driver(LPTSRDATA data, bool high)
data->prev_int2f_handler = _dos_getvect(0x2f);
_dos_setvect(0x2f, data:>int2f_isr);
- printf("Driver installed\n");
+ printf(kittengets(1, 7, "Driver installed\n"));
// If we reallocated ourselves to UMB,
// it's time to free our initial conventional memory allocation
@@ -578,6 +581,7 @@ static __declspec(aborts) int install_driver(LPTSRDATA data, bool high)
finish_reallocation(_psp, FP_SEG(data));
}
+ kittenclose();
_dos_keep(EXIT_SUCCESS, get_paragraphs(resident_size));
// Shouldn't reach this part
@@ -591,7 +595,7 @@ static bool check_if_driver_uninstallable(LPTSRDATA data)
// Compare the segment of the installed handler to see if its ours
// or someone else's
if (FP_SEG(cur_int2f_handler) != FP_SEG(data)) {
- fprintf(stderr, "INT2F has been hooked by someone else, cannot safely remove\n");
+ fprintf(stderr, kittengets(3, 19, "INT2F has been hooked by someone else, cannot safely remove\n"));
return false;
}
@@ -618,48 +622,47 @@ static int uninstall_driver(LPTSRDATA data)
// it is always 256 bytes (16 paragraphs) before the TSR segment
dos_free(FP_SEG(data) - (DOS_PSP_SIZE/16));
- printf("Driver uninstalled\n");
+ printf(kittengets(1, 8, "Driver uninstalled\n"));
return 0;
}
static int driver_not_found(void)
{
- fprintf(stderr, "Driver data not found (driver not installed?)\n");
+ fprintf(stderr, kittengets(3, 20, "Driver data not found (driver not installed?)\n"));
return EXIT_FAILURE;
}
static void print_help(void)
{
- printf("\n"
- "Usage: \n"
- " VBSF <ACTION> <ARGS..>\n\n"
- "Supported actions:\n"
- " install install the driver (default)\n"
- " low install in conventional memory (otherwise UMB)\n"
- " short use short file names from windows hosts\n"
- " hash <n> number of hash generated chars following the '~'\n"
- " for generating DOS valid files\n"
- " (%d min, %d max, %d default)\n"
- " uninstall uninstall the driver from memory\n"
- " list list available shared folders\n"
- " mount <FOLD> <X:> mount a shared folder into drive X:\n"
- " umount <X:> unmount shared folder from drive X:\n"
- " rescan unmount everything and recreate automounts\n",
- MIN_HASH_CHARS, MAX_HASH_CHARS, DEF_HASH_CHARS
- );
+ puts(kittengets(0, 0, "\n"
+ "Usage: "));
+ puts(kittengets(0, 1, " VBSF <ACTION> <ARGS..>\n"));
+ puts(kittengets(0, 2, "Supported actions:"));
+ puts(kittengets(0, 3, " install install the driver (default)"));
+ puts(kittengets(0, 4, " low install in conventional memory (otherwise UMB)"));
+ puts(kittengets(0, 5, " short use short file names from windows hosts"));
+ puts(kittengets(0, 6, " hash <n> number of hash generated chars following the '~'"));
+ puts(kittengets(0, 7, " for generating DOS valid files"));
+ printf(kittengets(0, 8, " (%d min, %d max, %d default)\n"),
+ MIN_HASH_CHARS, MAX_HASH_CHARS, DEF_HASH_CHARS);
+ puts(kittengets(0, 9, " uninstall uninstall the driver from memory"));
+ puts(kittengets(0, 10, " list list available shared folders"));
+ puts(kittengets(0, 11, " mount <FOLD> <X:> mount a shared folder into drive X:"));
+ puts(kittengets(0, 12, " umount <X:> unmount shared folder from drive X:"));
+ puts(kittengets(0, 13, " rescan unmount everything and recreate automounts"));
}
static int invalid_arg(const char *s)
{
- fprintf(stderr, "Invalid argument '%s'\n", s);
+ fprintf(stderr, kittengets(3, 21, "Invalid argument '%s'\n"), s);
print_help();
return EXIT_FAILURE;
}
static int arg_required(const char *s)
{
- fprintf(stderr, "Argument required for '%s'\n", s);
+ fprintf(stderr, kittengets(3, 22, "Argument required for '%s'\n"), s);
print_help();
return EXIT_FAILURE;
}
@@ -692,6 +695,8 @@ int main(int argc, const char *argv[])
int err, argi = 1;
SHFLSTRING_WITH_BUF(utf8name, SHFL_MAX_LEN);
+ cat = kittenopen("vbsf");
+
if (argi >= argc || stricmp(argv[argi], "install") == 0) {
uint8_t hash_chars = DEF_HASH_CHARS;
bool high = true;
@@ -717,10 +722,10 @@ int main(int argc, const char *argv[])
}
}
- printf("\nVBSharedFolders %x.%x\n", VERSION_MAJOR, VERSION_MINOR);
+ printf(kittengets(1, 9, "\nVBSharedFolders %x.%x\n"), VERSION_MAJOR, VERSION_MINOR);
if (data) {
- printf("VBSF already installed\n");
+ printf(kittengets(1, 10, "VBSF already installed\n"));
print_help();
return EXIT_SUCCESS;
}