]> code.citadel.org Git - citadel.git/blobdiff - citadel/msgform.c
* Replaced all "Citadel/UX" references with "Citadel"
[citadel.git] / citadel / msgform.c
index 6b47b83ef99e53b0aaf75d9903135060de2c544f..ba6f2fdfce4ad17b36958b29d79fad0e1dff40c2 100644 (file)
@@ -1,14 +1,14 @@
 /*
- * msgform.c v2.1
- * see copyright.doc for copyright information
+ * $Id$
  * 
  * This is simply a filter that converts Citadel binary message format
  * to readable, formatted output.
  * 
  * If the -q (quiet or qwk) flag is used, only the message text prints, and
  * then it stops at the end of the first message it prints.
- * This is used by the QWK reader for Citadel/UX during message format
+ * This is used by the QWK reader for Citadel during message format
  * translation.
+ *
  */
 
 #include "sysdep.h"
 #include <stdio.h>
 #include <ctype.h>
 #include <string.h>
-#include <time.h>
+
+#if TIME_WITH_SYS_TIME
+# include <sys/time.h>
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
+#endif
+
 #include <errno.h>
 
-long finduser();
-int fmout();
-int fpgetfield();
 
 int qwk = 0;
 
+int fpgetfield(FILE *fp, char *string);
+int fmout(int width, FILE *fp);
+
 
-#ifdef NO_STRERROR
+#ifndef HAVE_STRERROR
 /*
  * replacement strerror() for systems that don't have it
  */
-char *strerror(e)
-int e; {
+char *strerror(int e)
+{
        static char buf[32];
 
-       sprintf(buf,"errno = %d",e);
+       snprintf(buf, sizeof buf, "errno = %d",e);
        return(buf);
        }
 #endif
 
-void main(argc,argv)
-int argc;
-char *argv[]; {
+int main(int argc, char **argv)
+{
        struct tm *tm;
        int a,b,e,mtype,aflag;
        char bbb[1024];
        char subject[1024];
        FILE *fp;
-       long now;
+       time_t now;
 
        if (argc==2) if (!strcmp(argv[1],"-q")) qwk = 1;
        fp=stdin;
@@ -104,9 +114,9 @@ TOP:        do {
        goto TOP;
 }
 
-int fpgetfield(fp,string) /* level-2 break out next null-terminated string */
-FILE *fp;
-char string[];
+int fpgetfield(FILE *fp, char *string) /* level-2 break out next null-terminated string */
+         
+              
 {
 int a,b;
 strcpy(string,"");
@@ -120,10 +130,8 @@ a=0;
        return(0);
 }
 
-int fmout(width,fp)
-int width;
-FILE *fp;
-       {
+int fmout(int width, FILE *fp)
+{
        int a,b,c;
        int real = 0;
        int old = 0;