2 * This is just a little hack to copy standard input to a message in Aide>
17 void make_message(FILE *fp, char *target_room)
26 fprintf(fp, "Proom_aide");
28 fprintf(fp, "T%ld", (long)now);
30 fprintf(fp, "ACitadel");
32 fprintf(fp, "O%s", target_room);
34 fprintf(fp, "N%s", NODENAME);
38 while (a = getc(stdin), a > 0) {
52 int main(int argc, char **argv)
55 char target_room[ROOMNAMELEN];
56 FILE *tempfp, *spoolfp;
62 strcpy(target_room, "Aide");
63 for (i=1; i<argc; ++i) {
64 if (!strncasecmp(argv[i], "-r", 2)) {
65 strncpy(target_room, &argv[i][2], sizeof(target_room));
66 target_room[sizeof(target_room)-1] = 0;
68 fprintf(stderr, "%s: usage: %s [-rTargetRoom]\n",
75 snprintf(tempspool, sizeof tempspool, "./network/spoolin/ap.%d",
80 perror("cannot open temp file");
84 /* Generate a message from stdin */
85 make_message(tempfp, target_room);
87 /* Copy it to a new temp file in the spool directory */
90 spoolfp = fopen(tempspool, "wb");
91 if (spoolfp == NULL) {
92 perror("cannot open spool file");
95 while (ch = getc(tempfp), (ch >= 0))
101 execlp("./netproc", "netproc", "-i", NULL);
102 perror("cannot run netproc");