home *** CD-ROM | disk | FTP | other *** search
- unzip(FileEntry *fe, int do_unzip)
- {
- static int chose_zipv = 0;
- struct ffblk f;
- int i, done;
- int show_error = 1;
- strcpy(default_fptr, fe->file_name);
- while (1)
- {
- struct stat s;
-
- printf("\nInstalling %s\n", default_dir);
-
- if (stat(default_dir, &s) == 0)
- if ((s.st_mode & S_IFMT) == S_IFREG)
- break;
-
- if (show_error)
- printf("\nCannot open file %s. It should be on disk %d\n", default_dir, fe->disk_no);
- show_error = 1;
- switch (select(0, "Select :", "Inserted new disk", "Select another directory",
- "List that directory", "Skip", "Quit", 0))
- {
- case 1:
- break;
- case 2:
- *default_fptr = 0;
- query("Directory to get files from : ", default_dir, default_dir);
- default_fptr = default_dir + strlen(default_dir);
- if (default_fptr > default_dir)
- if (default_fptr[-1] != '\\' && default_fptr[-1] != '/' && default_fptr[-1] != ':')
- *default_fptr++ = '\\';
- strcpy(default_fptr, fe->file_name);
- break;
- case 3:
- strcpy(default_fptr, "*.*");
- printf("\nListing of %s\n", default_dir);
- done = findfirst(default_dir, &f, FA_ARCH | FA_RDONLY | FA_DIREC);
- i = 0;
- while (!done)
- {
- if (f.ff_attrib & FA_DIREC)
- printf(" [%s]%*c", f.ff_name, 12-strlen(f.ff_name), ' ');
- else
- {
- strlwr(f.ff_name);
- printf("%s %-12s ", kb(f.ff_fsize), f.ff_name);
- }
- if (++i == 3)
- {
- putchar('\n');
- i = 0;
- }
- else
- fputs(" | ", stdout);
- done = findnext(&f);
- }
- if (i)
- putchar('\n');
- putchar('\n');
- show_error = 0;
- break;
- case 4:
- return;
- case 5:
- exit(0);
- }
- }
-
- if (!chose_zipv)
- chose_zipv = yesno("Would you like to see the files as they are unzipped");
-
- if (do_unzip)
- spawnlp(P_WAIT, "unzip-dj.exe", "unzip-dj.exe", (chose_zipv=='y') ? "-o" : "-o -qq", default_dir, 0);
- else
- copyfile(default_dir, fe->file_name);
- }
-