#include <stdinc.h>
#include <getparam.h>
string defv[] = {
"key=val\n helpstring",
...
"VERSION=x.y\n mm-ddd-yy AUTHOR",
NULL,
};
string usage="Usage message ... ";
string cvsid="$Id$";
void nemo_main(void)
{
stropen(getparam("in"),"r");
stropen(getparam("out"),"w");
...
}
Instead of starting a program with main(argc,argv) a NEMO program should be started with nemo_main(), but see LIMITATIONS below.
The code for nemo_main looks something like:
#include <stdinc.h>
#include <getparam.h>
extern string defv[]; /* defv MUST be defined in user program
! */
void main(argc,argv)
int argc; /* number of arguments + 1 */
char *argv[]; /* pointer to arguments */
{
if(argv[argc] != NULL)
warning("Your C compiler seems to have an old-style (short) argv[]");
initparam(argv,defv); /* start */
nemo_main(); /* call program */
finiparam(); /* end */
exit(0); /* return normal status to shell
*/
}
~/src/kernel/misc nemomain.c nemomain.cc c and c++ versions ~/src/kernel/io defv.c usage.c stubs for missing extern
29-jun-89 created PJT 28-nov-94 doc PJT 17-mar-04 void PJT