PR/25694: Luke Mewburn: Don't abuse unconstify'ing a string and writing to

it, because you'll core dump. Also remove extra const that gives pain to
the irix compiler.
This commit is contained in:
christos 2005-05-29 03:55:37 +00:00
parent 65b04a0bf1
commit 917b5f36b1
2 changed files with 10 additions and 10 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: parse.c,v 1.20 2003/12/05 13:37:48 lukem Exp $ */
/* $NetBSD: parse.c,v 1.21 2005/05/29 03:55:37 christos Exp $ */
/*-
* Copyright (c) 1992, 1993
@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)parse.c 8.1 (Berkeley) 6/4/93";
#else
__RCSID("$NetBSD: parse.c,v 1.20 2003/12/05 13:37:48 lukem Exp $");
__RCSID("$NetBSD: parse.c,v 1.21 2005/05/29 03:55:37 christos Exp $");
#endif
#endif /* not lint && not SCCSID */
@ -136,7 +136,7 @@ el_parse(EditLine *el, int argc, const char *argv[])
* the appropriate character or -1 if the escape is not valid
*/
protected int
parse__escape(const char **const ptr)
parse__escape(const char ** ptr)
{
const char *p;
int c;

View File

@ -1,4 +1,4 @@
/* $NetBSD: tty.c,v 1.21 2004/08/13 12:10:39 mycroft Exp $ */
/* $NetBSD: tty.c,v 1.22 2005/05/29 03:55:37 christos Exp $ */
/*-
* Copyright (c) 1992, 1993
@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)tty.c 8.1 (Berkeley) 6/4/93";
#else
__RCSID("$NetBSD: tty.c,v 1.21 2004/08/13 12:10:39 mycroft Exp $");
__RCSID("$NetBSD: tty.c,v 1.22 2005/05/29 03:55:37 christos Exp $");
#endif
#endif /* not lint && not SCCSID */
@ -1228,7 +1228,7 @@ tty_stty(EditLine *el, int argc __attribute__((__unused__)), const char **argv)
return (0);
}
while (argv && (s = *argv++)) {
char *p;
const char *p;
switch (*s) {
case '+':
case '-':
@ -1239,10 +1239,10 @@ tty_stty(EditLine *el, int argc __attribute__((__unused__)), const char **argv)
break;
}
d = s;
if ((p = strchr(s, '=')) != NULL)
*p++ = '\0';
p = strchr(s, '=');
for (m = ttymodes; m->m_name; m++)
if (strcmp(m->m_name, d) == 0 &&
if ((p ? strncmp(m->m_name, d, (size_t)(p - d)) :
strcmp(m->m_name, d)) == 0 &&
(p == NULL || m->m_type == MD_CHAR))
break;
@ -1253,7 +1253,7 @@ tty_stty(EditLine *el, int argc __attribute__((__unused__)), const char **argv)
}
if (p) {
int c = ffs((int)m->m_value);
int v = *p ? parse__escape((const char **const) &p) :
int v = *++p ? parse__escape((const char **) &p) :
el->el_tty.t_vdisable;
assert(c-- != 0);
c = tty__getcharindex(c);