in el_parse(), use a temporary buffer to store the program name when
comparing, preventing trashing of argv[0]. remove note in man page warning of former behaviour.
This commit is contained in:
parent
e3f5fb922f
commit
63177b84ae
@ -1,4 +1,4 @@
|
||||
.\" $NetBSD: editline.3,v 1.7 1997/11/09 00:13:52 lukem Exp $
|
||||
.\" $NetBSD: editline.3,v 1.8 1998/01/21 11:12:34 lukem Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 1997 The NetBSD Foundation, Inc.
|
||||
.\" All rights reserved.
|
||||
@ -187,19 +187,6 @@ didn't match, or
|
||||
Refer to
|
||||
.Xr editrc 5
|
||||
for more information.
|
||||
.Pp
|
||||
.Em NOTE:
|
||||
.Va argv[0]
|
||||
may be modified by
|
||||
.Fn el_parse .
|
||||
The colon between
|
||||
.Dq prog
|
||||
and the command,
|
||||
.Ar command ,
|
||||
will be replaced with a NUL
|
||||
.Po
|
||||
.Dq \e0
|
||||
.Pc .
|
||||
.It Fn el_set
|
||||
Set
|
||||
.Nm
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: parse.c,v 1.6 1997/07/06 18:25:31 christos Exp $ */
|
||||
/* $NetBSD: parse.c,v 1.7 1998/01/21 11:12:35 lukem Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992, 1993
|
||||
@ -41,7 +41,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)parse.c 8.1 (Berkeley) 6/4/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: parse.c,v 1.6 1997/07/06 18:25:31 christos Exp $");
|
||||
__RCSID("$NetBSD: parse.c,v 1.7 1998/01/21 11:12:35 lukem Exp $");
|
||||
#endif
|
||||
#endif /* not lint && not SCCSID */
|
||||
|
||||
@ -110,8 +110,19 @@ el_parse(el, argc, argv)
|
||||
return -1;
|
||||
ptr = strchr(argv[0], ':');
|
||||
if (ptr != NULL) {
|
||||
*ptr++ = '\0';
|
||||
if (! el_match(el->el_prog, argv[0]))
|
||||
char *tprog;
|
||||
int l;
|
||||
|
||||
l = ptr - argv[0] - 1;
|
||||
tprog = (char *)malloc(l + 1);
|
||||
if (tprog == NULL)
|
||||
return 0;
|
||||
strncpy(tprog, argv[0], l);
|
||||
tprog[l] = '\0';
|
||||
ptr++;
|
||||
l = el_match(el->el_prog, tprog);
|
||||
free(tprog);
|
||||
if (!l)
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user