summaryrefslogtreecommitdiff
path: root/chat/i2cb/patches/patch-at
blob: 389b984622872f25e01df12b14da6aacbb8fb9f5 (plain)
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
$NetBSD: patch-at,v 1.3 2014/04/21 18:16:13 joerg Exp $

--- src/getline.c.orig	2000-03-15 22:13:28.000000000 +0000
+++ src/getline.c
@@ -5,8 +5,8 @@
 #include "icb.h"
 #include "externs.h"
 
-char	*getline (char *prompt, int expand);
-void	handletab (int count, char c);
+char	*i2cb_getline (char *prompt, int expand);
+int	handletab (int count, char c);
 
 /* get a line from the user, with input processing */
 /* returns chars in line, or 0 if user erased to beginning of line */
@@ -15,7 +15,7 @@ void	handletab (int count, char c);
 static char *line_read = (char *)NULL;
 
 char *
-getline (char *prompt, int expand)
+i2cb_getline (char *prompt, int expand)
 {
 	linenumber = 0;
        /* If the buffer has already been allocated, return the memory
@@ -44,7 +44,7 @@ getline (char *prompt, int expand)
 /*
  *  keystroke handler for tab key
  */
-void
+int
 handletab (int count, char c)
 {
 	char mpref[256];
@@ -59,7 +59,7 @@ handletab (int count, char c)
 	/* make sure the history's not empty - punt if it is */
 	if (histcount()==0)
 	{
-		return;
+		return 0;
 	}
 
 	/* remember cursor location */
@@ -83,7 +83,7 @@ handletab (int count, char c)
 		}
 		else
 			printf("\007");
-		return;
+		return 0;
 	}
 	
 	/* starts with command character */
@@ -96,7 +96,7 @@ handletab (int count, char c)
 		words++;
 		for (i=0; i<rl_end; ++i)
 		{
-			if (isspace(rl_line_buffer[i]))
+			if (isspace((unsigned char)rl_line_buffer[i]))
 			{
 				term++;
 				if (words==2)
@@ -126,7 +126,7 @@ handletab (int count, char c)
 		}
 		else
 			printf("\007");
-		return;
+		return 0;
 	}
 	
 	/* case 4 - nickname completion */
@@ -135,7 +135,7 @@ handletab (int count, char c)
 		if (word2len > MAX_NICKLEN)
 		{
 			printf("\007");
-			return;
+			return 0;
 		}
 		
 		if (rl_line_buffer[word2]=='@')
@@ -162,7 +162,7 @@ handletab (int count, char c)
 		}
 		else
 			printf("\007");
-		return;
+		return 0;
 	}
 	
 	/* case 5 - replace nickname */
@@ -189,9 +189,10 @@ handletab (int count, char c)
 		}
 		else
 			printf("\007");
-		return;
+		return 0;
 	}
 		
 	/* anything else */
 	printf("\007");
+	return 0;
 }