]> diplodocus.org Git - nmh/blobdiff - uip/mhical.c
Print pointers in debug with C99's `%p' rather than `0x%x'.
[nmh] / uip / mhical.c
index d18d601acfdef9da42ce03d1ca793c37f5d72f67..1567d3af26997db190229cf4598709712a1ce1b3 100644 (file)
@@ -1,5 +1,4 @@
-/*
- * 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
  *
  * This code is Copyright (c) 2014, by the authors of nmh.
  * See the COPYRIGHT file in the root directory of the nmh
@@ -57,6 +56,7 @@ DEFINE_SWITCH_ARRAY(MHICAL, switches);
 #undef X
 
 vevent vevents = { NULL, NULL, NULL};
 #undef X
 
 vevent vevents = { NULL, NULL, NULL};
+int parser_status = 0;
 
 int
 main (int argc, char *argv[]) {
 
 int
 main (int argc, char *argv[]) {
@@ -237,7 +237,7 @@ main (int argc, char *argv[]) {
         free (outfile);
     }
 
         free (outfile);
     }
 
-    return 0;
+    return parser_status;
 }
 
 /*
 }
 
 /*
@@ -714,7 +714,7 @@ display (FILE *file, contentline *clines, char *nfs) {
     }
 
     /* Don't call on the END:VCALENDAR 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);
       (void) fmt_scan (fmt, buffer, INT_MAX, dat, NULL);
       fputs (charstring_buffer (buffer), file);
       fmt_free (fmt, 1);
@@ -810,7 +810,7 @@ fold (char *line, int uses_cr) {
 #endif
 
         charstring_push_back_chars (folded_line, cp, char_len, 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. */
 
         /* remaining must be > 0 to pass the loop condition above, so
            if it's not > 1, it is == 1. */
@@ -825,7 +825,7 @@ fold (char *line, int uses_cr) {
             }
         }
 
             }
         }
 
-        cp += char_len > 0 ? char_len : 1;
+        cp += max(char_len, 1);
     }
 
     free (line);
     }
 
     free (line);