"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "libedit/el.c" between
tnftp-20151004.tar.gz and tnftp-20200705.tar.gz

About: tnftp is an enhanced ftp client (prior name "lukemftp").

el.c  (tnftp-20151004):el.c  (tnftp-20200705)
/* $NetBSD: el.c,v 1.5 2005/06/09 16:48:57 lukem Exp $ */ /* $NetBSD: el.c,v 1.8 2020/07/04 13:43:21 lukem Exp $ */
/* from NetBSD: el.c,v 1.39 2004/07/08 00:51:36 christos Exp */ /* from NetBSD: el.c,v 1.99 2019/07/23 10:18:52 christos Exp */
/*- /*-
* Copyright (c) 1992, 1993 * Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved. * The Regents of the University of California. All rights reserved.
* *
* This code is derived from software contributed to Berkeley by * This code is derived from software contributed to Berkeley by
* Christos Zoulas of Cornell University. * Christos Zoulas of Cornell University.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions * modification, are permitted provided that the following conditions
skipping to change at line 36 skipping to change at line 36
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
*/ */
#include "tnftp.h" #include "config.h"
#include "sys.h"
#if 0 /* tnftp */
#if !defined(lint) && !defined(SCCSID)
#if 0
static char sccsid[] = "@(#)el.c 8.2 (Berkeley) 1/3/94";
#else
__RCSID(" NetBSD: el.c,v 1.99 2019/07/23 10:18:52 christos Exp ");
#endif
#endif /* not lint && not SCCSID */
#endif /* tnftp */
/* /*
* el.c: EditLine interface functions * el.c: EditLine interface functions
*/ */
#if 0 /* tnftp */
#include <sys/types.h> #include <sys/types.h>
#include <sys/param.h> #include <sys/param.h>
#include <string.h> #include <ctype.h>
#include <stdlib.h> #include <langinfo.h>
#include <locale.h>
#include <stdarg.h> #include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#endif /* tnftp */
#include "el.h" #include "el.h"
#include "parse.h"
#include "read.h"
/* el_init(): /* el_init():
* Initialize editline and set default parameters. * Initialize editline and set default parameters.
*/ */
public EditLine * EditLine *
el_init(const char *prog, FILE *fin, FILE *fout, FILE *ferr) el_init(const char *prog, FILE *fin, FILE *fout, FILE *ferr)
{ {
return el_init_fd(prog, fin, fout, ferr, fileno(fin), fileno(fout),
fileno(ferr));
}
EditLine *el = (EditLine *) el_malloc(sizeof(EditLine)); libedit_private EditLine *
el_init_internal(const char *prog, FILE *fin, FILE *fout, FILE *ferr,
int fdin, int fdout, int fderr, int flags)
{
EditLine *el = el_calloc(1, sizeof(*el));
if (el == NULL) if (el == NULL)
return (NULL); return NULL;
memset(el, 0, sizeof(EditLine));
el->el_infd = fileno(fin); el->el_infile = fin;
el->el_outfile = fout; el->el_outfile = fout;
el->el_errfile = ferr; el->el_errfile = ferr;
if ((el->el_prog = el_strdup(prog)) == NULL) {
el->el_infd = fdin;
el->el_outfd = fdout;
el->el_errfd = fderr;
el->el_prog = wcsdup(ct_decode_string(prog, &el->el_scratch));
if (el->el_prog == NULL) {
el_free(el); el_free(el);
return NULL; return NULL;
} }
/* /*
* Initialize all the modules. Order is important!!! * Initialize all the modules. Order is important!!!
*/ */
el->el_flags = 0; el->el_flags = flags;
if (term_init(el) == -1) { if (terminal_init(el) == -1) {
el_free(el->el_prog); el_free(el->el_prog);
el_free(el); el_free(el);
return NULL; return NULL;
} }
(void) key_init(el); (void) keymacro_init(el);
(void) map_init(el); (void) map_init(el);
if (tty_init(el) == -1) if (tty_init(el) == -1)
el->el_flags |= NO_TTY; el->el_flags |= NO_TTY;
(void) ch_init(el); (void) ch_init(el);
(void) search_init(el); (void) search_init(el);
(void) hist_init(el); (void) hist_init(el);
(void) prompt_init(el); (void) prompt_init(el);
(void) sig_init(el); (void) sig_init(el);
(void) read_init(el); (void) literal_init(el);
if (read_init(el) == -1) {
el_end(el);
return NULL;
}
return el;
}
return (el); EditLine *
el_init_fd(const char *prog, FILE *fin, FILE *fout, FILE *ferr,
int fdin, int fdout, int fderr)
{
return el_init_internal(prog, fin, fout, ferr, fdin, fdout, fderr, 0);
} }
/* el_end(): /* el_end():
* Clean up. * Clean up.
*/ */
public void void
el_end(EditLine *el) el_end(EditLine *el)
{ {
if (el == NULL) if (el == NULL)
return; return;
el_reset(el); el_reset(el);
term_end(el); terminal_end(el);
key_end(el); keymacro_end(el);
map_end(el); map_end(el);
tty_end(el); if (!(el->el_flags & NO_TTY))
tty_end(el, TCSAFLUSH);
ch_end(el); ch_end(el);
read_end(el->el_read);
search_end(el); search_end(el);
hist_end(el); hist_end(el);
prompt_end(el); prompt_end(el);
sig_end(el); sig_end(el);
literal_end(el);
el_free((ptr_t) el->el_prog); el_free(el->el_prog);
el_free((ptr_t) el); el_free(el->el_visual.cbuff);
el_free(el->el_visual.wbuff);
el_free(el->el_scratch.cbuff);
el_free(el->el_scratch.wbuff);
el_free(el->el_lgcyconv.cbuff);
el_free(el->el_lgcyconv.wbuff);
el_free(el);
} }
/* el_reset(): /* el_reset():
* Reset the tty and the parser * Reset the tty and the parser
*/ */
public void void
el_reset(EditLine *el) el_reset(EditLine *el)
{ {
tty_cookedmode(el); tty_cookedmode(el);
ch_reset(el); /* XXX: Do we want that? */ ch_reset(el); /* XXX: Do we want that? */
} }
/* el_set(): /* el_set():
* set the editline parameters * set the editline parameters
*/ */
public int int
el_set(EditLine *el, int op, ...) el_wset(EditLine *el, int op, ...)
{ {
va_list va; va_list ap;
int rv = 0; int rv = 0;
if (el == NULL) if (el == NULL)
return (-1); return -1;
va_start(va, op); va_start(ap, op);
switch (op) { switch (op) {
case EL_PROMPT: case EL_PROMPT:
case EL_RPROMPT: case EL_RPROMPT: {
rv = prompt_set(el, va_arg(va, el_pfunc_t), op); el_pfunc_t p = va_arg(ap, el_pfunc_t);
rv = prompt_set(el, p, 0, op, 1);
break;
}
case EL_RESIZE: {
el_zfunc_t p = va_arg(ap, el_zfunc_t);
void *arg = va_arg(ap, void *);
rv = ch_resizefun(el, p, arg);
break;
}
case EL_ALIAS_TEXT: {
el_afunc_t p = va_arg(ap, el_afunc_t);
void *arg = va_arg(ap, void *);
rv = ch_aliasfun(el, p, arg);
break; break;
}
case EL_PROMPT_ESC:
case EL_RPROMPT_ESC: {
el_pfunc_t p = va_arg(ap, el_pfunc_t);
int c = va_arg(ap, int);
rv = prompt_set(el, p, (wchar_t)c, op, 1);
break;
}
case EL_TERMINAL: case EL_TERMINAL:
rv = term_set(el, va_arg(va, char *)); rv = terminal_set(el, va_arg(ap, char *));
break; break;
case EL_EDITOR: case EL_EDITOR:
rv = map_set_editor(el, va_arg(va, char *)); rv = map_set_editor(el, va_arg(ap, wchar_t *));
break; break;
case EL_SIGNAL: case EL_SIGNAL:
if (va_arg(va, int)) if (va_arg(ap, int))
el->el_flags |= HANDLE_SIGNALS; el->el_flags |= HANDLE_SIGNALS;
else else
el->el_flags &= ~HANDLE_SIGNALS; el->el_flags &= ~HANDLE_SIGNALS;
break; break;
case EL_BIND: case EL_BIND:
case EL_TELLTC: case EL_TELLTC:
case EL_SETTC: case EL_SETTC:
case EL_ECHOTC: case EL_ECHOTC:
case EL_SETTY: case EL_SETTY:
{ {
const char *argv[20]; const wchar_t *argv[20];
int i; int i;
for (i = 1; i < 20; i++) for (i = 1; i < (int)__arraycount(argv); i++)
if ((argv[i] = va_arg(va, char *)) == NULL) if ((argv[i] = va_arg(ap, wchar_t *)) == NULL)
break; break;
switch (op) { switch (op) {
case EL_BIND: case EL_BIND:
argv[0] = "bind"; argv[0] = L"bind";
rv = map_bind(el, i, argv); rv = map_bind(el, i, argv);
break; break;
case EL_TELLTC: case EL_TELLTC:
argv[0] = "telltc"; argv[0] = L"telltc";
rv = term_telltc(el, i, argv); rv = terminal_telltc(el, i, argv);
break; break;
case EL_SETTC: case EL_SETTC:
argv[0] = "settc"; argv[0] = L"settc";
rv = term_settc(el, i, argv); rv = terminal_settc(el, i, argv);
break; break;
case EL_ECHOTC: case EL_ECHOTC:
argv[0] = "echotc"; argv[0] = L"echotc";
rv = term_echotc(el, i, argv); rv = terminal_echotc(el, i, argv);
break; break;
case EL_SETTY: case EL_SETTY:
argv[0] = "setty"; argv[0] = L"setty";
rv = tty_stty(el, i, argv); rv = tty_stty(el, i, argv);
break; break;
default: default:
rv = -1; rv = -1;
EL_ABORT((el->el_errfile, "Bad op %d\n", op)); EL_ABORT((el->el_errfile, "Bad op %d\n", op));
break; break;
} }
break; break;
} }
case EL_ADDFN: case EL_ADDFN:
{ {
char *name = va_arg(va, char *); wchar_t *name = va_arg(ap, wchar_t *);
char *help = va_arg(va, char *); wchar_t *help = va_arg(ap, wchar_t *);
el_func_t func = va_arg(va, el_func_t); el_func_t func = va_arg(ap, el_func_t);
rv = map_addfunc(el, name, help, func); rv = map_addfunc(el, name, help, func);
break; break;
} }
case EL_HIST: case EL_HIST:
{ {
hist_fun_t func = va_arg(va, hist_fun_t); hist_fun_t func = va_arg(ap, hist_fun_t);
ptr_t ptr = va_arg(va, char *); void *ptr = va_arg(ap, void *);
rv = hist_set(el, func, ptr); rv = hist_set(el, func, ptr);
if (MB_CUR_MAX == 1)
el->el_flags &= ~NARROW_HISTORY;
break; break;
} }
case EL_EDITMODE: case EL_EDITMODE:
if (va_arg(va, int)) if (va_arg(ap, int))
el->el_flags &= ~EDIT_DISABLED; el->el_flags &= ~EDIT_DISABLED;
else else
el->el_flags |= EDIT_DISABLED; el->el_flags |= EDIT_DISABLED;
rv = 0; rv = 0;
break; break;
case EL_GETCFN: case EL_GETCFN:
{ {
el_rfunc_t rc = va_arg(va, el_rfunc_t); el_rfunc_t rc = va_arg(ap, el_rfunc_t);
rv = el_read_setfn(el, rc); rv = el_read_setfn(el->el_read, rc);
break; break;
} }
case EL_CLIENTDATA: case EL_CLIENTDATA:
el->el_data = va_arg(va, void *); el->el_data = va_arg(ap, void *);
break; break;
case EL_UNBUFFERED: case EL_UNBUFFERED:
rv = va_arg(va, int); rv = va_arg(ap, int);
if (rv && !(el->el_flags & UNBUFFERED)) { if (rv && !(el->el_flags & UNBUFFERED)) {
el->el_flags |= UNBUFFERED; el->el_flags |= UNBUFFERED;
read_prepare(el); read_prepare(el);
} else if (!rv && (el->el_flags & UNBUFFERED)) { } else if (!rv && (el->el_flags & UNBUFFERED)) {
el->el_flags &= ~UNBUFFERED; el->el_flags &= ~UNBUFFERED;
read_finish(el); read_finish(el);
} }
rv = 0; rv = 0;
break; break;
case EL_PREP_TERM: case EL_PREP_TERM:
rv = va_arg(va, int); rv = va_arg(ap, int);
if (rv) if (rv)
(void) tty_rawmode(el); (void) tty_rawmode(el);
else else
(void) tty_cookedmode(el); (void) tty_cookedmode(el);
rv = 0; rv = 0;
break; break;
case EL_SETFP:
{
FILE *fp;
int what;
what = va_arg(ap, int);
fp = va_arg(ap, FILE *);
rv = 0;
switch (what) {
case 0:
el->el_infile = fp;
el->el_infd = fileno(fp);
break;
case 1:
el->el_outfile = fp;
el->el_outfd = fileno(fp);
break;
case 2:
el->el_errfile = fp;
el->el_errfd = fileno(fp);
break;
default:
rv = -1;
break;
}
break;
}
case EL_REFRESH:
re_clear_display(el);
re_refresh(el);
terminal__flush(el);
break;
default: default:
rv = -1; rv = -1;
break; break;
} }
va_end(va); va_end(ap);
return (rv); return rv;
} }
/* el_get(): /* el_get():
* retrieve the editline parameters * retrieve the editline parameters
*/ */
public int int
el_get(EditLine *el, int op, void *ret) el_wget(EditLine *el, int op, ...)
{ {
va_list ap;
int rv; int rv;
if (el == NULL || ret == NULL) if (el == NULL)
return (-1); return -1;
va_start(ap, op);
switch (op) { switch (op) {
case EL_PROMPT: case EL_PROMPT:
case EL_RPROMPT: case EL_RPROMPT: {
rv = prompt_get(el, (void *) &ret, op); el_pfunc_t *p = va_arg(ap, el_pfunc_t *);
rv = prompt_get(el, p, 0, op);
break; break;
}
case EL_PROMPT_ESC:
case EL_RPROMPT_ESC: {
el_pfunc_t *p = va_arg(ap, el_pfunc_t *);
wchar_t *c = va_arg(ap, wchar_t *);
rv = prompt_get(el, p, c, op);
break;
}
case EL_EDITOR: case EL_EDITOR:
rv = map_get_editor(el, (void *) &ret); rv = map_get_editor(el, va_arg(ap, const wchar_t **));
break; break;
case EL_SIGNAL: case EL_SIGNAL:
*((int *) ret) = (el->el_flags & HANDLE_SIGNALS); *va_arg(ap, int *) = (el->el_flags & HANDLE_SIGNALS);
rv = 0; rv = 0;
break; break;
case EL_EDITMODE: case EL_EDITMODE:
*((int *) ret) = (!(el->el_flags & EDIT_DISABLED)); *va_arg(ap, int *) = !(el->el_flags & EDIT_DISABLED);
rv = 0; rv = 0;
break; break;
case EL_TERMINAL: case EL_TERMINAL:
term_get(el, (const char **)ret); terminal_get(el, va_arg(ap, const char **));
rv = 0; rv = 0;
break; break;
#if 0 /* XXX */ case EL_GETTC:
case EL_BIND:
case EL_TELLTC:
case EL_SETTC:
case EL_ECHOTC:
case EL_SETTY:
{ {
const char *argv[20]; static char name[] = "gettc";
int i; char *argv[3];
argv[0] = name;
for (i = 1; i < sizeof(argv) / sizeof(argv[0]); i++) argv[1] = va_arg(ap, char *);
if ((argv[i] = va_arg(va, char *)) == NULL) argv[2] = va_arg(ap, void *);
break; rv = terminal_gettc(el, 3, argv);
switch (op) {
case EL_BIND:
argv[0] = "bind";
rv = map_bind(el, i, argv);
break;
case EL_TELLTC:
argv[0] = "telltc";
rv = term_telltc(el, i, argv);
break;
case EL_SETTC:
argv[0] = "settc";
rv = term_settc(el, i, argv);
break;
case EL_ECHOTC:
argv[0] = "echotc";
rv = term_echotc(el, i, argv);
break;
case EL_SETTY:
argv[0] = "setty";
rv = tty_stty(el, i, argv);
break;
default:
rv = -1;
EL_ABORT((el->errfile, "Bad op %d\n", op));
break;
}
break; break;
} }
case EL_ADDFN:
{
char *name = va_arg(va, char *);
char *help = va_arg(va, char *);
el_func_t func = va_arg(va, el_func_t);
rv = map_addfunc(el, name, help, func);
break;
}
case EL_HIST:
{
hist_fun_t func = va_arg(va, hist_fun_t);
ptr_t ptr = va_arg(va, char *);
rv = hist_set(el, func, ptr);
}
break;
#endif /* XXX */
case EL_GETCFN: case EL_GETCFN:
*((el_rfunc_t *)ret) = el_read_getfn(el); *va_arg(ap, el_rfunc_t *) = el_read_getfn(el->el_read);
rv = 0; rv = 0;
break; break;
case EL_CLIENTDATA: case EL_CLIENTDATA:
*((void **)ret) = el->el_data; *va_arg(ap, void **) = el->el_data;
rv = 0; rv = 0;
break; break;
case EL_UNBUFFERED: case EL_UNBUFFERED:
*((int *) ret) = (!(el->el_flags & UNBUFFERED)); *va_arg(ap, int *) = (el->el_flags & UNBUFFERED) != 0;
rv = 0; rv = 0;
break; break;
case EL_GETFP:
{
int what;
FILE **fpp;
what = va_arg(ap, int);
fpp = va_arg(ap, FILE **);
rv = 0;
switch (what) {
case 0:
*fpp = el->el_infile;
break;
case 1:
*fpp = el->el_outfile;
break;
case 2:
*fpp = el->el_errfile;
break;
default:
rv = -1;
break;
}
break;
}
default: default:
rv = -1; rv = -1;
break;
} }
va_end(ap);
return (rv); return rv;
} }
/* el_line(): /* el_line():
* Return editing info * Return editing info
*/ */
public const LineInfo * const LineInfoW *
el_line(EditLine *el) el_wline(EditLine *el)
{ {
return (const LineInfo *) (void *) &el->el_line; return (const LineInfoW *)(void *)&el->el_line;
} }
/* el_source(): /* el_source():
* Source a file * Source a file
*/ */
public int int
el_source(EditLine *el, const char *fname) el_source(EditLine *el, const char *fname)
{ {
FILE *fp; FILE *fp;
size_t len; size_t len;
ssize_t slen;
char *ptr; char *ptr;
char *path = NULL;
const wchar_t *dptr;
int error = 0;
fp = NULL; fp = NULL;
if (fname == NULL) { if (fname == NULL) {
static const char elpath[] = "/.editrc"; #ifdef HAVE_ISSETUGID
char path[MAXPATHLEN]; if (issetugid())
return -1;
if ((ptr = getenv("HOME")) == NULL)
return (-1); if ((fname = getenv("EDITRC")) == NULL) {
if (strlcpy(path, ptr, sizeof(path)) >= sizeof(path)) static const char elpath[] = "/.editrc";
return (-1); size_t plen = sizeof(elpath);
if (strlcat(path, elpath, sizeof(path)) >= sizeof(path))
return (-1); if ((ptr = getenv("HOME")) == NULL)
fname = path; return -1;
plen += strlen(ptr);
if ((path = el_calloc(plen, sizeof(*path))) == NULL)
return -1;
(void)snprintf(path, plen, "%s%s", ptr,
elpath + (*ptr == '\0'));
fname = path;
}
#else
/*
* If issetugid() is missing, always return an error, in order
* to keep from inadvertently opening up the user to a security
* hole.
*/
return -1;
#endif
} }
if (fname[0] == '\0')
return -1;
if (fp == NULL) if (fp == NULL)
fp = fopen(fname, "r"); fp = fopen(fname, "r");
if (fp == NULL) if (fp == NULL) {
return (-1); el_free(path);
return -1;
while ((ptr = fgetln(fp, &len)) != NULL) { }
if (len > 0 && ptr[len - 1] == '\n')
--len; ptr = NULL;
ptr[len] = '\0'; len = 0;
if (parse_line(el, ptr) == -1) { while ((slen = getline(&ptr, &len, fp)) != -1) {
(void) fclose(fp); if (*ptr == '\n')
return (-1); continue; /* Empty line. */
} if (slen > 0 && ptr[--slen] == '\n')
ptr[slen] = '\0';
dptr = ct_decode_string(ptr, &el->el_scratch);
if (!dptr)
continue;
/* loop until first non-space char or EOL */
while (*dptr != '\0' && iswspace(*dptr))
dptr++;
if (*dptr == '#')
continue; /* ignore, this is a comment line */
if ((error = parse_line(el, dptr)) == -1)
break;
} }
free(ptr);
el_free(path);
(void) fclose(fp); (void) fclose(fp);
return (0); return error;
} }
/* el_resize(): /* el_resize():
* Called from program when terminal is resized * Called from program when terminal is resized
*/ */
public void void
el_resize(EditLine *el) el_resize(EditLine *el)
{ {
int lins, cols; int lins, cols;
sigset_t oset, nset; sigset_t oset, nset;
(void) sigemptyset(&nset); (void) sigemptyset(&nset);
(void) sigaddset(&nset, SIGWINCH); (void) sigaddset(&nset, SIGWINCH);
(void) sigprocmask(SIG_BLOCK, &nset, &oset); (void) sigprocmask(SIG_BLOCK, &nset, &oset);
/* get the correct window size */ /* get the correct window size */
if (term_get_size(el, &lins, &cols)) if (terminal_get_size(el, &lins, &cols))
term_change_size(el, lins, cols); terminal_change_size(el, lins, cols);
(void) sigprocmask(SIG_SETMASK, &oset, NULL); (void) sigprocmask(SIG_SETMASK, &oset, NULL);
} }
/* el_beep(): /* el_beep():
* Called from the program to beep * Called from the program to beep
*/ */
public void void
el_beep(EditLine *el) el_beep(EditLine *el)
{ {
term_beep(el); terminal_beep(el);
} }
/* el_editmode() /* el_editmode()
* Set the state of EDIT_DISABLED from the `edit' command. * Set the state of EDIT_DISABLED from the `edit' command.
*/ */
protected int libedit_private int
/*ARGSUSED*/ /*ARGSUSED*/
el_editmode(EditLine *el, int argc, const char **argv) el_editmode(EditLine *el, int argc, const wchar_t **argv)
{ {
const char *how; const wchar_t *how;
if (argv == NULL || argc != 2 || argv[1] == NULL) if (argv == NULL || argc != 2 || argv[1] == NULL)
return (-1); return -1;
how = argv[1]; how = argv[1];
if (strcmp(how, "on") == 0) { if (wcscmp(how, L"on") == 0) {
el->el_flags &= ~EDIT_DISABLED; el->el_flags &= ~EDIT_DISABLED;
tty_rawmode(el); tty_rawmode(el);
} else if (strcmp(how, "off") == 0) { } else if (wcscmp(how, L"off") == 0) {
tty_cookedmode(el); tty_cookedmode(el);
el->el_flags |= EDIT_DISABLED; el->el_flags |= EDIT_DISABLED;
} }
else { else {
(void) fprintf(el->el_errfile, "edit: Bad value `%s'.\n", how); (void) fprintf(el->el_errfile, "edit: Bad value `%ls'.\n",
return (-1); how);
return -1;
} }
return (0); return 0;
} }
 End of changes. 91 change blocks. 
176 lines changed or deleted 307 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)