apply diff from manuel giraud via oksh to keep track of LINENO in a trap
This commit is contained in:
parent
2a72f0e2f0
commit
747b27a846
18
check.t
18
check.t
@ -1,4 +1,4 @@
|
||||
# $MirOS: src/bin/mksh/check.t,v 1.377 2010/05/16 19:17:41 tg Exp $
|
||||
# $MirOS: src/bin/mksh/check.t,v 1.378 2010/05/22 12:49:13 tg Exp $
|
||||
# $OpenBSD: bksl-nl.t,v 1.2 2001/01/28 23:04:56 niklas Exp $
|
||||
# $OpenBSD: history.t,v 1.5 2001/01/28 23:04:56 niklas Exp $
|
||||
# $OpenBSD: read.t,v 1.3 2003/03/10 03:48:16 david Exp $
|
||||
@ -25,7 +25,7 @@
|
||||
# http://www.research.att.com/~gsf/public/ifs.sh
|
||||
|
||||
expected-stdout:
|
||||
@(#)MIRBSD KSH R39 2010/05/16
|
||||
@(#)MIRBSD KSH R39 2010/05/22
|
||||
description:
|
||||
Check version of shell.
|
||||
stdin:
|
||||
@ -3321,6 +3321,20 @@ expected-stdout:
|
||||
dot B 3
|
||||
C 3
|
||||
---
|
||||
name: lineno-trap
|
||||
description:
|
||||
Check if LINENO is tracked in traps
|
||||
stdin:
|
||||
fail() {
|
||||
echo "line <$1>"
|
||||
exit 1
|
||||
}
|
||||
trap 'fail $LINENO' INT ERR
|
||||
false
|
||||
expected-stdout:
|
||||
line <6>
|
||||
expected-exit: 1
|
||||
---
|
||||
name: read-IFS-1
|
||||
description:
|
||||
Simple test, default IFS
|
||||
|
12
histrap.c
12
histrap.c
@ -1,5 +1,5 @@
|
||||
/* $OpenBSD: history.c,v 1.38 2010/05/01 21:09:23 guenther Exp $ */
|
||||
/* $OpenBSD: trap.c,v 1.22 2005/03/30 17:16:37 deraadt Exp $ */
|
||||
/* $OpenBSD: history.c,v 1.39 2010/05/19 17:36:08 jasper Exp $ */
|
||||
/* $OpenBSD: trap.c,v 1.23 2010/05/19 17:36:08 jasper Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
|
||||
@ -26,7 +26,7 @@
|
||||
#include <sys/file.h>
|
||||
#endif
|
||||
|
||||
__RCSID("$MirOS: src/bin/mksh/histrap.c,v 1.93 2010/05/13 18:44:09 tg Exp $");
|
||||
__RCSID("$MirOS: src/bin/mksh/histrap.c,v 1.94 2010/05/22 12:49:14 tg Exp $");
|
||||
|
||||
/*-
|
||||
* MirOS: This is the default mapping type, and need not be specified.
|
||||
@ -250,7 +250,7 @@ c_fc(const char **wp)
|
||||
Source *sold = source;
|
||||
int ret;
|
||||
|
||||
ret = command(editor ? editor : "${FCEDIT:-/bin/ed} $_");
|
||||
ret = command(editor ? editor : "${FCEDIT:-/bin/ed} $_", 0);
|
||||
source = sold;
|
||||
if (ret)
|
||||
return (ret);
|
||||
@ -318,7 +318,7 @@ hist_execute(char *cmd)
|
||||
*/
|
||||
/* XXX: source should not get trashed by this.. */
|
||||
sold = source;
|
||||
ret = command(cmd);
|
||||
ret = command(cmd, 0);
|
||||
source = sold;
|
||||
return (ret);
|
||||
}
|
||||
@ -1286,7 +1286,7 @@ runtrap(Trap *p)
|
||||
/* Note: trapstr is fully parsed before anything is executed, thus
|
||||
* no problem with afree(p->trap) in settrap() while still in use.
|
||||
*/
|
||||
command(trapstr);
|
||||
command(trapstr, current_lineno);
|
||||
exstat = oexstat;
|
||||
if (i == SIGEXIT_ || i == SIGERR_) {
|
||||
if (p->flags & TF_CHANGED)
|
||||
|
8
main.c
8
main.c
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: main.c,v 1.45 2009/01/29 23:27:26 jaredy Exp $ */
|
||||
/* $OpenBSD: main.c,v 1.46 2010/05/19 17:36:08 jasper Exp $ */
|
||||
/* $OpenBSD: tty.c,v 1.9 2006/03/14 22:08:01 deraadt Exp $ */
|
||||
/* $OpenBSD: io.c,v 1.22 2006/03/17 16:30:13 millert Exp $ */
|
||||
/* $OpenBSD: table.c,v 1.13 2009/01/17 22:06:44 millert Exp $ */
|
||||
@ -33,7 +33,7 @@
|
||||
#include <locale.h>
|
||||
#endif
|
||||
|
||||
__RCSID("$MirOS: src/bin/mksh/main.c,v 1.164 2010/04/20 17:28:20 tg Exp $");
|
||||
__RCSID("$MirOS: src/bin/mksh/main.c,v 1.165 2010/05/22 12:49:15 tg Exp $");
|
||||
|
||||
extern char **environ;
|
||||
|
||||
@ -540,13 +540,15 @@ include(const char *name, int argc, const char **argv, int intr_ok)
|
||||
return (i & 0xff); /* & 0xff to ensure value not -1 */
|
||||
}
|
||||
|
||||
/* spawn a command into a shell optionally keeping track of the line number */
|
||||
int
|
||||
command(const char *comm)
|
||||
command(const char *comm, int line)
|
||||
{
|
||||
Source *s;
|
||||
|
||||
s = pushs(SSTRING, ATEMP);
|
||||
s->start = s->str = comm;
|
||||
s->line = line;
|
||||
return (shell(s, false));
|
||||
}
|
||||
|
||||
|
8
sh.h
8
sh.h
@ -4,7 +4,7 @@
|
||||
/* $OpenBSD: tree.h,v 1.10 2005/03/28 21:28:22 deraadt Exp $ */
|
||||
/* $OpenBSD: expand.h,v 1.6 2005/03/30 17:16:37 deraadt Exp $ */
|
||||
/* $OpenBSD: lex.h,v 1.11 2006/05/29 18:22:24 otto Exp $ */
|
||||
/* $OpenBSD: proto.h,v 1.32 2009/01/29 23:27:26 jaredy Exp $ */
|
||||
/* $OpenBSD: proto.h,v 1.33 2010/05/19 17:36:08 jasper Exp $ */
|
||||
/* $OpenBSD: c_test.h,v 1.4 2004/12/20 11:34:26 otto Exp $ */
|
||||
/* $OpenBSD: tty.h,v 1.5 2004/12/20 11:34:26 otto Exp $ */
|
||||
|
||||
@ -150,9 +150,9 @@
|
||||
#endif
|
||||
|
||||
#ifdef EXTERN
|
||||
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.391 2010/05/16 19:04:42 tg Exp $");
|
||||
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.392 2010/05/22 12:49:16 tg Exp $");
|
||||
#endif
|
||||
#define MKSH_VERSION "R39 2010/05/16"
|
||||
#define MKSH_VERSION "R39 2010/05/22"
|
||||
|
||||
#ifndef MKSH_INCLUDES_ONLY
|
||||
|
||||
@ -1496,7 +1496,7 @@ void pprompt(const char *, int);
|
||||
int promptlen(const char *);
|
||||
/* main.c */
|
||||
int include(const char *, int, const char **, int);
|
||||
int command(const char *);
|
||||
int command(const char *, int);
|
||||
int shell(Source *volatile, int volatile);
|
||||
void unwind(int) MKSH_A_NORETURN;
|
||||
void newenv(int);
|
||||
|
Loading…
Reference in New Issue
Block a user