16,20c16
< * 3. All advertising materials mentioning features or use of this software
< * must display the following acknowledgement:
< * This product includes software developed by the University of
< * California, Berkeley and its contributors.
< * 4. Neither the name of the University nor the names of its contributors
---
> * 3. Neither the name of the University nor the names of its contributors
46,47c42,43
< __RCSID("$NetBSD: test.c,v 1.8 1999/09/21 00:07:03 lukem Exp $");
< __FBSDID("$FreeBSD: head/lib/libedit/TEST/test.c 84260 2001-10-01 08:41:27Z obrien $");
---
> __RCSID("$NetBSD: test.c,v 1.18 2005/06/01 11:37:52 lukem Exp $");
> __FBSDID("$FreeBSD: head/lib/libedit/TEST/test.c 148834 2005-08-07 20:55:59Z stefanf $");
63d58
< #include "tokenizer.h"
66c61
< static EditLine *el = NULL;
---
> volatile sig_atomic_t gotsig = 0;
68c63
< static u_char complete(EditLine *, int);
---
> static unsigned char complete(EditLine *, int);
76,77c71,72
< static char a[] = "Edit$";
< static char b[] = "Edit>";
---
> static char a[] = "Edit$ ";
> static char b[] = "Edit> ";
85,87c80
<
< (void) fprintf(stderr, "Got signal %d.\n", i);
< el_reset(el);
---
> gotsig = i;
102c95,96
< for (ptr = lf->cursor - 1; !isspace(*ptr) && ptr > lf->buffer; ptr--)
---
> for (ptr = lf->cursor - 1;
> !isspace((unsigned char)*ptr) && ptr > lf->buffer; ptr--)
124a119
> EditLine *el = NULL;
128c123,126
< int lastevent = 0, ncontinuation;
---
> #if 0
> int lastevent = 0;
> #endif
> int ncontinuation;
172,173c170
< int ac;
< char **av;
---
> int ac, cc, co;
175c172
< (void) fprintf(stderr, "got %d %s", num, buf);
---
> int i;
176a174,190
> const char **av;
> const LineInfo *li;
> li = el_line(el);
> #ifdef DEBUG
> (void) fprintf(stderr, "==> got %d %s", num, buf);
> (void) fprintf(stderr, " > li `%.*s_%.*s'\n",
> (li->cursor - li->buffer), li->buffer,
> (li->lastchar - 1 - li->cursor),
> (li->cursor >= li->lastchar) ? "" : li->cursor);
>
> #endif
> if (gotsig) {
> (void) fprintf(stderr, "Got signal %d.\n", gotsig);
> gotsig = 0;
> el_reset(el);
> }
>
180,182c194,204
< if (tok_line(tok, buf, &ac, &av) > 0)
< ncontinuation = 1;
<
---
> ac = cc = co = 0;
> ncontinuation = tok_line(tok, li, &ac, &av, &cc, &co);
> if (ncontinuation < 0) {
> (void) fprintf(stderr, "Internal error\n");
> continuation = 0;
> continue;
> }
> #ifdef DEBUG
> (void) fprintf(stderr, " > nc %d ac %d cc %d co %d\n",
> ncontinuation, ac, cc, co);
> #endif
190c212
< err(1, "%d: %s\n", lastevent, ev.str);
---
> err(1, "%d: %s", lastevent, ev.str);
202a225,236
> if (continuation)
> continue;
> #ifdef DEBUG
> for (i = 0; i < ac; i++) {
> (void) fprintf(stderr, " > arg# %2d ", i);
> if (i != cc)
> (void) fprintf(stderr, "`%s'\n", av[i]);
> else
> (void) fprintf(stderr, "`%.*s_%s'\n",
> co, av[i], av[i] + co);
> }
> #endif
238c272
< execvp(av[0], av);
---
> execvp(av[0], __DECONST(char *const *, av));
< * 3. All advertising materials mentioning features or use of this software
< * must display the following acknowledgement:
< * This product includes software developed by the University of
< * California, Berkeley and its contributors.
< * 4. Neither the name of the University nor the names of its contributors
---
> * 3. Neither the name of the University nor the names of its contributors
46,47c42,43
< __RCSID("$NetBSD: test.c,v 1.8 1999/09/21 00:07:03 lukem Exp $");
< __FBSDID("$FreeBSD: head/lib/libedit/TEST/test.c 84260 2001-10-01 08:41:27Z obrien $");
---
> __RCSID("$NetBSD: test.c,v 1.18 2005/06/01 11:37:52 lukem Exp $");
> __FBSDID("$FreeBSD: head/lib/libedit/TEST/test.c 148834 2005-08-07 20:55:59Z stefanf $");
63d58
< #include "tokenizer.h"
66c61
< static EditLine *el = NULL;
---
> volatile sig_atomic_t gotsig = 0;
68c63
< static u_char complete(EditLine *, int);
---
> static unsigned char complete(EditLine *, int);
76,77c71,72
< static char a[] = "Edit$";
< static char b[] = "Edit>";
---
> static char a[] = "Edit$ ";
> static char b[] = "Edit> ";
85,87c80
<
< (void) fprintf(stderr, "Got signal %d.\n", i);
< el_reset(el);
---
> gotsig = i;
102c95,96
< for (ptr = lf->cursor - 1; !isspace(*ptr) && ptr > lf->buffer; ptr--)
---
> for (ptr = lf->cursor - 1;
> !isspace((unsigned char)*ptr) && ptr > lf->buffer; ptr--)
124a119
> EditLine *el = NULL;
128c123,126
< int lastevent = 0, ncontinuation;
---
> #if 0
> int lastevent = 0;
> #endif
> int ncontinuation;
172,173c170
< int ac;
< char **av;
---
> int ac, cc, co;
175c172
< (void) fprintf(stderr, "got %d %s", num, buf);
---
> int i;
176a174,190
> const char **av;
> const LineInfo *li;
> li = el_line(el);
> #ifdef DEBUG
> (void) fprintf(stderr, "==> got %d %s", num, buf);
> (void) fprintf(stderr, " > li `%.*s_%.*s'\n",
> (li->cursor - li->buffer), li->buffer,
> (li->lastchar - 1 - li->cursor),
> (li->cursor >= li->lastchar) ? "" : li->cursor);
>
> #endif
> if (gotsig) {
> (void) fprintf(stderr, "Got signal %d.\n", gotsig);
> gotsig = 0;
> el_reset(el);
> }
>
180,182c194,204
< if (tok_line(tok, buf, &ac, &av) > 0)
< ncontinuation = 1;
<
---
> ac = cc = co = 0;
> ncontinuation = tok_line(tok, li, &ac, &av, &cc, &co);
> if (ncontinuation < 0) {
> (void) fprintf(stderr, "Internal error\n");
> continuation = 0;
> continue;
> }
> #ifdef DEBUG
> (void) fprintf(stderr, " > nc %d ac %d cc %d co %d\n",
> ncontinuation, ac, cc, co);
> #endif
190c212
< err(1, "%d: %s\n", lastevent, ev.str);
---
> err(1, "%d: %s", lastevent, ev.str);
202a225,236
> if (continuation)
> continue;
> #ifdef DEBUG
> for (i = 0; i < ac; i++) {
> (void) fprintf(stderr, " > arg# %2d ", i);
> if (i != cc)
> (void) fprintf(stderr, "`%s'\n", av[i]);
> else
> (void) fprintf(stderr, "`%.*s_%s'\n",
> co, av[i], av[i] + co);
> }
> #endif
238c272
< execvp(av[0], av);
---
> execvp(av[0], __DECONST(char *const *, av));