4 * This is just a little hack to copy standard input to a message in Aide>
17 void make_message(FILE *fp, char *target_room, char *author)
26 fprintf(fp, "Proom_aide");
28 fprintf(fp, "T%ld", (long)now);
30 fprintf(fp, "A%s", author);
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];
57 FILE *tempfp, *spoolfp;
63 strcpy(target_room, "Aide");
64 strcpy(author, "Citadel");
65 for (i=1; i<argc; ++i) {
66 if (!strncasecmp(argv[i], "-r", 2)) {
67 strncpy(target_room, &argv[i][2], sizeof(target_room));
68 target_room[sizeof(target_room)-1] = 0;
70 else if (!strncasecmp(argv[i], "-a", 2)) {
71 strncpy(author, &argv[i][2], sizeof(author));
72 author[sizeof(author)-1] = 0;
74 fprintf(stderr, "%s: usage: %s "
75 "[-rTargetRoom] [-aAuthor]\n",
82 snprintf(tempspool, sizeof tempspool, "./network/spoolin/ap.%d",
87 perror("cannot open temp file");
91 /* Generate a message from stdin */
92 make_message(tempfp, target_room, author);
94 /* Copy it to a new temp file in the spool directory */
97 spoolfp = fopen(tempspool, "wb");
98 if (spoolfp == NULL) {
99 perror("cannot open spool file");
102 while (ch = getc(tempfp), (ch >= 0))
108 execlp("./netproc", "netproc", "-i", NULL);
109 perror("cannot run netproc");