diff options
author | Scott Prager <splinterofchaos@gmail.com> | 2014-09-04 23:44:24 -0400 |
---|---|---|
committer | Scott Prager <splinterofchaos@gmail.com> | 2014-09-30 19:35:46 -0400 |
commit | 566ce93135c5762f5a2708dccf8a8b573f42438c (patch) | |
tree | 5352aaaa5453b72f7e941d9f0b1f82728775aecc /src/nvim/misc1.c | |
parent | d3cd3d2b8f84f87d9f6bc32d085fb5741771857b (diff) | |
download | rneovim-566ce93135c5762f5a2708dccf8a8b573f42438c.tar.gz rneovim-566ce93135c5762f5a2708dccf8a8b573f42438c.tar.bz2 rneovim-566ce93135c5762f5a2708dccf8a8b573f42438c.zip |
vim-patch:7.4.248
Problem: Cannot distinguish between NL and NUL in output of system().
Solution: Add systemlist(). (ZyX)
https://code.google.com/p/vim/source/detail?r=v7-4-248
Diffstat (limited to 'src/nvim/misc1.c')
-rw-r--r-- | src/nvim/misc1.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/nvim/misc1.c b/src/nvim/misc1.c index 52780b9a57..f832fa25f2 100644 --- a/src/nvim/misc1.c +++ b/src/nvim/misc1.c @@ -3401,13 +3401,16 @@ void fast_breakcheck(void) /* * 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 ( char_u *cmd, char_u *infile, /* optional input file name */ - int flags /* can be SHELL_SILENT */ + int flags, // can be kShellOptSilent + size_t *ret_len ) { char_u *tempname; @@ -3463,13 +3466,15 @@ get_cmd_output ( EMSG2(_(e_notread), tempname); 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) if (buffer[i] == NUL) buffer[i] = 1; buffer[len] = NUL; /* make sure the buffer is terminated */ + } else { + *ret_len = len; } done: |