From 66824391d1453265ab4643f7afe2bb1332f83878 Mon Sep 17 00:00:00 2001 From: christos Date: Mon, 3 Jun 1996 12:21:17 +0000 Subject: [PATCH] Fix PR/2504: return with no args returns 0 instead of the return value of the previous command in functions --- bin/sh/eval.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/bin/sh/eval.c b/bin/sh/eval.c index c9eb26e6105c..44518a9fe12b 100644 --- a/bin/sh/eval.c +++ b/bin/sh/eval.c @@ -1,4 +1,4 @@ -/* $NetBSD: eval.c,v 1.29 1996/03/06 14:49:29 pk Exp $ */ +/* $NetBSD: eval.c,v 1.30 1996/06/03 12:21:17 christos Exp $ */ /*- * Copyright (c) 1993 @@ -40,7 +40,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.30 1996/06/03 12:21:17 christos Exp $"; #endif #endif /* not lint */ @@ -925,11 +925,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) { @@ -949,11 +946,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;