Let's use getopt..

git-svn-id: svn://katsu.triplehelix.org/dgamelaunch/trunk@210 db0b04b0-f4d1-0310-9a6d-de3e77497b0e
This commit is contained in:
Joshua Kwan 2004-02-01 20:53:08 +00:00
parent 38d2f7576b
commit 56fd9165d0
1 changed files with 17 additions and 10 deletions

View File

@ -1478,28 +1478,35 @@ main (int argc, char** argv)
/* for chroot and program execution */
char atrcfilename[81], *spool;
unsigned int len;
int i;
int c;
for (i = 1; i < argc; i++)
while ((c = getopt(argc, argv, "qh:p")) != -1)
{
if (!strcmp(argv[i], "-q")) silent = 1;
if (*argv[i] == '-')
switch (c)
{
i++;
continue;
case 'q':
silent = 1; break;
default:
break; /*ignore */
}
else
}
if (optind < argc)
{
while (optind < argc)
{
if (config)
{
if (!silent)
fprintf(stderr, "warning: using %s\n", argv[i]);
fprintf(stderr, "warning: using %s\n", argv[optind]);
free(config);
}
config = strdup(argv[i]);
config = strdup(argv[optind]);
optind++;
}
}
create_config();
/* signal handlers */