You are here: Foswiki>WorldFoundry Web>ToolsStandard (30 May 2003, WillNorris;)Edit Attach
Command line tools standards:

  • if run without parameters, should print name of tool, version number, author, copyright, and usage information
  • run without any printing to the screen with the exception of error messages or if the -v or -verbose flag is given (or streams)
  • should prefer the -ooutputfile inputfile* paradigm to a single in, single out (linking with wildargv.c will automatically enable wildcarding) (Kevin doesn't like this)
  • support reading some or all of the command line parameters from a file or the environment (linking with the Cave Logic Studios version of wildargv.c will automatically enable this functionality)
  • Upon error and exit, delete any output files (use atexit() to install a cleanup handler)
  • Install a Ctrl-Break handler. Ctrl-Break/Ctrl-C counts as an error and should clean up after itself
  • Should return 0 upon successful completion and some other number if any errors occur
Do not use a count of errors as the exit status for a program. That does not work, because exit status values are limited to 8 bits (0 through 255). A single run of the program might have 256 errors; if you try to return 256 as the exit status, the parent process will see 0 as the status, and it will appear that the program succeeded.
  • Compile tools as a Windows NT character-mode executable. This doesn't require the dos4gw.exe stub and takes much less time to launch the program. Additionally, NT applications are long filename-aware.
Topic revision: r1 - 30 May 2003, WillNorris;
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback