4 * This is just a little hack to copy standard input to a message in Aide>
11 #if TIME_WITH_SYS_TIME
12 # include <sys/time.h>
16 # include <sys/time.h>
28 void make_message(FILE *fp, char *target_room, char *author)
37 fprintf(fp, "Proom_aide");
39 fprintf(fp, "T%ld", (long)now);
41 fprintf(fp, "A%s", author);
43 fprintf(fp, "O%s", target_room);
45 fprintf(fp, "N%s", NODENAME);
49 while (a = getc(stdin), a > 0) {
63 int main(int argc, char **argv)
66 char target_room[ROOMNAMELEN];
68 FILE *tempfp, *spoolfp;
74 strcpy(target_room, "Aide");
75 strcpy(author, "Citadel");
76 for (i=1; i<argc; ++i) {
77 if (!strncasecmp(argv[i], "-r", 2)) {
78 strncpy(target_room, &argv[i][2], sizeof(target_room));
79 target_room[sizeof(target_room)-1] = 0;
81 else if (!strncasecmp(argv[i], "-a", 2)) {
82 strncpy(author, &argv[i][2], sizeof(author));
83 author[sizeof(author)-1] = 0;
85 fprintf(stderr, "%s: usage: %s "
86 "[-rTargetRoom] [-aAuthor]\n",
93 snprintf(tempspool, sizeof tempspool, "./network/spoolin/ap.%d",
98 perror("cannot open temp file");
102 /* Generate a message from stdin */
103 make_message(tempfp, target_room, author);
105 /* Copy it to a new temp file in the spool directory */
108 spoolfp = fopen(tempspool, "wb");
109 if (spoolfp == NULL) {
110 perror("cannot open spool file");
113 while (ch = getc(tempfp), (ch >= 0))
119 execlp("./netproc", "netproc", "-i", NULL);
120 perror("cannot run netproc");