changeset 664:586caf75fccc

utillib: Add utl_arg_rest helper.
author Matti Hamalainen <ccr@tnsp.org>
date Sat, 20 Feb 2021 17:44:49 +0200
parents 8bde8f798188
children 4156adacdc31
files utillib.tcl
diffstat 1 files changed, 13 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/utillib.tcl	Sat Feb 20 17:35:40 2021 +0200
+++ b/utillib.tcl	Sat Feb 20 17:44:49 2021 +0200
@@ -146,6 +146,19 @@
 }
 
 
+proc utl_arg_rest {uarglist uindex ustr} {
+  upvar $ustr dstr
+
+  if {$uindex < [llength $uarglist]} {
+    set dstr [join [lrange $uarglist $uindex end] " "]
+    return 1
+  } else {
+    set dstr ""
+    return 0
+  }
+}
+
+
 ###
 ### HTML / HTTP related
 ###