1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
$NetBSD: patch-aa,v 1.2 2008/12/17 02:19:59 christos Exp $
--- glob/tilde.c.orig 1995-02-24 16:20:46.000000000 -0500
+++ glob/tilde.c 2008-12-16 20:35:03.000000000 -0500
@@ -28,12 +28,16 @@
#endif
#include <pwd.h>
+#include <string.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 +45,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 +64,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 +211,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)
|