diff options
author | Ian Lynagh <igloo@earth.li> | 2008-01-23 16:01:39 +0000 |
---|---|---|
committer | Ian Lynagh <igloo@earth.li> | 2008-01-23 16:01:39 +0000 |
commit | bf93e4a1b9750979dd8b7ed45a25adaac84f91a1 (patch) | |
tree | 29d34882f41e7a21cace2feeb241be4c44e3630e /includes/shell-tools.c | |
parent | 867d76ddb9b4231f36e85abd68c1ed26d834d039 (diff) | |
download | haskell-bf93e4a1b9750979dd8b7ed45a25adaac84f91a1.tar.gz |
Fix setting argv[0] in shell-utils.c on Windows
Diffstat (limited to 'includes/shell-tools.c')
-rw-r--r-- | includes/shell-tools.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/includes/shell-tools.c b/includes/shell-tools.c index 4aebaf94f3..82c22d38bc 100644 --- a/includes/shell-tools.c +++ b/includes/shell-tools.c @@ -57,7 +57,7 @@ int run(char *this, char *program, int argc, char** argv) { /* Compute length of the flattened 'argv', including spaces! */ cmdline_len = 0; - for(i = 1; i < argc; i++) { + for(i = 0; i < argc; i++) { /* Note: play it safe and quote all argv strings */ /* In the worst case we have to escape every character with a \ */ cmdline_len += 1 + 2 * strlen(argv[i]) + 2; @@ -69,7 +69,7 @@ int run(char *this, char *program, int argc, char** argv) { } ptr = new_cmdline; - for(i = 1; i < argc; i++) { + for(i = 0; i < argc; i++) { *ptr++ = ' '; *ptr++ = '"'; src = argv[i]; @@ -83,6 +83,7 @@ int run(char *this, char *program, int argc, char** argv) { *ptr++ = '"'; } *ptr = '\0'; + new_cmdline = new_cmdline + 1; /* Skip the leading space */ /* Note: Used to use _spawnv(_P_WAIT, ...) here, but it suffered from the parent intercepting console events such as Ctrl-C, |