Hi!
AIU=As I understand.
>int main(int argc, char **argv)
> if (argc > 1 && memicmp(argv[1], "CONFIG", 6) == 0)
> else if (memicmp(argp, "BOOTONLY", 8) == 0 && !bootonly)
> else if (memicmp(argp, "BOTH", 4) == 0 && !both)
- AIU, there should be stricmp() (or third parameter of memicmp() should be
increased to include zero byte)?
> COUNT drive; /* destination drive */
> drive = toupper(argv[drivearg][0]) - 'A';
> if (drive < 0 || drive >= 26)
> {
> printf("%s: drive %c must be A:..Z:\n", pgm,
> *argv[(argc == 3 ? 2 : 1)]);
> exit(1);
> }
- AIU, should be:
UCOUNT drive; /* destination drive */
--^
drive = toupper (*argv[drivearg]) - 'A';
if (drive > 'Z'-'A')
{
printf("%s: drive %c must be A:..Z:\n", pgm, *argv[drivearg]);
-------------------------------------------------------^^^^^^^^
exit(1);
}
but I think, this diagnostic may be ommited completely.
> strncpy(srcPath, argv[srcarg], SYS_MAXPATH - 12);
> /* leave room for COMMAND.COM\0 */
> srcPath[SYS_MAXPATH - 13] = '\0';
- AIU, should be:
strncpy(srcPath, argv[srcarg], sizeof srcPath - 12);
/* leave room for COMMAND.COM\0 */
srcPath[sizeof srcPath - 12] = '\0';
-----------------------------^^
> /* make sure srcPath + "file" is a valid path */
> slen = strlen(srcPath);
> if ((srcPath[slen - 1] != ':') &&
> ((srcPath[slen - 1] != '\\') || (srcPath[slen - 1] != '/')))
> {
> srcPath[slen] = '\\';
> slen++;
> srcPath[slen] = '\0';
> }
- bug? AIU, should be:
/* make sure srcPath + "file" is a valid path */
size_t slen = strlen (srcPath);
if (slen) {
----^^^^^^^^^
char ch = srcPath [slen - 1];
if (ch != ':' && ch != '\\' && ch != '/')
-----------------------------------^^
srcPath [slen] = '\\', srcPath [slen + 1] = '\0';
}
> /* Get source drive */
> if ((strlen(srcPath) > 1) && (srcPath[1] == ':')) /* src specifies drive */
- optimization: if (*srcPath && srcPath [1] == ':')
> /* Don't try root if src==dst drive or source path given */
> if ((drive == srcDrive)
> || (*srcPath
> && ((srcPath[1] != ':') || ((srcPath[1] == ':') && srcPath[2]))))
> *rootPath = '\0';
> else
> sprintf(rootPath, "%c:\\", 'A' + srcDrive);
- (x || (~x && y)) equal to (x && y), so, there should be:
/* Don't try root if src==dst drive or source path given */
static char root [] = "\0:\\";
if (drive != srcDrive &&
(srcPath [0] == '\0' || /* empty string or */
(srcPath [1] == ':' && srcPath [2] == '\0'))) /* drive only "A:" */
root [0] = 'A' + srcDrive;
> if (!copy(drive, srcPath, rootPath, kernel_name))
> {
> printf("\n%s: cannot copy \"%s\"\n", pgm, kernel_name);
---------------^^
- if copy() will print "\n" itself, then first "\n" after copy() call will
not be required.
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
Freedos-kernel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freedos-kernel