Logo linecount: a source code line counter

Home - News - FAQ - Known Bugs - Downloads - License

Q: How do I create a custom class of files?

A: Add a section to the existing configuration file, or create a new configuration file with that section. The configuration file should be an XML file which adheres to the following DTD:

<!ELEMENT linecounter (class*)>

<!ELEMENT class (extensions, comments)>

<!ELEMENT extensions (extension+)>

<!ELEMENT extension EMPTY>
<!ATTLIST extension value NMTOKEN #REQUIRED>
<!ATTLIST extension description CDATA #REQUIRED>

<!ELEMENT comments ((single | multi)+)>


This DTD can be found at
A quite extensive configuration file is included in the downloadable packages.

NOTE: all configuration files must have a DTD declaration, either inline or external!

Q: It keeps telling me "necessary parameter --class missing". What's up?

A: You must always specify the "--class" parameter. The value should be the name of a class in the configuration file. E.g. "--class=java"

Q: Where should I store the configuration file?

A: linecount looks first for "$HOME/.linecounter/linecounter.xml"1; if that file does not exist, it looks for a "linecounter.xml" in the current directory. If that check fails as well, it will produce an error.
Note that you can always override these files by using the "--config" option.

Q: You told me I could find here how to count files. So how do I do it?

A: Use the "-f" option for single files, "-d" for directories that should not be recursed, and "-r" for directories that should be recursed. All three optioons take multiple files / directories, and their order is not important.
E.g., using "-f -d test1 test2 -r test1r test2r" counts the files "" and "", as well as all files in directories "test1" and "test2" but not in their subdirectories, and all files in directories "test1r" and "test2r" and their subdirectories (as long as they match the specified class).

Q: I keep getting a "could not read configuration file" message. What's wrong?

A: If the DTD is an external one, the program may not be able to access it. Try using an inline DTD instead.

1: Although it appears that this will work for UNIX only, it works for Windows as well. $HOME just means the users home directory, which normally is "C:\Documents and Settings\<username>" for Windows2000/XP

Valid HTML 4.01!