65oo2/vm/main.c

66 lines
1.1 KiB
C
Raw Normal View History

2024-02-29 12:01:58 +00:00
#include "config.h"
#include <stdlib.h>
#include <stdio.h>
#ifdef HAVE_LIBGEN_H
# include <libgen.h>
#endif /* HAVE_LIBGEN_H */
#include <SDL.h>
static const char *prg_name;
static void
usage(int retcode)
{
if (retcode == EXIT_FAILURE)
{
fprintf(stderr,
"Try '%s -h' for more information.\n", prg_name);
}
else
{
printf("Usage: %s [-hV] [-b bios]\n", prg_name);
printf("\t-h\tdisplay this help and exit\n");
printf("\t-V\toutput version information\n");
printf("\nReport bugs to <%s>\n", PACKAGE_BUGREPORT);
}
exit(retcode);
}
static void
version(void)
{
printf("%S version %s\n", PACKAGE_NAME, PACKAGE_VERSION);
exit(EXIT_SUCCESS);
}
int
main(int argc, char **argv)
{
#ifdef HAVE_LIBGEN_H
prg_name = basename(argv[0]);
#else
prg_name = argv[0];
#endif /* HAVE_LIBGEN_H */
while ((argc > 1) && (argv[1][0] == '-'))
{
switch (argv[1][1])
{
case 'h':
usage(EXIT_SUCCESS);
break;
case 'V':
version();
break;
default:
usage(EXIT_FAILURE);
break;
}
argv++;
argc--;
}
return (EXIT_SUCCESS);
}