From 0b2f38c67d3501f997a7840ff2f0791cfc3e06cd Mon Sep 17 00:00:00 2001
From: Stefan Rueger <stefan.rueger@urclocks.com>
Date: Tue, 12 Jul 2022 11:39:52 +0100
Subject: [PATCH] Allow optional comma separators for data items in terminal
 write

---
 src/term.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/term.c b/src/term.c
index cd7e3b45..f4472452 100644
--- a/src/term.c
+++ b/src/term.c
@@ -616,6 +616,10 @@ static int cmd_write(PROGRAMMER * pgm, struct avrpart * p,
         data.str_ptr = NULL;
       }
 
+      // remove trailing comma to allow cut and paste of lists
+      if(arglen > 0 && argi[arglen-1] == ',')
+        argi[--arglen] = 0;
+
       // Try integers and assign data size
       errno = 0;
       data.ull = strtoull(argi, &end_ptr, 0);