Upgrade from new bash

This commit is contained in:
Andrey A. Chernov 1994-12-30 14:39:39 +00:00
parent 7658fd20d7
commit 7ccdf7da4c
2 changed files with 12 additions and 17 deletions

View File

@ -22,15 +22,15 @@
675 Mass Ave, Cambridge, MA 02139, USA. */
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
# include "config.h"
#endif
#include <sys/types.h>
#include <signal.h>
#include <errno.h>
#include <stdio.h>
#if defined (HAVE_CONFIG_H)
# include "config.h"
#endif
#if defined (HAVE_UNISTD_H)
# include <unistd.h>
#endif /* HAVE_UNISTD_H */

View File

@ -250,22 +250,16 @@ tilde_expand_word (filename)
}
else
{
char u_name[257];
struct passwd *user_entry;
char *username;
int i, c;
struct passwd *user_entry;
int i;
username = u_name;
for (i = 1; c = dirname[i]; i++)
{
if (c == '/')
break;
else
username[i - 1] = c;
}
username = xmalloc (strlen (dirname));
for (i = 1; dirname[i] && dirname[i] != '/'; i++)
username[i - 1] = dirname[i];
username[i - 1] = '\0';
if (!(user_entry = getpwnam (username)))
if ((user_entry = getpwnam (username)) == 0)
{
/* If the calling program has a special syntax for
expanding tildes, and we couldn't find a standard
@ -298,7 +292,8 @@ tilde_expand_word (filename)
free (dirname);
dirname = temp_name;
}
endpwent ();
endpwent ();
free (username);
}
}
return (dirname);