handle case when source not specified but filename for boot sector is given (sys X: bootfile.bin)

git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@1500 6ac86273-5f31-0410-b378-82cca8765d1b
This commit is contained in:
Kenneth J Davis 2009-11-13 22:47:02 +00:00
parent 0d4c23ffac
commit bf408d35f4
2 changed files with 36 additions and 6 deletions

View File

@ -1,4 +1,4 @@
FreeDOS System Installer v3.6d, Jul 29 2009 FreeDOS System Installer v3.6e - Nov 13, 2009
documentation by: documentation by:
Jeremy Davis Jeremy Davis
Bart Oldeman Bart Oldeman
@ -15,7 +15,7 @@ we try to keep this document updated.
Usage: SYS [source] drive: [bootsect] [{option}] Usage: SYS [source] drive: [bootsect] [{option}]
source = A:,B:,C:\KERNEL\BIN\,etc., or current directory if not given 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: bootsect = name of 512-byte boot sector file image for drive:
to write to *instead* of real boot sector to write to *instead* of real boot sector
{option} is one or more of the following: {option} is one or more of the following:

View File

@ -32,7 +32,7 @@
#define FDCONFIG /* include support to configure FD kernel */ #define FDCONFIG /* include support to configure FD kernel */
/* #define DRSYS */ /* SYS for Enhanced DR-DOS (OpenDOS enhancement Project) */ /* #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 " #define SYS_NAME "FreeDOS System Installer "
@ -617,17 +617,47 @@ void initOptions(int argc, char *argv[], SYSOptions *opts)
{ {
drivearg = argno; /* either source or destination drive */ drivearg = argno; /* either source or destination drive */
} }
else if (!srcarg /* && drivearg */) else if (!srcarg /* && drivearg */ && !opts->bsFile)
{
/* 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 */ srcarg = drivearg; /* set source path */
drivearg = argno; /* set destination drive */ 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 */) else if (!opts->bsFile /* && srcarg && drivearg */)
{ {
opts->bsFile = argv[argno]; opts->bsFile = argv[argno];
} }
else /* if (opts->bsFile && srcarg && drivearg) */ else /* if (opts->bsFile && srcarg && drivearg) */
{ {
EXITBADARG:
printf("%s: invalid argument %s\n", pgm, argv[argno]); printf("%s: invalid argument %s\n", pgm, argv[argno]);
showHelpAndExit(); showHelpAndExit();
} }