Changeset 4700 for trunk/tools


Ignore:
Timestamp:
Nov 26, 2000, 12:26:40 PM (25 years ago)
Author:
bird
Message:

Added exclude file option, -x <file;file...>.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/fastdep/fastdep.c

    r4653 r4700  
    1 /* $Id: fastdep.c,v 1.23 2000-11-21 04:35:36 bird Exp $
     1/* $Id: fastdep.c,v 1.24 2000-11-26 11:26:40 bird Exp $
    22 *
    33 * Fast dependents. (Fast = Quick and Dirty!)
     
    9999    BOOL            fCheckCyclic;       /* allways check for cylic dependency before inserting an dependent. */
    100100    BOOL            fCacheSearchDirs;   /* cache entire search dirs. */
     101    const char *    pszExcludeFiles;    /* List of excluded files. */
    101102} OPTIONS, *POPTIONS;
    102103
     
    314315    static char szInclude[32768] = ";";
    315316    static char szExclude[32768] = ";";
     317    static char szExcludeFiles[65536] = "";
    316318
    317319    OPTIONS options =
     
    329331        FALSE,           /* fAppend */
    330332        TRUE,            /* fCheckCyclic */
    331         TRUE             /* fCacheSearchDirs */
     333        TRUE,            /* fCacheSearchDirs */
     334        szExcludeFiles   /* pszExcludeFiles */
    332335    };
    333336
     
    401404                    else
    402405                    {
    403                         if (argi + 1 < argc)
    404                             pszDepFile = argv[++argi];
     406                        argi++;
     407                        if (argi < argc)
     408                            pszDepFile = argv[argi];
    405409                        else
    406410                        {
     
    441445                    else
    442446                    {
    443                         psz = argv[argi+1];
    444                         argi++;
     447                        if (++argi >= argc)
     448                        {
     449                            fprintf(stderr, "syntax error! Option -e.\n");
     450                            return 1;
     451                        }
     452                        psz = argv[argi];
    445453                    }
    446454                    /* check if enviroment variable */
     
    478486                    else
    479487                    {
    480                         psz = argv[argi+1];
    481                         argi++;
     488                        if (++argi >= argc)
     489                        {
     490                            fprintf(stderr, "syntax error! Option -i.\n");
     491                            return 1;
     492                        }
     493                        psz = argv[argi];
    482494                    }
    483495                    /* check if enviroment variable */
     
    534546                        else
    535547                        {
    536                             strcpy(szObjectExt, argv[argi+1]);
    537                             argi++;
     548                            if (++argi >= argc)
     549                            {
     550                                fprintf(stderr, "syntax error! Option -obj.\n");
     551                                return 1;
     552                            }
     553                            strcpy(szObjectExt, argv[argi]);
    538554                        }
    539555                        break;
     
    551567                    else
    552568                    {
    553                         strcpy(szObjectDir, argv[argi+1]);
    554                         argi++;
     569                        if (++argi >= argc)
     570                        {
     571                            fprintf(stderr, "syntax error! Option -o.\n");
     572                            return 1;
     573                        }
     574                        strcpy(szObjectDir, argv[argi]);
    555575                    }
    556576                    if (szObjectDir[0] != '\0'
     
    567587                    else
    568588                    {
    569                         strcpy(szRsrcExt, argv[argi+1]);
    570                         argi++;
     589                        if (++argi >= argc)
     590                        {
     591                            fprintf(stderr, "syntax error! Option -r.\n");
     592                            return 1;
     593                        }
     594                        strcpy(szRsrcExt, argv[argi]);
     595                    }
     596                    break;
     597
     598                case 'x':
     599                case 'X': /* Exclude files */
     600                    psz = &achBuffer[CCHMAXPATH+8];
     601                    if (strlen(argv[argi]) > 2)
     602                        strcpy(psz, &argv[argi][2]);
     603                    else
     604                    {
     605                        if (++argi >= argc)
     606                        {
     607                            fprintf(stderr, "syntax error! Option -x.\n");
     608                            return 1;
     609                        }
     610                        strcpy(psz, argv[argi]);
     611                    }
     612                    while (psz != NULL && *psz != ';')
     613                    {
     614                        char *  pszNext = strchr(psz, ';');
     615                        int     cch = strlen(szExcludeFiles);
     616                        if (pszNext)
     617                            *pszNext++ = '\0';
     618                        if (DosQueryPathInfo(psz, FIL_QUERYFULLNAME, &szExcludeFiles[cch], CCHMAXPATH))
     619                        {
     620                            fprintf(stderr, "error: Invalid exclude name\n");
     621                            return -1;
     622                        }
     623                        strlwr(&szExcludeFiles[cch]);
     624                        strcat(&szExcludeFiles[cch], ";");
     625                        psz = pszNext;
    571626                    }
    572627                    break;
     
    670725                     )
    671726                {
    672                     char *psz;
    673                     char  szSource[CCHMAXPATH];
     727                    const char *    psz;
     728                    char            szSource[CCHMAXPATH];
     729                    BOOL            fExcluded;
    674730
    675731                    /*
     
    688744
    689745                    /*
     746                     * Check if this is an excluded file.
     747                     */
     748                    fExcluded = FALSE;
     749                    psz = options.pszExcludeFiles;
     750                    while (*psz != '\0' && *psz != ';')
     751                    {
     752                        const char * pszNext = strchr(psz, ';');
     753                        if (strlen(szSource) == pszNext - psz && strncmp(szSource, psz, pszNext - psz) == 0)
     754                            fExcluded = TRUE;
     755                        psz = pszNext + 1;
     756                    }
     757                    if (fExcluded)
     758                        continue;
     759
     760                    /*
    690761                     * Analyse the file.
    691762                     */
     
    729800        "Syntax: FastDep [-a<[+]|->] [-ca] [-cy<[+]|->] [-d <outputfn>]\n"
    730801        "                [-e <excludepath>] [-eall<[+]|->] [-i <include>] [-n<[+]|->]\n"
    731         "                [-o <objdir>] [-obr<[+]|->]  <files>\n"
     802        "                [-o <objdir>] [-obr<[+]|->] [-x <f1[;f2]>] [-r <rsrcext>]\n"
     803        "                <files> [more options [more files [...]]]\n"
    732804        "    or\n"
    733805        "        FastDep [options] @<parameterfile>\n"
     
    756828        "   -obj[ ]<objext> Object extention.           Default: obj\n"
    757829        "   -r[ ]<rsrcext>  Resource binary extention.  Default: res\n"
     830        "   -x[ ]<f1[;f2]>  Files to exclude. Only exact filenames.\n"
    758831        "   <files>         Files to scan. Wildchars are allowed.\n"
    759832        "\n"
     833        "Options and files could be mixed.\n"
    760834        " copyright (c) 1999-2000 knut st. osmundsen (knut.stange.osmundsen@pmsc.no)\n",
    761835        pszDefaultDepFile
Note: See TracChangeset for help on using the changeset viewer.