Changeset 1752 for trunk/dll/arccnrs.c
- Timestamp:
- Mar 2, 2014, 2:39:13 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/dll/arccnrs.c
r1749 r1752 94 94 22 Feb 14 GKY Fix warn readonly yes don't ask to work when recursing directories. 95 95 28 Apr 14 JBS Ticket #522: Ensure use of wrapper functions where needed 96 01 Mar 14 GKY Fixed error checking in FillArcCnr only to report missing archivers after 97 all entries have been tried. Added a check b/gzip exes for TAR.B/GZ archives. 98 Use the test archive string from the first working archive description. 99 Enhance the error message. Ticket 502 100 01 Mar 14 GKY Fix a trap caused by selecting "print" from the arccontainer menu. Ticket 525 101 01 Mar 14 GKY Fix the problem with copying text from the test archive window by launching 102 it in a command shell (i.e. comspec /k archiver -t archive) Ticket 503 96 103 97 104 ***********************************************************************/ … … 330 337 break; 331 338 332 case ARCERR_TEST: 339 case ARCERR_TEST: { 340 CHAR *comspec; 341 333 342 ad = WinQueryWindowPtr(hwnd, QWL_USER); 343 comspec = getenv( "COMSPEC" ); 334 344 runemf2(SEPARATEKEEP | WINDOWED | MAXIMIZED, 335 345 hwnd, pszSrcFile, __LINE__, NULL, NULL, 336 "%s %s",337 ad->info->test,346 "%s /k %s %s", 347 comspec, ad->info->test, 338 348 BldQuotedFileName(szQuotedArcName, ad->arcname)); 339 349 break; 350 } 340 351 } 341 352 return 0; … … 575 586 CHAR lonename[CCHMAXPATH + 2], 576 587 *nsize, *osize, *fdate, *fname, *p, *pp, *arctemp; 577 // Change the DosQueryAppType call below to xDosQueryAppType if "s" is no longer in low memory588 CHAR TestStr[CCHMAXPATH * 2]; 578 589 CHAR s[CCHMAXPATH * 2]; 579 590 BOOL gotstart; … … 581 592 BOOL wasquote; 582 593 BOOL nomove = FALSE; // fixme to be gone? 594 BOOL notest; 595 BOOL nobzip, ftarbz, nogzip, ftargz; 583 596 INT highest = 0, fieldnum, counter = 0, numarcfiles = 0; 584 597 PARCITEM lastpai; … … 588 601 APIRET rc; 589 602 CHAR *mode; 603 ULONG cnter = 0; 590 604 591 605 if (!arcname || !arcinfo) … … 603 617 ArcTempRoot); 604 618 MakeTempName(arctemp, ArcTempRoot, 2); 605 619 p = strrchr(arcname, '.'); 620 if (p) { 621 APIRET temp; 622 623 p = p - 3; 624 nobzip = stricmp(p, "TAR.BZ"); 625 nogzip = stricmp(p, "TAR.GZ"); 626 if (!nobzip) { 627 ftarbz = TRUE; 628 if (DosQueryAppType("bzip.exe" , &apptype)) { 629 nobzip = TRUE; 630 temp = saymsg(MB_YESNO, HWND_DESKTOP, NullStr, GetPString(IDS_ARCNOBZIP)); 631 if (temp != MBID_NO) 632 return 0; 633 } 634 } 635 else if (!nogzip) { 636 ftargz = TRUE; 637 if (DosQueryAppType("gzip.exe" , &apptype)) { 638 nogzip = TRUE; 639 temp = saymsg(MB_YESNO, HWND_DESKTOP, NullStr, GetPString(IDS_ARCNOGZIP)); 640 if (temp != MBID_NO) 641 return 0; 642 } 643 } 644 } 606 645 607 646 ReTry: … … 681 720 return 0; 682 721 } 683 else { 684 runemf2(SEPARATE | INVISIBLE | MINIMIZED | BACKGROUND | WAIT, 685 hwndCnr, pszSrcFile, __LINE__, NULL, NULL, 686 "%s %s", 687 info->list, 688 BldQuotedFileName(s, arcname)); 689 oldstdout = fileno(stdout); 690 DosError(FERR_DISABLEHARDERR); 691 DosDupHandle(newstdout, &oldstdout); 692 DosClose(newstdout); 693 fclose(fp); 694 } 722 else { 723 rc = 0; 724 //DbgMsg(pszSrcFile, __LINE__, "Number of tries %i", cnter); 725 rc = DosQueryAppType(s, &apptype); 726 if (!rc) { 727 cnter ++; 728 runemf2(SEPARATE | INVISIBLE | MINIMIZED | BACKGROUND | WAIT, 729 hwndCnr, pszSrcFile, __LINE__, NULL, NULL, 730 "%s %s", 731 info->list, 732 BldQuotedFileName(s, arcname)); 733 if (cnter == 1) { 734 if (info->test) 735 strcpy(TestStr, info->test); 736 else 737 notest = TRUE; 738 } 739 else if (notest && info->test) { 740 strcpy(TestStr, info->test); 741 notest = FALSE; 742 } 743 } 744 oldstdout = fileno(stdout); 745 DosError(FERR_DISABLEHARDERR); 746 DosDupHandle(newstdout, &oldstdout); 747 DosClose(newstdout); 748 fclose(fp); 749 } 695 750 } 696 751 } … … 889 944 890 945 fclose(fp); 891 946 //DbgMsg(pszSrcFile, __LINE__, "Archive check counter %i numarcfiles %i gotstart %i %c", 947 // cnter, numarcfiles, gotstart, pStopFlag); 892 948 if (*pStopFlag) 893 949 numarcfiles = 0; // Request close … … 899 955 CHAR errstr[CCHMAXPATH + 256]; 900 956 901 957 // Try for alternate archiver 902 958 tinfo = info; 903 959 do { … … 913 969 } while (tinfo); 914 970 if (!fAlertBeepOff) 915 DosBeep(750, 50); // wake up user 916 sprintf(errstr, GetPString(IDS_ARCERRORINFOTEXT), 917 arcname, 918 !gotstart ? GetPString(IDS_NOGOTSTARTTEXT) : NullStr, 919 !numarcfiles ? GetPString(IDS_NOARCFILESFOUNDTEXT) : 920 NullStr, 921 !gotend ? GetPString(IDS_NOENDOFLISTTEXT) : NullStr); 922 memset(&ad, 0, sizeof(ARCDUMP)); 923 ad.info = info; 924 strcpy(ad.listname, arctemp); 925 strcpy(ad.arcname, arcname); 926 ad.errmsg = errstr; 927 WinDlgBox(HWND_DESKTOP, 928 hwndCnr, 929 ArcErrProc, FM3ModHandle, ARCERR_FRAME, MPFROMP(&ad)); 971 DosBeep(750, 50); // wake up user 972 if (cnter > 0) { 973 CHAR Temp[CCHMAXPATH + 2]; 974 975 sprintf(errstr, GetPString(IDS_ARCERRORINFOTEXT), 976 arcname, 977 !gotstart ? GetPString(IDS_NOGOTSTARTTEXT) : NullStr, 978 !numarcfiles ? GetPString(IDS_NOARCFILESFOUNDTEXT) : NullStr, 979 !gotend ? GetPString(IDS_NOENDOFLISTTEXT) : NullStr, 980 !notest ? NullStr : GetPString(IDS_ARCNOTEST), 981 ftarbz && !nobzip ? GetPString(IDS_ARCBZIPTESTTARBZ) : NullStr, 982 ftargz && !nogzip ? GetPString(IDS_ARCGZIPTESTTARGZ) : NullStr); 983 memset(&ad, 0, sizeof(ARCDUMP)); 984 ad.info = info; 985 strcpy(ad.listname, arctemp); 986 strcpy(ad.arcname, arcname); 987 if (!notest) { 988 strcpy(Temp, info->test); 989 info->test = xstrdup(TestStr, pszSrcFile, __LINE__); 990 } 991 else if ((ftarbz && !nobzip) || (ftargz && !nogzip)) 992 info->test = xstrdup(ftarbz ? "bzip.exe -t" : "gzip.exe - t", 993 pszSrcFile, __LINE__); 994 ad.errmsg = errstr; 995 WinDlgBox(HWND_DESKTOP, 996 hwndCnr, 997 ArcErrProc, FM3ModHandle, ARCERR_FRAME, MPFROMP(&ad)); 998 if (!notest) 999 info->test = xstrdup(Temp, pszSrcFile, __LINE__); 1000 else if ((ftarbz && !nobzip) || (ftargz && !nogzip)) 1001 info->test = xstrdup("", pszSrcFile, __LINE__); 1002 } 1003 else 1004 saymsg(MB_OK, HWND_DESKTOP, GetPString(IDS_ARCMISSINGEXE), 1005 GetPString(IDS_ARCMISSINGEXEVERBOSE)); 930 1006 } 931 1007 else if (!nomove && tinfo) { 932 // if we got a false hit, move working hit to top 933 tinfo = info->next; 1008 // if we got a false hit, move working hit to top 1009 tinfo = info->next; 934 1010 info->next = arcsighead; 935 1011 arcsighead->prev = info; … … 1892 1968 li->type == IDM_OPENDEFAULT || 1893 1969 li->type == IDM_OPENSETTINGS || 1894 (li->type == IDM_EDITBINARY &&// JBS No way for this () to be true??1895 li->type == IDM_MCIPLAY)) &&1970 (li->type == IDM_EDITBINARY || // JBS No way for this () to be true?? 1971 li->type == IDM_MCIPLAY)) || 1896 1972 !li->info->exwdirs)) ? 1897 1973 li->info->extract : … … 2198 2274 } // switch 2199 2275 } 2200 if (li ->type != IDM_OPENDEFAULT && li->type != IDM_OPENSETTINGS)2276 if (li && li->type != IDM_OPENDEFAULT && li->type != IDM_OPENSETTINGS) 2201 2277 { 2202 2278 FreeListInfo(li); … … 2668 2744 WinEnableMenuItem((HWND) mp2, 2669 2745 IDM_DELETE, dcd->info->delete != NULL); 2670 WinEnableMenuItem((HWND) mp2, IDM_TEST, dcd->info->test != NULL); 2671 WinEnableMenuItem((HWND) mp2, 2672 IDM_EXTRACT, dcd->info->extract != NULL); 2746 WinEnableMenuItem((HWND) mp2, IDM_TEST, dcd->info->test != NULL); 2747 WinEnableMenuItem((HWND) mp2, IDM_EXTRACT, 2748 dcd->info->extract != NULL && !strstr(dcd->info->ext, "TAR")); 2749 WinEnableMenuItem((HWND) mp2, IDM_ARCEXTRACT, 2750 dcd->info->extract != NULL && !strstr(dcd->info->ext, "TAR")); 2673 2751 WinEnableMenuItem((HWND) mp2, 2674 2752 IDM_EXTRACTWDIRS, dcd->info->exwdirs != NULL); … … 2682 2760 2683 2761 case IDM_VIEWSMENU: 2762 WinEnableMenuItem((HWND) mp2, IDM_TEST, dcd->info->test != NULL); 2763 WinEnableMenuItem((HWND) mp2, IDM_ARCEXTRACT, 2764 dcd->info->extract != NULL && !strstr(dcd->info->ext, "TAR")); 2684 2765 WinCheckMenuItem((HWND) mp2, 2685 2766 IDM_MINIICONS, (dcd->flWindowAttr & CV_MINI) != 0); … … 3689 3770 strcpy(dcd->directory, extractpath); 3690 3771 } 3691 // Removed because it can't be set from inside the container and names with a space3692 // break it. I don't think it makes sense from the container any way GKY 8-10-133693 /*if (!*dcd->directory && fFileNameCnrPath && dcd->arcname) {3694 strcpy(fullname, dcd->arcname);3695 p = strrchr(fullname, '.');3696 if (p) {3697 *p = 0;3698 }3699 else {3700 p = fullname + strlen(fullname);3701 p--;3702 *p = 0;3703 }3704 strcpy(dcd->directory, fullname);3705 } */3706 3772 if (!*dcd->directory && *lastextractpath) { 3707 3773 //DosEnterCritSec(); //GKY 11-29-08
Note:
See TracChangeset
for help on using the changeset viewer.