Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
jquast authored and root committed Aug 16, 2023
1 parent 964c08a commit b2c43ea
Showing 1 changed file with 23 additions and 35 deletions.
58 changes: 23 additions & 35 deletions utils/dos33fs-utils/dos33.c
Original file line number Diff line number Diff line change
Expand Up @@ -1063,26 +1063,21 @@ int main(int argc, char **argv) {
int retval=0;

/* Check command line arguments */
while ((c = getopt(argc, argv, "a:l:t:s:dhvxy")) != -1)
{
switch (c)
{

case 'd':
fprintf(stderr, "DEBUG enabled\n");
debug = 1;
break;
case 'l':
length = strtol(optarg, &endptr, 0);
if (debug)
fprintf(stderr, "Length=%d\n", length);
break;
case 'a':
address = strtol(optarg, &endptr, 0);
if (debug)
fprintf(stderr, "Address=%d\n", address);
break;
while ((c = getopt (argc, argv,"a:l:t:s:dhvxy"))!=-1) {
switch (c) {

case 'd':
fprintf(stderr,"DEBUG enabled\n");
debug=1;
break;
case 'a':
address=strtol(optarg,&endptr,0);
if (debug) fprintf(stderr,"Address=%d\n",address);
break;
case 'l':
length=strtol(optarg,&endptr,0);
if (debug) fprintf(stderr,"Length=%d\n",length);
break;
#if 0
case 't':
track=strtol(optarg,&endptr,0);
Expand All @@ -1106,11 +1101,8 @@ int main(int argc, char **argv) {
break;
}
}
for (c = 0; c < argc;c++) {
printf("+ argv[%d]=%s\n",c,argv[c]);
}
if (optind == argc)
{

if (optind==argc) {
fprintf(stderr,"ERROR! Must specify disk image!\n\n");
return -ERROR_INVALID_PARAMATER;
}
Expand All @@ -1133,7 +1125,6 @@ int main(int argc, char **argv) {
retval=-ERROR_INVALID_PARAMATER;
goto exit_and_close;
}
printf("after next argument, optind=%d (%s) (command)\n", optind, argv[optind]);

/* Grab command */
strncpy(temp_string,argv[optind],BUFSIZ-1);
Expand All @@ -1145,7 +1136,6 @@ int main(int argc, char **argv) {

/* Move to next argument */
optind++;
printf("after next argument, optind=%d (%s) [...]\n", optind, argv[optind]);

command=lookup_command(temp_string);

Expand Down Expand Up @@ -1266,22 +1256,20 @@ int main(int argc, char **argv) {
case 'h':
display_help(argv[0], 0);
return 0;
case 'l':
length = strtol(optarg, &endptr, 0);
if (debug)
fprintf(stderr, "Length=%d\n", length);
break;
case 'a':
address = strtol(optarg, &endptr, 0);
if (debug)
fprintf(stderr, "Address=%d\n", address);
address=strtol(optarg,&endptr,0);
if (debug) fprintf(stderr,"Address=%d\n",address);
break;
case 'l':
length=strtol(optarg,&endptr,0);
if (debug) fprintf(stderr,"Length=%d\n",length);
break;
}
}
}

if (argc==optind) {
fprintf(stderr, "Error! local_file argument required\n");
fprintf(stderr,"Error! local_file argument required\n");

if (command==COMMAND_BSAVE) {
fprintf(stderr,"%s %s BSAVE "
Expand Down

0 comments on commit b2c43ea

Please sign in to comment.