Eliminating the getopt disgrace.

This commit is contained in:
Christoph Lohmann
2013-06-14 20:20:47 +02:00
parent 75c97de593
commit 4d38f60685
28 changed files with 724 additions and 476 deletions

View File

@@ -5,14 +5,26 @@
#include <unistd.h>
#include "util.h"
static void
usage(void)
{
eprintf("usage: %s string\n", argv0);
exit(1);
}
int
main(int argc, char *argv[])
{
if(getopt(argc, argv, "") != -1)
exit(EXIT_FAILURE);
if(optind != argc-1)
eprintf("usage: %s string\n", argv[0]);
ARGBEGIN {
default:
usage();
} ARGEND;
if(argc < 1)
usage();
puts(dirname(argv[optind]));
return EXIT_SUCCESS;
return 0;
}