Changeset 1157 for trunk/dll/grep.c


Ignore:
Timestamp:
Sep 5, 2008, 11:39:52 PM (17 years ago)
Author:
John Small
Message:

Ticket 187: Draft 1: Functions only

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/grep.c

    r1063 r1157  
    4444#include "fm3str.h"
    4545#include "grep.h"
    46 #include "pathutil.h"                   // BldFullPathName
    47 #include "filldir.h"                    // FillInRecordFromFFB
    48 #include "makelist.h"                   // AddToList
    49 #include "errutil.h"                    // Dos_Error...
    50 #include "strutil.h"                    // GetPString
    51 #include "tmrsvcs.h"                    // ITIMER_DESC
     46#include "pathutil.h"                   // BldFullPathName
     47#include "filldir.h"                    // FillInRecordFromFFB
     48#include "makelist.h"                   // AddToList
     49#include "errutil.h"                    // Dos_Error...
     50#include "strutil.h"                    // GetPString
     51#include "tmrsvcs.h"                    // ITIMER_DESC
    5252#include "fm3dll.h"
     53#include "eas.h"                        // Free_FEAList
    5354#include "fortify.h"
    5455
     
    5859
    5960static VOID DoAllSubdirs(GREP *grep,
    60                         CHAR *searchPath,
    61                         BOOL recursing,
    62                         char **fle,
    63                         UINT numfls,
    64                         ITIMER_DESC *pitdSleep,
    65                         ITIMER_DESC *pitdReport);
     61                        CHAR *searchPath,
     62                        BOOL recursing,
     63                        char **fle,
     64                        UINT numfls,
     65                        ITIMER_DESC *pitdSleep,
     66                        ITIMER_DESC *pitdReport);
    6667static INT DoMatchingFiles(GREP *grep,
    67                            CHAR *path,
    68                            CHAR **fle,
    69                            UINT numfls,
    70                            ITIMER_DESC *pitdSleep,
    71                            ITIMER_DESC *pitdReport);
     68                           CHAR *path,
     69                           CHAR **fle,
     70                           UINT numfls,
     71                           ITIMER_DESC *pitdSleep,
     72                           ITIMER_DESC *pitdReport);
    7273static BOOL DoOneFile(GREP *grep,
    73                       CHAR *fileName,
    74                       FILEFINDBUF4L *pffb,
    75                       ITIMER_DESC *pitdSleep,
    76                       ITIMER_DESC *pitdReport);
     74                      CHAR *fileName,
     75                      FILEFINDBUF4L *pffb,
     76                      ITIMER_DESC *pitdSleep,
     77                      ITIMER_DESC *pitdReport);
    7778static BOOL DoInsertion(GREP *grep,
    78                         ITIMER_DESC *pitdSleep,
    79                         ITIMER_DESC *pitdReport);
     79                        ITIMER_DESC *pitdSleep,
     80                        ITIMER_DESC *pitdReport);
    8081static BOOL InsertDupe(GREP *grep, CHAR *dir, FILEFINDBUF4L *pffb);
    8182static VOID FillDupes(GREP *grep,
    82                       ITIMER_DESC *pitdSleep,
    83                       ITIMER_DESC *pitdReport);
     83                      ITIMER_DESC *pitdSleep,
     84                      ITIMER_DESC *pitdReport);
    8485
    8586static VOID FreeDupes(GREP *grep);
     
    8889
    8990#define isleap(year) ((((year%4)==0) && ((year%100)!=0)) || \
    90         ((year%400)==0))
     91        ((year%400)==0))
    9192
    9293static INT monthdays[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
     
    122123
    123124static BOOL m_match(CHAR *string, CHAR *pattern, BOOL absolute, BOOL ignore,
    124                     LONG len)
     125                    LONG len)
    125126{
    126127  // return TRUE if pattern found in string
     
    131132
    132133  if (len && string && pattern) {
    133     if (absolute)                       // no pattern matching
     134    if (absolute)                       // no pattern matching
    134135      return (findstring(pattern, strlen(pattern), string, len,
    135                         (ignore == FALSE)) != NULL);
     136                        (ignore == FALSE)) != NULL);
    136137
    137138    while (*tn && len2 < len) {
    138139      switch (*tn) {
    139140      case ' ':
    140         while (*tn == ' ')
    141           tn++;
    142         while (len2 < len && isspace(string[len2]))
    143           len2++;
    144         break;
     141        while (*tn == ' ')
     142          tn++;
     143        while (len2 < len && isspace(string[len2]))
     144          len2++;
     145        break;
    145146
    146147      case '*':
    147         while (*tn == '*' || *tn == '?')
    148           tn++;
    149         if (!*tn)
    150           return TRUE;
    151         if (ignore) {
    152           while (len2 < len && string[len2] != *tn)
    153             len2++;
    154         }
    155         else {
    156           while (len2 < len && toupper(string[len2] != *tn))
    157             len2++;
    158         }
    159         break;
     148        while (*tn == '*' || *tn == '?')
     149          tn++;
     150        if (!*tn)
     151          return TRUE;
     152        if (ignore) {
     153          while (len2 < len && string[len2] != *tn)
     154            len2++;
     155        }
     156        else {
     157          while (len2 < len && toupper(string[len2] != *tn))
     158            len2++;
     159        }
     160        break;
    160161
    161162      case '[':
    162         tn++;
    163         if (!*tn)
    164           return FALSE;
    165         lo = *tn;
    166         tn++;
    167         if (*tn != '-')
    168           return FALSE;
    169         tn++;
    170         if (!*tn)
    171           return FALSE;
    172         hi = *tn;
    173         tn++;
    174         if (*tn != ']')
    175           return FALSE;
    176         tn++;
    177         if (ignore) {
    178           if ((toupper(string[len2]) >= toupper(lo)) &&
    179               (toupper(string[len2]) <= toupper(hi)))
    180             len2++;
    181           else {
    182             tn = pattern;
    183             len2 = lastlen = lastlen + 1;
    184           }
    185         }
    186         else {
    187           if ((string[len2] >= lo) && (string[len2] <= hi))
    188             len2++;
    189           else {
    190             tn = pattern;
    191             len2 = lastlen = lastlen + 1;
    192           }
    193         }
    194         break;
     163        tn++;
     164        if (!*tn)
     165          return FALSE;
     166        lo = *tn;
     167        tn++;
     168        if (*tn != '-')
     169          return FALSE;
     170        tn++;
     171        if (!*tn)
     172          return FALSE;
     173        hi = *tn;
     174        tn++;
     175        if (*tn != ']')
     176          return FALSE;
     177        tn++;
     178        if (ignore) {
     179          if ((toupper(string[len2]) >= toupper(lo)) &&
     180              (toupper(string[len2]) <= toupper(hi)))
     181            len2++;
     182          else {
     183            tn = pattern;
     184            len2 = lastlen = lastlen + 1;
     185          }
     186        }
     187        else {
     188          if ((string[len2] >= lo) && (string[len2] <= hi))
     189            len2++;
     190          else {
     191            tn = pattern;
     192            len2 = lastlen = lastlen + 1;
     193          }
     194        }
     195        break;
    195196
    196197      case '?':
    197         tn++;
    198         len2++;
    199         break;
     198        tn++;
     199        len2++;
     200        break;
    200201
    201202      case '\\':
    202         tn++;
    203         if (!*tn)
    204           return FALSE;
    205         // else intentional fallthru
     203        tn++;
     204        if (!*tn)
     205          return FALSE;
     206        // else intentional fallthru
    206207      default:
    207         if (ignore) {
    208           if (toupper(*tn) == toupper(string[len2])) {
    209             tn++;
    210             len2++;
    211           }
    212           else {
    213             tn = pattern;
    214             len2 = lastlen = lastlen + 1;
    215           }
    216         }
    217         else {
    218           if (*tn == string[len2]) {
    219             tn++;
    220             len2++;
    221           }
    222           else {
    223             tn = pattern;
    224             len2 = lastlen = lastlen + 1;
    225           }
    226         }
    227         break;
     208        if (ignore) {
     209          if (toupper(*tn) == toupper(string[len2])) {
     210            tn++;
     211            len2++;
     212          }
     213          else {
     214            tn = pattern;
     215            len2 = lastlen = lastlen + 1;
     216          }
     217        }
     218        else {
     219          if (*tn == string[len2]) {
     220            tn++;
     221            len2++;
     222          }
     223          else {
     224            tn = pattern;
     225            len2 = lastlen = lastlen + 1;
     226          }
     227        }
     228        break;
    228229      }
    229230    }
     
    238239
    239240static BOOL match(CHAR *string, CHAR *patterns, BOOL absolute, BOOL ignore,
    240                   LONG len, ULONG numlines, CHAR *matched, BOOL matchall)
     241                  LONG len, ULONG numlines, CHAR *matched, BOOL matchall)
    241242{
    242243  BOOL ret = FALSE;
     
    251252    if (matched && ret && x < numlines)
    252253      matched[x] = 1;
    253     p += strlen(p);                     // check each pattern in 0-terminated list
     254    p += strlen(p);                     // check each pattern in 0-terminated list
    254255    p++;
    255256    x++;
     
    265266  UINT x;
    266267  UINT numfls;
    267   static CHAR *fle[512];                // 06 Feb 08 SHL fixme to not be static
     268  static CHAR *fle[512];                // 06 Feb 08 SHL fixme to not be static
    268269  CHAR *p, *pp, searchPath[CCHMAXPATH * 2];
    269270
    270   ITIMER_DESC itdSleep = { 0 };         // 06 Feb 08 SHL
     271  ITIMER_DESC itdSleep = { 0 };         // 06 Feb 08 SHL
    271272  ITIMER_DESC itdReport = { 0 };
    272273
     
    280281#  endif
    281282  grep = *(GREP *)arg;
    282   *grep.stopflag = 0;                   // reset thread-killing flag
     283  *grep.stopflag = 0;                   // reset thread-killing flag
    283284  DosError(FERR_DISABLEHARDERR);
    284285  priority_normal();
     
    291292      WinCancelShutdown(ghmq, TRUE);
    292293      IncrThreadUsage();
    293       // DosSleep(100); //05 Aug 07 GKY 128     // 07 Feb 08 SHL
     294      // DosSleep(100); //05 Aug 07 GKY 128     // 07 Feb 08 SHL
    294295      // hwndStatus does not exist for applet
    295296      WinSetWindowText(hwndStatus ? hwndStatus : grep.hwndCurFile,
    296                        GetPString(grep.finddupes ? IDS_GREPDUPETEXT :
    297                                                    IDS_GREPSCANTEXT));
     297                       GetPString(grep.finddupes ? IDS_GREPDUPETEXT :
     298                                                   IDS_GREPSCANTEXT));
    298299
    299300      pp = grep.searchPattern;
    300301      while (*pp) {
    301         if (!grep.absFlag) {
    302           p = GREPCHARS;                // see if any sense in pattern matching
    303           while (*p) {
    304             if (strchr(pp, *p))
    305               break;
    306             p++;
    307           }
    308           if (!*p)                      // nope, turn it off
    309             grep.absFlag = TRUE;
    310         }
    311         pp = pp + strlen(pp) + 1;
     302        if (!grep.absFlag) {
     303          p = GREPCHARS;                // see if any sense in pattern matching
     304          while (*p) {
     305            if (strchr(pp, *p))
     306              break;
     307            p++;
     308          }
     309          if (!*p)                      // nope, turn it off
     310            grep.absFlag = TRUE;
     311        }
     312        pp = pp + strlen(pp) + 1;
    312313      }
    313314
     
    315316      grep.antiattr &= (~FILE_DIRECTORY);
    316317      if (grep.antiattr & FILE_READONLY)
    317         grep.antiattr |= MUST_HAVE_READONLY;
     318        grep.antiattr |= MUST_HAVE_READONLY;
    318319      if (grep.antiattr & FILE_HIDDEN)
    319         grep.antiattr |= MUST_HAVE_HIDDEN;
     320        grep.antiattr |= MUST_HAVE_HIDDEN;
    320321      if (grep.antiattr & FILE_SYSTEM)
    321         grep.antiattr |= MUST_HAVE_SYSTEM;
     322        grep.antiattr |= MUST_HAVE_SYSTEM;
    322323      if (grep.antiattr & FILE_ARCHIVED)
    323         grep.antiattr |= MUST_HAVE_ARCHIVED;
     324        grep.antiattr |= MUST_HAVE_ARCHIVED;
    324325
    325326      grep.anyexcludes = FALSE;
     
    328329
    329330      while ((fle[numfls] = strtok(NULL, ";")) != NULL && numfls < 511) {
    330         if (*fle[numfls] == '/')
    331           grep.anyexcludes = TRUE;
    332         numfls++;
     331        if (*fle[numfls] == '/')
     332          grep.anyexcludes = TRUE;
     333        numfls++;
    333334      }
    334335
    335       InitITimer(&itdSleep, 500);       // Sleep every 500 mSec
    336       InitITimer(&itdReport, 2000);     // Report every 2 sec
     336      InitITimer(&itdSleep, 500);       // Sleep every 500 mSec
     337      InitITimer(&itdReport, 2000);     // Report every 2 sec
    337338
    338339      // loop through search masks
    339340      for (x = 0; x < numfls; x++) {
    340341
    341         if (*fle[x] == '/')             // is an exclude mask only
    342           goto ExcludeSkip;
    343 
    344         // first, separate any path from mask
    345 
    346         p = (char *)(fle[x] + (strlen(fle[x]) - 1));
    347         while (*p != '\\' && *p != ':' && p != fle[x])
    348           --p;
    349 
    350         if (p == fle[x]) {              // no path
    351           strcpy(searchPath, grep.curdir);
    352           strncpy(grep.fileMask, fle[x], CCHMAXPATH);
    353           grep.fileMask[CCHMAXPATH - 1] = 0;
    354         }
    355         else {                          // got to deal with a path
    356           if (*p == ':') {              // just a drive, start in root dir
    357             *p = 0;
    358             p++;
    359             strncpy(searchPath, fle[x], CCHMAXPATH - 2);
    360             searchPath[CCHMAXPATH - 3] = 0;
    361             strcat(searchPath, ":\\");
    362             strcpy(grep.fileMask, p);
    363           }
    364           if (*p == '\\') {
    365             // got a 'full' path
    366             CHAR temp;
    367 
    368             p++;
    369             temp = *p;
    370             *p = 0;
    371             strncpy(searchPath, fle[x], CCHMAXPATH);
    372             searchPath[CCHMAXPATH - 1] = 0;
    373             *p = temp;
    374             strcpy(grep.fileMask, p);
    375           }
    376           if (!*grep.fileMask)
    377             strcpy(grep.fileMask, "*");
    378         }
    379         if (*grep.stopflag)
    380           break;
    381         // do single directory
    382         DoMatchingFiles(&grep, searchPath, fle, numfls, &itdSleep, &itdReport);
    383         if (grep.dirFlag)               // do subdirs
    384           DoAllSubdirs(&grep, searchPath, FALSE, fle, numfls, &itdSleep, &itdReport);
     342        if (*fle[x] == '/')             // is an exclude mask only
     343          goto ExcludeSkip;
     344
     345        // first, separate any path from mask
     346
     347        p = (char *)(fle[x] + (strlen(fle[x]) - 1));
     348        while (*p != '\\' && *p != ':' && p != fle[x])
     349          --p;
     350
     351        if (p == fle[x]) {              // no path
     352          strcpy(searchPath, grep.curdir);
     353          strncpy(grep.fileMask, fle[x], CCHMAXPATH);
     354          grep.fileMask[CCHMAXPATH - 1] = 0;
     355        }
     356        else {                          // got to deal with a path
     357          if (*p == ':') {              // just a drive, start in root dir
     358            *p = 0;
     359            p++;
     360            strncpy(searchPath, fle[x], CCHMAXPATH - 2);
     361            searchPath[CCHMAXPATH - 3] = 0;
     362            strcat(searchPath, ":\\");
     363            strcpy(grep.fileMask, p);
     364          }
     365          if (*p == '\\') {
     366            // got a 'full' path
     367            CHAR temp;
     368
     369            p++;
     370            temp = *p;
     371            *p = 0;
     372            strncpy(searchPath, fle[x], CCHMAXPATH);
     373            searchPath[CCHMAXPATH - 1] = 0;
     374            *p = temp;
     375            strcpy(grep.fileMask, p);
     376          }
     377          if (!*grep.fileMask)
     378            strcpy(grep.fileMask, "*");
     379        }
     380        if (*grep.stopflag)
     381          break;
     382        // do single directory
     383        DoMatchingFiles(&grep, searchPath, fle, numfls, &itdSleep, &itdReport);
     384        if (grep.dirFlag)               // do subdirs
     385          DoAllSubdirs(&grep, searchPath, FALSE, fle, numfls, &itdSleep, &itdReport);
    385386      ExcludeSkip:
    386         if (*grep.stopflag)
    387           break;
    388         if (WinIsWindow(grep.ghab, grep.hwndFiles))
    389           DoInsertion(&grep, &itdSleep, &itdReport);    // insert any remaining objects
     387        if (*grep.stopflag)
     388          break;
     389        if (WinIsWindow(grep.ghab, grep.hwndFiles))
     390          DoInsertion(&grep, &itdSleep, &itdReport);    // insert any remaining objects
    390391      } // for
    391392
    392393      if (WinIsWindow(grep.ghab, grep.hwndFiles))
    393         DoInsertion(&grep, &itdSleep, &itdReport);      // insert any remaining objects
     394        DoInsertion(&grep, &itdSleep, &itdReport);      // insert any remaining objects
    394395
    395396      if (WinIsWindow(grep.ghab, grep.hwndFiles) &&
    396           grep.finddupes &&
    397           !*grep.stopflag)
     397          grep.finddupes &&
     398          !*grep.stopflag)
    398399      {
    399         FillDupes(&grep, &itdSleep, &itdReport);
     400        FillDupes(&grep, &itdSleep, &itdReport);
    400401      }
    401402
    402       if (!PostMsg(grep.hwndFiles, UM_CONTAINER_FILLED, MPVOID, MPVOID))        // tell window we're done
    403         WinSendMsg(grep.hwndFiles, UM_CONTAINER_FILLED, MPVOID, MPVOID);
     403      if (!PostMsg(grep.hwndFiles, UM_CONTAINER_FILLED, MPVOID, MPVOID))        // tell window we're done
     404        WinSendMsg(grep.hwndFiles, UM_CONTAINER_FILLED, MPVOID, MPVOID);
    404405      WinDestroyMsgQueue(ghmq);
    405406    }
     
    435436  for (x = 0; x < numfls; x++) {
    436437    if (*fle[x] == '/' &&
    437         wildcard((strchr(fle[x], '\\') ||
    438                   strchr(fle[x], ':')) ? name : n, fle[x] + 1, FALSE))
     438        wildcard((strchr(fle[x], '\\') ||
     439                  strchr(fle[x], ':')) ? name : n, fle[x] + 1, FALSE))
    439440      return TRUE;
    440441  }
     
    443444
    444445static VOID DoAllSubdirs(GREP *grep,
    445                         CHAR *searchPath,
    446                         BOOL recursing,
    447                         CHAR **fle,
    448                         UINT numfls,
    449                         ITIMER_DESC *pitdSleep,
    450                         ITIMER_DESC *pitdReport)
     446                        CHAR *searchPath,
     447                        BOOL recursing,
     448                        CHAR **fle,
     449                        UINT numfls,
     450                        ITIMER_DESC *pitdSleep,
     451                        ITIMER_DESC *pitdReport)
    451452{
    452453  // process all subdirectories
     
    464465  DosError(FERR_DISABLEHARDERR);
    465466  if (!DosFindFirst(searchPath, &findHandle, (MUST_HAVE_DIRECTORY |
    466                     FILE_ARCHIVED | FILE_SYSTEM | FILE_HIDDEN | FILE_READONLY),
    467                     &ffb, (ULONG) sizeof(ffb),
    468                     (PULONG) & ulFindCnt, FIL_QUERYEASIZE)) {
     467                    FILE_ARCHIVED | FILE_SYSTEM | FILE_HIDDEN | FILE_READONLY),
     468                    &ffb, (ULONG) sizeof(ffb),
     469                    (PULONG) & ulFindCnt, FIL_QUERYEASIZE)) {
    469470
    470471    // get rid of mask portion, save end-of-directory
     
    475476    else
    476477      p = searchPath;
    477     do {                                // Process each directory that matches the mask
     478    do {                                // Process each directory that matches the mask
    478479      priority_normal();
    479480      if (*grep->stopflag)
    480         break;
     481        break;
    481482      // Skip . and ..
    482483      if (ffb.achName[0] != '.' ||
    483           (ffb.achName[1] &&
    484            (ffb.achName[1] != '.' || ffb.achName[2]))) {
    485         strcpy(p, ffb.achName);
    486         if (!grep->anyexcludes || !IsExcluded(searchPath, fle, numfls)) {
    487           // 07 Feb 08 SHL
    488           if (IsITimerExpired(pitdReport)) {
    489             if (!hwndStatus)
    490               WinSetWindowText(grep->hwndCurFile, searchPath);
    491             else if (WinQueryFocus(HWND_DESKTOP) == grep->hwndFiles) {
    492               CHAR s[CCHMAXPATH + 64];
    493               sprintf(s, "%s %s", GetPString(IDS_SCANNINGTEXT), searchPath);
    494               WinSetWindowText(hwndStatus, s);
    495             }
    496           }
    497           DoMatchingFiles(grep, searchPath, fle, numfls, pitdSleep, pitdReport);
    498           // 07 Feb 08 SHL
    499           if (IsITimerExpired(pitdReport)) {
    500             if (!hwndStatus)
    501               WinSetWindowText(grep->hwndCurFile, searchPath);
    502             else {
    503               if (WinQueryFocus(HWND_DESKTOP) == grep->hwndFiles) {
    504                 CHAR s[CCHMAXPATH + 64];
    505                 sprintf(s, "%s %s", GetPString(IDS_SCANNINGTEXT), searchPath);
    506                 WinSetWindowText(hwndStatus, s);
    507               }
    508             }
    509           }
    510           DoAllSubdirs(grep, searchPath, TRUE, fle, numfls, pitdSleep, pitdReport);
    511           // DosSleep(0); //26 Aug 07 GKY 1     // 07 Feb 08 SHL
    512         }
     484          (ffb.achName[1] &&
     485           (ffb.achName[1] != '.' || ffb.achName[2]))) {
     486        strcpy(p, ffb.achName);
     487        if (!grep->anyexcludes || !IsExcluded(searchPath, fle, numfls)) {
     488          // 07 Feb 08 SHL
     489          if (IsITimerExpired(pitdReport)) {
     490            if (!hwndStatus)
     491              WinSetWindowText(grep->hwndCurFile, searchPath);
     492            else if (WinQueryFocus(HWND_DESKTOP) == grep->hwndFiles) {
     493              CHAR s[CCHMAXPATH + 64];
     494              sprintf(s, "%s %s", GetPString(IDS_SCANNINGTEXT), searchPath);
     495              WinSetWindowText(hwndStatus, s);
     496            }
     497          }
     498          DoMatchingFiles(grep, searchPath, fle, numfls, pitdSleep, pitdReport);
     499          // 07 Feb 08 SHL
     500          if (IsITimerExpired(pitdReport)) {
     501            if (!hwndStatus)
     502              WinSetWindowText(grep->hwndCurFile, searchPath);
     503            else {
     504              if (WinQueryFocus(HWND_DESKTOP) == grep->hwndFiles) {
     505                CHAR s[CCHMAXPATH + 64];
     506                sprintf(s, "%s %s", GetPString(IDS_SCANNINGTEXT), searchPath);
     507                WinSetWindowText(hwndStatus, s);
     508              }
     509            }
     510          }
     511          DoAllSubdirs(grep, searchPath, TRUE, fle, numfls, pitdSleep, pitdReport);
     512          // DosSleep(0); //26 Aug 07 GKY 1     // 07 Feb 08 SHL
     513        }
    513514      }
    514515      ulFindCnt = 1;
    515516    } while (!DosFindNext(findHandle,
    516                           &ffb,
    517                           sizeof(ffb), (PULONG) & ulFindCnt));
     517                          &ffb,
     518                          sizeof(ffb), (PULONG) & ulFindCnt));
    518519    DosFindClose(findHandle);
    519520    priority_normal();
    520521  }
    521   if (p)                                // strip off last directory addition
     522  if (p)                                // strip off last directory addition
    522523    *p = 0;
    523524}
     
    528529
    529530static INT DoMatchingFiles(GREP *grep,
    530                            CHAR *path,
    531                            CHAR **fle,
    532                            UINT numfls,
    533                            ITIMER_DESC *pitdSleep,
    534                            ITIMER_DESC *pitdReport)
     531                           CHAR *path,
     532                           CHAR **fle,
     533                           UINT numfls,
     534                           ITIMER_DESC *pitdSleep,
     535                           ITIMER_DESC *pitdReport)
    535536{
    536537  // process all matching files in a directory
     
    567568  ulFindCnt = FilesToGet;
    568569  rc = xDosFindFirst(szFindPath,
    569                      &findHandle,
    570                      FILE_NORMAL | grep->attrFile | grep->antiattr,
    571                      pffbArray,
    572                      ulBufBytes,
    573                      &ulFindCnt,
    574                      FIL_QUERYEASIZEL);
     570                     &findHandle,
     571                     FILE_NORMAL | grep->attrFile | grep->antiattr,
     572                     pffbArray,
     573                     ulBufBytes,
     574                     &ulFindCnt,
     575                     FIL_QUERYEASIZEL);
    575576  if (!rc) {
    576577    do {
     
    579580      pffbFile = pffbArray;
    580581      for (x = 0; x < ulFindCnt; x++) {
    581         if (*grep->stopflag)
    582           break;
    583         if (*pffbFile->achName != '.' ||
    584             (pffbFile->achName[1] && pffbFile->achName[1] != '.')) {
    585           strcpy(p, pffbFile->achName); // build filename
    586           if (strlen(szFindPath) > CCHMAXPATH){
    587             // Complain if pathnames exceeds max
    588             DosFindClose(findHandle);
    589             //xfree(pffbArray, pszSrcFile, __LINE__);
    590             if (!fDone) {
    591               fDone = TRUE;
    592               saymsg(MB_OK | MB_ICONASTERISK,
    593                      HWND_DESKTOP,
    594                      GetPString(IDS_WARNINGTEXT),
    595                      "One or more of your files has a full path name that exceeds the OS/2 maximum");
    596             }
    597             return 1;
    598           }
    599 
    600           // 07 Feb 08 SHL
    601           if (IsITimerExpired(pitdReport)) {
    602             if (!hwndStatus)
    603               WinSetWindowText(grep->hwndCurFile, szFindPath);
    604             else {
    605               if (WinQueryFocus(HWND_DESKTOP) == grep->hwndFiles) {
    606                 CHAR s[CCHMAXPATH + 64];
    607                 sprintf(s, "%s %s", GetPString(IDS_SCANNINGTEXT), szFindPath);
    608                 WinSetWindowText(hwndStatus, s);
    609               }
    610             }
    611           }
    612 
    613           if (!grep->anyexcludes || !IsExcluded(szFindPath, fle, numfls)) {
    614             if (!grep->finddupes)
    615               DoOneFile(grep, szFindPath, pffbFile, pitdSleep, pitdReport);
    616             else if (!InsertDupe(grep, szFindPath, pffbFile)) {
    617               DosFindClose(findHandle);
    618               free(pffbArray);
     582        if (*grep->stopflag)
     583          break;
     584        if (*pffbFile->achName != '.' ||
     585            (pffbFile->achName[1] && pffbFile->achName[1] != '.')) {
     586          strcpy(p, pffbFile->achName); // build filename
     587          if (strlen(szFindPath) > CCHMAXPATH){
     588            // Complain if pathnames exceeds max
     589            DosFindClose(findHandle);
     590            //xfree(pffbArray, pszSrcFile, __LINE__);
     591            if (!fDone) {
     592              fDone = TRUE;
     593              saymsg(MB_OK | MB_ICONASTERISK,
     594                     HWND_DESKTOP,
     595                     GetPString(IDS_WARNINGTEXT),
     596                     "One or more of your files has a full path name that exceeds the OS/2 maximum");
     597            }
     598            return 1;
     599          }
     600
     601          // 07 Feb 08 SHL
     602          if (IsITimerExpired(pitdReport)) {
     603            if (!hwndStatus)
     604              WinSetWindowText(grep->hwndCurFile, szFindPath);
     605            else {
     606              if (WinQueryFocus(HWND_DESKTOP) == grep->hwndFiles) {
     607                CHAR s[CCHMAXPATH + 64];
     608                sprintf(s, "%s %s", GetPString(IDS_SCANNINGTEXT), szFindPath);
     609                WinSetWindowText(hwndStatus, s);
     610              }
     611            }
     612          }
     613
     614          if (!grep->anyexcludes || !IsExcluded(szFindPath, fle, numfls)) {
     615            if (!grep->finddupes)
     616              DoOneFile(grep, szFindPath, pffbFile, pitdSleep, pitdReport);
     617            else if (!InsertDupe(grep, szFindPath, pffbFile)) {
     618              DosFindClose(findHandle);
     619              free(pffbArray);
    619620#             ifdef FORTIFY
    620621              Fortify_LeaveScope();
    621622#              endif
    622               return 1;
    623             }
    624           }
    625         }
    626         if (!pffbFile->oNextEntryOffset)
    627           break;
    628         pffbFile = (PFILEFINDBUF4L)((PBYTE)pffbFile + pffbFile->oNextEntryOffset);
     623              return 1;
     624            }
     625          }
     626        }
     627        if (!pffbFile->oNextEntryOffset)
     628          break;
     629        pffbFile = (PFILEFINDBUF4L)((PBYTE)pffbFile + pffbFile->oNextEntryOffset);
    629630      } // for
    630631      if (*grep->stopflag)
    631         break;
     632        break;
    632633      SleepIfNeeded(pitdSleep, 1);
    633       // DosSleep(0); //26 Aug 07 GKY 1 // 07 Feb 08 SHL
     634      // DosSleep(0); //26 Aug 07 GKY 1 // 07 Feb 08 SHL
    634635      ulFindCnt = FilesToGet;
    635636      rc = xDosFindNext(findHandle, pffbArray, ulBufBytes, &ulFindCnt, FIL_QUERYEASIZEL);
     
    642643  if (rc && rc != ERROR_NO_MORE_FILES) {
    643644    Dos_Error(MB_ENTER, rc, HWND_DESKTOP, pszSrcFile, __LINE__,
    644               GetPString(IDS_CANTFINDDIRTEXT), szFindPath);
     645              GetPString(IDS_CANTFINDDIRTEXT), szFindPath);
    645646  }
    646647
     
    684685
    685686static BOOL DoInsertion(GREP *grep,
    686                         ITIMER_DESC *pitdSleep,
    687                         ITIMER_DESC *pitdReport)
     687                        ITIMER_DESC *pitdSleep,
     688                        ITIMER_DESC *pitdReport)
    688689{
    689690  RECORDINSERT ri;
     
    696697
    697698  pci = WinSendMsg(grep->hwndFiles,
    698                    CM_ALLOCRECORD,
    699                    MPFROMLONG(EXTRA_RECORD_BYTES),
    700                    MPFROMLONG(grep->toinsert));
     699                   CM_ALLOCRECORD,
     700                   MPFROMLONG(EXTRA_RECORD_BYTES),
     701                   MPFROMLONG(grep->toinsert));
    701702  if (!pci) {
    702703    Win_Error(grep->hwndFiles, grep->hwndFiles, pszSrcFile, __LINE__,
    703               "CM_ALLOCRECORD %u failed", grep->toinsert);
     704              "CM_ALLOCRECORD %u failed", grep->toinsert);
    704705  }
    705706  else {
    706707    if (grep->sayfiles) {
    707708      if (!hwndStatus)
    708         WinSetWindowText(grep->hwndCurFile, GetPString(IDS_GREPINSERTINGTEXT));
     709        WinSetWindowText(grep->hwndCurFile, GetPString(IDS_GREPINSERTINGTEXT));
    709710      else {
    710         if (WinQueryFocus(HWND_DESKTOP) == grep->hwndFiles)
    711           WinSetWindowText(hwndStatus, GetPString(IDS_GREPINSERTINGTEXT));
     711        if (WinQueryFocus(HWND_DESKTOP) == grep->hwndFiles)
     712          WinSetWindowText(hwndStatus, GetPString(IDS_GREPINSERTINGTEXT));
    712713      }
    713714    }
     
    716717    for (x = 0; grep->insertffb[x]; x++) {
    717718      FillInRecordFromFFB(grep->hwndFiles,
    718                           pci, grep->dir[x], grep->insertffb[x], FALSE, dcd);
     719                          pci, grep->dir[x], grep->insertffb[x], FALSE, dcd);
    719720      pci = (PCNRITEM) pci->rc.preccNextRecord;
    720721      SleepIfNeeded(pitdSleep, 1);
     
    728729    ri.fInvalidateRecord = TRUE;
    729730    WinSendMsg(grep->hwndFiles,
    730                CM_INSERTRECORD, MPFROMP(pciFirst), MPFROMP(&ri));
     731               CM_INSERTRECORD, MPFROMP(pciFirst), MPFROMP(&ri));
    731732    if (dcd) {
    732733      DosEnterCritSec();
     
    735736    }
    736737    SleepIfNeeded(pitdSleep, 1);
    737     // if (grep->toinsert == FilesToGet)        // 07 Feb 08 SHL
    738     //  DosSleep(0);  //26 Aug 07 GKY 1 // 07 Feb 08 SHL
     738    // if (grep->toinsert == FilesToGet)        // 07 Feb 08 SHL
     739    //  DosSleep(0);  //26 Aug 07 GKY 1 // 07 Feb 08 SHL
    739740    freegreplist(grep);
    740741    PostMsg(grep->hwndFiles, UM_RESCAN, MPVOID, MPVOID);
     
    750751
    751752static BOOL InsertGrepFile(GREP *grep,
    752                            CHAR *pszFileName,
    753                            PFILEFINDBUF4L pffb,
    754                            ITIMER_DESC *pitdSleep,
    755                            ITIMER_DESC *pitdReport)
     753                           CHAR *pszFileName,
     754                           PFILEFINDBUF4L pffb,
     755                           ITIMER_DESC *pitdSleep,
     756                           ITIMER_DESC *pitdReport)
    756757{
    757758  PSZ p;
     
    770771      // Got directory
    771772      if (p < szDirectory + 4)
    772         p++;                            // Include root backslash
     773        p++;                            // Include root backslash
    773774      *p = 0;
    774775
    775776      if (!grep->insertffb) {
    776         // Allocate 1 extra for end marker?
    777         grep->insertffb = xmallocz(sizeof(PFILEFINDBUF4L) * (FilesToGet + 1),
    778                                    pszSrcFile, __LINE__);
    779         if (!grep->insertffb)
    780           return FALSE;
    781         grep->dir = xmallocz(sizeof(CHAR *) * (FilesToGet + 1),
    782                              pszSrcFile, __LINE__);
    783         if (!grep->dir) {
    784           free(grep->insertffb);
     777        // Allocate 1 extra for end marker?
     778        grep->insertffb = xmallocz(sizeof(PFILEFINDBUF4L) * (FilesToGet + 1),
     779                                   pszSrcFile, __LINE__);
     780        if (!grep->insertffb)
     781          return FALSE;
     782        grep->dir = xmallocz(sizeof(CHAR *) * (FilesToGet + 1),
     783                             pszSrcFile, __LINE__);
     784        if (!grep->dir) {
     785          free(grep->insertffb);
    785786#         ifdef FORTIFY
    786787          Fortify_LeaveScope();
    787788#          endif
    788           return FALSE;
    789         }
     789          return FALSE;
     790        }
    790791      }
    791792
    792793      grep->insertffb[grep->toinsert] =
    793         xmalloc(sizeof(FILEFINDBUF4L), pszSrcFile, __LINE__);
     794        xmalloc(sizeof(FILEFINDBUF4L), pszSrcFile, __LINE__);
    794795      if (!grep->insertffb[grep->toinsert])
    795         return FALSE;
     796        return FALSE;
    796797      memcpy(grep->insertffb[grep->toinsert], pffb, sizeof(FILEFINDBUF4L));
    797798
     
    802803        Fortify_LeaveScope();
    803804#        endif
    804         return FALSE;
     805        return FALSE;
    805806      }
    806807
     
    808809      grep->toinsert++;
    809810      if (grep->toinsert == FilesToGet)
    810         return DoInsertion(grep, pitdSleep, pitdReport);
     811        return DoInsertion(grep, pitdSleep, pitdReport);
    811812      return TRUE;
    812813    }
     
    820821
    821822static BOOL DoOneFile(GREP *grep,
    822                       CHAR *pszFileName,
    823                       FILEFINDBUF4L *pffb,
    824                       ITIMER_DESC *pitdSleep,
    825                       ITIMER_DESC *pitdReport)
     823                      CHAR *pszFileName,
     824                      FILEFINDBUF4L *pffb,
     825                      ITIMER_DESC *pitdSleep,
     826                      ITIMER_DESC *pitdReport)
    826827{
    827828  // process a single file
     
    837838    else {
    838839      if (WinQueryFocus(HWND_DESKTOP) == grep->hwndFiles)
    839         WinSetWindowText(hwndStatus, pszFileName);
     840        WinSetWindowText(hwndStatus, pszFileName);
    840841    }
    841842  }
     
    849850    if (grep->greaterthan) {
    850851      if (adjsize < grep->greaterthan)
    851         keep = FALSE;
     852        keep = FALSE;
    852853    }
    853854    if (keep && grep->lessthan) {
    854855      if (adjsize > grep->lessthan)
    855         keep = FALSE;
     856        keep = FALSE;
    856857    }
    857858    if (!keep)
     
    867868    if (grep->newerthan) {
    868869      if (numsecs < grep->newerthan)
    869         keep = FALSE;
     870        keep = FALSE;
    870871    }
    871872    if (keep && grep->olderthan) {
    872873      if (numsecs > grep->olderthan)
    873         keep = FALSE;
     874        keep = FALSE;
    874875    }
    875876    if (!keep)
     
    877878  }
    878879
    879   if ((!grep->searchEAs && !grep->searchFiles) || !*grep->searchPattern)        // just a find
     880  if ((!grep->searchEAs && !grep->searchFiles) || !*grep->searchPattern)        // just a find
    880881    return InsertGrepFile(grep, pszFileName, pffb, pitdSleep, pitdReport);
    881882
     
    891892      info = head;
    892893      while (info && !strmatch) {
    893         alltext = TRUE;
    894         switch (*(USHORT *)info->value) {
    895         case EAT_ASCII:
    896           if (match(info->value + (sizeof(USHORT) * 2),
    897                     grep->searchPattern, grep->absFlag,
    898                     grep->caseFlag == FALSE,
    899                     info->cbValue - (sizeof(USHORT) * 2),
    900                     grep->numlines,
    901                     grep->matched,
    902                     !grep->findifany)) {
    903             strmatch = TRUE;
    904           }
    905           break;
    906         case EAT_MVST:
    907           type = *(USHORT *)(info->value + (sizeof(USHORT) * 3));
    908           if (type == EAT_ASCII) {
    909             data = info->value + (sizeof(USHORT) * 4);
    910             len = *(USHORT *) data;
    911             data += sizeof(USHORT);
    912             while ((data - info->value) + len <= info->cbValue) {
    913               temp = *(data + len);
    914               *(data + len) = 0;
    915               if (match(data,
    916                         grep->searchPattern,
    917                         grep->absFlag,
    918                         (grep->caseFlag == FALSE),
    919                         len,
    920                         grep->numlines, grep->matched, !grep->findifany)) {
    921                 strmatch = TRUE;
    922                 break;
    923               }
    924               data += len;
    925               if (data - info->value >= info->cbValue)
    926                 break;
    927               *data = temp;
    928               len = *(USHORT *) data;
    929               data += sizeof(USHORT);
    930             }
    931           }
    932           break;
    933         case EAT_MVMT:
    934           data = info->value + (sizeof(USHORT) * 3);
    935           type = *(USHORT *) data;
    936           data += sizeof(USHORT);
    937           len = *(USHORT *) data;
    938           data += sizeof(USHORT);
    939           while ((data - info->value) - len <= info->cbValue) {
    940             if (type != EAT_ASCII) {
    941               alltext = FALSE;
    942               break;
    943             }
    944             data += len;
    945             if (data - info->value >= info->cbValue)
    946               break;
    947             type = *(USHORT *) data;
    948             data += sizeof(USHORT);
    949             len = *(USHORT *) data;
    950             data += sizeof(USHORT);
    951           }
    952           if (alltext) {
    953             data = info->value + (sizeof(USHORT) * 3);
    954             type = *(USHORT *) data;
    955             data += sizeof(USHORT);
    956             len = *(USHORT *) data;
    957             data += sizeof(USHORT);
    958             while ((data - info->value) - len <= info->cbValue) {
    959               temp = *(data + len);
    960               *(data + len) = 0;
    961               if (match(data,
    962                         grep->searchPattern,
    963                         grep->absFlag,
    964                         (grep->caseFlag == FALSE),
    965                         len,
    966                         grep->numlines, grep->matched, !grep->findifany)) {
    967                 strmatch = TRUE;
    968                 break;
    969               }
    970               data += len;
    971               *data = temp;
    972               if (data - info->value >= info->cbValue)
    973                 break;
    974               type = *(USHORT *) data;
    975               data += sizeof(USHORT);
    976               len = *(USHORT *) data;
    977               data += sizeof(USHORT);
    978             }
    979           }
    980           break;
    981         default:
    982           break;
    983         }
    984         info = info->next;
    985       }                                 // while
     894        alltext = TRUE;
     895        switch (*(USHORT *)info->value) {
     896        case EAT_ASCII:
     897          if (match(info->value + (sizeof(USHORT) * 2),
     898                    grep->searchPattern, grep->absFlag,
     899                    grep->caseFlag == FALSE,
     900                    info->cbValue - (sizeof(USHORT) * 2),
     901                    grep->numlines,
     902                    grep->matched,
     903                    !grep->findifany)) {
     904            strmatch = TRUE;
     905          }
     906          break;
     907        case EAT_MVST:
     908          type = *(USHORT *)(info->value + (sizeof(USHORT) * 3));
     909          if (type == EAT_ASCII) {
     910            data = info->value + (sizeof(USHORT) * 4);
     911            len = *(USHORT *) data;
     912            data += sizeof(USHORT);
     913            while ((data - info->value) + len <= info->cbValue) {
     914              temp = *(data + len);
     915              *(data + len) = 0;
     916              if (match(data,
     917                        grep->searchPattern,
     918                        grep->absFlag,
     919                        (grep->caseFlag == FALSE),
     920                        len,
     921                        grep->numlines, grep->matched, !grep->findifany)) {
     922                strmatch = TRUE;
     923                break;
     924              }
     925              data += len;
     926              if (data - info->value >= info->cbValue)
     927                break;
     928              *data = temp;
     929              len = *(USHORT *) data;
     930              data += sizeof(USHORT);
     931            }
     932          }
     933          break;
     934        case EAT_MVMT:
     935          data = info->value + (sizeof(USHORT) * 3);
     936          type = *(USHORT *) data;
     937          data += sizeof(USHORT);
     938          len = *(USHORT *) data;
     939          data += sizeof(USHORT);
     940          while ((data - info->value) - len <= info->cbValue) {
     941            if (type != EAT_ASCII) {
     942              alltext = FALSE;
     943              break;
     944            }
     945            data += len;
     946            if (data - info->value >= info->cbValue)
     947              break;
     948            type = *(USHORT *) data;
     949            data += sizeof(USHORT);
     950            len = *(USHORT *) data;
     951            data += sizeof(USHORT);
     952          }
     953          if (alltext) {
     954            data = info->value + (sizeof(USHORT) * 3);
     955            type = *(USHORT *) data;
     956            data += sizeof(USHORT);
     957            len = *(USHORT *) data;
     958            data += sizeof(USHORT);
     959            while ((data - info->value) - len <= info->cbValue) {
     960              temp = *(data + len);
     961              *(data + len) = 0;
     962              if (match(data,
     963                        grep->searchPattern,
     964                        grep->absFlag,
     965                        (grep->caseFlag == FALSE),
     966                        len,
     967                        grep->numlines, grep->matched, !grep->findifany)) {
     968                strmatch = TRUE;
     969                break;
     970              }
     971              data += len;
     972              *data = temp;
     973              if (data - info->value >= info->cbValue)
     974                break;
     975              type = *(USHORT *) data;
     976              data += sizeof(USHORT);
     977              len = *(USHORT *) data;
     978              data += sizeof(USHORT);
     979            }
     980          }
     981          break;
     982        default:
     983          break;
     984        }
     985        info = info->next;
     986      }                                 // while
    986987      Free_FEAList(head);
    987       // DosSleep(1);                   // 07 Feb 08 SHL
     988      // DosSleep(1);                   // 07 Feb 08 SHL
    988989    }
    989990  }
     
    996997      inputFile = _fsopen(pszFileName, "rb", SH_DENYNO);
    997998      if (inputFile) {
    998         pos = ftell(inputFile);
    999         while (!feof(inputFile)) {
    1000           if (pos)
    1001             fseek(inputFile, pos - 1024, SEEK_SET);
    1002           len = fread(input, 1, 65536, inputFile);
    1003           if (len >= 0) {
    1004             if (*grep->stopflag)
    1005               break;
    1006             if (match(input,
    1007                       grep->searchPattern,
    1008                       grep->absFlag,
    1009                       (grep->caseFlag == FALSE),
    1010                       len, grep->numlines, grep->matched, !grep->findifany)) {
    1011               strmatch = TRUE;
    1012               break;
    1013             }
    1014           }
    1015           else
    1016             break;
    1017         }
    1018         fclose(inputFile);
     999        pos = ftell(inputFile);
     1000        while (!feof(inputFile)) {
     1001          if (pos)
     1002            fseek(inputFile, pos - 1024, SEEK_SET);
     1003          len = fread(input, 1, 65536, inputFile);
     1004          if (len >= 0) {
     1005            if (*grep->stopflag)
     1006              break;
     1007            if (match(input,
     1008                      grep->searchPattern,
     1009                      grep->absFlag,
     1010                      (grep->caseFlag == FALSE),
     1011                      len, grep->numlines, grep->matched, !grep->findifany)) {
     1012              strmatch = TRUE;
     1013              break;
     1014            }
     1015          }
     1016          else
     1017            break;
     1018        }
     1019        fclose(inputFile);
    10191020      }
    10201021      free(input);
     
    10221023      Fortify_LeaveScope();
    10231024#      endif
    1024       // DosSleep(1);                   // 07 Feb 08 SHL
     1025      // DosSleep(1);                   // 07 Feb 08 SHL
    10251026    }
    10261027  } // if
     
    10311032}
    10321033
    1033 static LONG cr3tab[] = {                // CRC polynomial 0xEDB88320
     1034static LONG cr3tab[] = {                // CRC polynomial 0xEDB88320
    10341035
    10351036  0x00000000, 0x77073096, 0xee0e612c, 0x990951ba,
     
    11251126    else {
    11261127      while (!feof(fp)) {
    1127         len = fread(buffer, 1, 65535, fp);
    1128         if (len && len < 65536L)
    1129           CRC = CRCBlock(buffer, len, CRC);
    1130         else
    1131           break;
    1132         // DosSleep(0); //26 Aug 07 GKY 1       // 07 Feb 08 SHL
     1128        len = fread(buffer, 1, 65535, fp);
     1129        if (len && len < 65536L)
     1130          CRC = CRCBlock(buffer, len, CRC);
     1131        else
     1132          break;
     1133        // DosSleep(0); //26 Aug 07 GKY 1       // 07 Feb 08 SHL
    11331134      }
    11341135      fclose(fp);
    1135       // DosSleep(1);                   // 07 Feb 08 SHL
     1136      // DosSleep(1);                   // 07 Feb 08 SHL
    11361137    }
    11371138    free(buffer);
     
    12901291
    12911292static VOID FillDupes(GREP *grep,
    1292                       ITIMER_DESC *pitdSleep,
    1293                       ITIMER_DESC *pitdReport)
     1293                      ITIMER_DESC *pitdSleep,
     1294                      ITIMER_DESC *pitdReport)
    12941295{
    12951296  DUPES *c, *i, **r;
     
    13001301  ULONG x;
    13011302  ULONG y;
    1302   // ULONG cntr = 1000;                 // 09 Feb 08 SHL
    1303 
    1304   // if (grep->CRCdupes)                // 09 Feb 08 SHL
    1305   //  cntr = 100;                       // 09 Feb 08 SHL
     1303  // ULONG cntr = 1000;                 // 09 Feb 08 SHL
     1304
     1305  // if (grep->CRCdupes)                // 09 Feb 08 SHL
     1306  //  cntr = 100;                       // 09 Feb 08 SHL
    13061307  x = 0;
    13071308  for (i = grep->dupehead; i; i = i->next)
    1308     x++;                                // Count
     1309    x++;                                // Count
    13091310
    13101311  if (x) {
     
    13131314    else if (WinQueryFocus(HWND_DESKTOP) == grep->hwndFiles)
    13141315      WinSetWindowText(hwndStatus, GetPString(IDS_GREPDUPESORTINGTEXT));
    1315     // DosSleep(0);  //26 Aug 07 GKY 1  // 07 Feb 08 SHL
     1316    // DosSleep(0);  //26 Aug 07 GKY 1  // 07 Feb 08 SHL
    13161317    grep->dupenames = xmalloc(sizeof(DUPES *) * (x + 1), pszSrcFile, __LINE__);
    13171318    if (!grep->nosizedupes)
     
    13201321      y = 0;
    13211322      for (i = grep->dupehead; i; i = i->next) {
    1322         grep->dupenames[y] = i;
    1323         if (!grep->nosizedupes)
    1324           grep->dupesizes[y] = i;
    1325         y++;
     1323        grep->dupenames[y] = i;
     1324        if (!grep->nosizedupes)
     1325          grep->dupesizes[y] = i;
     1326        y++;
    13261327      }
    1327       grep->dupenames[y] = NULL;        // Mark end
     1328      grep->dupenames[y] = NULL;        // Mark end
    13281329      if (!grep->nosizedupes)
    1329         grep->dupesizes[y] = NULL;
    1330 
    1331       InitITimer(pitdSleep, 0);         // Reset rate estimator
     1330        grep->dupesizes[y] = NULL;
     1331
     1332      InitITimer(pitdSleep, 0);         // Reset rate estimator
    13321333      SleepIfNeeded(pitdSleep, 1);
    1333       // DosSleep(0); //26 Aug 07 GKY 1 // 07 Feb 08 SHL
     1334      // DosSleep(0); //26 Aug 07 GKY 1 // 07 Feb 08 SHL
    13341335
    13351336      qsort(grep->dupenames,
    1336             x,
    1337             sizeof(DUPES *),
    1338             grep->ignoreextdupes ? comparenamesqe : comparenamesq);
     1337            x,
     1338            sizeof(DUPES *),
     1339            grep->ignoreextdupes ? comparenamesqe : comparenamesq);
    13391340      SleepIfNeeded(pitdSleep, 1);
    1340       // DosSleep(0); //26 Aug 07 GKY 1 // 07 Feb 08 SHL
     1341      // DosSleep(0); //26 Aug 07 GKY 1 // 07 Feb 08 SHL
    13411342      if (!grep->nosizedupes) {
    1342         qsort(grep->dupesizes, x, sizeof(DUPES *), comparesizesq);
    1343         SleepIfNeeded(pitdSleep, 1);
    1344         // DosSleep(0); //26 Aug 07 GKY 1       // 07 Feb 08 SHL
     1343        qsort(grep->dupesizes, x, sizeof(DUPES *), comparesizesq);
     1344        SleepIfNeeded(pitdSleep, 1);
     1345        // DosSleep(0); //26 Aug 07 GKY 1       // 07 Feb 08 SHL
    13451346      }
    13461347
    13471348      if (!hwndStatus)
    1348         WinSetWindowText(grep->hwndCurFile, GetPString(IDS_GREPDUPECOMPARINGTEXT));
     1349        WinSetWindowText(grep->hwndCurFile, GetPString(IDS_GREPDUPECOMPARINGTEXT));
    13491350      else if (WinQueryFocus(HWND_DESKTOP) == grep->hwndFiles)
    1350         WinSetWindowText(hwndStatus, GetPString(IDS_GREPDUPECOMPARINGTEXT));
    1351 
    1352       InitITimer(pitdSleep, 0);         // Reset rate estimator
     1351        WinSetWindowText(hwndStatus, GetPString(IDS_GREPDUPECOMPARINGTEXT));
     1352
     1353      InitITimer(pitdSleep, 0);         // Reset rate estimator
    13531354      i = grep->dupehead;
    13541355      y = 0;
    13551356      while (i) {
    1356         if (*grep->stopflag)
    1357           break;
    1358         SleepIfNeeded(pitdSleep, 1);    // 07 Feb 08 SHL
    1359         if (!(i->flags & GF_SKIPME)) {
    1360           r = (DUPES **) bsearch(i, grep->dupenames, x, sizeof(DUPES *),
    1361                                 ((grep->ignoreextdupes) ? comparenamesbe :
    1362                                   comparenamesb));
    1363           if (r) {
    1364             while (r > grep->dupenames && ((grep->ignoreextdupes) ?
    1365                                         !comparenamesqe((r - 1), &i) :
    1366                                         !comparenamesq((r - 1), &i)))
    1367               r--;
    1368             while (*r && ((grep->ignoreextdupes) ?
    1369                           !comparenamesqe(r, &i) : !comparenamesq(r, &i))) {
    1370               if (*r == i || ((*r)->flags & (GF_INSERTED | GF_SKIPME))) {
    1371                 r++;
    1372                 continue;
    1373               }
    1374               if (grep->CRCdupes) {
    1375                 if ((*r)->CRC == -1L) {
    1376                   (*r)->CRC = CRCFile((*r)->name, &error);
    1377                   if (error)
    1378                     (*r)->CRC = -1L;
    1379                   else if ((*r)->CRC == -1L)
    1380                     (*r)->CRC = 0L;
    1381                 }
    1382                 if (i->CRC == -1L) {
    1383                   i->CRC = CRCFile(i->name, &error);
    1384                   if (error)
    1385                     i->CRC = -1L;
    1386                   else if (i->CRC == -1L)
    1387                     i->CRC = 0L;
    1388                 }
    1389                 if (((*r)->size != i->size) || ((*r)->CRC != -1L &&
    1390                                                 i->CRC != -1L
    1391                                                 && (*r)->CRC != i->CRC)) {
    1392                   r++;
    1393                   continue;
    1394                 }
    1395               }
    1396               if (!AddToList((*r)->name, &list, &numfiles, &numalloced)) {
    1397                 (*r)->flags |= GF_INSERTED;
    1398                 if (grep->sayfiles) {
    1399                   if (!hwndStatus)
    1400                     WinSetWindowText(grep->hwndFiles, (*r)->name);
    1401                   else if (WinQueryFocus(HWND_DESKTOP) == grep->hwndFiles)
    1402                     WinSetWindowText(hwndStatus, (*r)->name);
    1403                 }
    1404                 if ((*r)->size == i->size &&
    1405                     (i->date.year == (*r)->date.year &&
    1406                      i->date.month == (*r)->date.month &&
    1407                      i->date.day == (*r)->date.day &&
    1408                      i->time.hours == (*r)->time.hours &&
    1409                      i->time.minutes == (*r)->time.minutes &&
    1410                      i->time.twosecs == (*r)->time.twosecs))
    1411                   (*r)->flags |= GF_SKIPME;
    1412               }
    1413               if (!(i->flags & (GF_INSERTED | GF_SKIPME))) {
    1414                 if (!AddToList(i->name, &list, &numfiles, &numalloced)) {
    1415                   i->flags |= GF_INSERTED;
    1416                   if ((*r)->flags & GF_SKIPME)
    1417                     i->flags |= GF_SKIPME;
    1418                 }
    1419               }
    1420               r++;
    1421             }
    1422           }
    1423           if (!grep->nosizedupes) {
    1424             r = (DUPES **) bsearch(i,
    1425                                    grep->dupesizes,
    1426                                    x, sizeof(DUPES *), comparesizesb);
    1427             if (r) {
    1428               while (r > grep->dupesizes && !comparesizesq((r - 1), &i))
    1429                 r--;
    1430               while (*r && !comparesizesq(r, &i)) {
    1431                 if (*r == i || ((*r)->flags & (GF_INSERTED | GF_SKIPME)) ||
    1432                     (i->date.year != (*r)->date.year ||
    1433                      i->date.month != (*r)->date.month ||
    1434                      i->date.day != (*r)->date.day ||
    1435                      i->time.hours != (*r)->time.hours ||
    1436                      i->time.minutes != (*r)->time.minutes ||
    1437                      i->time.twosecs != (*r)->time.twosecs)) {
    1438                   r++;
    1439                   continue;
    1440                 }
    1441                 if (grep->CRCdupes) {
    1442                   if ((*r)->CRC == -1L) {
    1443                     (*r)->CRC = CRCFile((*r)->name, &error);
    1444                     if (error)
    1445                       (*r)->CRC = -1L;
    1446                     else if ((*r)->CRC == -1L)
    1447                       (*r)->CRC = 0L;
    1448                   }
    1449                   if (i->CRC == -1L) {
    1450                     i->CRC = CRCFile(i->name, &error);
    1451                     if (error)
    1452                       i->CRC = -1L;
    1453                     else if (i->CRC == -1L)
    1454                       i->CRC = 0L;
    1455                   }
    1456                   if ((*r)->CRC != -1L && i->CRC != -1L &&
    1457                       (*r)->CRC != i->CRC) {
    1458                     *r += 1;
    1459                     continue;
    1460                   }
    1461                 }
    1462                 if (!AddToList((*r)->name, &list, &numfiles, &numalloced)) {
    1463                   if (grep->sayfiles) {
    1464                     if (!hwndStatus)
    1465                       WinSetWindowText(grep->hwndCurFile, (*r)->name);
    1466                     else if (WinQueryFocus(HWND_DESKTOP) == grep->hwndFiles)
    1467                       WinSetWindowText(hwndStatus, (*r)->name);
    1468                   }
    1469                   (*r)->flags |= GF_INSERTED;
    1470                   if (((grep->ignoreextdupes) ?
    1471                        comparenamesqe(r, &i) : comparenamesq(r, &i)))
    1472                     (*r)->flags |= GF_SKIPME;
    1473                 }
    1474                 if (!(i->flags & (GF_INSERTED | GF_SKIPME))) {
    1475                   if (!AddToList(i->name, &list, &numfiles, &numalloced)) {
    1476                     i->flags |= GF_INSERTED;
    1477                     if ((*r)->flags & GF_SKIPME)
    1478                       i->flags |= GF_SKIPME;
    1479                   }
    1480                 }
    1481                 r++;
    1482               }
    1483             }
    1484           }
    1485         }
    1486         i = i->next;
    1487         y++;
    1488         // 08 Feb 08 SHL
    1489         if (IsITimerExpired(pitdReport)) {
    1490           CHAR s[44];
    1491           sprintf(s, GetPString(IDS_GREPDUPECHECKPROGTEXT), y, grep->numfiles);
    1492           if (!hwndStatus)
    1493             WinSetWindowText(grep->hwndCurFile, s);
    1494           else {
    1495             if (WinQueryFocus(HWND_DESKTOP) == grep->hwndFiles)
    1496               WinSetWindowText(hwndStatus, s);
    1497           }
    1498         }
    1499         // DosSleep(0); //26 Aug 07 GKY 1
     1357        if (*grep->stopflag)
     1358          break;
     1359        SleepIfNeeded(pitdSleep, 1);    // 07 Feb 08 SHL
     1360        if (!(i->flags & GF_SKIPME)) {
     1361          r = (DUPES **) bsearch(i, grep->dupenames, x, sizeof(DUPES *),
     1362                                ((grep->ignoreextdupes) ? comparenamesbe :
     1363                                  comparenamesb));
     1364          if (r) {
     1365            while (r > grep->dupenames && ((grep->ignoreextdupes) ?
     1366                                        !comparenamesqe((r - 1), &i) :
     1367                                        !comparenamesq((r - 1), &i)))
     1368              r--;
     1369            while (*r && ((grep->ignoreextdupes) ?
     1370                          !comparenamesqe(r, &i) : !comparenamesq(r, &i))) {
     1371              if (*r == i || ((*r)->flags & (GF_INSERTED | GF_SKIPME))) {
     1372                r++;
     1373                continue;
     1374              }
     1375              if (grep->CRCdupes) {
     1376                if ((*r)->CRC == -1L) {
     1377                  (*r)->CRC = CRCFile((*r)->name, &error);
     1378                  if (error)
     1379                    (*r)->CRC = -1L;
     1380                  else if ((*r)->CRC == -1L)
     1381                    (*r)->CRC = 0L;
     1382                }
     1383                if (i->CRC == -1L) {
     1384                  i->CRC = CRCFile(i->name, &error);
     1385                  if (error)
     1386                    i->CRC = -1L;
     1387                  else if (i->CRC == -1L)
     1388                    i->CRC = 0L;
     1389                }
     1390                if (((*r)->size != i->size) || ((*r)->CRC != -1L &&
     1391                                                i->CRC != -1L
     1392                                                && (*r)->CRC != i->CRC)) {
     1393                  r++;
     1394                  continue;
     1395                }
     1396              }
     1397              if (!AddToList((*r)->name, &list, &numfiles, &numalloced)) {
     1398                (*r)->flags |= GF_INSERTED;
     1399                if (grep->sayfiles) {
     1400                  if (!hwndStatus)
     1401                    WinSetWindowText(grep->hwndFiles, (*r)->name);
     1402                  else if (WinQueryFocus(HWND_DESKTOP) == grep->hwndFiles)
     1403                    WinSetWindowText(hwndStatus, (*r)->name);
     1404                }
     1405                if ((*r)->size == i->size &&
     1406                    (i->date.year == (*r)->date.year &&
     1407                     i->date.month == (*r)->date.month &&
     1408                     i->date.day == (*r)->date.day &&
     1409                     i->time.hours == (*r)->time.hours &&
     1410                     i->time.minutes == (*r)->time.minutes &&
     1411                     i->time.twosecs == (*r)->time.twosecs))
     1412                  (*r)->flags |= GF_SKIPME;
     1413              }
     1414              if (!(i->flags & (GF_INSERTED | GF_SKIPME))) {
     1415                if (!AddToList(i->name, &list, &numfiles, &numalloced)) {
     1416                  i->flags |= GF_INSERTED;
     1417                  if ((*r)->flags & GF_SKIPME)
     1418                    i->flags |= GF_SKIPME;
     1419                }
     1420              }
     1421              r++;
     1422            }
     1423          }
     1424          if (!grep->nosizedupes) {
     1425            r = (DUPES **) bsearch(i,
     1426                                   grep->dupesizes,
     1427                                   x, sizeof(DUPES *), comparesizesb);
     1428            if (r) {
     1429              while (r > grep->dupesizes && !comparesizesq((r - 1), &i))
     1430                r--;
     1431              while (*r && !comparesizesq(r, &i)) {
     1432                if (*r == i || ((*r)->flags & (GF_INSERTED | GF_SKIPME)) ||
     1433                    (i->date.year != (*r)->date.year ||
     1434                     i->date.month != (*r)->date.month ||
     1435                     i->date.day != (*r)->date.day ||
     1436                     i->time.hours != (*r)->time.hours ||
     1437                     i->time.minutes != (*r)->time.minutes ||
     1438                     i->time.twosecs != (*r)->time.twosecs)) {
     1439                  r++;
     1440                  continue;
     1441                }
     1442                if (grep->CRCdupes) {
     1443                  if ((*r)->CRC == -1L) {
     1444                    (*r)->CRC = CRCFile((*r)->name, &error);
     1445                    if (error)
     1446                      (*r)->CRC = -1L;
     1447                    else if ((*r)->CRC == -1L)
     1448                      (*r)->CRC = 0L;
     1449                  }
     1450                  if (i->CRC == -1L) {
     1451                    i->CRC = CRCFile(i->name, &error);
     1452                    if (error)
     1453                      i->CRC = -1L;
     1454                    else if (i->CRC == -1L)
     1455                      i->CRC = 0L;
     1456                  }
     1457                  if ((*r)->CRC != -1L && i->CRC != -1L &&
     1458                      (*r)->CRC != i->CRC) {
     1459                    *r += 1;
     1460                    continue;
     1461                  }
     1462                }
     1463                if (!AddToList((*r)->name, &list, &numfiles, &numalloced)) {
     1464                  if (grep->sayfiles) {
     1465                    if (!hwndStatus)
     1466                      WinSetWindowText(grep->hwndCurFile, (*r)->name);
     1467                    else if (WinQueryFocus(HWND_DESKTOP) == grep->hwndFiles)
     1468                      WinSetWindowText(hwndStatus, (*r)->name);
     1469                  }
     1470                  (*r)->flags |= GF_INSERTED;
     1471                  if (((grep->ignoreextdupes) ?
     1472                       comparenamesqe(r, &i) : comparenamesq(r, &i)))
     1473                    (*r)->flags |= GF_SKIPME;
     1474                }
     1475                if (!(i->flags & (GF_INSERTED | GF_SKIPME))) {
     1476                  if (!AddToList(i->name, &list, &numfiles, &numalloced)) {
     1477                    i->flags |= GF_INSERTED;
     1478                    if ((*r)->flags & GF_SKIPME)
     1479                      i->flags |= GF_SKIPME;
     1480                  }
     1481                }
     1482                r++;
     1483              }
     1484            }
     1485          }
     1486        }
     1487        i = i->next;
     1488        y++;
     1489        // 08 Feb 08 SHL
     1490        if (IsITimerExpired(pitdReport)) {
     1491          CHAR s[44];
     1492          sprintf(s, GetPString(IDS_GREPDUPECHECKPROGTEXT), y, grep->numfiles);
     1493          if (!hwndStatus)
     1494            WinSetWindowText(grep->hwndCurFile, s);
     1495          else {
     1496            if (WinQueryFocus(HWND_DESKTOP) == grep->hwndFiles)
     1497              WinSetWindowText(hwndStatus, s);
     1498          }
     1499        }
     1500        // DosSleep(0); //26 Aug 07 GKY 1
    15001501      } // while
    15011502    }
     
    15041505      DosBeep(50, 100);
    15051506      if (!hwndStatus)
    1506         WinSetWindowText(grep->hwndCurFile, GetPString(IDS_GREPDUPECOMPARINGTEXT));
     1507        WinSetWindowText(grep->hwndCurFile, GetPString(IDS_GREPDUPECOMPARINGTEXT));
    15071508      else if (WinQueryFocus(HWND_DESKTOP) == grep->hwndFiles)
    1508         WinSetWindowText(hwndStatus, GetPString(IDS_GREPDUPECOMPARINGTEXT));
     1509        WinSetWindowText(hwndStatus, GetPString(IDS_GREPDUPECOMPARINGTEXT));
    15091510      x = y = 0;
    15101511      xfree(grep->dupenames, pszSrcFile, __LINE__);
     
    15161517#      endif
    15171518
    1518       InitITimer(pitdSleep, 0);         // Reset rate estimator
     1519      InitITimer(pitdSleep, 0);         // Reset rate estimator
    15191520      i = grep->dupehead;
    15201521      while (i) {
    1521         if (*grep->stopflag)
    1522           break;
    1523         SleepIfNeeded(pitdSleep, 1);
    1524         if (!(i->flags & GF_SKIPME)) {
    1525           if (IsITimerExpired(pitdReport)) {
    1526             // if (!(y % cntr)) { }
    1527             CHAR s[44];
    1528             sprintf(s, GetPString(IDS_GREPDUPECHECKPROGTEXT), y, grep->numfiles);
    1529             if (!hwndStatus)
    1530               WinSetWindowText(grep->hwndCurFile, s);
    1531             else if (WinQueryFocus(HWND_DESKTOP) == grep->hwndFiles)
    1532               WinSetWindowText(hwndStatus, s);
    1533             // DosSleep(0); //26 Aug 07 GKY 1   // 07 Feb 08 SHL
    1534           }
    1535           y++;
    1536           pi = strrchr(i->name, '\\');
    1537           if (pi)
    1538             pi++;
    1539           else
    1540             pi = i->name;
    1541           c = grep->dupehead;
    1542           while (c) {
    1543             if (*grep->stopflag)
    1544               break;
    1545             if (c != i && !(c->flags & (GF_INSERTED | GF_SKIPME))) {
    1546               x++;
    1547               pc = strrchr(c->name, '\\');
    1548               if (pc)
    1549                 pc++;
    1550               else
    1551                 pc = c->name;
    1552               if ((!grep->nosizedupes && i->size == c->size && i->date.year == c->date.year && i->date.month == c->date.month && i->date.day == c->date.day && i->time.hours == c->time.hours && i->time.minutes == c->time.minutes && i->time.twosecs == c->time.twosecs) || !stricmp(pc, pi)) {       // potential dupe
    1553                 if (grep->CRCdupes) {
    1554                   if (grep->CRCdupes) {
    1555                     if (c->CRC == -1L) {
    1556                       c->CRC = CRCFile(c->name, &error);
    1557                       if (error)
    1558                         c->CRC = -1L;
    1559                       else if (c->CRC == -1L)
    1560                         c->CRC = 0L;
    1561                     }
    1562                     if (i->CRC == -1L) {
    1563                       i->CRC = CRCFile(i->name, &error);
    1564                       if (error)
    1565                         i->CRC = -1L;
    1566                       else if (i->CRC == -1L)
    1567                         i->CRC = 0L;
    1568                     }
    1569                     if ((c->size != i->size) || (c->CRC != -1L &&
    1570                                                 i->CRC != -1L
    1571                                                 && c->CRC != i->CRC)) {
    1572                       c = c->next;
    1573                       continue;
    1574                     }
    1575                   }
    1576                 }
    1577                 if (AddToList(c->name, &list, &numfiles, &numalloced))
    1578                   goto BreakOut;        // Failed
    1579                 if (!(i->flags & GF_INSERTED)) {
    1580                   if (AddToList(i->name, &list, &numfiles, &numalloced))
    1581                     goto BreakOut;      // Failed
    1582                 }
    1583                 if (grep->sayfiles) {
    1584                   if (!hwndStatus)
    1585                     WinSetWindowText(grep->hwndCurFile, pc);
    1586                   else if (WinQueryFocus(HWND_DESKTOP) == grep->hwndFiles)
    1587                     WinSetWindowText(hwndStatus, pc);
    1588                 }
    1589                 c->flags |= GF_INSERTED;
    1590                 i->flags |= GF_INSERTED;
    1591                 if (!stricmp(pc, pi)) {
    1592                   c->flags |= GF_SKIPME;
    1593                   i->flags |= GF_SKIPME;
    1594                 }
    1595               }
    1596               // else if (!(x % 100))   // 07 Feb 08 SHL
    1597               //        DosSleep(0);  //26 Aug 07 GKY 1 // 07 Feb 08 SHL
    1598             }
    1599             c = c->next;
    1600           }
    1601         }
    1602         i = i->next;
     1522        if (*grep->stopflag)
     1523          break;
     1524        SleepIfNeeded(pitdSleep, 1);
     1525        if (!(i->flags & GF_SKIPME)) {
     1526          if (IsITimerExpired(pitdReport)) {
     1527            // if (!(y % cntr)) { }
     1528            CHAR s[44];
     1529            sprintf(s, GetPString(IDS_GREPDUPECHECKPROGTEXT), y, grep->numfiles);
     1530            if (!hwndStatus)
     1531              WinSetWindowText(grep->hwndCurFile, s);
     1532            else if (WinQueryFocus(HWND_DESKTOP) == grep->hwndFiles)
     1533              WinSetWindowText(hwndStatus, s);
     1534            // DosSleep(0); //26 Aug 07 GKY 1   // 07 Feb 08 SHL
     1535          }
     1536          y++;
     1537          pi = strrchr(i->name, '\\');
     1538          if (pi)
     1539            pi++;
     1540          else
     1541            pi = i->name;
     1542          c = grep->dupehead;
     1543          while (c) {
     1544            if (*grep->stopflag)
     1545              break;
     1546            if (c != i && !(c->flags & (GF_INSERTED | GF_SKIPME))) {
     1547              x++;
     1548              pc = strrchr(c->name, '\\');
     1549              if (pc)
     1550                pc++;
     1551              else
     1552                pc = c->name;
     1553              if ((!grep->nosizedupes && i->size == c->size && i->date.year == c->date.year && i->date.month == c->date.month && i->date.day == c->date.day && i->time.hours == c->time.hours && i->time.minutes == c->time.minutes && i->time.twosecs == c->time.twosecs) || !stricmp(pc, pi)) {       // potential dupe
     1554                if (grep->CRCdupes) {
     1555                  if (grep->CRCdupes) {
     1556                    if (c->CRC == -1L) {
     1557                      c->CRC = CRCFile(c->name, &error);
     1558                      if (error)
     1559                        c->CRC = -1L;
     1560                      else if (c->CRC == -1L)
     1561                        c->CRC = 0L;
     1562                    }
     1563                    if (i->CRC == -1L) {
     1564                      i->CRC = CRCFile(i->name, &error);
     1565                      if (error)
     1566                        i->CRC = -1L;
     1567                      else if (i->CRC == -1L)
     1568                        i->CRC = 0L;
     1569                    }
     1570                    if ((c->size != i->size) || (c->CRC != -1L &&
     1571                                                i->CRC != -1L
     1572                                                && c->CRC != i->CRC)) {
     1573                      c = c->next;
     1574                      continue;
     1575                    }
     1576                  }
     1577                }
     1578                if (AddToList(c->name, &list, &numfiles, &numalloced))
     1579                  goto BreakOut;        // Failed
     1580                if (!(i->flags & GF_INSERTED)) {
     1581                  if (AddToList(i->name, &list, &numfiles, &numalloced))
     1582                    goto BreakOut;      // Failed
     1583                }
     1584                if (grep->sayfiles) {
     1585                  if (!hwndStatus)
     1586                    WinSetWindowText(grep->hwndCurFile, pc);
     1587                  else if (WinQueryFocus(HWND_DESKTOP) == grep->hwndFiles)
     1588                    WinSetWindowText(hwndStatus, pc);
     1589                }
     1590                c->flags |= GF_INSERTED;
     1591                i->flags |= GF_INSERTED;
     1592                if (!stricmp(pc, pi)) {
     1593                  c->flags |= GF_SKIPME;
     1594                  i->flags |= GF_SKIPME;
     1595                }
     1596              }
     1597              // else if (!(x % 100))   // 07 Feb 08 SHL
     1598              //        DosSleep(0);  //26 Aug 07 GKY 1 // 07 Feb 08 SHL
     1599            }
     1600            c = c->next;
     1601          }
     1602        }
     1603        i = i->next;
    16031604      } // while
    16041605    }
     
    16081609  if (numfiles && list) {
    16091610    if (!PostMsg(grep->hwndFiles,
    1610                 WM_COMMAND,
    1611                 MPFROM2SHORT(IDM_COLLECTOR, 0),
    1612                 MPFROMP(list)))
     1611                WM_COMMAND,
     1612                MPFROM2SHORT(IDM_COLLECTOR, 0),
     1613                MPFROMP(list)))
    16131614      FreeList(list);
    16141615  }
Note: See TracChangeset for help on using the changeset viewer.