home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Monster Media 1994 #1
/
monster.zip
/
monster
/
PROG_C
/
EUROSET.ZIP
/
DEMO.C
< prev
next >
Wrap
C/C++ Source or Header
|
1994-01-27
|
10KB
|
267 lines
/* demo.c 1994 jan 03 [gh]
+-----------------------------------------------------------------------------
| Abstract:
| Test fold library
|
| Authorship:
| Copyright (c) 1994 Gisle Hannemyr.
| Permission is granted to hack, make and distribute copies of this program
| as long as this copyright notice is not removed.
| Flames, bug reports, comments and improvements to:
| snail: Gisle Hannemyr, Brageveien 3A, 0452 Oslo, Norway
| email: X400: gisle.hannemyr@nr.no
| Inet: gisle@ifi.uio.no, gisle@oslonett.no
| UUCP: ...!mcsun!ifi!gisle
|
|
| History:
| 1.0 94 jan 03 [gh] Wrote it.
+---------------------------------------------------------------------------*/
#include <stdio.h>
#include <string.h>
#include "fold.h"
/*---( samples )------------------------------------------------------------*/
unsigned char Jumbo[10000];
unsigned char *plain = (unsigned char *)"\
Path: ifi.uio.no!nntp.uio.no!trane.uninett.no!sunic!EU.net!howland.reston.an\
s.net!xlink.net!rz.uni-karlsruhe.de!subnet.sub.net!syris.de!noris.de!not-for\
-mail\n\
From: erlichs@syris.de (Matthias Erlichs)\n\
Newsgroups: news.software.nntp\n\
Subject: Re: Using = in the active file...\n\
Date: 17 Jan 1994 15:10:48 +0100\n\
Organization: Smurf-O-Box, Nuernberg, FRG\n\
Lines: 14\n\
Message-ID: <2he698$3t7@syris.de>\n\
References: <2g1emi$gl1@ns1.arlut.utexas.edu> <Pnews.bruce.75833709.6178@bl\
illy.uucp> <2h3pm1$ro@syris.de> <Pnews.bruce.758596240.17719@blilly.uu\
cp>\n\
NNTP-Posting-Host: localhost\n\
\n\
In news.software.nntp, article <Pnews.bruce.758596240.17719@blilly.uucp>,\n\
lillyb@ccmail.nhq.sony.com (Bruce Lilly) writes:\n\
> \n\
> Subscription is not necessarily appropriate; one use at C news\n\
> sites is to file in one place all articles in groups that are\n\
> passed on to other systems, but which are not desired locally--\n\
> \"=junk\" works well for this, along with expiration of the junk\n\
\n\
INN uses \"j\" instead of \"=junk\" for exactly this reason.\n\
Posting to such groups is allowed.\n\
-- \n\
Matthias Erlichs \ XLink-POP N\374rnberg | EMail: erlichs@syris.de\n\
Schleiermacherstra\337e 21 \ Unix+Linux+Mac | Phone: please use email.\n\
90491 N\374rnberg (Germany) \ Consulting+Networking+Programming+etc'ing\n";
unsigned char *usacii = (unsigned char *)"\
Path: ifi.uio.no!nac.no!trane.uninett.no!sunic!EU.net!uunet!nntp.club.cc.cmu\
.edu!tres.ust.gov!ptbma.usbm.gov!klevemmc\n\
From: klevemmc@ptbma.ust.gov (Klevemann)\n\
Newsgroups: news.software.nntp\n\
Subject: Logging NNRP\n\
Date: 11 Jan 1994 16:11:07 GMT\n\
Organization: U. S. Tres\n\
Lines: 13\n\
Distribution: inet\n\
Message-ID: <2guj2r$6v4@miner.usbm.gov>\n\
NNTP-Posting-Host: ptbma.usbm.gov\n\
X-Newsreader: TIN [version 1.2 PL2]\n\
\n\
I think I might have asked this question before, but is there a way to \n\
log nnrp requests with inn 1.4 ?\n\
--\n\
Bill Klevemann, Network Support Group, U.S. Tres.\n";
unsigned char *isol1 = (unsigned char *)"\
Path: ifi.uio.no!nntp.uio.no!trane.uninett.no!sunic!EU.net!howland.reston.an\
s.net!xlink.net!rz.uni-karlsruhe.de!subnet.sub.net!syris.de!noris.de!not-for\
-mail\n\
From: erlichs@syris.de (Matthias Erlichs)\n\
Newsgroups: news.software.nntp\n\
Subject: Re: Using = in the active file...\n\
Date: 17 Jan 1994 15:10:48 +0100\n\
Organization: Smurf-O-Box, Nuernberg, FRG\n\
Lines: 14\n\
Message-ID: <2he698$3t7@syris.de>\n\
References: <2g1emi$gl1@ns1.arlut.utexas.edu> <Pnews.bruce.75833709.6178@bl\
illy.uucp> <2h3pm1$ro@syris.de> <Pnews.bruce.758596240.17719@blilly.uu\
cp>\n\
NNTP-Posting-Host: localhost\n\
Mime-Version: 1.0\n\
Content-Type: text/plain; charset=iso-8859-1\n\
Content-Transfer-Encoding: 8bit\n\
\n\
In news.software.nntp, article <Pnews.bruce.758596240.17719@blilly.uucp>,\n\
lillyb@ccmail.nhq.sony.com (Bruce Lilly) writes:\n\
> \n\
> Subscription is not necessarily appropriate; one use at C news\n\
> sites is to file in one place all articles in groups that are\n\
> passed on to other systems, but which are not desired locally--\n\
> \"=junk\" works well for this, along with expiration of the junk\n\
\n\
INN uses \"j\" instead of \"=junk\" for exactly this reason.\n\
Posting to such groups is allowed.\n\
-- \n\
Matthias Erlichs \ XLink-POP N\374rnberg | EMail: erlichs@syris.de\n\
Schleiermacherstra\337e 21 \ Unix+Linux+Mac | Phone: please use email.\n\
90491 N\374rnberg (Germany) \ Consulting+Networking+Programming+etc'ing\n";
unsigned char *isol1qp = (unsigned char *)"\
From \"Georg Gearlos <georg@cpanix.no>\" Fri Jun 11 13:19:58 1993\n\
Flags: 000000000001\n\
Return-Path: <georg>\n\
Received: from gyda.cpanix.no by cpanix.no with SMTP \n\
id <AAcpanix.no26176> for <georg@cpanix.no>; Fri, 11 Jun 1993 13:1\
9:57 +0200\n\
Received: by gyda.cpanix.no ; Fri, 11 Jun 1993 13:19:56 +0200\n\
Date: Fri, 11 Jun 1993 13:19:55 +0200\n\
Mime-Version: 1.0\n\
From: Georg Gearlos <georg@cpanix.no>\n\
To: peons@cybernet.no\n\
Subject: Fin reklame for Cybernet!\n\
Message-Id: <CMM.0.90.4.739797595.georg@gyda.cpanix.no>\n\
Content-Type: text/plain; charset=\"iso-8859-1\"\n\
Content-Transfer-Encoding: quoted-printable\n\
\n\
QTIP, som er et program for bruk av IT til kvalitet i produksjon,\n\
har n=E5 avsluttet sitt forprosjekt og anbefaler bl.a. at medlems-\n\
bedrifter uten E-mail tegner avtale med Cybernet for =E5 f=E5 tilgang\n\
til elektronisk post.\n\
\n\
Jeg synes dette var fint =E5 f=E5 h=F8re, og minner samtidig om et viktig\n\
prinsipp i \"gerilja-markedsf=F8ring\": Det er sv=E6rt viktig =E5\n\
f=E5 fatt i \"the movers and shakers\" som kunder. Det er disse som\n\
etablerer trender og sprer praksis rundt seg. Vi burde kanskje g=E5\n\
gjennom kundelista og identifisere M&S -- og gi disse VIP-behandling.\n\
\n\
Meta-disclaimer: A society that needs disclaimers has too many lawyers.\n\
=20\n\
- Georg Gearlos (Cybernet Inc.)\n\
OSI: C=3Dno;PRMD=3Duninett;O=3Dnr;S=3DGearlos;G=3DGeorg (X.400 SA =\n\
format)\n\
georg.gearlos@nfraad.no (RFC-822 format)\n\
Inet: georg@cpanix.no\n\
UUCP: ...!mcsun!ifi!georg\n\
------------------------------------------------\n";
unsigned char *iso646n = (unsigned char *)"\
Newsgroups: no.general,no.mail\n\
Path: oslonett.no!telepost.no!news.eunet.no!nuug!falch!falch!steinarb\n\
From: steinarb@falch.no (Steinar Bang)\n\
Subject: X.400 til Internet gateway?\n\
Content-Type: text/plain; charset=x-iso-ir-60\n\
Message-ID: <STEINARB.94Jan20155501@falch.falch.no>\n\
Followup-To: no.general\n\
Sender: Falch Newsfeed <usenet@falch.no>\n\
Content-Transfer-Encoding: 7bit\n\
Organization: Falch Hurtigtrykk, Oslo, Norway\n\
Mime-Version: 1.0\n\
Date: Thu, 20 Jan 1994 14:55:01 GMT\n\
Lines: 10\n\
\n\
Finnes det noen MIME-sak ala X.400 til SMTP gateway, som kj|rer p}\n\
Sparc/PC/Novell/Mac, } f} kj|pt (eller som finnes fritt tilgjengelig)\n\
idag? Hvem tar man is}fall kontakt med?\n\
\n\
Jeg har lest FAQ-lista til comp.mail.mime, s} det er ikke n|dvendig }\n\
sende meg den. Men hvis det er noen som vet noe konkret om\n\
l|sningene rundt PP eller Z-mail, som st}r nevnt i denne FAQ-lista, s}\n\
er jeg meget interessert i } h|re om det.\n\
\n\
- Steinar\n";
/*---( demo )---------------------------------------------------------------*/
void dodemo(cset, which)
int cset;
int which;
{
unsigned char *buf, *head, *body;
switch (which) {
case 0: buf = plain; break;
case 1: buf = usacii; break;
case 2: buf = isol1; break;
case 3: buf = isol1qp; break;
case 4: buf = iso646n; break;
default: fputs("*** Unknown demo.\n", stderr);
} /* dodemo */
strcpy(Jumbo, buf);
head = Jumbo;
body = splitbody(Jumbo);
if (!body) fputs("*** no body?\n", stderr);
initout(cset); /* Or set this up permanently to be right */
inithead(head); /* Parse headers */
unmimebuffer(body); /* Unmime it. */
foldbuffer(body); /* Fold the buffer. */
fputs("========================================================================\n", stdout);
if (head) fputs(head, stdout);
fputs("------------------------------------------------------------------------\n", stdout);
if (body) fputs(body, stdout);
fputs("========================================================================\n", stdout);
} /* dodemo */
/*---( main )---------------------------------------------------------------*/
int main(argc, argv)
int argc; char *argv[];
{
char buff[80];
int ii, jj;
fputs("\
First we need to know your character set, please select one off:\n\
1) ISO-646-IRV\n\
2) ISO-IR-60\n\
3) ISO-8859/1\n\
4) IBM CP 850\n\
5) Macintosh\n\
6) (Exit)\n\
Select one (1-6) : ", stdout);
fflush(stdout);
fgets(buff, 10, stdin);
sscanf(buff, "%d", &ii);
if ((ii < 1) || (ii >= 6)) return(0);
for (;;) {
fputs("\
Please select one off:\n\
0) Plain, no headers\n\
1) US ASCII, 7 bit\n\
2) ISO-8859/1, 8 bit\n\
3) ISO-8859/1, quoted-printable\n\
4) ISO-IR60 (Norwegian) 7 bit)\n\
5) (Exit)\n\
Select one (0-5) : ", stdout);
fflush(stdout);
fgets(buff, 10, stdin);
sscanf(buff, "%d", &jj);
printf(">>> %d\n", jj);
if ((jj < 0) || (jj >= 5)) break;
dodemo(ii, jj);
} /* forever */
return(0);
} /* main */
/* EOF */