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 l

⟦1e25398f7⟧ TextFile

    Length: 3162 (0xc5a)
    Types: TextFile
    Names: »list.c«

Derivation

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

TextFile

#include "quipu/util.h"
#include "quipu/list.h"
#include "quipu/sequence.h"

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

extern LLog    *log_dua;
extern char	move_flag;

extern int      sizelimit;
char  list_show;

call_list (argc, argv)
int             argc;
char          **argv;
{
	struct ds_list_arg list_arg;
	struct ds_list_result result;
	struct list_cache *ptr;
	struct DSError  error;
	int             x;
	char            nocacheflag = FALSE;
	extern 	int	copy_flag;

	list_show = TRUE;
	move_flag = FALSE;

	list_arg.lsa_common.ca_servicecontrol.svc_sizelimit = sizelimit;

	if ((argc = service_control (opt, argc, argv, &list_arg.lsa_common)) == -1)
		return;

	for (x = 1; x < argc; x++) {

		if (test_arg (argv[x], "-nocache",4))
			nocacheflag = TRUE;
		else if (test_arg (argv[x], "-noshow",4))
			list_show = FALSE;
		else if (test_arg (argv[x], "-move",2))
			move_flag = TRUE;
		else if (test_arg (argv[x], "-nomove",3))
			move_flag = FALSE;
		else if (move (argv[x]) == OK)
			continue;
		else {
			ps_printf (opt,"Unknown option %s\n",argv[x]);
			Usage (argv[0]);
			return;
		}

	}

	list_arg.lsa_object = dn;

	if ((!nocacheflag) && copy_flag)
		if ((ptr = find_list_cache (dn,list_arg.lsa_common.ca_servicecontrol.svc_sizelimit)) != NULLCACHE) {
			print_list_subordinates (ptr->list_subs, ptr->list_problem,TRUE);
			consolidate_move();
			return;
		}
	LLOG (log_dua, LLOG_DEBUG, ("Dish:- Attempting a list..."));

	if (rebind () != OK)
		return;

	if (ds_list (&list_arg, &error, &result) != DS_OK) {	/* deal with error */
		ds_error (opt, &error);
		LLOG (log_dua, LLOG_DEBUG, ("Dish:- list caused an error..."));
	} else {		/* use data */
		LLOG (log_dua, LLOG_DEBUG, ("Dish:- Successful list..."));
		if (result.lsr_common.cr_aliasdereferenced) {
			ps_print (rps, "(Alias dereferenced - ");
			dn_decode (result.lsr_object);
			dn_print (rps, result.lsr_object, READOUT);
			dn_free (result.lsr_object);
			ps_print (rps, ")\n");
		}
		print_list_subordinates (result.lsr_subordinates, result.lsr_limitproblem,FALSE);

		cache_list (result.lsr_subordinates, result.lsr_limitproblem,dn,
			list_arg.lsa_common.ca_servicecontrol.svc_sizelimit);

		subords_free (result.lsr_subordinates);

		consolidate_move();
		
		LLOG (log_dua, LLOG_DEBUG, ("Dish:- Successful exiting of list..."));
	}
}

print_list_subordinates (ptr, prob, from_cache)
struct subordinate *ptr;
int             prob;
char		from_cache;
{
DN adn;
DN newdn;
int seqno;

	adn = dn_cpy (dn);
	newdn = dn_comp_new (rdn_comp_new(NULLAttrT,NULLAttrV));	
	if (adn != NULLDN)
		dn_append (adn,newdn);
	else
		adn = newdn;

	if (ptr == NULLSUBORD)
		if (list_show)
			ps_print (rps,"No children\n");

	for (; ptr != NULLSUBORD; ptr = ptr->sub_next) {
		if (! from_cache)
			rdn_decode (ptr->sub_rdn);
		rdn_free (newdn->dn_rdn);
		dn_comp_fill (newdn,rdn_cpy(ptr->sub_rdn));
		seqno = add_sequence (adn);
		if (seqno != 0)
			ps_printf (rps,"%-3d ",seqno);
		if (list_show)
			rdn_print (rps, ptr->sub_rdn, READOUT);
		ps_print (rps, "\n");
	}

	dn_free (adn);

	if (prob != LSR_NOLIMITPROBLEM)
		if (list_show)
			ps_print (rps, "(Limit problem)\n");

}