DataMuseum.dk

Presents historical artifacts from the history of:

DKUUG/EUUG Conference tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about DKUUG/EUUG Conference tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - metrics - download
Index: T s

⟦52a89c519⟧ TextFile

    Length: 1342 (0x53e)
    Types: TextFile
    Names: »strip_addr.c«

Derivation

└─⟦2d1937cfd⟧ Bits:30007241 EUUGD22: P.P 5.0
    └─⟦dc59850a2⟧ »EurOpenD22/pp5.0/pp-5.tar.Z« 
        └─⟦e5a54fb17⟧ 
            └─⟦this⟧ »pp-5.0/Uip/misc/strip_addr.c« 

TextFile

/* strip_addr.c: simpify addresses */

# ifndef lint
static char Rcsid[] = "@(#)$Header: /cs/research/pp/hubris/pp-beta/Uip/misc/RCS/strip_addr.c,v 5.0 90/09/20 16:33:22 pp Exp Locker: pp $";
# endif

/*
 * $Header: /cs/research/pp/hubris/pp-beta/Uip/misc/RCS/strip_addr.c,v 5.0 90/09/20 16:33:22 pp Exp Locker: pp $
 *
 * $Log:	strip_addr.c,v $
 * Revision 5.0  90/09/20  16:33:22  pp
 * rcsforce : 5.0 public release
 * 
 */



#include "util.h"
#include "ap.h"

static int no_routes = 0;

main (argc, argv)
int	argc;
char	**argv;
{
	int	opt;
	extern int optind;

	while ((opt = getopt (argc, argv, "rp")) != EOF)
		switch (opt) {
		    case 'r':
			no_routes ++;
			break;
		    case 'p':
			ap_use_percent ();
			break;
		    default:
			break;
		}

	argc -= optind; argv += optind;


	if (argc <= 0) {
		char	buf[BUFSIZ];

		while (fgets (buf, sizeof buf, stdin) )
			do_addr (buf);
	}
	else
		while (argc-- > 0)
			do_addr (*argv++);
	exit (0);
}


do_addr (str)
char	*str;
{
	char	*cp;
	AP_ptr local, domain, route, tree;

	tree = ap_s2t (str);

	switch ((int)tree) {
	    case NOTOK:
	    case 0:
		printf ("%s\n", str);
		return;
	}
	(void) ap_t2p (tree, (AP_ptr *)0, (AP_ptr *)0,
		       &local, &domain, &route);
	cp = ap_p2s_nc (NULLAP, NULLAP, local, domain,
			no_routes ? NULLAP : route);
	printf ("%s\n", cp);

	free (cp);
}