|
|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T r
Length: 1943 (0x797)
Types: TextFile
Names: »rfc2or.c«
└─⟦2d1937cfd⟧ Bits:30007241 EUUGD22: P.P 5.0
└─⟦dc59850a2⟧ »EurOpenD22/pp5.0/pp-5.tar.Z«
└─⟦e5a54fb17⟧
└─⟦this⟧ »pp-5.0/Tools/ckor/rfc2or.c«
/* rfc2or.c: Parses an RFC address using the tables or, or2rfc and rfc2or */
# ifndef lint
static char Rcsid[] = "@(#)$Header: /cs/research/pp/hubris/pp-beta/Tools/ckor/RCS/rfc2or.c,v 5.0 90/09/20 16:25:49 pp Exp Locker: pp $";
# endif
/*
* $Header: /cs/research/pp/hubris/pp-beta/Tools/ckor/RCS/rfc2or.c,v 5.0 90/09/20 16:25:49 pp Exp Locker: pp $
*
* $Log: rfc2or.c,v $
* Revision 5.0 90/09/20 16:25:49 pp
* rcsforce : 5.0 public release
*
*/
#include "head.h"
#include "or.h"
extern char or_error[];
/* --------------------- Begin Routines -------------------------------- */
main (argc, argv)
int argc;
char *argv[];
{
char buf[BUFSIZ];
int i = 1;
sys_init (argv[0]);
if (or_init() == NOTOK ) {
printf ("or_init() failed\n");
exit (1);
}
if (argc == 1)
while (gets (buf) != NULL)
parse_address (buf);
else
while (i < argc)
parse_address (argv[i++]);
}
/* --------------------- Static Routines ------------------------------- */
static int parse_address (str)
char *str;
{
char rfcbuf [BUFSIZ];
char x400buf [BUFSIZ];
OR_ptr or = NULLOR;
or_error[0] = x400buf[0] = rfcbuf[0] = '\0';
/* --- Perform the x400 addressing --- */
if ((or_rfc2or (str, &or) != OK) || (or == NULLOR))
goto error;
if (isstr (or_error))
goto error;
or_or2std (or, x400buf, FALSE);
/* --- Perform the rfc822 address parsing --- */
if (or_or2rfc (or, rfcbuf) == NOTOK)
goto error;
if (isstr (or_error))
goto error;
printf ("\n%s -> (x400) %s\n%-*s -> (rfc822) %s\n",
str, x400buf, strlen(str), "", rfcbuf);
goto finish;
error: ;
printf ("Address parsing rfc2or failed \nReason : %s\n", or_error);
if (rfcbuf[0] != '\0')
printf ("%s -> (rfc822) %s\n", str, rfcbuf);
if (x400buf[0] != '\0')
printf ("%s -> (x400) %s\n", str, x400buf);
finish: ;
printf ("\n");
fflush (stdout);
or_free (or);
return;
}