libixp

git clone git://oldgit.suckless.org/libixp/
Log | Files | Refs | LICENSE

commit c701f98249c31804b073b72e6b2a93748fb35857
parent 1755fb93a2eedabdf569a88512b50875366cd8ce
Author: Kris Maglione <jg@suckless.org>
Date:   Fri, 16 Feb 2007 02:13:56 -0500

Fixed arg parsing in ixpc.c

Diffstat:
ixpc.c | 10++++++----
1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/ixpc.c b/ixpc.c @@ -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++]; - file = argv[i++]; - if((details = !strncmp(cmd, "-l", 3))) { - if(argc < 3 || strncmp(argv[argc - 3], "ls", 3)) + if(!strcmp(argv[i], "-l")) { + details = 1; + if(++i >= argc || strcmp(cmd, "ls")) goto Usage; - cmd = argv[argc - 3]; } + file = argv[i++]; if(!address) ixp_eprint("ixpc: error: $IXP_ADDRESS not set\n"); if(ixp_client_dial(&c, address, getpid()) == -1)