dos33: more whitespace cleanup

I blame jed
This commit is contained in:
Vince Weaver 2016-12-13 15:39:29 -05:00
parent b758047c60
commit 602b137363

View File

@ -1265,6 +1265,7 @@ int main(int argc, char **argv) {
char output_filename[BUFSIZ]; char output_filename[BUFSIZ];
char *result_string; char *result_string;
int always_yes=0,firstarg=1,extra_ops=0; int always_yes=0,firstarg=1,extra_ops=0;
char *temp;
/* Check command line arguments */ /* Check command line arguments */
/* Ugh I should use getopt() or something similar here */ /* Ugh I should use getopt() or something similar here */
@ -1357,20 +1358,20 @@ int main(int argc, char **argv) {
case COMMAND_CATALOG: case COMMAND_CATALOG:
/* get first catalog */ /* get first catalog */
catalog_entry=dos33_get_catalog_ts(dos_fd); catalog_entry=dos33_get_catalog_ts(dos_fd);
printf("\nDISK VOLUME %i\n\n",sector_buffer[VTOC_DISK_VOLUME]); printf("\nDISK VOLUME %i\n\n",sector_buffer[VTOC_DISK_VOLUME]);
while(catalog_entry>0) { while(catalog_entry>0) {
catalog_entry=dos33_find_next_file(dos_fd,catalog_entry); catalog_entry=dos33_find_next_file(dos_fd,catalog_entry);
if (catalog_entry>0) { if (catalog_entry>0) {
dos33_print_file_info(dos_fd,catalog_entry); dos33_print_file_info(dos_fd,catalog_entry);
catalog_entry+=(1<<16); catalog_entry+=(1<<16);
/* dos33_find_next_file() handles wrapping issues */ /* dos33_find_next_file() handles wrapping issues */
} }
} }
printf("\n"); printf("\n");
break; break;
case COMMAND_SAVE: case COMMAND_SAVE:
/* argv3 == type == A,B,T,I,N,L etc */ /* argv3 == type == A,B,T,I,N,L etc */
@ -1401,44 +1402,43 @@ int main(int argc, char **argv) {
/* Then use the input name. Note, we strip */ /* Then use the input name. Note, we strip */
/* everything up to the last slash so useless */ /* everything up to the last slash so useless */
/* path info isn't used */ /* path info isn't used */
{
char *temp;
temp=argv[firstarg+3]+(strlen(argv[firstarg+3])-1); temp=argv[firstarg+3]+(strlen(argv[firstarg+3])-1);
while(temp!=argv[firstarg+3]) { while(temp!=argv[firstarg+3]) {
temp--; temp--;
if (*temp == '/') { if (*temp == '/') {
temp++; temp++;
break; break;
} }
} }
if (strlen(temp)>30) { if (strlen(temp)>30) {
fprintf(stderr, fprintf(stderr,
"Warning! Truncating filename to 30 chars!\n"); "Warning! Truncating filename to 30 chars!\n");
} }
strncpy(apple_filename,temp,30); strncpy(apple_filename,temp,30);
apple_filename[30]=0; apple_filename[30]=0;
} }
}
catalog_entry=dos33_check_file_exists(dos_fd,apple_filename,
catalog_entry=dos33_check_file_exists(dos_fd,apple_filename, FILE_NORMAL);
FILE_NORMAL);
if (catalog_entry>=0) {
if (catalog_entry>=0) { fprintf(stderr,"Warning! %s exists!\n",apple_filename);
fprintf(stderr,"Warning! %s exists!\n",apple_filename); if (!always_yes) {
if (!always_yes) { printf("Over-write (y/n)?");
printf("Over-write (y/n)?"); result_string=fgets(temp_string,BUFSIZ,stdin);
result_string=fgets(temp_string,BUFSIZ,stdin); if ((result_string==NULL) || (temp_string[0]!='y')) {
if ((result_string==NULL) || (temp_string[0]!='y')) { printf("Exiting early...\n");
printf("Exiting early...\n"); goto exit_and_close;
goto exit_and_close; }
} }
} fprintf(stderr,"Deleting previous version...\n");
fprintf(stderr,"Deleting previous version...\n"); dos33_delete_file(dos_fd,catalog_entry);
dos33_delete_file(dos_fd,catalog_entry); }
}
dos33_add_file(dos_fd,type,argv[firstarg+3],apple_filename); dos33_add_file(dos_fd,type,argv[firstarg+3],apple_filename);