pkgsrc/chat/i2cb/patches/patch-at
2014-04-21 18:16:13 +00:00

99 lines
2.1 KiB
Text

$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;
}