Changeset 906


Ignore:
Timestamp:
Jan 6, 2008, 5:21:14 AM (18 years ago)
Author:
Gregg Young
Message:

The basic program quoting code and some mailto cleanup.

Location:
trunk/dll
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/arccnrs.c

    r897 r906  
    17001700              for (x = 0; li->list[x]; x++) {
    17011701                BldFullPathName(fullname, li->targetpath, li->list[x]);
    1702                 // sprintf(fullname, "%s%s%s",
    1703                 //      li->targetpath,
    1704                 //      (li->targetpath[strlen(li->targetpath) - 1] == '\\') ?
    1705                 //      NullStr : "\\", li->list[x]);
    17061702                if (IsFile(fullname) != -1) {
    17071703                  AddToList(li->list[x], &exfiles, &numfiles, &numalloc);
     
    18611857                }
    18621858                BldFullPathName(cl, li->targetpath, li->list[x]);
    1863                 // sprintf(cl, "%s%s%s", li->targetpath,
    1864                 //      (li->targetpath[strlen(li->targetpath) - 1] == '\\') ?
    1865                 //      NullStr : "\\", li->list[x]);
    18661859                temp = li->list[x];
    18671860                li->list[x] = xstrdup(cl, pszSrcFile, __LINE__);
     
    26842677      case IDM_NOTEBOOK:
    26852678        if (!ParentIsDesktop(dcd->hwndParent, dcd->hwndParent))
    2686           PostMsg(dcd->hwndParent, msg, mp1, mp2);
    2687         else
     2679          PostMsg(dcd->hwndParent, msg, mp1, mp2);
     2680        else
    26882681          WinDlgBox(HWND_DESKTOP,
    26892682                    hwnd,
    2690                     CfgDlgProc, FM3ModHandle, CFG_FRAME, (PVOID) "Archive");
     2683                    CfgDlgProc, FM3ModHandle, CFG_FRAME, MPFROMP("Archive"));
    26912684        break;
    26922685
     
    29562949              for (x = 0; li->list && li->list[x]; x++) {
    29572950                BldFullPathName(s, dcd->workdir, li->list[x]);
    2958                 // sprintf(s, "%s%s%s", dcd->workdir,
    2959                 //      (dcd->workdir[strlen(dcd->workdir) - 1] == '\\') ?
    2960                 //      NullStr : "\\", li->list[x]);
    29612951                if (IsFile(s) != 1) {
    29622952                  free(li->list[x]);
  • trunk/dll/avv.c

    r888 r906  
    5252static PSZ nonull(PSZ a);
    5353static PSZ free_and_strdup_from_window(HWND hwnd, USHORT id, PSZ pszDest);
     54static PSZ free_and_strdup_quoted_from_window(HWND hwnd, USHORT id, PSZ pszDest);
    5455
    5556//=== EditArchiverDefinition() Select archiver to edit definition ===
     
    8586  if (*sz)
    8687    pszDest = xstrdup(sz, pszSrcFile, __LINE__);
     88  else
     89    pszDest = NULL;
     90  return pszDest;
     91}
     92
     93static PSZ free_and_strdup_quoted_from_window(HWND hwnd, USHORT id, PSZ pszDest)
     94{
     95  CHAR sz[256], *psz[256];
     96
     97  xfree(pszDest);
     98  WinQueryDlgItemText(hwnd, id, sizeof(sz), sz);
     99  if (*sz){
     100    *psz = CheckApp_QuoteAddExe(sz);
     101    pszDest = xstrdup(sz, pszSrcFile, __LINE__);
     102  }
    87103  else
    88104    pszDest = NULL;
     
    816832        free_and_strdup_from_window(hwnd, AD_ID, admp->info->id);
    817833      admp->info->create =
    818         free_and_strdup_from_window(hwnd, AD_ADD, admp->info->create);
     834        free_and_strdup_quoted_from_window(hwnd, AD_ADD, admp->info->create);
    819835      admp->info->createwdirs =
    820         free_and_strdup_from_window(hwnd, AD_ADDWPATHS,
     836        free_and_strdup_quoted_from_window(hwnd, AD_ADDWPATHS,
    821837                                    admp->info->createwdirs);
    822838      admp->info->createrecurse =
    823         free_and_strdup_from_window(hwnd, AD_ADDRECURSE,
     839        free_and_strdup_quoted_from_window(hwnd, AD_ADDRECURSE,
    824840                                    admp->info->createrecurse);
    825841      admp->info->movewdirs =
    826         free_and_strdup_from_window(hwnd, AD_MOVEWPATHS,
     842        free_and_strdup_quoted_from_window(hwnd, AD_MOVEWPATHS,
    827843                                    admp->info->movewdirs);
    828844      admp->info->move =
    829         free_and_strdup_from_window(hwnd, AD_MOVE, admp->info->move);
     845        free_and_strdup_quoted_from_window(hwnd, AD_MOVE, admp->info->move);
    830846      admp->info->delete =
    831         free_and_strdup_from_window(hwnd, AD_DELETE, admp->info->delete);
     847        free_and_strdup_quoted_from_window(hwnd, AD_DELETE, admp->info->delete);
    832848      admp->info->test =
    833         free_and_strdup_from_window(hwnd, AD_TEST, admp->info->test);
     849        free_and_strdup_quoted_from_window(hwnd, AD_TEST, admp->info->test);
    834850      admp->info->extract =
    835         free_and_strdup_from_window(hwnd, AD_EXTRACT, admp->info->extract);
     851        free_and_strdup_quoted_from_window(hwnd, AD_EXTRACT, admp->info->extract);
    836852      admp->info->exwdirs =
    837         free_and_strdup_from_window(hwnd, AD_WDIRS, admp->info->exwdirs);
     853        free_and_strdup_quoted_from_window(hwnd, AD_WDIRS, admp->info->exwdirs);
    838854      admp->info->ext =
    839855        free_and_strdup_from_window(hwnd, AD_EXT, admp->info->ext);
     
    841857        free_and_strdup_from_window(hwnd, AD_SIG, admp->info->signature);
    842858      admp->info->siglen = literal(admp->info->signature);
    843       admp->info->list = free_and_strdup_from_window(hwnd,
     859      admp->info->list = free_and_strdup_quoted_from_window(hwnd,
    844860                                                     AD_LIST,
    845861                                                     admp->info->list);
  • trunk/dll/collect.c

    r888 r906  
    15271527        else
    15281528          WinDlgBox(HWND_DESKTOP, hwnd, CfgDlgProc, FM3ModHandle,
    1529                     CFG_FRAME, (PVOID) "Collector");
     1529                    CFG_FRAME, MPFROMP("Collector"));
    15301530        break;
    15311531
  • trunk/dll/fm3dll.h

    r902 r906  
    740740char *RootName(char *filename);
    741741APIRET MakeFullName(char *filename);
     742PSZ CheckApp_QuoteAddExe(PSZ pszPgm);
    742743
    743744/* misc.c */
     
    867868void strip_trail_char(char *pszStripChars, char *pszSrc);
    868869VOID remove_first_occurence_of_character(char *pszRemoveChar, char *pszSrc);
     870VOID remove_last_occurence_of_character(char *pszRemoveChar, char *pszSrc);
    869871
    870872#define lstrip(s)         strip_lead_char(" \t",(s))
     
    14461448  fSubjectLengthMax, fNoLargeFileSupport, fNoMailtoMailRun,
    14471449  fHttpRunWPSDefault, fFtpRunWPSDefault, fLibPathStrictMailRun,
    1448   fLibPathStrictHttpRun, fLibPathStrictFtpRun;
     1450  fLibPathStrictHttpRun, fLibPathStrictFtpRun, fCancelAction;
    14491451DATADEF BOOL detailsladate, detailslatime, detailscrdate, detailscrtime,
    14501452  detailslongname, detailsea, detailssize, detailssubject,
  • trunk/dll/fm3dll.str

    r897 r906  
    295295The FM/2 INI file \"%s\" can not be marked read/write.
    296296FM/2: Help
    297 
    298 
    299 
    300 
    301 
     297The program "%s" not found.\nAre the Path and Filename correct?\nDo you wish to save it anyway?
     298"%s" doesn't appear to be executable.\nDo you wish to save it anyway?
     299"%s" isn't an exe file and has no extension.\nFM2 requires an extension for executing a program
     300"%s" doesn't appear to be executable. It doesn't have a standard executable file extension\nDo you wish to save it anyway?
     301"%s" has quoting in the program arguments which may or may not be correct.
    302302
    303303FM/2: See all files
     
    658658Can't find this file.
    659659Must be run through command processor (i.e. "CMD.EXE /C ...")
    660 OS/2 says: Not a directly executable type.
     660OS/2 says: Doesn't appear to be a directly executable type.
    661661Acceptable apptype
    662662DOS
  • trunk/dll/fm3str.h

    r892 r906  
    301301#define IDS_INIREADONLYTEXT                                   294
    302302#define IDS_FM2HELPTITLETEXT                                  295
     303#define IDS_PROGRAMNOTFOUNDTEXT                               296
     304#define IDS_PROGRAMNOTEXETEXT                                 297
     305#define IDS_PROGRAMNOTEXE2TEXT                                298
     306#define IDS_PROGRAMNOTEXE3TEXT                                299
     307#define IDS_QUOTESINARGSTEXT                                  300
    303308#define IDS_SEEALLTITLETEXT                                   302
    304309#define IDS_UNTITLEDTEXT                                      303
  • trunk/dll/newview.c

    r898 r906  
    145145  CHAR *pszCharCounter;
    146146  CHAR *pszTestStr = pszSrc;
    147   CHAR szMailTo[1024] = "<mailto:";
    148   CHAR szMailEnd[] = ">";
     147  CHAR szMailTo[1024] = "mailto:";
     148  //CHAR szMailEnd[] = ">";
    149149
    150150  if (!strnstr(pszTestStr, pszFindChar, StrLens))
     
    158158      strip_trail_char(">", pszSrc);
    159159      strcat(szMailTo, pszSrc);
    160       strcat(szMailTo, szMailEnd);
     160     // strcat(szMailTo, szMailEnd);
    161161      pszSrc = szMailTo;
    162162      return pszSrc;
     
    185185    strip_trail_char(">", pszSrc);
    186186    strcat(szMailTo, pszSrc);
    187     strcat(szMailTo, szMailEnd);
     187    //strcat(szMailTo, szMailEnd);
    188188    pszSrc = szMailTo;
    189189    return pszSrc;
  • trunk/dll/notebook.c

    r898 r906  
    198198    PrfWriteProfileString(fmprof, appname, "DefArc", szDefArc);
    199199    {
    200       CHAR szBuf[CCHMAXPATH], buf[10] = "\"%-/";
     200      CHAR szBuf[CCHMAXPATH], *psz;
    201201
    202202      WinQueryDlgItemText(hwnd, CFGA_VIRUS, CCHMAXPATH, szBuf);
    203203      szBuf[CCHMAXPATH - 1] = 0;
     204      if (strcmp(szBuf, virus)){
     205        psz = CheckApp_QuoteAddExe(szBuf);
     206        memcpy(virus, psz, strlen(psz) + 1);
     207        if (!strchr(virus, '%') && strlen(virus) > 3)
     208          strcat(virus, " %p");
     209      }
     210      if (!*virus)
     211        strcpy(virus, "OS2SCAN.EXE %p /SUB /A");
     212      WinQueryDlgItemText(hwnd, CFGA_EXTRACTPATH, CCHMAXPATH, szBuf);
     213      szBuf[CCHMAXPATH - 1] = 0;
    204214      bstrip(szBuf);
    205       if (!strcspn(szBuf, buf))
    206         BldQuotedFileName(virus, szBuf);
    207       else
    208         memcpy(virus, szBuf, strlen(szBuf) + 1);
    209       if (!strchr(virus, '%') && strlen(virus) > 3)
    210         strcat(virus, " %p");
    211     }
    212     if (!*virus)
    213       strcpy(virus, "OS2SCAN.EXE %p /SUB /A");
    214     WinQueryDlgItemText(hwnd, CFGA_EXTRACTPATH, CCHMAXPATH, extractpath);
    215     extractpath[CCHMAXPATH - 1] = 0;
    216     bstrip(extractpath);
    217     if (*extractpath) {
    218       if (strcmp(extractpath, "*")) {
    219 
    220         MakeFullName(extractpath);
    221         if (IsFile(extractpath)) {
    222           ulResult = saymsg(MB_YESNOCANCEL | MB_ICONQUESTION | MB_DEFBUTTON1, HWND_DESKTOP,
    223                             GetPString(IDS_WARNINGTEXT),
    224                             GetPString(IDS_EXTPATHNOTVALIDTEXT),
    225                             extractpath);
    226           if (ulResult == MBID_YES)
    227             *extractpath = 0;
    228           if (ulResult == MBID_CANCEL){
    229             WinDlgBox(HWND_DESKTOP,
    230                       hwnd, CfgDlgProc,
    231                       FM3ModHandle, CFG_FRAME,
    232                       (PVOID) "Archive");
    233             break;
     215
     216      if (strcmp(extractpath, szBuf)) {
     217        memcpy(extractpath, szBuf, strlen(szBuf) + 1);
     218        if (*extractpath){
     219          MakeFullName(extractpath);
     220          if (IsFile(extractpath)) {
     221            ulResult = saymsg(MB_YESNOCANCEL | MB_ICONQUESTION | MB_DEFBUTTON1, HWND_DESKTOP,
     222                              GetPString(IDS_WARNINGTEXT),
     223                              GetPString(IDS_EXTPATHNOTVALIDTEXT),
     224                              extractpath);
     225            if (ulResult == MBID_YES)
     226              *extractpath = 0;
     227            if (ulResult == MBID_CANCEL){
     228              WinDlgBox(HWND_DESKTOP,
     229                        hwnd, CfgDlgProc,
     230                        FM3ModHandle, CFG_FRAME,
     231                        MPFROMP("Archive"));
     232              break;
     233            }
    234234          }
    235         }
     235        }
    236236      }
    237237    }
     
    239239    PrfWriteProfileString(fmprof, appname, "ExtractPath", extractpath);
    240240    break;
     241  }
     242  if (fCancelAction){
     243    fCancelAction = FALSE;
     244    WinDlgBox(HWND_DESKTOP,
     245              hwnd, CfgDlgProc, FM3ModHandle, CFG_FRAME, MPFROMP("Archive"));
    241246  }
    242247  return WinDefDlgProc(hwnd, msg, mp1, mp2);
     
    450455  case WM_CLOSE:
    451456    {
    452       CHAR szBuf[CCHMAXPATH], buf[10] = "\"%-/";
     457      CHAR szBuf[CCHMAXPATH], *psz;
    453458
    454459      WinQueryDlgItemText(hwnd, CFGV_VIEWER, CCHMAXPATH, szBuf);
    455460      szBuf[CCHMAXPATH - 1] = 0;
    456       bstrip(szBuf);
    457       if (!strcspn(szBuf, buf))
    458         BldQuotedFileName(viewer, szBuf);
    459       else
    460         memcpy(viewer, szBuf, strlen(szBuf) + 1);
    461       if (!strchr(viewer, '%') && strlen(viewer) > 3)
    462         strcat(viewer, " %a");
     461      if (strcmp(szBuf, viewer)){
     462        psz = CheckApp_QuoteAddExe(szBuf);
     463        memcpy(viewer, psz, strlen(psz) + 1);
     464        if (!strchr(viewer, '%') && strlen(viewer) > 3)
     465          strcat(viewer, " %a");
     466      }
    463467      WinQueryDlgItemText(hwnd, CFGV_EDITOR, CCHMAXPATH, szBuf);
    464468      szBuf[CCHMAXPATH - 1] = 0;
    465       bstrip(szBuf);
    466       if (!strcspn(szBuf, buf))
    467         BldQuotedFileName(editor, szBuf);
    468       else
    469         memcpy(editor, szBuf, strlen(szBuf) + 1);
    470       if (!strchr(editor, '%') && strlen(editor) > 3)
    471         strcat(editor, " %a");
     469      if (strcmp(szBuf, editor)){
     470        psz = CheckApp_QuoteAddExe(szBuf);
     471        memcpy(editor, psz, strlen(psz) + 1);
     472        if (!strchr(editor, '%') && strlen(editor) > 3)
     473          strcat(editor, " %a");
     474      }
    472475      WinQueryDlgItemText(hwnd, CFGV_BINVIEW, CCHMAXPATH, szBuf);
    473476      szBuf[CCHMAXPATH - 1] = 0;
    474       bstrip(szBuf);
    475       if (!strcspn(szBuf, buf))
    476         BldQuotedFileName(binview, szBuf);
    477       else
    478         memcpy(binview, szBuf, strlen(szBuf) + 1);
    479       if (!strchr(binview, '%') && strlen(binview) > 3)
    480         strcat(binview, " %a");
     477      if (strcmp(szBuf, binview)){
     478        psz = CheckApp_QuoteAddExe(szBuf);
     479        memcpy(binview, psz, strlen(psz) + 1);
     480        if (!strchr(binview, '%') && strlen(binview) > 3)
     481          strcat(binview, " %a");
     482      }
    481483      WinQueryDlgItemText(hwnd, CFGV_BINED, CCHMAXPATH, szBuf);
    482484      szBuf[CCHMAXPATH - 1] = 0;
    483       bstrip(szBuf);
    484       if (!strcspn(szBuf, buf))
    485         BldQuotedFileName(bined, szBuf);
    486       else
    487         memcpy(bined, szBuf, strlen(szBuf) + 1);
    488       if (!strchr(bined, '%') && strlen(bined) > 3)
    489         strcat(bined, " %a");
    490       else
    491         memcpy(bined, szBuf, strlen(szBuf) + 1);
     485      if (strcmp(szBuf, bined)){
     486        psz = CheckApp_QuoteAddExe(szBuf);
     487        memcpy(bined, psz, strlen(psz) + 1);
     488        if (!strchr(bined, '%') && strlen(bined) > 3)
     489          strcat(bined, " %a");
     490      }
    492491      PrfWriteProfileString(fmprof, appname, "Viewer", viewer);
    493492      PrfWriteProfileString(fmprof, appname, "Editor", editor);
     
    508507      break;
    509508    }
     509  }
     510  if (fCancelAction){
     511    fCancelAction = FALSE;
     512    WinDlgBox(HWND_DESKTOP,
     513              hwnd, CfgDlgProc, FM3ModHandle, CFG_FRAME, MPFROMP("Viewer1"));
    510514  }
    511515  return WinDefDlgProc(hwnd, msg, mp1, mp2);
     
    637641
    638642  case WM_CLOSE:
    639     {
    640       CHAR szBuf[CCHMAXPATH], buf[10] = "\"%-/";
     643    { // fixme these strings can be longer than CCHMAXPATH since
     644      // they contain args.
     645      CHAR szBuf[CCHMAXPATH], *psz;
    641646
    642647      WinQueryDlgItemText(hwnd, CFGH_RUNHTTPWORKDIR, CCHMAXPATH, szBuf);
    643648      szBuf[CCHMAXPATH - 1] = 0;
    644649      bstrip(szBuf);
    645       if (!strcspn(szBuf, buf))
    646         BldQuotedFileName(httprundir, szBuf);
    647       else
    648         memcpy(httprundir, szBuf, strlen(szBuf) + 1);
     650      memcpy(httprundir, szBuf, strlen(szBuf) + 1);
    649651      WinQueryDlgItemText(hwnd, CFGH_RUNFTPWORKDIR, CCHMAXPATH, szBuf);
    650652      szBuf[CCHMAXPATH - 1] = 0;
    651653      bstrip(szBuf);
    652       if (!strcspn(szBuf, buf))
    653         BldQuotedFileName(ftprundir, szBuf);
    654       else
    655         memcpy(ftprundir, szBuf, strlen(szBuf) + 1);
     654      memcpy(ftprundir, szBuf, strlen(szBuf) + 1);
    656655      WinQueryDlgItemText(hwnd, CFGH_RUNMAILWORKDIR, CCHMAXPATH, szBuf);
    657656      szBuf[CCHMAXPATH - 1] = 0;
    658657      bstrip(szBuf);
    659       if (!strcspn(szBuf, buf))
    660         BldQuotedFileName(mailrundir, szBuf);
    661       else
    662         memcpy(mailrundir, szBuf, strlen(szBuf) + 1);
     658      memcpy(mailrundir, szBuf, strlen(szBuf) + 1);
    663659      WinQueryDlgItemText(hwnd, CFGH_FTPRUN, CCHMAXPATH, szBuf);
    664660      szBuf[CCHMAXPATH - 1] = 0;
    665       bstrip(szBuf);
    666       if (!strchr(szBuf, '"'))
    667         BldQuotedFileName(ftprun, szBuf);
    668       else
    669         memcpy(ftprun, szBuf, strlen(szBuf) + 1);
     661      if (strcmp(szBuf, ftprun)){
     662        psz = CheckApp_QuoteAddExe(szBuf);
     663        memcpy(ftprun, psz, strlen(psz) + 1);
     664      }
    670665      WinQueryDlgItemText(hwnd, CFGH_HTTPRUN, CCHMAXPATH, szBuf);
    671666      szBuf[CCHMAXPATH - 1] = 0;
    672       bstrip(szBuf);
    673       if (!strchr(szBuf, '"'))
    674         BldQuotedFileName(httprun, szBuf);
    675       else
    676         memcpy(httprun, szBuf, strlen(szBuf) + 1);
     667      if (strcmp(szBuf, httprun)){
     668        psz = CheckApp_QuoteAddExe(szBuf);
     669        memcpy(httprun, psz, strlen(psz) + 1);
     670      }
    677671      WinQueryDlgItemText(hwnd, CFGH_MAILRUN, CCHMAXPATH, szBuf);
    678672      szBuf[CCHMAXPATH - 1] = 0;
    679       bstrip(szBuf);
    680       if (!strcspn(szBuf, buf))
    681         BldQuotedFileName(mailrun, szBuf);
    682       else
    683         memcpy(mailrun, szBuf, strlen(szBuf) + 1);
     673      if (strcmp(szBuf, mailrun)){
     674        psz = CheckApp_QuoteAddExe(szBuf);
     675        memcpy(mailrun, psz, strlen(psz) + 1);
     676      }
    684677      PrfWriteProfileString(fmprof, appname, "HttpRunDir", httprundir);
    685678      PrfWriteProfileString(fmprof, appname, "FtpRunDir", ftprundir);
     
    708701      break;
    709702    }
     703  }
     704  if (fCancelAction){
     705    fCancelAction = FALSE;
     706    WinDlgBox(HWND_DESKTOP,
     707              hwnd, CfgDlgProc, FM3ModHandle, CFG_FRAME, MPFROMP("Viewer2"));
    710708  }
    711709  return WinDefDlgProc(hwnd, msg, mp1, mp2);
     
    12491247  case WM_CLOSE:
    12501248    {
    1251       CHAR szBuf[CCHMAXPATH], buf[10] = "\"%-/";
     1249      CHAR szBuf[CCHMAXPATH], *psz;
    12521250
    12531251      WinQueryDlgItemText(hwnd, CFGC_DIRCOMPARE, CCHMAXPATH, szBuf);
    12541252        szBuf[CCHMAXPATH - 1] = 0;
    1255         bstrip(szBuf);
    1256         if (!strcspn(szBuf, buf))
    1257           BldQuotedFileName(dircompare, szBuf);
    1258         else
    1259           memcpy(dircompare, szBuf, strlen(szBuf) + 1);
    1260         if (!strchr(dircompare, '%') && strlen(dircompare) > 3)
    1261           strcat(dircompare, " %a");
     1253        if (strcmp(szBuf, dircompare)){
     1254          psz = CheckApp_QuoteAddExe(szBuf);
     1255          memcpy(dircompare, psz, strlen(psz) + 1);
     1256          if (!strchr(dircompare, '%') && strlen(dircompare) > 3)
     1257            strcat(dircompare, " %a");
     1258        }
    12621259      PrfWriteProfileString(fmprof, appname, "DirCompare", dircompare);
    12631260      WinQueryDlgItemText(hwnd, CFGC_COMPARE, CCHMAXPATH, szBuf);
    12641261        szBuf[CCHMAXPATH - 1] = 0;
    1265         bstrip(szBuf);
    1266         if (!strcspn(szBuf, buf))
    1267           BldQuotedFileName(compare, szBuf);
    1268         else
    1269           memcpy(compare, szBuf, strlen(szBuf) + 1);
    1270         if (!strchr(compare, '%') && strlen(compare) > 3)
    1271           strcat(compare, " %a");
     1262        if (strcmp(szBuf, compare)){
     1263          psz = CheckApp_QuoteAddExe(szBuf);
     1264          memcpy(compare, psz, strlen(psz) + 1);
     1265          if (!strchr(compare, '%') && strlen(compare) > 3)
     1266            strcat(compare, " %a");
     1267        }
    12721268      PrfWriteProfileString(fmprof, appname, "Compare", compare);
    12731269      break;
    12741270    }
     1271  }
     1272  if (fCancelAction){
     1273    fCancelAction = FALSE;
     1274    WinDlgBox(HWND_DESKTOP,
     1275              hwnd, CfgDlgProc, FM3ModHandle, CFG_FRAME, MPFROMP("Compare"));
    12751276  }
    12761277  return WinDefDlgProc(hwnd, msg, mp1, mp2);
     
    31113112      }
    31123113    }
     3114    if (mp2 && !strcmp((CHAR *) mp2, "Viewer2"))
     3115      PostMsg(WinWindowFromID(hwnd, CFG_NOTEBOOK),
     3116              BKM_TURNTOPAGE, MPFROMLONG(np[9].pageID), MPVOID);
     3117    else if (mp2 && !strcmp((CHAR *) mp2, "Viewer1"))
     3118           PostMsg(WinWindowFromID(hwnd, CFG_NOTEBOOK),
     3119                   BKM_TURNTOPAGE, MPFROMLONG(np[8].pageID), MPVOID);
     3120    else if (mp2 && !strcmp((CHAR *) mp2, "Compare"))
     3121           PostMsg(WinWindowFromID(hwnd, CFG_NOTEBOOK),
     3122                   BKM_TURNTOPAGE, MPFROMLONG(np[10].pageID), MPVOID);
     3123    else if (mp2 && !strcmp((CHAR *) mp2, "Archive"))
     3124           PostMsg(WinWindowFromID(hwnd, CFG_NOTEBOOK),
     3125                   BKM_TURNTOPAGE, MPFROMLONG(np[5].pageID), MPVOID);
     3126    else if (mp2 && !strcmp((CHAR *) mp2, "Tree"))
     3127           PostMsg(WinWindowFromID(hwnd, CFG_NOTEBOOK),
     3128                   BKM_TURNTOPAGE, MPFROMLONG(np[6].pageID), MPVOID);
     3129    else if (mp2 && !strcmp((CHAR *) mp2, "Collector"))
     3130           PostMsg(WinWindowFromID(hwnd, CFG_NOTEBOOK),
     3131                   BKM_TURNTOPAGE, MPFROMLONG(np[3].pageID), MPVOID);
    31133132    /* see if we've been asked to display quick cfg page */
    3114     if (!mp2 ||
    3115         strcmp((CHAR *) mp2, "First Time") ||
    3116         !x || !np[x - 1].hwnd || !np[x - 1].pageID) {
    3117       PostMsg(WinWindowFromID(hwnd, CFG_NOTEBOOK),
    3118               BKM_TURNTOPAGE, MPFROMLONG(np[0].pageID), MPVOID);
    3119     }
     3133    else if (!mp2 || strcmp((CHAR *) mp2, "First Time") ||
     3134             !x || !np[x - 1].hwnd || !np[x - 1].pageID)
     3135           PostMsg(WinWindowFromID(hwnd, CFG_NOTEBOOK),
     3136                   BKM_TURNTOPAGE, MPFROMLONG(np[0].pageID), MPVOID);
    31203137    else {
    31213138      PostMsg(MainObjectHwnd, UM_SETDIR, MPFROMLONG(1L), MPVOID);
    31223139      PostMsg(WinWindowFromID(hwnd, CFG_NOTEBOOK),
    3123               BKM_TURNTOPAGE, MPFROMLONG(np[x - 1].pageID), MPVOID);
     3140              BKM_TURNTOPAGE, MPFROMLONG(np[x - 1].pageID), MPVOID);
    31243141      PostMsg(hwnd, UM_FOCUSME, MPFROMLONG(np[x - 1].hwnd), MPVOID);
    31253142      PostMsg(np[x - 1].hwnd, WM_COMMAND, MPFROM2SHORT(IDM_HELP, 0), MPVOID);
    31263143    }
    3127     break;
     3144
     3145  break;
    31283146
    31293147  case UM_FOCUSME:
  • trunk/dll/strips.c

    r895 r906  
    8181}
    8282
     83VOID remove_last_occurence_of_character(char *pszRemoveChar, char *pszSrc)
     84{
     85  PSZ pszStrLocation;
     86
     87  pszStrLocation = strrchr(pszSrc, *pszRemoveChar);
     88  if (pszStrLocation)
     89    memmove(pszStrLocation, pszStrLocation + 1, strlen(pszStrLocation) + 1);
     90}
     91
    8392#pragma alloc_text(MISC8,chop_at_crnl,convert_nl_to_nul,strip_trail_char,strip_lead_char)
  • trunk/dll/systemf.c

    r893 r906  
    636636  BOOL useTermQ = FALSE;
    637637  char szTempdir[CCHMAXPATH];
    638   //char szTempPgm[CCHMAXPATH], tempcom[2048], temparg[2048], buf[10] = " &|<>";
    639   //char *offset, *offsetexe, *offsetcom, *offsetcmd, *offsetbtm, *offsetbat;
    640   //UINT offsetquote;
    641638
    642639  typedef struct {
     
    685682           parguments);
    686683  va_end(parguments);
    687   /*offsetexe = strstr(strlwr(pszPgm), ".exe");
    688   offsetcmd = strstr(strlwr(pszPgm), ".cmd");
    689   offsetcom = strstr(strlwr(pszPgm), ".com");
    690   offsetbtm = strstr(strlwr(pszPgm), ".btm");
    691   offsetbat = strstr(strlwr(pszPgm), ".bat");
    692   if (offsetexe)
    693     offset = offsetexe;
    694   else if (offsetcom)
    695     offset = offsetcom;
    696   else if (offsetcmd)
    697     offset = offsetcmd;
    698   else if (offsetbtm)
    699     offset = offsetbtm;
    700   else if (offsetbat)
    701     offset = offsetbat;
    702   else {
    703     offset = pszPgm;
    704   }
    705   offsetquote = strcspn(pszPgm, buf);
    706   if (pszPgm[0] != '\"' && offsetquote < offset - pszPgm && offsetquote != NULL){
    707     strcpy(tempcom, pszPgm);
    708     tempcom[offset + 4 - pszPgm] = '\0';
    709     strcpy (temparg, &pszPgm[offset + 4 - pszPgm]);
    710     pszDirectory = szTempdir;
    711     strcpy(pszDirectory, tempcom);
    712     offset = strrchr(pszDirectory, '\\');
    713     pszDirectory[offset +1 - pszDirectory] = '\0';
    714     BldQuotedFileName(szTempPgm, tempcom);
    715     strcat(szTempPgm, temparg);
    716     memcpy(pszPgm, szTempPgm, 2048);
    717     //printf("%s\n %s\n%s %s\n %d %d",
    718     //       pszPgm, szTempPgm, tempcom, temparg, offset, offsetquote); fflush(stdout);
    719   } */
     684
    720685  if (pszEnvironment) {
    721686    p = &pszEnvironment[strlen(pszEnvironment)] + 1;
     
    13431308}
    13441309
     1310PSZ CheckApp_QuoteAddExe(PSZ pszPgm)
     1311{
     1312  char szTempPgm[CCHMAXPATH], tempcom[CCHMAXPATH], temparg[CCHMAXPATH];
     1313  char *offset, *offsetexe, *offsetcom, *offsetcmd, *offsetbtm, *offsetbat;
     1314  APIRET ret;
     1315  ULONG ulAppType;
     1316  char *pszChar;
     1317  FILEFINDBUF3 FindBuffer;
     1318  ULONG ulResultBufLen = sizeof(FILEFINDBUF3);
     1319  HDIR hdirFindHandle = HDIR_CREATE;
     1320  ULONG ulFindCount = 1;
     1321  PSZ pszQuotedCompletePgm;
     1322
     1323  bstrip(pszPgm);
     1324  strcpy(tempcom, pszPgm);
     1325  if (tempcom[0] != '\0'){
     1326    offsetexe = strstr(strlwr(pszPgm), ".exe");
     1327    offsetcmd = strstr(strlwr(pszPgm), ".cmd");
     1328    offsetcom = strstr(strlwr(pszPgm), ".com");
     1329    offsetbtm = strstr(strlwr(pszPgm), ".btm");
     1330    offsetbat = strstr(strlwr(pszPgm), ".bat");
     1331    if (offsetbat){
     1332      if (strstr(strlwr(pszPgm), "command ") < offsetbat)
     1333        offset = pszPgm;
     1334      else
     1335        offset = offsetbat;
     1336    }
     1337    else if (offsetbtm){
     1338      if (strstr(strlwr(pszPgm), "4os2 ") < offsetbtm)
     1339        offset = pszPgm;
     1340      else
     1341        offset = offsetbtm;
     1342    }
     1343    else if (offsetcmd){
     1344      if (strstr(strlwr(pszPgm), "cmd ") < offsetcmd ||
     1345          strstr(strlwr(pszPgm), "4os2 ") < offsetcmd)
     1346        offset = pszPgm;
     1347      else
     1348        offset = offsetcmd;
     1349    }
     1350    else if (offsetcom)
     1351      offset = offsetcom;
     1352    else if (offsetexe)
     1353      offset = offsetexe;
     1354    else {
     1355      offset = pszPgm;
     1356    }
     1357    if (offset - pszPgm != 0){
     1358      tempcom[offset + 4 - pszPgm] = '\0';
     1359      strcpy(temparg, &pszPgm[offset + 4 - pszPgm]);
     1360      /*if ((offsetexe  && !offsetcom && !offsetcmd && !offsetbtm && !offsetbat) ||
     1361          (offsetcom  && !offsetexe && !offsetcmd && !offsetbtm && !offsetbat) ||
     1362          (offsetcmd  && !offsetexe && !offsetcom && !offsetbtm && !offsetbat) ||
     1363          (offsetbtm  && !offsetexe && !offsetcom && !offsetcmd && !offsetbat) ||
     1364          (offsetbat  && !offsetexe && !offsetcom && !offsetcmd && !offsetbtm))*/
     1365      remove_first_occurence_of_character("\"", tempcom);
     1366      if (strchr(tempcom, '\"') != strrchr(tempcom, '\"'))
     1367        saymsg(MB_OK, HWND_DESKTOP,
     1368               NullStr,
     1369               GetPString(IDS_QUOTESINARGSTEXT),
     1370               pszPgm);
     1371      else
     1372        remove_first_occurence_of_character("\"", tempcom);
     1373      if ((temparg[0] == '\"' && temparg[1] == ' ') ||
     1374           !strstr(pszPgm, "\\:")||
     1375           strchr(temparg, '\"') == strrchr(temparg, '\"'))
     1376        remove_first_occurence_of_character("\"", temparg);
     1377      if (strchr(temparg, '\"') != strrchr(temparg, '\"'))
     1378        saymsg(MB_OK, HWND_DESKTOP,
     1379               NullStr,
     1380               GetPString(IDS_QUOTESINARGSTEXT),
     1381               pszPgm);
     1382      if (!strstr(strlwr(tempcom), ".exe")) {
     1383        ret = DosFindFirst(tempcom, &hdirFindHandle, FILE_NORMAL, &FindBuffer,
     1384                           ulResultBufLen, &ulFindCount, FIL_STANDARD);
     1385        BldQuotedFileName(szTempPgm, tempcom);
     1386      }
     1387      else{
     1388        BldQuotedFileName(szTempPgm, tempcom);
     1389        ret = DosQueryAppType(tempcom, &ulAppType);
     1390      }
     1391      //printf("%d A", ret); fflush(stdout);
     1392      if (ret) {
     1393        ret = saymsg(MB_YESNO,
     1394                     HWND_DESKTOP,
     1395                     NullStr,
     1396                     GetPString(IDS_PROGRAMNOTFOUNDTEXT),
     1397                     pszPgm);
     1398        if (ret == MBID_YES){
     1399          if (temparg[0] != ' ')
     1400            strcat(szTempPgm, " ");
     1401          strcat(szTempPgm, temparg);
     1402          pszQuotedCompletePgm = szTempPgm;
     1403        }
     1404        else{
     1405          fCancelAction = TRUE;
     1406          pszQuotedCompletePgm = pszPgm;
     1407        }
     1408      }
     1409      else{
     1410        if (temparg[0] != ' ')
     1411          strcat(szTempPgm, " ");
     1412        strcat(szTempPgm, temparg);
     1413        pszQuotedCompletePgm = szTempPgm;
     1414      }
     1415
     1416    }
     1417    else if (tempcom && (!strchr(tempcom, '.') ||
     1418                         strrchr(tempcom, '.' ) < strrchr(tempcom, '\\'))){
     1419      if (!strchr(tempcom, ' ')){
     1420        while (strchr(tempcom, '\"'))
     1421          remove_first_occurence_of_character("\"", tempcom);
     1422        strcat(tempcom, ".exe");
     1423        ret = DosFindFirst(tempcom, &hdirFindHandle, FILE_NORMAL, &FindBuffer,
     1424                           ulResultBufLen, &ulFindCount, FIL_STANDARD);
     1425        //printf("%d", ret); fflush(stdout);
     1426      }
     1427      else{
     1428        pszChar = tempcom;
     1429        while (pszChar){
     1430          while (strchr(tempcom, '\"'))
     1431            remove_first_occurence_of_character("\"", tempcom);
     1432          if (*pszChar == ' '){
     1433            *pszChar = '\0';
     1434            strcat(tempcom, ".exe");
     1435            ret = DosQueryAppType(tempcom, &ulAppType);
     1436            //printf("%d %s\n", ret, tempcom); fflush(stdout);
     1437            if (!ret){
     1438              break;
     1439            }
     1440          }
     1441          strcpy(tempcom, pszPgm);
     1442          pszChar++;
     1443        }
     1444      }
     1445      if (!ret){
     1446        BldQuotedFileName(szTempPgm, tempcom);
     1447        strcpy(temparg, pszPgm + strlen(tempcom) - 3);
     1448        if ((temparg[0] == '\"' && temparg[1] == ' ') ||
     1449             !strstr(pszPgm, "\\:" ) ||
     1450             strchr(temparg, '\"') == strrchr(temparg, '\"'))
     1451          remove_first_occurence_of_character("\"", temparg);
     1452        if (strchr(temparg, '\"') != strrchr(temparg, '\"'))
     1453          saymsg(MB_OK, HWND_DESKTOP,
     1454                 NullStr,
     1455                 GetPString(IDS_QUOTESINARGSTEXT),
     1456                 pszPgm);
     1457        if (temparg[0] != ' ')
     1458          strcat(szTempPgm, " ");
     1459        strcat(szTempPgm, temparg);
     1460        pszQuotedCompletePgm = szTempPgm;
     1461      }
     1462      else {
     1463        ret = saymsg(MB_OK,
     1464                     HWND_DESKTOP,
     1465                     NullStr,
     1466                     GetPString(IDS_PROGRAMNOTEXE2TEXT),
     1467                     pszPgm);
     1468          fCancelAction = TRUE;
     1469          pszQuotedCompletePgm = pszPgm;
     1470      }
     1471    }
     1472    else {
     1473      pszChar = strrchr(tempcom, '.');
     1474      while (pszChar && *pszChar !=' '){
     1475        pszChar++;
     1476      }
     1477      *pszChar = '\0';
     1478      strcpy (temparg, pszPgm + strlen(tempcom));
     1479      while (strchr(tempcom, '\"'))
     1480        remove_first_occurence_of_character("\"", tempcom);
     1481    if ((temparg[0] == '\"' && temparg[1] == ' ') ||
     1482         !strstr(pszPgm, "\\:")||
     1483         strchr(temparg, '\"') == strrchr(temparg, '\"'))
     1484      remove_first_occurence_of_character("\"", temparg);
     1485    if (strchr(temparg, '\"') != strrchr(temparg, '\"'))
     1486      saymsg(MB_OK, HWND_DESKTOP,
     1487             NullStr,
     1488             GetPString(IDS_QUOTESINARGSTEXT),
     1489             pszPgm);
     1490    ret = DosFindFirst(tempcom, &hdirFindHandle, FILE_NORMAL, &FindBuffer,
     1491                         ulResultBufLen, &ulFindCount, FIL_STANDARD);
     1492
     1493    BldQuotedFileName(szTempPgm, tempcom);
     1494    //printf("%d %s ", ret, tempcom); fflush(stdout);
     1495    if (ret) {
     1496      ret = saymsg(MB_YESNO,
     1497                   HWND_DESKTOP,
     1498                   NullStr,
     1499                   GetPString(IDS_PROGRAMNOTFOUNDTEXT),
     1500                   pszPgm);
     1501      if (ret == MBID_YES){
     1502        if (temparg[0] != ' ')
     1503          strcat(szTempPgm, " ");
     1504        strcat(szTempPgm, temparg);
     1505        pszQuotedCompletePgm = szTempPgm;
     1506      }
     1507      else{
     1508        fCancelAction = TRUE;
     1509        pszQuotedCompletePgm = pszPgm;
     1510      }
     1511    }
     1512    ret = saymsg(MB_YESNO,
     1513                   HWND_DESKTOP,
     1514                   NullStr,
     1515                   GetPString(IDS_PROGRAMNOTEXE3TEXT),
     1516                   pszPgm);
     1517      if (ret == MBID_YES){
     1518        if (temparg[0] != ' ')
     1519          strcat(szTempPgm, " ");
     1520        strcat(szTempPgm, temparg);
     1521        pszQuotedCompletePgm = szTempPgm;
     1522      }
     1523      else{
     1524        fCancelAction = TRUE;
     1525        pszQuotedCompletePgm = pszPgm;
     1526      }
     1527    }
     1528    return pszQuotedCompletePgm;
     1529  }
     1530  return pszPgm;
     1531}
     1532
    13451533#pragma alloc_text(SYSTEMF,ShowSession,ExecOnList,runemf2)
  • trunk/dll/treecnr.c

    r888 r906  
    23732373
    23742374      case IDM_NOTEBOOK:
    2375         if (!ParentIsDesktop(dcd->hwndParent, dcd->hwndParent))
    2376           PostMsg(dcd->hwndParent, msg, mp1, mp2);
    2377         else
     2375        //if (!ParentIsDesktop(dcd->hwndParent, dcd->hwndParent))
     2376        //  PostMsg(dcd->hwndParent, msg, mp1, mp2);
     2377        //else
    23782378          WinDlgBox(HWND_DESKTOP, hwnd, CfgDlgProc, FM3ModHandle,
    2379                     CFG_FRAME, (PVOID) "Tree");
     2379                    CFG_FRAME, MPFROMP("Tree"));
    23802380        break;
    23812381
Note: See TracChangeset for help on using the changeset viewer.