+ strcpy(target_room, "Aide");
+ strcpy(author, "Citadel");
+ strcpy(subject, "");
+ for (i=1; i<argc; ++i) {
+ if (!strncasecmp(argv[i], "-r", 2)) {
+ strncpy(target_room, &argv[i][2], sizeof(target_room));
+ target_room[sizeof(target_room)-1] = 0;
+ }
+ else if (!strncasecmp(argv[i], "-a", 2)) {
+ strncpy(author, &argv[i][2], sizeof(author));
+ author[sizeof(author)-1] = 0;
+ }
+ else if (!strncasecmp(argv[i], "-s", 2)) {
+ strncpy(subject, &argv[i][2], sizeof(subject));
+ subject[sizeof(subject)-1] = 0;
+ } else {
+ fprintf(stderr, "%s: usage: %s "
+ "[-rTargetRoom] [-aAuthor] [-sSubject]\n",
+ argv[0], argv[0]);
+ exit(1);
+ }
+ }
+
+ snprintf(tempspool, sizeof tempspool,
+ "%s/ap.%04lx",
+ ctdl_netin_dir,
+ (long)getpid());
+
+ unlink(tempspool);
+
+ tempfp = fopen(tempspool, "w+b");
+ unlink(tempspool);
+ if (tempfp == NULL) {
+ perror("cannot open temp file");
+ exit(errno);
+ }
+
+ /* Generate a message from stdin */
+ ap_make_message(tempfp, target_room, author, subject);
+
+ /* Copy it to a new temp file in the spool directory */
+ rewind(tempfp);