annote is a command line tool for creating annotated C source listings as HTML files. annote provides a main routine which handles command line arguments, and relies on html to do the work.

annote.h

Copyright © 2003, 2004 Dave Bayer. Subject to the terms and conditions of the MIT License.

Command line variables:

extern unsigned detab;
extern BOOL nocss;

annote.c

Copyright © 2003, 2004 Dave Bayer. Subject to the terms and conditions of the MIT License.

#include "root.h"
#include "file.h"
#include "filter.h"
#include "merge.h"
#include "html.h"

detab

If detab is nonzero, detab source file inputs using a tab stop every detab spaces.

unsigned detab = 4;

nocss

If nocss is YES, do not write the style file style.css.

BOOL nocss = NO;

main

Pass the file name arguments to htmlFromDoc.

int main( int argc, const char *argv[] )
{
    const char huh[] = "annote: argument not understood,";
    unsigned n;

    --argc, ++argv;
    while ( argc > 0 && **argv == '-' )
    {
        if ( strcmp( *argv, "-detab" ) == 0 )
        {
            --argc, ++argv;
            if ( sscanf( *argv, "%u", &n ) == 1 )
                detab = n;
            else
                fprintf( stderr, "%s -detab %s\n", huh, *argv );
        }
        else if ( strcmp( *argv, "-nocss" ) == 0 )
        {
            --argc, ++argv;
                nocss = YES;
        }
        else
            fprintf( stderr, "%s %s\n", huh, *argv );
        --argc, ++argv;
    }
    htmlFromDoc( argc, argv );
    return 0;
}