51 lines
1.6 KiB
Text
51 lines
1.6 KiB
Text
|
$NetBSD: patch-bi,v 1.1 2006/05/15 15:33:00 christos Exp $
|
||
|
|
||
|
--- glob/tilde.c.orig 1995-02-24 16:20:46.000000000 -0500
|
||
|
+++ glob/tilde.c 2006-05-15 10:56:09.000000000 -0400
|
||
|
@@ -28,12 +28,15 @@
|
||
|
#endif
|
||
|
|
||
|
#include <pwd.h>
|
||
|
+#include <stdlib.h>
|
||
|
+#include <unistd.h>
|
||
|
|
||
|
#ifndef savestring
|
||
|
#define savestring(x) (char *)strcpy ((char *)xmalloc (1 + strlen (x)), (x))
|
||
|
#endif
|
||
|
|
||
|
typedef int Function ();
|
||
|
+typedef char *CPFunction ();
|
||
|
#if !defined (NULL)
|
||
|
# define NULL 0x0
|
||
|
#endif
|
||
|
@@ -41,7 +44,7 @@
|
||
|
#if defined (TEST)
|
||
|
static char *xmalloc (), *xrealloc ();
|
||
|
#else
|
||
|
-extern char *malloc (), *xrealloc ();
|
||
|
+extern char *xmalloc (), *xrealloc ();
|
||
|
#endif /* TEST */
|
||
|
|
||
|
/* The default value of tilde_additional_prefixes. This is set to
|
||
|
@@ -60,7 +63,7 @@
|
||
|
standard meaning for expanding a tilde fails. The function is called
|
||
|
with the text (sans tilde, as in "foo"), and returns a malloc()'ed string
|
||
|
which is the expansion, or a NULL pointer if there is no expansion. */
|
||
|
-Function *tilde_expansion_failure_hook = (Function *)NULL;
|
||
|
+CPFunction *tilde_expansion_failure_hook = (CPFunction *)NULL;
|
||
|
|
||
|
/* When non-null, this is a NULL terminated array of strings which
|
||
|
are duplicates for a tilde prefix. Bash uses this to expand
|
||
|
@@ -207,9 +210,9 @@
|
||
|
if (!dirname[1] || dirname[1] == '/')
|
||
|
{
|
||
|
/* Prepend $HOME to the rest of the string. */
|
||
|
- char *temp_home = (char *)getenv ("HOME");
|
||
|
+ char *temp_home = getenv ("HOME");
|
||
|
|
||
|
- temp_name = (char *)alloca (1 + strlen (&dirname[1])
|
||
|
+ temp_name = alloca (1 + strlen (&dirname[1])
|
||
|
+ (temp_home? strlen (temp_home) : 0));
|
||
|
temp_name[0] = '\0';
|
||
|
if (temp_home)
|