]> code.citadel.org Git - citadel.git/blobdiff - citadel/aidepost.c
* CtdlSaveMsg() is now CtdlSubmitMsg() and can accept any combination of
[citadel.git] / citadel / aidepost.c
index 0ed777b66f457ef428de76c2a86f84248f69eca7..c7a7265c60787eb995c01b9dea6e5d641cf2be38 100644 (file)
 #include "citadel.h"
 #include "config.h"
 
-void make_message(FILE *fp, char *target_room, char *author)
+#ifndef HAVE_SNPRINTF
+#include "snprintf.h"
+#endif
+
+
+/*
+ * Simplified function to generate a message in our format
+ */
+static void ap_make_message(FILE *fp, char *target_room, char *author)
 {
        int a;
        long bb, cc;
@@ -89,8 +97,8 @@ int main(int argc, char **argv)
                }
        }
 
-
-       snprintf(tempspool, sizeof tempspool, "./network/spoolin/ap.%d",
+       snprintf(tempspool, sizeof tempspool,
+               "./network/spoolin/ap.%04x",
                getpid());
 
        tempfp = tmpfile();
@@ -100,7 +108,7 @@ int main(int argc, char **argv)
        }
 
        /* Generate a message from stdin */
-       make_message(tempfp, target_room, author);
+       ap_make_message(tempfp, target_room, author);
 
        /* Copy it to a new temp file in the spool directory */
        rewind(tempfp);
@@ -110,13 +118,12 @@ int main(int argc, char **argv)
                perror("cannot open spool file");
                exit(errno);
        }
-       while (ch = getc(tempfp), (ch >= 0))
+       while (ch = getc(tempfp), (ch >= 0)) {
                putc(ch, spoolfp);
+       }
 
        fclose(tempfp);
        fclose(spoolfp);
 
-       execlp("./netproc", "netproc", "-i", NULL);
-       perror("cannot run netproc");
-       exit(errno);
+       exit(0);
 }