3 * see copyright.doc for copyright information
5 * This program is a filter which converts Citadel/UX binary message format
6 * to standard UseNet news format. Useful for Citadel<->News gateways.
29 int a, b, e, mtype, aflag;
30 char bbb[100], ngn[100];
39 /* experimental cuunbatch header generation */
40 for (a = 0; a < argc; ++a) {
41 if (!strcmp(argv[a], "-c"))
59 strcpy(tuid, "postmaster");
65 fprintf(tfp, "Message-ID: <%ld@%s>\n", tmid, tsid);
70 while (a = getc(fp), a > 0) {
76 if ((b != 'M') && (b > 0))
82 if (!strcmp(tsid, NODENAME))
84 for (a = 0; a < strlen(tuid); ++a)
87 fprintf(tfp, "From: %s@%s ", tuid, tsid);
88 for (a = 0; a < strlen(tuid); ++a)
91 fprintf(tfp, "(%s)\n", tuid);
94 fprintf(tfp, "Path: %s\n", bbb);
99 fprintf(tfp, "Newsgroups: %s\n", ngn);
102 fprintf(tfp, "To: %s\n", bbb);
104 fprintf(tfp, "Subject: %s\n", bbb);
107 tm = (struct tm *) localtime(&now);
108 fprintf(tfp, "Date: %s", asctime(tm));
110 } while ((b != 'M') && (b > 0));
114 printf("#! cuunbatch %ld\n", msglen);
116 printf("#! rnews %ld\n", msglen);
121 putc(getc(tfp), stdout);
127 fpgetfield(fp, string) /* level-2 break out next null-terminated string */
146 fmout(width, fp, mout)
150 int a, b, c, real, old;
155 c = 1; /* c is the current pos */
162 if (((a == 13) || (a == 10)) && (old != 13) && (old != 10))
164 if (((old == 13) || (old == 10)) && (isspace(real))) {
172 if (((strlen(aaa) + c) > (width - 1)) && (strlen(aaa) > (width - 1))) {
173 fprintf(mout, "\n%s", aaa);
182 if ((strlen(aaa) + c) > (width - 1)) {
186 fprintf(mout, "%s ", aaa);
192 if ((a == 13) || (a == 10)) {
193 fprintf(mout, "%s\n", aaa);
200 FMTEND:fprintf(mout, "\n");
204 xref(roomname, newsgroup)
205 char *roomname, *newsgroup;
211 strcpy(newsgroup, roomname);
212 fp = fopen("./network/rnews.xref", "r");
215 while (fgets(tbuf, 128, fp) != NULL) {
216 tbuf[strlen(tbuf) - 1] = 0; /* strip off the newline */
222 if (!strcasecmp(&tbuf[commapos + 1], roomname))
223 strcpy(newsgroup, tbuf);