diff options
author | Bram Moolenaar <Bram@vim.org> | 2014-04-05 19:44:40 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2014-04-05 19:44:40 +0200 |
commit | 39c29ed5118ab513554d1d51d6a98e65f32784ba (patch) | |
tree | 01f3df4888dd4be45f2098fe71b574436d1e3a72 /src/misc1.c | |
parent | 57ebe6e2f94edad6adc43246d98919e728095211 (diff) | |
download | vim-git-39c29ed5118ab513554d1d51d6a98e65f32784ba.tar.gz |
updated for version 7.4.248v7.4.248
Problem: Cannot distinguish between NL and NUL in output of system().
Solution: Add systemlist(). (ZyX)
Diffstat (limited to 'src/misc1.c')
-rw-r--r-- | src/misc1.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/misc1.c b/src/misc1.c index c52945f5c..a71ab7cc9 100644 --- a/src/misc1.c +++ b/src/misc1.c @@ -10665,7 +10665,7 @@ expand_backtick(gap, pat, flags) 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 @@ addfile(gap, f, flags) /* * 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 @@ get_cmd_output(cmd, infile, flags) 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 @@ get_cmd_output(cmd, infile, flags) buffer[len] = NUL; /* make sure the buffer is terminated */ } + else + *ret_len = len; done: vim_free(tempname); |