diff --git a/docs/sys.txt b/docs/sys.txt index 7d27d3e..38b808e 100644 --- a/docs/sys.txt +++ b/docs/sys.txt @@ -1,4 +1,4 @@ -FreeDOS System Installer v3.6d, Jul 29 2009 +FreeDOS System Installer v3.6e - Nov 13, 2009 documentation by: Jeremy Davis Bart Oldeman @@ -15,7 +15,7 @@ we try to keep this document updated. Usage: SYS [source] drive: [bootsect] [{option}] source = A:,B:,C:\KERNEL\BIN\,etc., or current directory if not given - dest = A,B,etc. + dest = drive (A:,B:,C:,... or A,B,C,...) to install system to bootsect = name of 512-byte boot sector file image for drive: to write to *instead* of real boot sector {option} is one or more of the following: diff --git a/sys/sys.c b/sys/sys.c index df5fc4d..0f67c39 100644 --- a/sys/sys.c +++ b/sys/sys.c @@ -32,7 +32,7 @@ #define FDCONFIG /* include support to configure FD kernel */ /* #define DRSYS */ /* SYS for Enhanced DR-DOS (OpenDOS enhancement Project) */ -#define SYS_VERSION "v3.6d" +#define SYS_VERSION "v3.6e" #define SYS_NAME "FreeDOS System Installer " @@ -617,10 +617,39 @@ void initOptions(int argc, char *argv[], SYSOptions *opts) { drivearg = argno; /* either source or destination drive */ } - else if (!srcarg /* && drivearg */) + else if (!srcarg /* && drivearg */ && !opts->bsFile) { - srcarg = drivearg; /* set source path */ - drivearg = argno; /* set destination drive */ + /* need to determine is user specified [source] dest or dest [bootfile] (or [source] dest [bootfile]) + - dest must be either X or X: as only a drive specifier without any path is valid - + if 1st arg not drive and 2nd is then [source] dest form + if 1st arg drive and 2nd is not drive then dest [bootfile] form + if both 1st arg and 2nd are not drives then invalid arguments + if both 1st arg and 2nd are drives then assume [source] dest form (use ./X form is single letter used) + */ + if (!argv[drivearg][1] || (argv[drivearg][1]==':' && !argv[drivearg][2])) // if 1st arg drive + { + if (!argv[argno][1] || (argv[argno][1]==':' && !argv[argno][2])) // if 2nd arg drive + { + srcarg = drivearg; /* set source path */ + drivearg = argno; /* set destination drive */ + } + else + { + opts->bsFile = argv[argno]; + } + } + else + { + if (!argv[argno][1] || (argv[argno][1]==':' && !argv[argno][2])) // if 2nd arg drive + { + srcarg = drivearg; /* set source path */ + drivearg = argno; /* set destination drive */ + } + else + { + goto EXITBADARG; + } + } } else if (!opts->bsFile /* && srcarg && drivearg */) { @@ -628,6 +657,7 @@ void initOptions(int argc, char *argv[], SYSOptions *opts) } else /* if (opts->bsFile && srcarg && drivearg) */ { + EXITBADARG: printf("%s: invalid argument %s\n", pgm, argv[argno]); showHelpAndExit(); }