Ignore:
Timestamp:
Dec 7, 1999, 12:52:44 AM (26 years ago)
Author:
bird
Message:

Bugfixes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/database/StateUpd.cpp

    r1993 r2004  
    1 /* $Id: StateUpd.cpp,v 1.4 1999-12-06 18:11:49 bird Exp $ */
    2 /*
     1/* $Id: StateUpd.cpp,v 1.5 1999-12-06 23:52:42 bird Exp $
     2 *
    33 * StateUpd - Scans source files for API functions and imports data on them.
    44 *
     
    3636static void openLogs(void);
    3737static void closeLogs(void);
    38 static unsigned long processDir(char *pszDir, BOOL fFile, POPTIONS pOptions);
     38static unsigned long processDir(const char *pszDirOrFile, POPTIONS pOptions);
    3939static unsigned long processFile(const char *pszFilename, POPTIONS pOptions);
    4040static unsigned long processAPI(char **papszLines, int i, int &iRet, const char *pszFilename, POPTIONS pOptions);
     
    215215            /* processing */
    216216            if (argv[argi] == NULL || *argv[argi] == '\0')
    217                 ulRc = processDir(".", FALSE, &options);
     217                ulRc = processDir(".", &options);
    218218            else
    219219                while (argv[argi] != NULL)
    220220                {
    221                     ulRc += processDir(argv[argi],
    222                                        argv[argi][strlen(argv[argi])-1] != '\\' && argv[argi][strlen(argv[argi])-1] != '/',
    223                                        &options);
     221                    ulRc += processDir(argv[argi], &options);
    224222                    argi++;
    225223                }
     
    344342
    345343/**
    346  * Processes a subdirectory and files.
     344 * Processes a file or a subdirectory with files.
    347345 * @returns   high word = number of signals
    348346 *            low  word = number of APIs processed. (1 or 0).
    349  * @param     pszDir    Directory or file, see fFile.
    350  * @param     fFile     File indicator, TRUE: pszDir is a file, FALSE: pszDir is a dir.
    351  * @param     pOptions  Pointer to options.
    352  * @sketch    0. Interpret parameters.
     347 * @param     pszDirOrFile  Directory or file, see fFile.
     348 * @param     pOptions      Pointer to options.
     349 * @sketch    -0. Determin dir or file.
     350 *            0. Interpret parameters.
    353351 *            1. Scan current directory for *.cpp and *.c files and process them.
    354352 *            2. If recusion option is enabled:
    355353 *                   Scan current directory for sub-directories, scan them using recursion.
    356354 */
    357 static unsigned long processDir(char *pszDir, BOOL fFile, POPTIONS pOptions)
     355static unsigned long processDir(const char *pszDirOrFile, POPTIONS pOptions)
    358356{
    359357    unsigned long ulRc = 0; /* high word = #signals, low word = #APIs successfully processed */
     358    char         szBuf[CCHMAXPATH];
    360359    char         szFileSpec[CCHMAXPATH];
    361360    APIRET       rc;
    362361    FILEFINDBUF3 ffb;
     362    FILESTATUS3  fs;
    363363    ULONG        ul = 1;
    364364    HDIR         hDir = (HDIR)HDIR_CREATE;
    365     char        *pszFile;
    366 
    367     /* O. */
     365    PSZ          pszDir;
     366    PSZ          pszFile;
     367    BOOL         fFile;
     368
     369    /* -0.*/
     370    rc = DosQueryPathInfo(pszDirOrFile, FIL_STANDARD, &fs , sizeof(fs));
     371    fFile = rc == NO_ERROR && (fs.attrFile & FILE_DIRECTORY) != FILE_DIRECTORY;
     372
     373    /* 0. */
     374    strcpy(szBuf, pszDirOrFile);
     375    pszDir = szBuf;
    368376    if (fFile)
    369377    {
    370         if ((pszFile = strrchr(pszDir, '\\')) == NULL)
    371             pszFile = strrchr(pszDir, '/');
    372         if (pszFile != NULL)
     378        if ((pszFile = strrchr(pszDir, '\\')) != NULL
     379            || (pszFile = strrchr(pszDir, '/')) != NULL)
    373380            *pszFile++ = '\0';
    374381        else
     
    379386    }
    380387    else
     388    {
    381389        pszFile = NULL;
     390        ul = strlen(pszDir)-1;
     391        if (pszDir[ul] == '\\' || pszDir[ul] == '/')
     392            pszDir[ul] = '\0';
     393    }
    382394
    383395
     
    387399    else
    388400        strcat(strcpy(&szFileSpec[0], pszDir), "\\*.c*");
     401    ul = 1;
    389402    rc = DosFindFirst((PCSZ)&szFileSpec[0], &hDir,
    390403                      FILE_READONLY | FILE_HIDDEN | FILE_SYSTEM | FILE_ARCHIVED,
     
    419432                if (fFile)
    420433                    strcat(strcat(&szFileSpec[0], "\\"), pszFile);
    421                 ulRc += processDir(&szFileSpec[0], fFile, pOptions);
     434                ulRc += processDir(&szFileSpec[0], pOptions);
    422435            }
    423436
Note: See TracChangeset for help on using the changeset viewer.