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 static 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,
94 "./network/spoolin/ap.%04x",
99 perror("cannot open temp file");
103 /* Generate a message from stdin */
104 make_message(tempfp, target_room, author);
106 /* Copy it to a new temp file in the spool directory */
109 spoolfp = fopen(tempspool, "wb");
110 if (spoolfp == NULL) {
111 perror("cannot open spool file");
114 while (ch = getc(tempfp), (ch >= 0))