@@ -309,6 +309,7 @@ static win_env conv_envvars[] =
309
309
{NL (" HOME=" ), NULL , NULL , env_path_to_posix, env_path_to_win32, false },
310
310
{NL (" LD_LIBRARY_PATH=" ), NULL , NULL ,
311
311
env_plist_to_posix, env_plist_to_win32, true },
312
+ {NL (" SHELL=" ), NULL , NULL , env_path_to_posix, env_path_to_win32, true , true },
312
313
{NL (" TMPDIR=" ), NULL , NULL , env_path_to_posix, env_path_to_win32, false },
313
314
{NL (" TMP=" ), NULL , NULL , env_path_to_posix, env_path_to_win32, false },
314
315
{NL (" TEMP=" ), NULL , NULL , env_path_to_posix, env_path_to_win32, false },
@@ -337,7 +338,7 @@ static const unsigned char conv_start_chars[256] =
337
338
WC, 0 , 0 , 0 , WC, 0 , 0 , 0 ,
338
339
/* 80 */
339
340
/* P Q R S T U V W */
340
- WC, 0 , 0 , 0 , WC, 0 , 0 , 0 ,
341
+ WC, 0 , 0 , WC, WC, 0 , 0 , 0 ,
341
342
/* 88 */
342
343
/* x Y Z */
343
344
0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,
@@ -366,6 +367,7 @@ win_env::operator = (struct win_env& x)
366
367
toposix = x.toposix ;
367
368
towin32 = x.towin32 ;
368
369
immediate = false ;
370
+ skip_if_empty = x.skip_if_empty ;
369
371
return *this ;
370
372
}
371
373
@@ -387,6 +389,8 @@ win_env::add_cache (const char *in_posix, const char *in_native)
387
389
native = (char *) realloc (native, namelen + 1 + strlen (in_native));
388
390
stpcpy (stpcpy (native, name), in_native);
389
391
}
392
+ else if (skip_if_empty && !*in_posix)
393
+ native = (char *) calloc (1 , 1 );
390
394
else
391
395
{
392
396
tmp_pathbuf tp;
@@ -452,6 +456,8 @@ posify_maybe (char **here, const char *value, char *outenv)
452
456
return ;
453
457
454
458
int len = strcspn (src, " =" ) + 1 ;
459
+ if (conv->skip_if_empty && !src[len])
460
+ return ;
455
461
456
462
/* Turn all the items from c:<foo>;<bar> into their
457
463
mounted equivalents - if there is one. */
0 commit comments