aboutsummaryrefslogtreecommitdiff
path: root/jim.c
diff options
context:
space:
mode:
authorSteve Bennett <steveb@workware.net.au>2010-10-30 15:20:38 +1000
committerSteve Bennett <steveb@workware.net.au>2010-11-19 22:26:21 +1000
commitd98489727fe31fa217d237b36901211adc35282d (patch)
tree807297728746e597799dee38560455be3742691a /jim.c
parent64de34132f32f91e573e8f66d843daf3fd50b16d (diff)
downloadjimtcl-d98489727fe31fa217d237b36901211adc35282d.zip
jimtcl-d98489727fe31fa217d237b36901211adc35282d.tar.gz
jimtcl-d98489727fe31fa217d237b36901211adc35282d.tar.bz2
Better Tcl compatibility for [lrepeat]
With zero count and also with no list elements Signed-off-by: Steve Bennett <steveb@workware.net.au>
Diffstat (limited to 'jim.c')
-rw-r--r--jim.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/jim.c b/jim.c
index a03ff0b..dbe6d89 100644
--- a/jim.c
+++ b/jim.c
@@ -13163,11 +13163,15 @@ static int Jim_LrepeatCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const *
Jim_Obj *objPtr;
long count;
- if (argc < 3 || Jim_GetLong(interp, argv[1], &count) != JIM_OK || count <= 0) {
- Jim_WrongNumArgs(interp, 1, argv, "positiveCount value ?value ...?");
+ if (argc < 2 || Jim_GetLong(interp, argv[1], &count) != JIM_OK || count < 0) {
+ Jim_WrongNumArgs(interp, 1, argv, "count ?value ...?");
return JIM_ERR;
}
+ if (count == 0 || argc == 2) {
+ return JIM_OK;
+ }
+
argc -= 2;
argv += 2;