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

⟦a5e1b27c3⟧ TextFile

    Length: 2300 (0x8fc)
    Types: TextFile
    Names: »showname.c«

Derivation

└─⟦3d0c2be1b⟧ Bits:30001254 ISODE-5.0 Tape
    └─⟦eba4602b1⟧ »./isode-5.0.tar.Z« 
        └─⟦d3ac74d73⟧ 
            └─⟦this⟧ »isode-5.0/quipu/dish/showname.c« 

TextFile

/* showname.c - */

#ifndef	lint
static char *rcsid = "$Header: /f/osi/quipu/dish/RCS/showname.c,v 6.0 89/03/18 23:40:56 mrose Rel $";
#endif

/* 
 * $Header: /f/osi/quipu/dish/RCS/showname.c,v 6.0 89/03/18 23:40:56 mrose Rel $
 *
 *
 * $Log:	showname.c,v $
 * Revision 6.0  89/03/18  23:40:56  mrose
 * Release 5.0
 * 
 */

/*
 *				  NOTICE
 *
 *    Acquisition, use, and distribution of this module and related
 *    materials are subject to the restrictions of a license agreement.
 *    Consult the Preface in the User's Manual for the full terms of
 *    this agreement.
 *
 */


#include "quipu/util.h"
#include "quipu/name.h"

extern DN       current_dn;
extern DN       dn;
extern PS       opt;
extern PS       rps;

extern LLog    *log_dua;
extern char 	print_format;


call_showname (argc, argv)
int             argc;
char          **argv;
{
	DN              dnptr;
	DN              trail = NULLDN;
	int             compact = FALSE;
	int             x;
	DN              top;
	extern DN	rel_dn;

	if ((argc = read_cache (argc, argv)) < 0)
		return;

	for (x = 1; x < argc; x++) {
		if (test_arg (argv[x], "-compact",2))  {	/* compact */
			compact = TRUE;
			argc--;
		} else if (test_arg (argv[x], "-nocompact",3))  {
			compact = FALSE;
			argc--;
		} else {
			ps_printf (opt,"Unknown option %s\n",argv[x]);
			Usage (argv[0]);
			return;
		}
	}

	if (compact) {
		if (rel_dn != NULLDN) {
			DN a,b;

			a = rel_dn;
			b = current_dn;
			for (; a != NULLDN && b != NULLDN ; a = a->dn_parent, b = b->dn_parent)
				if ( dn_comp_cmp (a,b) == NOTOK) 
					break;
			if (a == NULLDN)
				dn_print (rps,b,EDBOUT);
			else {
				ps_print (rps, "@");
				dn_print (rps,current_dn,EDBOUT);
			}
			ps_print (rps, "\n");
		} else {
			dn_print (rps, current_dn, EDBOUT);
			ps_print (rps, "\n");
		}
	} else {
		if (current_dn == NULLDN) {
			ps_print (rps, "Currently at the ROOT\n");
			return;
		}
		top = dn_cpy (current_dn);
		for (dnptr = top; dnptr->dn_parent != NULLDN; dnptr = dnptr->dn_parent)
			trail = dnptr;

		if (trail == NULLDN)
			dnptr = top;
		else {
			trail->dn_parent = NULLDN;
			ps_print (rps, "Parent Name: ");
			dn_print (rps, top, print_format);
			ps_print (rps, "\n");
			trail->dn_parent = dnptr;
		}
		showattribute (dnptr->dn_rdn->rdn_at);
		dn_free (top);
	}
}