[hackers] [libixp] Fixed arg parsing in ixpc.c

From: Kris Maglione <jg_AT_suckless.org>
Date: Fri Feb 16 08:14:46 2007

changeset: 32:b42525592801
tag: tip
user: Kris Maglione <jg_AT_suckless.org>
date: Fri Feb 16 02:13:56 2007 -0500
summary: Fixed arg parsing in ixpc.c

diff -r 3924985620cb -r b42525592801 ixpc.c
--- a/ixpc.c Fri Feb 16 07:44:04 2007 +0100
+++ b/ixpc.c Fri Feb 16 02:13:56 2007 -0500
@@ -257,13 +257,15 @@ main(int argc, char *argv[]) {
                 }
                 else if(!strncmp(argv[i], "-a", 3))
                         address = argv[++i];
+ if(i + 2 > argc)
+ goto Usage;
         cmd = argv[i++];
+ if(!strcmp(argv[i], "-l")) {
+ details = 1;
+ if(++i >= argc || strcmp(cmd, "ls"))
+ goto Usage;
+ }
         file = argv[i++];
- if((details = !strncmp(cmd, "-l", 3))) {
- if(argc < 3 || strncmp(argv[argc - 3], "ls", 3))
- goto Usage;
- cmd = argv[argc - 3];
- }
         if(!address)
                 ixp_eprint("ixpc: error: $IXP_ADDRESS not set\n");
         if(ixp_client_dial(&c, address, getpid()) == -1)
Received on Fri Feb 16 2007 - 08:14:46 UTC

This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 15:55:22 UTC