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>
33 static void make_message(FILE *fp, char *target_room, char *author)
42 fprintf(fp, "Proom_aide");
44 fprintf(fp, "T%ld", (long)now);
46 fprintf(fp, "A%s", author);
48 fprintf(fp, "O%s", target_room);
50 fprintf(fp, "N%s", NODENAME);
54 while (a = getc(stdin), a > 0) {
68 int main(int argc, char **argv)
71 char target_room[ROOMNAMELEN];
73 FILE *tempfp, *spoolfp;
79 strcpy(target_room, "Aide");
80 strcpy(author, "Citadel");
81 for (i=1; i<argc; ++i) {
82 if (!strncasecmp(argv[i], "-r", 2)) {
83 strncpy(target_room, &argv[i][2], sizeof(target_room));
84 target_room[sizeof(target_room)-1] = 0;
86 else if (!strncasecmp(argv[i], "-a", 2)) {
87 strncpy(author, &argv[i][2], sizeof(author));
88 author[sizeof(author)-1] = 0;
90 fprintf(stderr, "%s: usage: %s "
91 "[-rTargetRoom] [-aAuthor]\n",
98 snprintf(tempspool, sizeof tempspool,
99 "./network/spoolin/ap.%04x",
103 if (tempfp == NULL) {
104 perror("cannot open temp file");
108 /* Generate a message from stdin */
109 make_message(tempfp, target_room, author);
111 /* Copy it to a new temp file in the spool directory */
114 spoolfp = fopen(tempspool, "wb");
115 if (spoolfp == NULL) {
116 perror("cannot open spool file");
119 while (ch = getc(tempfp), (ch >= 0))