summaryrefslogtreecommitdiff
path: root/TEST/tc1.c
diff options
context:
space:
mode:
Diffstat (limited to 'TEST/tc1.c')
-rw-r--r--TEST/tc1.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/TEST/tc1.c b/TEST/tc1.c
index ee0b1a940a7f7..77f8a515373c2 100644
--- a/TEST/tc1.c
+++ b/TEST/tc1.c
@@ -1,4 +1,4 @@
-/* $NetBSD: tc1.c,v 1.1 2006/08/31 20:20:38 rpaulo Exp $ */
+/* $NetBSD: tc1.c,v 1.5 2010/04/18 21:17:47 christos Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -42,7 +42,7 @@ __COPYRIGHT("@(#) Copyright (c) 1992, 1993\n\
#if 0
static char sccsid[] = "@(#)test.c 8.1 (Berkeley) 6/4/93";
#else
-__RCSID("$NetBSD: tc1.c,v 1.1 2006/08/31 20:20:38 rpaulo Exp $");
+__RCSID("$NetBSD: tc1.c,v 1.5 2010/04/18 21:17:47 christos Exp $");
#endif
#endif /* not lint && not SCCSID */
@@ -57,6 +57,7 @@ __RCSID("$NetBSD: tc1.c,v 1.1 2006/08/31 20:20:38 rpaulo Exp $");
#include <stdlib.h>
#include <unistd.h>
#include <dirent.h>
+#include <locale.h>
#include "histedit.h"
@@ -71,7 +72,7 @@ static void sig(int);
static char *
prompt(EditLine *el)
{
- static char a[] = "Edit$ ";
+ static char a[] = "\1\033[7m\1Edit$\1\033[0m\1 ";
static char b[] = "Edit> ";
return (continuation ? b : a);
@@ -91,6 +92,7 @@ complete(EditLine *el, int ch)
const char* ptr;
const LineInfo *lf = el_line(el);
int len;
+ int res = CC_ERROR;
/*
* Find the last word
@@ -104,16 +106,16 @@ complete(EditLine *el, int ch)
if (len > strlen(dp->d_name))
continue;
if (strncmp(dp->d_name, ptr, len) == 0) {
- closedir(dd);
if (el_insertstr(el, &dp->d_name[len]) == -1)
- return (CC_ERROR);
+ res = CC_ERROR;
else
- return (CC_REFRESH);
+ res = CC_REFRESH;
+ break;
}
}
closedir(dd);
- return (CC_ERROR);
+ return res;
}
int
@@ -130,6 +132,7 @@ main(int argc, char *argv[])
History *hist;
HistEvent ev;
+ (void) setlocale(LC_CTYPE, "");
(void) signal(SIGINT, sig);
(void) signal(SIGQUIT, sig);
(void) signal(SIGHUP, sig);
@@ -146,7 +149,7 @@ main(int argc, char *argv[])
el_set(el, EL_EDITOR, "vi"); /* Default editor is vi */
el_set(el, EL_SIGNAL, 1); /* Handle signals gracefully */
- el_set(el, EL_PROMPT, prompt); /* Set the prompt function */
+ el_set(el, EL_PROMPT_ESC, prompt, '\1');/* Set the prompt function */
/* Tell editline to use this history interface */
el_set(el, EL_HIST, history, hist);