commit 59cdb136429627b740ba26245a2a1bfa81e68ab2
parent ee6b8ff88b8dc82f50deb482d549a3a98521ce6f
Author: Anselm R. Garbe <arg@10kloc.org>
Date: Fri, 13 Oct 2006 09:26:02 +0200
small simplificatio in ixpc
Diffstat:
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/ixpc.c b/ixpc.c
@@ -235,7 +235,7 @@ main(int argc, char *argv[]) {
/* command line args */
if(argc < 2)
- ixp_eprint("usage: ixpc [-a <address>] [-v] create | read | ls [-l] | remove | write <file>\n");
+ goto Usage;
for(i = 1; i < argc; i++)
if(!strncmp(argv[i], "-v", 3)) {
fputs("ixpc-"VERSION", (C)opyright MMIV-MMVI Anselm R. Garbe\n", stdout);
@@ -247,7 +247,7 @@ main(int argc, char *argv[]) {
file = argv[argc - 1];
if((details = !strncmp(cmd, "-l", 3))) {
if(argc < 3 || strncmp(argv[argc - 3], "ls", 3))
- ixp_eprint("usage: ixpc [-a <address>] [-v] create | read | ls [-l] | remove | write <file>\n");
+ goto Usage;
cmd = argv[argc - 3];
}
if(!address)
@@ -264,8 +264,10 @@ main(int argc, char *argv[]) {
ret = xremove(file);
else if(!strncmp(cmd, "write", 6))
ret = xwrite(file, IXP_OWRITE);
- else
+ else {
+Usage:
ixp_eprint("usage: ixpc [-a <address>] [-v] create | read | ls [-l] | remove | write <file>\n");
+ }
/* close socket */
ixp_client_hangup(&c);
return ret;