diff options
author | 1996-06-18 10:10:06 +0000 | |
---|---|---|
committer | 1996-06-18 10:10:06 +0000 | |
commit | 138e30b808513e6282e331f9f1fb2d8f1f252bac (patch) | |
tree | d5e196a17b484cb5336d3d9efbe0f29a0563c768 | |
parent | my netbsd pr#2217: add utmp support to ftpd, some other small changes/fixes. (diff) | |
download | wireguard-openbsd-138e30b808513e6282e331f9f1fb2d8f1f252bac.tar.xz wireguard-openbsd-138e30b808513e6282e331f9f1fb2d8f1f252bac.zip |
from netbsd; Fix PR/2504: return with no args returns 0 instead of
the return value of the previous command in functions
-rw-r--r-- | bin/sh/eval.c | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/bin/sh/eval.c b/bin/sh/eval.c index eea800333d6..52bece42a4e 100644 --- a/bin/sh/eval.c +++ b/bin/sh/eval.c @@ -1,5 +1,5 @@ -/* $OpenBSD: eval.c,v 1.2 1996/03/08 22:00:58 niklas Exp $ */ -/* $NetBSD: eval.c,v 1.29 1996/03/06 14:49:29 pk Exp $ */ +/* $OpenBSD: eval.c,v 1.3 1996/06/18 10:10:06 deraadt Exp $ */ +/* $NetBSD: eval.c,v 1.29.4.1 1996/06/10 19:36:36 jtc Exp $ */ /*- * Copyright (c) 1993 @@ -41,7 +41,7 @@ #if 0 static char sccsid[] = "@(#)eval.c 8.9 (Berkeley) 6/8/95"; #else -static char sccsid[] = "$NetBSD: eval.c,v 1.29 1996/03/06 14:49:29 pk Exp $"; +static char sccsid[] = "$NetBSD: eval.c,v 1.29.4.1 1996/06/10 19:36:36 jtc Exp $"; #endif #endif /* not lint */ @@ -926,11 +926,8 @@ breakcmd(argc, argv) int argc; char **argv; { - int n; + int n = argc > 1 ? number(argv[1]) : 1; - n = 1; - if (argc > 1) - n = number(argv[1]); if (n > loopnest) n = loopnest; if (n > 0) { @@ -950,11 +947,8 @@ returncmd(argc, argv) int argc; char **argv; { - int ret; + int ret = argc > 1 ? number(argv[1]) : oexitstatus; - ret = exitstatus; - if (argc > 1) - ret = number(argv[1]); if (funcnest) { evalskip = SKIPFUNC; skipcount = 1; |