From: simon Date: Mon, 25 Sep 2000 10:55:00 +0000 (+0000) Subject: Pageant now allows filenames with spaces on cmdline. Thanks to Brian Coogan X-Git-Url: https://git.distorted.org.uk/u/mdw/putty/commitdiff_plain/8c42f28c3cdeae6d882e5b8eff465ef6e6cc3d1a?hp=905beba565b5f023c9407be7413a625e6bd70cf1 Pageant now allows filenames with spaces on cmdline. Thanks to Brian Coogan git-svn-id: svn://svn.tartarus.org/sgt/putty@623 cda61777-01e9-0310-a592-d414129be87e --- diff --git a/pageant.c b/pageant.c index 09ef17e1..16197490 100644 --- a/pageant.c +++ b/pageant.c @@ -608,16 +608,28 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show) { /* * Process the command line and add RSA keys as listed on it. - * FIXME: we don't support spaces in filenames here. We should. */ { - char *p = cmdline; + char *p; + int inquotes = 0; + p = cmdline; while (*p) { while (*p && isspace(*p)) p++; if (*p && !isspace(*p)) { - char *q = p; - while (*p && !isspace(*p)) p++; - if (*p) *p++ = '\0'; + char *q = p, *pp = p; + while (*p && (inquotes || !isspace(*p))) + { + if (*p == '"') { + inquotes = !inquotes; + p++; + continue; + } + *pp++ = *p++; + } + if (*pp) { + if (*p) p++; + *pp++ = '\0'; + } add_keyfile(q); } }