TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: ALL
from: JARI LAAKSONEN
date: 1997-03-28 21:57:00
subject: 08/16 Comment utilities

========== CSplit: Version 2.0 ==========
========== CSplit: Begin part 8/16 ==========
        }
        while (!rc)
        {
            if (pBuff->GetName0() != '.')
            {
                if (pBuff->GetAttr() == FFbuff::ATTR_DIRECTORY)
                {
                    strcpy (szNewPath, szSearchPath);
                    szNewPath[strlen (szSearchPath) - 3] = '\0';
                    strcat (szNewPath, pBuff->GetName());
                    forAllMatch (obj, pnFiles, szNewPath);
                }
            }
            rc = pBuff->FindNext();
        }
    }
    // When we get here, we have in path, the path to the directory we \
\
are
    // going to work with.
    // Process all normal files that match the fileMask in
    // the current directory.
    int len = strlen (szSearchPath);
    strcpy (szNewPath, szSearchPath);
    szNewPath[len - 3] = '\0';
    strcat (szNewPath, fileMask);
    rc = pBuff->FindFirst (szNewPath, 0);
    szSearchPath[len - 3] = '\0';
    // Process each file that matches the mask.
    while (!rc)
    {
        strcpy (szNewPath, szSearchPath);
        strcat (szNewPath, pBuff->GetName());
        if (processFile (obj, szNewPath))
        {
            (*pnFiles)++;
        }
        rc = pBuff->FindNext();
    }
    pBuff->FindClose();
    delete pBuff;
    return 0;
}
int   main (int argc, char **argv)
{
    CommentCounter  obj;
    int             nFiles = 0;
    if (argc < 2)
    {
        fprintf (stderr, "USAGE: CMTCOUNT [-b] [-s] [-t] [-h] \
\
file(s)\n");
        fprintf (stderr, "  -b = check comment balance\n");
        fprintf (stderr, "  -s = include subdirectories\n");
        fprintf (stderr, "  -t = totals only\n");
        fprintf (stderr, "  -h = output in HTML format\n");
        return 1;
    }
    argv++;
    argc--;
    while (argc > 0 && (**argv == '-' || **argv == '/'))
    {
        (*argv)++;
        while (**argv != '\0')
        {
            switch (**argv)
            {
            case 's':
                bSubdirs = 1;
                break;
            case 'b':
                bBalance = 1;
                break;
            case 't':
                bTotalsOnly = 1;
                break;
            case 'h':
                bHtml = 1;
                break;
            default:
                printf (
                    "CMTCOUNT: Unrecognized flag '%c' ignored.\n\n",
                    **argv
                );
                break;
            }
            (*argv)++;
        }
        argv++;
        argc--;
    }
    if (bHtml)
    {
        struct tm   *tm;
        time_t      timer;
        timer = time(NULL);
        tm = localtime(&timer);
        // print some header information first.
        printf (
            "\n"
            "\n"
            "Source code statistics\n"
            "Date: %02d.%02d.%04d, Time: %02d:%02d\n"
            "\n"
            ,
            STR_VERSION,
            tm->tm_mday, tm->tm_mon + 1, 1900 + tm->tm_year,
            tm->tm_hour, tm->tm_min
        );
    }
    if (! bTotalsOnly)
    {
        if (bBalance)
        {
            printf ("  cmt bal\n");
        }
        else
        {
            printf ("C++ cmts  Cmt lin  Cod lin  Tot lin  Cmt/Lin \
\
ratio\n");
========== CSplit: End part 8/16 crc: 54c6 ==========
        // Albert                      email: jla@to.icl.fi
--- GoldED/2 2.50+
---------------
* Origin: Albert's Point/2 in Finland, Europe (2:221/360.20)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.