aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile2
-rw-r--r--nopen.c17
2 files changed, 13 insertions, 6 deletions
diff --git a/Makefile b/Makefile
index bd202bd..ff636bc 100644
--- a/Makefile
+++ b/Makefile
@@ -19,7 +19,7 @@ nopen: $(NOPENOBJ)
dprintf.o: util.h
noice.o: arg.h noiceconf.h util.h
-nopen.o: nopenconf.h util.h
+nopen.o: arg.h nopenconf.h util.h
spawn.o: util.h
strlcat.o: util.h
strlcpy.o: util.h
diff --git a/nopen.c b/nopen.c
index 7e74416..d0581bc 100644
--- a/nopen.c
+++ b/nopen.c
@@ -8,6 +8,7 @@
#include <string.h>
#include <unistd.h>
+#include "arg.h"
#include "util.h"
struct assoc {
@@ -19,6 +20,8 @@ struct assoc {
#include "nopenconf.h"
+char *argv0;
+
void
run(struct assoc *assoc, char *arg)
{
@@ -67,7 +70,7 @@ initassocs(void)
}
void
-usage(char *argv0)
+usage(void)
{
fprintf(stderr, "usage: %s file...\n", argv0);
exit(1);
@@ -76,10 +79,14 @@ usage(char *argv0)
int
main(int argc, char *argv[])
{
- if (argc == 1)
- usage(argv[0]);
- argc--;
- argv++;
+ ARGBEGIN {
+ default:
+ usage();
+ } ARGEND
+
+ if (argc == 0)
+ usage();
+
initassocs();
for (; *argv != NULL; argv++) {
struct assoc *assoc;
Un proyecto texto-plano.xyz