2 * This is just a little hack to copy standard input to a message in Aide>
16 void make_message(FILE *fp)
25 fprintf(fp, "Proom_aide");
27 fprintf(fp, "T%ld", (long)now);
29 fprintf(fp, "ACitadel");
33 fprintf(fp, "N%s", NODENAME);
37 while (a = getc(stdin), a > 0) {
51 int main(int argc, char **argv)
56 FILE *tempfp, *spoolfp;
60 snprintf(tempbase, sizeof tempbase, "ap.%d", getpid());
61 snprintf(temptmp, sizeof temptmp, "/tmp/%s", tempbase);
62 snprintf(tempspool, sizeof tempspool, "./network/spoolin/%s", tempbase);
64 tempfp = fopen(temptmp, "wb+");
66 perror("cannot open temp file");
69 /* Unlink the temp file, so it automatically gets deleted by the OS if
70 * this program is interrupted or crashes.
73 /* Generate a message from stdin */
76 /* Copy it to a new temp file in the spool directory */
79 spoolfp = fopen(tempspool, "wb");
80 if (spoolfp == NULL) {
81 perror("cannot open spool file");
84 while (ch = getc(tempfp), (ch >= 0))
90 execlp("./netproc", "netproc", "-i", NULL);
91 perror("cannot run netproc");