]> Kevux Git Server - fll/commitdiff
Bugfix: FSS Extended Write is not properly quoting quotes.
authorKevin Day <kevin@kevux.org>
Wed, 6 Mar 2024 02:52:16 +0000 (20:52 -0600)
committerKevin Day <kevin@kevux.org>
Wed, 6 Mar 2024 02:52:16 +0000 (20:52 -0600)
When writing using a quote character that is not the selected quote to use when writing, these other quote character must still be quoted.
Take for example this:
  # fss_extended_write -oc "'" '"' -oc '"' "'" -oc ' `' "\` " -oc "'" "'"
  "'" "\""
  "\"" "'"
  "`" "` "
  "'" "'"

Quoting the quotes is necessary to ensure that the FSS Extended Read properly works.
Otherwise the [' '] would be read as an Object without Content when instead the code should be ["'" "'"] which would be read as an Object of ' and a Content of '.

level_1/fl_fss/c/private-fss.c

index 506e0f06b7cf8cf1213dfc4acfa7fcba5eb869b7..9739cbd645caac9fcfb0d44e75c2cabab10513cc 100644 (file)
@@ -1042,6 +1042,30 @@ extern "C" {
       }
       else if (object.string[range->start] != f_fss_delimit_placeholder_s.string[0]) {
         if (!quote_is) {
+          if (object.string[range->start] == f_string_ascii_quote_double_s.string[0] || object.string[range->start] == f_string_ascii_quote_single_s.string[0] || object.string[range->start] == f_string_ascii_grave_s.string[0]) {
+            item_first = range->start++;
+
+            status = f_fss_skip_past_delimit(state, object, range);
+            if (F_status_is_error(status)) return status;
+
+            if (range->start > range->stop || range->start >= object.used) {
+              quote_is = F_true;
+            }
+            else if (object.string[range->start] == object.string[item_first]) {
+              quote_is = F_true;
+            }
+            else {
+              status = f_fss_is_space(state, object, *range);
+              if (F_status_is_error(status)) break;
+
+              if (status == F_true) {
+                quote_is = F_true;
+              }
+            }
+
+            range->start = item_first;
+          }
+
           status = f_fss_is_space(state, object, *range);
           if (F_status_is_error(status)) break;