updated for version 7.4.248
Problem: Cannot distinguish between NL and NUL in output of system().
Solution: Add systemlist(). (ZyX)
diff --git a/src/misc1.c b/src/misc1.c
index c52945f..a71ab7c 100644
--- a/src/misc1.c
+++ b/src/misc1.c
@@ -10665,7 +10665,7 @@
else
#endif
buffer = get_cmd_output(cmd, NULL,
- (flags & EW_SILENT) ? SHELL_SILENT : 0);
+ (flags & EW_SILENT) ? SHELL_SILENT : 0, NULL);
vim_free(cmd);
if (buffer == NULL)
return 0;
@@ -10765,13 +10765,16 @@
/*
* Get the stdout of an external command.
+ * If "ret_len" is NULL replace NUL characters with NL. When "ret_len" is not
+ * NULL store the length there.
* Returns an allocated string, or NULL for error.
*/
char_u *
-get_cmd_output(cmd, infile, flags)
+get_cmd_output(cmd, infile, flags, ret_len)
char_u *cmd;
char_u *infile; /* optional input file name */
int flags; /* can be SHELL_SILENT */
+ int *ret_len;
{
char_u *tempname;
char_u *command;
@@ -10841,7 +10844,7 @@
vim_free(buffer);
buffer = NULL;
}
- else
+ else if (ret_len == NULL)
{
/* Change NUL into SOH, otherwise the string is truncated. */
for (i = 0; i < len; ++i)
@@ -10850,6 +10853,8 @@
buffer[len] = NUL; /* make sure the buffer is terminated */
}
+ else
+ *ret_len = len;
done:
vim_free(tempname);