Mercurial > vim
comparison src/os_unix.c @ 13746:260256caac38 v8.0.1745
patch 8.0.1745: build failure on MS-Windows
commit https://github.com/vim/vim/commit/2060892028e05b1325dc0759259254180669eb5e
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Apr 21 22:30:08 2018 +0200
patch 8.0.1745: build failure on MS-Windows
Problem: Build failure on MS-Windows.
Solution: Build job arguments for MS-Windows. Fix allocating job twice.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sat, 21 Apr 2018 22:45:07 +0200 |
parents | 03224283bafc |
children | 9de2b25932eb |
comparison
equal
deleted
inserted
replaced
13745:b8d9c3a2e7f9 | 13746:260256caac38 |
---|---|
4151 ) | 4151 ) |
4152 break; | 4152 break; |
4153 } | 4153 } |
4154 return wait_pid; | 4154 return wait_pid; |
4155 } | 4155 } |
4156 | |
4157 #if defined(FEAT_JOB_CHANNEL) \ | |
4158 || !defined(USE_SYSTEM) \ | |
4159 || (defined(FEAT_GUI) && defined(FEAT_TERMINAL)) \ | |
4160 || defined(PROTO) | |
4161 /* | |
4162 * Parse "cmd" and put the white-separated parts in "argv". | |
4163 * "argv" is an allocated array with "argc" entries and room for 4 more. | |
4164 * Returns FAIL when out of memory. | |
4165 */ | |
4166 int | |
4167 mch_parse_cmd(char_u *cmd, int use_shcf, char ***argv, int *argc) | |
4168 { | |
4169 int i; | |
4170 char_u *p, *d; | |
4171 int inquote; | |
4172 | |
4173 /* | |
4174 * Do this loop twice: | |
4175 * 1: find number of arguments | |
4176 * 2: separate them and build argv[] | |
4177 */ | |
4178 for (i = 0; i < 2; ++i) | |
4179 { | |
4180 p = skipwhite(cmd); | |
4181 inquote = FALSE; | |
4182 *argc = 0; | |
4183 for (;;) | |
4184 { | |
4185 if (i == 1) | |
4186 (*argv)[*argc] = (char *)p; | |
4187 ++*argc; | |
4188 d = p; | |
4189 while (*p != NUL && (inquote || (*p != ' ' && *p != TAB))) | |
4190 { | |
4191 if (p[0] == '"') | |
4192 /* quotes surrounding an argument and are dropped */ | |
4193 inquote = !inquote; | |
4194 else | |
4195 { | |
4196 if (p[0] == '\\' && p[1] != NUL) | |
4197 { | |
4198 /* First pass: skip over "\ " and "\"". | |
4199 * Second pass: Remove the backslash. */ | |
4200 ++p; | |
4201 } | |
4202 if (i == 1) | |
4203 *d++ = *p; | |
4204 } | |
4205 ++p; | |
4206 } | |
4207 if (*p == NUL) | |
4208 { | |
4209 if (i == 1) | |
4210 *d++ = NUL; | |
4211 break; | |
4212 } | |
4213 if (i == 1) | |
4214 *d++ = NUL; | |
4215 p = skipwhite(p + 1); | |
4216 } | |
4217 if (*argv == NULL) | |
4218 { | |
4219 if (use_shcf) | |
4220 { | |
4221 /* Account for possible multiple args in p_shcf. */ | |
4222 p = p_shcf; | |
4223 for (;;) | |
4224 { | |
4225 p = skiptowhite(p); | |
4226 if (*p == NUL) | |
4227 break; | |
4228 ++*argc; | |
4229 p = skipwhite(p); | |
4230 } | |
4231 } | |
4232 | |
4233 *argv = (char **)alloc((unsigned)((*argc + 4) * sizeof(char *))); | |
4234 if (*argv == NULL) /* out of memory */ | |
4235 return FAIL; | |
4236 } | |
4237 } | |
4238 return OK; | |
4239 } | |
4240 #endif | |
4241 | 4156 |
4242 #if !defined(USE_SYSTEM) || defined(FEAT_JOB_CHANNEL) | 4157 #if !defined(USE_SYSTEM) || defined(FEAT_JOB_CHANNEL) |
4243 /* | 4158 /* |
4244 * Set the environment for a child process. | 4159 * Set the environment for a child process. |
4245 */ | 4160 */ |