X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/47e4d2685ab31e71336a7806fdc3dcd2a107f60f..e35fb433:/uip/mhical.c?ds=inline diff --git a/uip/mhical.c b/uip/mhical.c index 67ba90da..d62fce95 100644 --- a/uip/mhical.c +++ b/uip/mhical.c @@ -29,7 +29,7 @@ static void convert_common (contentline *, act); 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); @@ -56,6 +56,7 @@ DEFINE_SWITCH_ARRAY(MHICAL, switches); #undef X vevent vevents = { NULL, NULL, NULL}; +int parser_status = 0; int main (int argc, char *argv[]) { @@ -236,7 +237,7 @@ main (int argc, char *argv[]) { free (outfile); } - return 0; + return parser_status; } /* @@ -534,11 +535,10 @@ output (FILE *file, contentline *clines, int contenttype) { 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); } } @@ -713,7 +713,7 @@ display (FILE *file, contentline *clines, char *nfs) { } /* 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);