/*
This is a demonstration C source file, used for the c2html user manual.
*/
#include <stdio.h>
#define NUM_ARGS 2
#define ERR_INVALLID_NUM_ARGS 1
#define ERR_UNREC_ARG 2
int main (int argc, char *argv[])
{
if (argc != NUM_ARGS) /* If the number of arguments is not correct */
{
printf ("ERROR: invallid number of arguments\n");
exit (ERR_INVALLID_NUM_ARGS);
}
if (*argv[1] != '-')
{
printf ("ERROR: unrecognized option '%s'\n", argv[1]);
exit (ERR_UNREC_ARG);
}
switch (argv[1][1])
{
case 'b':
printf ("Bla\n");
break;
case 'h':
printf ("Hello world\n");
break;
default:
printf ("ERROR: unrecognized option '%s'\n", argv[1]);
exit (ERR_UNREC_ARG);
break;
}
exit (0);
}