Introduction
Introduction Statistics Contact Development Disclaimer Help
tsv2agenda: add support for multiline fileds - ics2txt - convert icalendar .ics…
git clone git://bitreich.org/ics2txt git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws…
Log
Files
Refs
Tags
README
---
commit f4e7114a3838d2bcd8b80fd946a5e4ada83e9b05
parent 46202b022c22d7e917ece6bcdb5f8235ac314e09
Author: Josuah Demangeon <[email protected]>
Date: Sun, 20 Jun 2021 21:44:57 +0200
tsv2agenda: add support for multiline fileds
Diffstat:
M tsv2agenda.c | 22 ++++++++++++++++++++--
1 file changed, 20 insertions(+), 2 deletions(-)
---
diff --git a/tsv2agenda.c b/tsv2agenda.c
@@ -106,6 +106,25 @@ print_header(AgendaCtx *ctx, struct tm *beg, struct tm *en…
}
static void
+print_row(AgendaCtx *ctx, char *line, struct tm *beg, struct tm *end, size_t *…
+{
+ print_header(ctx, beg, end, num);
+ for (char *cp = line; *cp != '\0'; cp++) {
+ if (*cp == '\\') {
+ switch (*++cp) {
+ case 'n':
+ fputc('\n', stdout);
+ print_header(ctx, beg, end, num);
+ fputs(": ", stdout);
+ continue;
+ }
+ }
+ fputc(*cp, stdout);
+ }
+ fputc('\n', stdout);
+}
+
+static void
print(AgendaCtx *ctx, char **fields)
{
struct tm beg = {0}, end = {0};
@@ -130,8 +149,7 @@ print(AgendaCtx *ctx, char **fields)
for (size_t i = FIELD_OTHER, row = 0; i < ctx->fieldnum; i++) {
if (*fields[i] == '\0')
continue;
- print_header(ctx, &beg, &end, &row);
- fprintf(stdout, "%s\n", fields[i]);
+ print_row(ctx, fields[i], &beg, &end, &row);
}
ctx->beg = beg;
You are viewing proxied material from bitreich.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.