aboutsummaryrefslogtreecommitdiffstats
path: root/src/bin/elua/io.c
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@samsung.com>2014-05-30 10:09:16 +0100
committerDaniel Kolesa <d.kolesa@samsung.com>2014-06-10 15:48:52 +0100
commita98b916a749d13b85882af5371d0a046ea6210ed (patch)
tree8514ca4d10d1a15aeacc097719d4b61fa3847ebe /src/bin/elua/io.c
parentelua: fclose before realpath (diff)
downloadefl-a98b916a749d13b85882af5371d0a046ea6210ed.tar.gz
elua: get_cmdline_from_argv cleanup + use _popen on windows
Diffstat (limited to 'src/bin/elua/io.c')
-rw-r--r--src/bin/elua/io.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/bin/elua/io.c b/src/bin/elua/io.c
index 3659c1d1f0..c603ce6c74 100644
--- a/src/bin/elua/io.c
+++ b/src/bin/elua/io.c
@@ -10,6 +10,7 @@ get_cmdline_from_argv(const char *fname, const char **argv)
Eina_Strbuf *buf;
char *ret;
char pbuf[PATH_MAX];
+ const char *arg = NULL;
FILE *testf = fopen(fname, "r");
if (!testf)
@@ -26,10 +27,9 @@ get_cmdline_from_argv(const char *fname, const char **argv)
eina_strbuf_append(buf, pbuf);
eina_strbuf_append_char(buf, '"');
- while (*argv)
+ while ((arg = *(argv++)))
{
- const char *arg = *(argv++);
- char c;
+ char c;
eina_strbuf_append_char(buf, ' ');
eina_strbuf_append_char(buf, '"');
@@ -62,7 +62,11 @@ elua_popen_c(const char *path, const char *md, const char *argv[])
char *cmdline = get_cmdline_from_argv(path, argv);
if (!cmdline) return NULL;
+#ifndef _WIN32
ret = popen(cmdline, md);
+#else
+ ret = _popen(cmdline, md);
+#endif
if (!ret) return NULL;
return ret;