]> git.plutz.net Git - webpoll/commitdiff
bugfix: avoid octal interpretation of leading zeros
authorPaul Hänsch <paul@plutz.net>
Thu, 29 Jul 2021 15:37:38 +0000 (17:37 +0200)
committerPaul Hänsch <paul@plutz.net>
Thu, 29 Jul 2021 15:37:38 +0000 (17:37 +0200)
newdate.sh
widgets.sh

index 4b220c14c49fa8908b5ea80ee38dfaf2dd4cbb4d..74277dce777d065a0f54c64ecca746aa8fa6620d 100755 (executable)
@@ -59,8 +59,8 @@ fs_splittimes() {
                       pattern="^(0?\[0-9\]|1\[0-9\]|2\[0-3\]):(\[0-5\]\[0-9\])$"/>
                <input name="todend_%s"   value="%s" placeholder="HH:MM"   list="dlist_timeofday"
                       pattern="^(0?\[0-9\]|1\[0-9\]|2\[0-3\]):(\[0-5\]\[0-9\])$"/>
-               [submit "todremove" "%i" -]
-             ' "$day" "${time%-*}" "$day" "${time#*-}" "${c}"
+               [submit "todremove_%s" "%i" -]
+             ' "$day" "${time%-*}" "$day" "${time#*-}" "$day" "${c}"
            done
            printf '[submit "addtime" "%s" + Add Time Option]' "$day"
          done)
@@ -111,7 +111,7 @@ if [ "$REQUEST_METHOD" = POST ]; then
         [ "${todstart%:??}" -lt "${todend%:??}" -o "${todstart%:??}" -eq "${todend%:??}" -a "${todstart#*:}" -lt "${todend#*:}" ] \
         2>&- \
         && { printf '%02i:%02i-%02i:%02i\n' "${todstart%:??}" "${todstart#*:}" "${todend%:??}" "${todend#*:}"; }\
-        || { [ "${todstart%:??}" -ge 0 -a  "${todstart#*:}" -ge 0 ] 2>&- && printf '%02i:%02i-\n' "${todstart%:??}" "${todstart#*:}"; }
+        || { [ "${todstart%:??}" -ge 0 -a  "${todstart#*:}" -ge 0 ] 2>&- && printf '%02i:%02i-\n' $(dec ${todstart%:??} ${todstart#*:}); }
       done |grep -xE '^([01][0-9]|2[0-3]):([0-5][0-9])-(([01][0-9]|2[0-3]):([0-5][0-9]))?$' |sort -u
     )"
     [ "$addtime" = "$date" ] && DBM "$file" append "tod_${date}" "${BR}-"
index 3eb4850b274d764b28078f1e5eb0d7148bdf2ebe..835e6463113dae536546a0124d96855f56763e75 100755 (executable)
@@ -7,6 +7,14 @@ else
   markdown() { busybox awk -f "$_EXEC/cgilite/markdown.awk"; }
 fi
 
+dec(){
+  local n
+  for n in "$@"; do
+    while [ "${n}" != "${n#0}" ]; do n="${n#0}"; done
+    printf %i\\n "$n"
+  done
+}
+
 checked(){
   local check="$1"; shift 1;
   for comp in "$@"; do