aboutsummaryrefslogtreecommitdiff
path: root/src/format.c
diff options
context:
space:
mode:
authorFederico Angelilli <code@fedang.net>2024-11-18 23:45:47 +0100
committerFederico Angelilli <code@fedang.net>2024-11-18 23:45:47 +0100
commit7a33c4e201783acb7d5bdd07bbccf921940b332c (patch)
tree3320c0da2c98bdc41529542eb8121daba0ba4bd8 /src/format.c
parentca2cf9265e2030a9098f18315e3addde7f518192 (diff)
Use format for fs
Diffstat (limited to 'src/format.c')
-rw-r--r--src/format.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/format.c b/src/format.c
index 8f42c00..49d5d35 100644
--- a/src/format.c
+++ b/src/format.c
@@ -87,9 +87,10 @@ next:
return true;
}
-bool format_remark(format_t *format, const char *label, const format_pair_t *pairs)
+int format_remark(format_t *format, const char *label, const format_pair_t *pairs)
{
- int errors = 0;
+ int errors = 0, marked = 0;
+
for (size_t i = 0; i < format->length; i++) {
// Skip regular strings
if (!format->marks[i]) continue;
@@ -103,6 +104,7 @@ bool format_remark(format_t *format, const char *label, const format_pair_t *pai
!strcmp(pairs[j].key, format->parts[i]))
{
format->marks[i] = pairs[j].mark;
+ marked++;
goto next;
}
}
@@ -113,7 +115,7 @@ bool format_remark(format_t *format, const char *label, const format_pair_t *pai
next:
}
- return errors == 0;
+ return errors > 0 ? -errors : marked;
}
void format_free(format_t *format)