*/
# if defined(HAVE_GETPWNAM) && defined(HAVE_PWD_H)
{
- struct passwd *pw;
-
/* Note: memory allocated by getpwnam() is never freed.
* Calling endpwent() apparently doesn't help. */
- pw = getpwnam((char *)dst + 1);
- if (pw != NULL)
- var = (char_u *)pw->pw_dir;
- else
- var = NULL;
+ struct passwd *pw = (*dst == NUL)
+ ? NULL : getpwnam((char *)dst + 1);
+
+ var = (pw == NULL) ? NULL : (char_u *)pw->pw_dir;
}
if (var == NULL)
# endif
# endif
if (match_file_list(p_wig, (*files)[i], ffname))
{
- /* remove this matching files from the list */
+ /* remove this matching file from the list */
vim_free((*files)[i]);
for (j = i; j + 1 < *num_files; ++j)
(*files)[j] = (*files)[j + 1];
static int has_special_wildchar(char_u *p);
/*
- * Return TRUE if "p" contains a special wildcard character.
- * Allowing for escaping.
+ * Return TRUE if "p" contains a special wildcard character, one that Vim
+ * cannot expand, requires using a shell.
*/
static int
has_special_wildchar(char_u *p)
{
for ( ; *p; mb_ptr_adv(p))
{
+ /* Allow for escaping. */
if (*p == '\\' && p[1] != NUL)
++p;
else if (vim_strchr((char_u *)SPECIAL_WILDCHAR, *p) != NULL)