diff options
Diffstat (limited to 'sfmain.c')
| -rw-r--r-- | sfmain.c | 28 |
1 files changed, 15 insertions, 13 deletions
@@ -30,10 +30,9 @@ #include "vboxshfl.h" #include "dostsr.h" #include "sftsr.h" +#include "unitbl.h" #include "unicode.h" -static 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')) { @@ -169,13 +168,12 @@ static void close_openfiles(LPTSRDATA data, int drive) static int mount_shfl(LPTSRDATA data, int drive, const char *folder) { int32_t err; - SHFLSTRING_WITH_BUF(str, SHFL_MAX_LEN); + SHFLSTRING_WITH_BUF(utf8name, SHFL_MAX_LEN); SHFLROOT root = SHFL_ROOT_NIL; - unsigned flags = SHFL_MIQF_DRIVE_LETTER, version = 0; - shflstring_strcpy(&str.shflstr, folder); + utf8name.shflstr.u16Length = local_to_utf8(data, utf8name.buf, folder, utf8name.shflstr.u16Size); - err = vbox_shfl_map_folder(&data->vb, data->hgcm_client_id, &str.shflstr, &root); + err = vbox_shfl_map_folder(&data->vb, data->hgcm_client_id, &utf8name.shflstr, &root); if (err) { fprintf(stderr, _(3, 3, "Cannot mount shared folder '%s', err=%d\n"), folder, err); return -1; @@ -237,7 +235,7 @@ static bool is_mounted_drive(LPTSRDATA data, char drive_letter, int drive) return true; } -static int mount(LPTSRDATA data, char *folder, char drive_letter, MOUNTOPTS *opts) +static int mount(LPTSRDATA data, const char *folder, char drive_letter, MOUNTOPTS *opts) { int drive = drive_letter_to_index(drive_letter); DOSLOL __far *lol = dos_get_list_of_lists(); @@ -270,7 +268,6 @@ static int mount(LPTSRDATA data, char *folder, char drive_letter, MOUNTOPTS *opt // By setting the physical flag, we also let DOS know the drive is present cds->flags = DOS_CDS_FLAG_NETWORK | DOS_CDS_FLAG_PHYSICAL; - (void)utf8_to_local(data, folder, folder, NULL); printf(_(1, 3, "Shared folder '%s' mounted as drive %c:\n"), folder, drive_letter); return EXIT_SUCCESS; @@ -481,7 +478,8 @@ static void load_unicode_table(uint16_t far *unicode_table) char fullpath[_MAX_PATH]; char buffer[256]; FILE *f; - int i, ret; + const uint16_t *builtin_tbl; + int ret; // get current Code Page // @@ -502,6 +500,12 @@ static void load_unicode_table(uint16_t far *unicode_table) goto error; } + // Try one of the builtin tables first + if ((builtin_tbl = get_uni_tbl(r.x.bx))) { + _fmemcpy(unicode_table, builtin_tbl, 256); + return; + } + sprintf(filename, r.x.bx > 999 ? "c%duni.tbl" : "cp%duni.tbl", r.x.bx); // Search in the same directory as the executable first @@ -812,9 +816,8 @@ int main(int argc, const char *argv[]) { LPTSRDATA data = get_tsr_data(true); int err, argi = 1; - SHFLSTRING_WITH_BUF(utf8name, SHFL_MAX_LEN); - cat = kittenopen("vbsf"); + kittenopen(argv[0]); if (argi >= argc || stricmp(argv[argi], "install") == 0) { uint8_t hash_chars = DEF_HASH_CHARS; @@ -890,8 +893,7 @@ int main(int argc, const char *argv[]) err = parse_mountopts(&opts, &argi, argc, argv); if (err) return err; - local_to_utf8(data, utf8name.buf, folder, utf8name.shflstr.u16Size); - return mount(data, utf8name.buf, drive, &opts); + return mount(data, folder, drive, &opts); } else if (stricmp(argv[argi], "umount") == 0 || stricmp(argv[argi], "unmount") == 0) { char drive; if (!data) return driver_not_found(); |
