aboutsummaryrefslogtreecommitdiffstats
path: root/erts/etc/common/ct_run.c
diff options
context:
space:
mode:
authorBjörn-Egil Dahlberg <[email protected]>2015-12-17 14:11:12 +0100
committerBjörn-Egil Dahlberg <[email protected]>2015-12-17 14:11:12 +0100
commitf77436f337d83a9751dc84d53791500c7f99c92e (patch)
treea69c9c6a6e0789dabaff3a7ce2445997b0ff6bac /erts/etc/common/ct_run.c
parentb855206a1a7788216717ca272f44e9beb1f58e7c (diff)
downloadotp-f77436f337d83a9751dc84d53791500c7f99c92e.tar.gz
otp-f77436f337d83a9751dc84d53791500c7f99c92e.tar.bz2
otp-f77436f337d83a9751dc84d53791500c7f99c92e.zip
Revert "Fix erroneous splitting of emulator path"
This reverts commit 731890f3b4ac62eed1221aa7d9fd2bfa6bf51d8c.
Diffstat (limited to 'erts/etc/common/ct_run.c')
-rw-r--r--erts/etc/common/ct_run.c25
1 files changed, 22 insertions, 3 deletions
diff --git a/erts/etc/common/ct_run.c b/erts/etc/common/ct_run.c
index 11cec26264..548514ee6c 100644
--- a/erts/etc/common/ct_run.c
+++ b/erts/etc/common/ct_run.c
@@ -83,6 +83,7 @@ static int eargc; /* Number of arguments in eargv. */
static void error(char* format, ...);
static char* emalloc(size_t size);
static char* strsave(char* string);
+static void push_words(char* src);
static int run_erlang(char* name, char** argv);
static char* get_default_emulator(char* progname);
#ifdef __WIN32__
@@ -151,8 +152,6 @@ int main(int argc, char** argv)
argv0 = argv;
emulator = get_default_emulator(argv[0]);
- if (strlen(emulator) >= MAXPATHLEN)
- error("Emulator path length is too large");
/*
* Allocate the argv vector to be used for arguments to Erlang.
@@ -164,7 +163,7 @@ int main(int argc, char** argv)
eargv_base = (char **) emalloc(eargv_size*sizeof(char*));
eargv = eargv_base;
eargc = 0;
- PUSH(strsave(emulator));
+ push_words(emulator);
eargc_base = eargc;
eargv = eargv + eargv_size/2;
eargc = 0;
@@ -295,6 +294,26 @@ int main(int argc, char** argv)
return run_erlang(eargv[0], eargv);
}
+static void
+push_words(char* src)
+{
+ char sbuf[MAXPATHLEN];
+ char* dst;
+
+ dst = sbuf;
+ while ((*dst++ = *src++) != '\0') {
+ if (isspace((int)*src)) {
+ *dst = '\0';
+ PUSH(strsave(sbuf));
+ dst = sbuf;
+ do {
+ src++;
+ } while (isspace((int)*src));
+ }
+ }
+ if (sbuf[0])
+ PUSH(strsave(sbuf));
+}
#ifdef __WIN32__
wchar_t *make_commandline(char **argv)
{