-/*
- * mhical.c -- operate on an iCalendar request
+/* mhical.c -- operate on an iCalendar request
*
* This code is Copyright (c) 2014, by the authors of nmh.
* See the COPYRIGHT file in the root directory of the nmh
#include <h/fmt_scan.h>
#include "h/addrsbr.h"
#include "h/mts.h"
+#include "h/done.h"
#include "h/utils.h"
#include <time.h>
static void dump_unfolded (FILE *, contentline *);
static void output (FILE *, contentline *, int);
static void display (FILE *, contentline *, char *);
-static const char *identity (const contentline *);
+static const char *identity (const contentline *) PURE;
static char *format_params (char *, param_list *);
static char *fold (char *, int);
#undef X
vevent vevents = { NULL, NULL, NULL};
+int parser_status = 0;
int
main (int argc, char *argv[]) {
free (outfile);
}
- return 0;
+ return parser_status;
}
/*
line = fold (add (node->value, line),
clines->cr_before_lf == CR_BEFORE_LF);
- if (clines->cr_before_lf == LF_ONLY) {
- fprintf (file, "%s\n", line);
- } else {
- fprintf (file, "%s\r\n", line);
- }
+ fputs(line, file);
+ if (clines->cr_before_lf != LF_ONLY)
+ putc('\r', file);
+ putc('\n', file);
free (line);
}
}
}
/* Don't call on the END:VCALENDAR line. */
- if (clines->next) {
+ if (clines && clines->next) {
(void) fmt_scan (fmt, buffer, INT_MAX, dat, NULL);
fputs (charstring_buffer (buffer), file);
fmt_free (fmt, 1);
#endif
charstring_push_back_chars (folded_line, cp, char_len, 1);
- remaining -= char_len > 0 ? char_len : 1;
+ remaining -= max(char_len, 1);
/* remaining must be > 0 to pass the loop condition above, so
if it's not > 1, it is == 1. */
}
}
- cp += char_len > 0 ? char_len : 1;
+ cp += max(char_len, 1);
}
free (line);