|
|
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 c
Length: 2711 (0xa97)
Types: TextFile
Names: »ckadr.c«
└─⟦2d1937cfd⟧ Bits:30007241 EUUGD22: P.P 5.0
└─⟦dc59850a2⟧ »EurOpenD22/pp5.0/pp-5.tar.Z«
└─⟦e5a54fb17⟧
└─⟦this⟧ »pp-5.0/Tools/ckadr/ckadr.c«
/* adr_check.c: check command line argument is a valid address */
# ifndef lint
static char Rcsid[] = "@(#)$Header: /cs/research/pp/hubris/pp-beta/Tools/ckadr/RCS/ckadr.c,v 5.0 90/09/20 16:24:24 pp Exp Locker: pp $";
# endif
/*
* $Header: /cs/research/pp/hubris/pp-beta/Tools/ckadr/RCS/ckadr.c,v 5.0 90/09/20 16:24:24 pp Exp Locker: pp $
*
* $Log: ckadr.c,v $
* Revision 5.0 90/09/20 16:24:24 pp
* rcsforce : 5.0 public release
*
*/
#include "util.h"
#include "adr.h"
#include "retcode.h"
#include "list_rchan.h"
static int responsibility = YES;
static int parse= CH_UK_PREF;
/* --------------------- Begin Routines ---------------------------------- */
main(argc, argv)
int argc;
char **argv;
{
char buf[BUFSIZ];
int i = 1;
extern int optind;
int opt;
sys_init(argv[0]);
while ((opt = getopt (argc, argv, "anpbl0123")) != EOF)
switch (opt) {
case 'a':
ap_norm_all_domains();
break;
case 'n':
responsibility = NO;
break;
case 'p':
ap_use_percent();
break;
case 'l':
parse = CH_USA_PREF;
break;
case 'b':
parse = CH_UK_PREF;
break;
case '0':
case '1':
case '2':
case '3':
parse = opt - '0';
break;
default:
printf("usage: %s [-a] [-n] [-p] [-b] [-l] [-0] [-1] [-2] [-3]\n", argv[0]);
exit(1);
break;
}
argc -= optind;
argv += optind;
if (argc == 0)
while (gets(buf) != NULL)
parse_address(buf);
else
while (argc--)
parse_address(*argv++);
}
static parse_address(str)
char *str;
{
ADDR *ad;
RP_Buf rp;
int origType;
int type, first;
LIST_RCHAN *ix;
if (index (str, '@'))
type = AD_822_TYPE;
else if (str[0] == '/')
type = AD_X400_TYPE;
else
type = AD_822_TYPE;
ad = adr_new(str, type, 0);
ad -> ad_resp = responsibility;
origType = ad->ad_type;
printf ("\n");
if (rp_isbad(ad_parse(ad, &rp, parse)))
printf("Address parsing failed:\nReason: %s\nParsing gave this:\n\n", ad->ad_parse_message);
if (origType == AD_X400_TYPE) {
if (isstr(ad->ad_r400adr))
printf("%s -> (x400) %s\n", str, ad->ad_r400adr);
if (isstr(ad->ad_r822adr))
printf("%s -> (rfc822) %s\n", str, ad->ad_r822adr);
}
else {
if (isstr(ad->ad_r822adr))
printf("%s -> (rfc822) %s\n", str, ad->ad_r822adr);
if (isstr(ad->ad_r400adr))
printf("%s -> (x400) %s\n", str, ad->ad_r400adr);
}
ix = ad -> ad_outchan;
first = 0;
while (ix) {
if (first == 0)
printf ("\n");
printf("%s to %s by %s\n",
(first++ == 0) ? "Delivered" : "Or delivered",
ix -> li_mta,
(ix -> li_chan) ?
ix -> li_chan -> ch_name : "no channel given");
ix = ix -> li_next;
}
printf ("\n");
}