|
|
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 u
Length: 6321 (0x18b1)
Types: TextFile
Names: »user.c«
└─⟦2d1937cfd⟧ Bits:30007241 EUUGD22: P.P 5.0
└─⟦35176feda⟧ »EurOpenD22/isode/isode-6.tar.Z«
└─⟦de7628f85⟧
└─⟦this⟧ »isode-6.0/quipu/dish/user.c«
/* user.c - */
#ifndef lint
static char *rcsid = "$Header: /f/osi/quipu/dish/RCS/user.c,v 7.2 90/01/11 18:37:47 mrose Exp $";
#endif
/*
* $Header: /f/osi/quipu/dish/RCS/user.c,v 7.2 90/01/11 18:37:47 mrose Exp $
*
*
* $Log: user.c,v $
* Revision 7.2 90/01/11 18:37:47 mrose
* real-sync
*
* Revision 7.1 89/12/19 16:21:07 mrose
* sync
*
* Revision 7.0 89/11/23 22:20:25 mrose
* Release 6.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/read.h"
#include "quipu/sequence.h"
#include "isoaddrs.h"
static struct dua_sequence * current_sequence = NULL_DS;
static struct dua_sequence * top_sequence = NULL_DS;
#define OPT (!frompipe || rps -> ps_byteno == 0 ? opt : rps)
#define RPS (!frompipe || opt -> ps_byteno == 0 ? rps : opt)
extern char frompipe;
extern PS opt, rps;
call_ds (argc,argv)
int argc;
char ** argv;
{
extern char bound;
extern char * myname;
extern char * dsa_address;
extern char * isodeversion;
extern char * dsapversion;
extern char * quipuversion;
extern DN fixed_pos;
extern DN user_name;
extern struct PSAPaddr dsa_bound;
if (argc > 1) {
if (test_arg (argv[1],"-sequence",1)) {
show_sequence (argv[2]);
return;
} else if (test_arg (argv[1], "-alias", 1)) {
new_alias (argv[2]);
return;
} else if (test_arg (argv[1], "-version", 1)) {
ps_printf (RPS,"ISODE version %s\n",isodeversion);
ps_printf (RPS,"DSAP version %s\n",dsapversion);
ps_printf (RPS,"QUIPU version %s\n",quipuversion);
return;
} else if (test_arg (argv[1], "-user", 1)) {
dn_print (RPS, user_name, EDBOUT);
ps_print (RPS, "\n");
return;
} else {
Usage (argv[0]);
return;
}
}
if (bound) {
ps_printf (RPS, "Connected to ");
if (strcmp (myname, dsa_address))
ps_printf (RPS, "%s at ", myname);
ps_printf (RPS, "%s\n", pa2str (&dsa_bound));
}
else
ps_print (RPS,"Not connected to a DSA (cache exists)\n");
ps_print (RPS,"Current position: @");
dn_print (RPS, fixed_pos, EDBOUT);
ps_print (RPS, "\nUser name: @");
dn_print (RPS, user_name, EDBOUT);
ps_print (RPS, "\n");
if (current_sequence != NULL_DS)
ps_printf (RPS,"Current sequence '%s'\n",current_sequence->ds_name);
}
set_sequence (str)
char * str;
{
struct dua_sequence *ptr;
if (lexequ (str,"reset") == 0) {
if (current_sequence == NULL_DS)
return;
current_sequence->ds_data = NULL_DE;
current_sequence->ds_last = NULL_DE;
return;
}
for (ptr = top_sequence; ptr != NULL_DS; ptr=ptr->ds_next)
if (lexequ (ptr->ds_name,str) == 0) {
current_sequence = ptr;
return;
}
ptr = ds_alloc();
ptr->ds_name = strdup (str);
ptr->ds_data = NULL_DE;
ptr->ds_last = NULL_DE;
ptr->ds_next = top_sequence;
top_sequence = ptr;
current_sequence = ptr;
}
unset_sequence ()
{
current_sequence = NULL_DS;
}
add_sequence (adn)
DN adn;
{
struct dua_seq_entry * ptr;
register int x=1;
if (current_sequence == NULL_DS)
return (0);
for (ptr=current_sequence->ds_data; ptr != NULL_DE; ptr=ptr->de_next,x++)
if (dn_cmp (adn,ptr->de_name) == 0)
return (x);
ptr = de_alloc();
ptr->de_name = dn_cpy (adn);
ptr->de_next = NULL_DE;
if (current_sequence->ds_data == NULL_DE)
current_sequence->ds_data = ptr;
else
current_sequence->ds_last->de_next = ptr;
current_sequence->ds_last = ptr;
return (x);
}
DN sequence_dn(y)
int y;
{
struct dua_seq_entry * ptr;
register int x = 1;
if (current_sequence == NULL_DS)
return (NULLDN);
for (ptr=current_sequence->ds_data;
(ptr != NULL_DE) && (x<y);
ptr=ptr->de_next,x++)
;
if (ptr == NULL_DE)
return (NULLDN);
if ( x == y )
return (ptr->de_name);
return (NULLDN);
}
show_sequence (str)
char * str;
{
struct dua_seq_entry * ptr;
register int x = 1;
if (str != NULLCP)
set_sequence (str);
if (current_sequence == NULL_DS) {
ps_print (OPT,"No sequence set!\n");
return;
}
if (strcmp (current_sequence -> ds_name, "default"))
ps_printf (RPS,"Sequence %s contains:-\n",
current_sequence->ds_name);
for (ptr=current_sequence->ds_data; ptr != NULL_DE; ptr=ptr->de_next, x++) {
ps_printf (RPS,"%-3d @",x);
dn_print (RPS,ptr->de_name,EDBOUT);
ps_print (RPS,"\n");
}
}
/* \f
*/
static new_alias (cp)
char *cp;
{
int seqno;
DN sdn;
if ((sdn = str2dn (*cp != '@' ? cp : cp + 1)) == NULLDN) {
ps_printf (OPT, "Invalid DN for alias: %s\n", cp);
return;
}
set_sequence ("default");
if (seqno = add_sequence (sdn)) {
ps_printf (RPS, "%-3d @", seqno);
dn_print (RPS, sdn, EDBOUT);
ps_print (RPS, "\n");
}
}
dish_error (ps,error)
PS ps;
struct DSError * error;
{
struct access_point * ap;
extern char neverefer;
extern int chase_flag;
if (error->dse_type == DSE_ABANDONED) {
ps_print (ps,"(DAP call interrupted - abandon successful)\n");
return (0);
}
if (error->dse_type == DSE_ABANDON_FAILED) {
ps_print (ps,"(DAP call interrupted - abandon unsuccessful)\n");
return (0);
}
if (error->dse_type == DSE_INTRERROR) {
ps_print (ps,"(DAP call interrupted)\n");
return (0);
}
if ((error->dse_type != DSE_REFERRAL)
|| ((chase_flag == 0) && neverefer)
|| (chase_flag == 1)) {
ds_error (ps,error);
return (0);
}
if (error->ERR_REFERRAL.DSE_ref_candidates == NULLCONTINUATIONREF) {
ps_print (ps,"*** Referral error (but no reference !!!) ***\n");
return (0);
}
for (ap = error->ERR_REFERRAL.DSE_ref_candidates->cr_accesspoints;
ap != NULLACCESSPOINT; ap=ap->ap_next) {
if (chase_flag != 2) {
ps_print (ps,"Referral to ");
(void) dn_decode (ap->ap_name);
dn_print (ps,ap->ap_name,EDBOUT);
if (yesno (". Chase ? ") == FALSE)
continue;
} else if (!frompipe) {
ps_print (ps,"Referring to ");
(void) dn_decode (ap->ap_name);
dn_print (ps,ap->ap_name,EDBOUT);
ps_print (ps,"...\n");
(void) ps_flush (ps);
}
if (referral_bind (ap->ap_address) != 0)
return (1);
if (chase_flag == 2)
break; /* only try first - otherwise possible looping */
}
return (0);
}