From 0f0a806e22895c5b7a6244e951c4f475a25184f8 Mon Sep 17 00:00:00 2001 From: Javier Date: Fri, 15 Apr 2022 10:59:31 +0200 Subject: add rescan option to redo automounts, in case user changes them --- mousetsr.h | 12 +++++++----- sfmain.c | 24 +++++++++++++++++++++--- sftsr.h | 3 +++ 3 files changed, 31 insertions(+), 8 deletions(-) diff --git a/mousetsr.h b/mousetsr.h index f3f6785..8ae1a7e 100644 --- a/mousetsr.h +++ b/mousetsr.h @@ -39,6 +39,13 @@ /** Trace events verbosily */ #define TRACE_EVENTS 0 +#define VERSION_MAJOR 0 +#define VERSION_MINOR 5 + +/** The report MS MOUSE compatible version to programs who ask for it. */ +#define REPORTED_VERSION_MAJOR 6 +#define REPORTED_VERSION_MINOR 0x30 + // End of user customizable defines #define USE_INTEGRATION (USE_VIRTUALBOX || USE_VMWARE) @@ -51,11 +58,6 @@ #define GRAPHIC_CURSOR_MASK_LEN (GRAPHIC_CURSOR_HEIGHT * GRAPHIC_CURSOR_SCANLINE_LEN) #define GRAPHIC_CURSOR_DATA_LEN (2 * GRAPHIC_CURSOR_MASK_LEN) -#define VERSION_MAJOR 0 -#define VERSION_MINOR 4 -#define REPORTED_VERSION_MAJOR 6 -#define REPORTED_VERSION_MINOR 0x30 - #if USE_VIRTUALBOX #include "vbox.h" diff --git a/sfmain.c b/sfmain.c index eadb7ae..bbd913b 100644 --- a/sfmain.c +++ b/sfmain.c @@ -319,6 +319,21 @@ static int unmount_all(LPTSRDATA data) return err; } +static int rescan(LPTSRDATA data) +{ + int err; + + if ((err = unmount_all(data))) { + return err; + } + + if ((err = automount(data))) { + return err; + } + + return 0; +} + static int configure_driver(LPTSRDATA data) { unsigned i; @@ -342,7 +357,6 @@ static int configure_driver(LPTSRDATA data) printf("Using timezone from TZ variable (%s)\n", tzname[0]); data->tz_offset = timezone / 2; } else { - printf("No TZ environment variable\n"); data->tz_offset = 0; } @@ -481,6 +495,7 @@ static void print_help(void) " list list available shared folders\n" " mount mount a shared folder into drive X:\n" " umount unmount shared folder from drive X:\n" + " rescan unmount everything and recreate automounts\n" ); } @@ -525,8 +540,6 @@ int main(int argc, const char *argv[]) LPTSRDATA data = get_tsr_data(true); int err, argi = 1; - //printf("\nVBSF %x.%x\n", VERSION_MAJOR, VERSION_MINOR); - if (argi >= argc || stricmp(argv[argi], "install") == 0) { bool high = true; @@ -541,6 +554,8 @@ int main(int argc, const char *argv[]) } } + printf("\nVBSharedFolders %x.%x\n", VERSION_MAJOR, VERSION_MINOR); + if (data) { printf("VBSF already installed\n"); print_help(); @@ -596,6 +611,9 @@ int main(int argc, const char *argv[]) if (!drive) return invalid_arg(argv[argi]); return unmount(data, drive); + } else if (stricmp(argv[argi], "rescan") == 0) { + if (!data) return driver_not_found(); + return rescan(data); } else { return invalid_arg(argv[argi]); } diff --git a/sftsr.h b/sftsr.h index ab1b0d2..4693688 100644 --- a/sftsr.h +++ b/sftsr.h @@ -26,6 +26,9 @@ #include "vbox.h" #include "int21dos.h" +#define VERSION_MAJOR 0 +#define VERSION_MINOR 2 + #define LASTDRIVE 'Z' #define MAX_NUM_DRIVE (LASTDRIVE - 'A') #define NUM_DRIVES (MAX_NUM_DRIVE + 1) -- cgit v1.2.3