|
|
1.1 ! root 1: /* user.c - */ ! 2: ! 3: #ifndef lint ! 4: static char *rcsid = "$Header: /f/osi/quipu/dish/RCS/user.c,v 7.4 90/07/09 14:47:27 mrose Exp $"; ! 5: #endif ! 6: ! 7: /* ! 8: * $Header: /f/osi/quipu/dish/RCS/user.c,v 7.4 90/07/09 14:47:27 mrose Exp $ ! 9: * ! 10: * ! 11: * $Log: user.c,v $ ! 12: * Revision 7.4 90/07/09 14:47:27 mrose ! 13: * sync ! 14: * ! 15: * Revision 7.3 90/03/15 11:18:37 mrose ! 16: * quipu-sync ! 17: * ! 18: * Revision 7.2 90/01/11 18:37:47 mrose ! 19: * real-sync ! 20: * ! 21: * Revision 7.1 89/12/19 16:21:07 mrose ! 22: * sync ! 23: * ! 24: * Revision 7.0 89/11/23 22:20:25 mrose ! 25: * Release 6.0 ! 26: * ! 27: */ ! 28: ! 29: /* ! 30: * NOTICE ! 31: * ! 32: * Acquisition, use, and distribution of this module and related ! 33: * materials are subject to the restrictions of a license agreement. ! 34: * Consult the Preface in the User's Manual for the full terms of ! 35: * this agreement. ! 36: * ! 37: */ ! 38: ! 39: ! 40: #include "quipu/util.h" ! 41: #include "quipu/read.h" ! 42: #include "quipu/sequence.h" ! 43: ! 44: extern struct dua_sequence * current_sequence; ! 45: extern struct dua_sequence * top_sequence; ! 46: ! 47: #include "isoaddrs.h" ! 48: ! 49: #define OPT (!frompipe || rps -> ps_byteno == 0 ? opt : rps) ! 50: #define RPS (!frompipe || opt -> ps_byteno == 0 ? rps : opt) ! 51: extern char frompipe; ! 52: extern PS opt, rps; ! 53: ! 54: extern char fred_flag; ! 55: ! 56: ! 57: call_ds (argc,argv) ! 58: int argc; ! 59: char ** argv; ! 60: { ! 61: extern char bound; ! 62: extern char * myname; ! 63: extern char * dsa_address; ! 64: extern char * isodeversion; ! 65: extern char * dsapversion; ! 66: extern char * quipuversion; ! 67: extern char * dishversion; ! 68: extern DN fixed_pos; ! 69: extern DN user_name; ! 70: extern struct PSAPaddr dsa_bound; ! 71: ! 72: fred_flag = FALSE; ! 73: ! 74: if (argc > 1 && test_arg (argv[1], "-fred", 4)) { ! 75: fred_flag = TRUE; ! 76: argc--, argv++; ! 77: } ! 78: ! 79: if (argc > 1) { ! 80: if (test_arg (argv[1],"-sequence",1)) { ! 81: show_sequence (RPS,argv[2]); ! 82: return; ! 83: } else if (test_arg (argv[1], "-alias", 1)) { ! 84: new_alias (argv[2]); ! 85: return; ! 86: } else if (test_arg (argv[1], "-version", 1)) { ! 87: ps_printf (RPS,"ISODE version %s\n",isodeversion); ! 88: ps_printf (RPS,"DSAP version %s\n",dsapversion); ! 89: ps_printf (RPS,"QUIPU version %s\n",quipuversion); ! 90: ps_printf (RPS,"DISH version %s\n",dishversion); ! 91: return; ! 92: } else if (test_arg (argv[1], "-user", 1)) { ! 93: if (fred_flag && user_name) ! 94: ufn_dn_print_aux (RPS, user_name, NULLDN, 0); ! 95: else ! 96: dn_print (RPS, user_name, EDBOUT); ! 97: ps_print (RPS, "\n"); ! 98: return; ! 99: } else if (test_arg (argv[1], "-syntax", 2)) { ! 100: int i; ! 101: char * syntax2str(); ! 102: for (i=1;i<MAX_AV_SYNTAX;i++) { ! 103: if (syntax2str(i) == NULLCP) ! 104: return; ! 105: ps_printf (RPS, "%s\n",syntax2str(i)); ! 106: } ! 107: return; ! 108: } else { ! 109: Usage (argv[0]); ! 110: return; ! 111: } ! 112: } ! 113: ! 114: if (bound) { ! 115: ps_printf (RPS, "Connected to "); ! 116: if (strcmp (myname, dsa_address)) ! 117: ps_printf (RPS, "%s at ", myname); ! 118: ps_printf (RPS, "%s\n", pa2str (&dsa_bound)); ! 119: } ! 120: else ! 121: ps_print (RPS,"Not connected to a DSA (cache exists)\n"); ! 122: ps_print (RPS,"Current position: "); ! 123: if (fred_flag && fixed_pos) ! 124: ufn_dn_print_aux (RPS, fixed_pos, NULLDN, 0); ! 125: else ! 126: ps_print (RPS, "@"), dn_print (RPS, fixed_pos, EDBOUT); ! 127: ps_print (RPS, "\nUser name: "); ! 128: if (fred_flag && user_name) ! 129: ufn_dn_print_aux (RPS, user_name, NULLDN, 0); ! 130: else ! 131: ps_print (RPS, "@"), dn_print (RPS, user_name, EDBOUT); ! 132: ps_print (RPS, "\n"); ! 133: if (current_sequence != NULL_DS) ! 134: ps_printf (RPS,"Current sequence '%s'\n",current_sequence->ds_name); ! 135: } ! 136: ! 137: ! 138: /* */ ! 139: ! 140: static new_alias (cp) ! 141: char *cp; ! 142: { ! 143: int seqno; ! 144: DN sdn; ! 145: ! 146: if ((sdn = str2dn (*cp != '@' ? cp : cp + 1)) == NULLDN) { ! 147: ps_printf (OPT, "Invalid DN for alias: %s\n", cp); ! 148: return; ! 149: } ! 150: ! 151: set_sequence ("default"); ! 152: if (seqno = add_sequence (sdn)) { ! 153: ps_printf (RPS, "%-3d ", seqno); ! 154: if (fred_flag && sdn) ! 155: ufn_dn_print_aux (RPS, sdn, NULLDN, 0); ! 156: else ! 157: ps_print (RPS, "@"), dn_print (RPS, sdn, EDBOUT); ! 158: ps_print (RPS, "\n"); ! 159: } ! 160: } ! 161: ! 162: dish_error (ps,error) ! 163: PS ps; ! 164: struct DSError * error; ! 165: { ! 166: struct access_point * ap; ! 167: extern char neverefer; ! 168: extern int chase_flag; ! 169: ! 170: if (error->dse_type == DSE_ABANDONED) { ! 171: ps_print (ps,"(DAP call interrupted - abandon successful)\n"); ! 172: return (0); ! 173: } ! 174: ! 175: if (error->dse_type == DSE_ABANDON_FAILED) { ! 176: ps_print (ps,"(DAP call interrupted - abandon unsuccessful)\n"); ! 177: return (0); ! 178: } ! 179: ! 180: if (error->dse_type == DSE_INTRERROR) { ! 181: ps_print (ps,"(DAP call interrupted)\n"); ! 182: return (0); ! 183: } ! 184: ! 185: if ((error->dse_type != DSE_REFERRAL) ! 186: || ((chase_flag == 0) && neverefer) ! 187: || (chase_flag == 1)) { ! 188: ds_error (ps,error); ! 189: return (0); ! 190: } ! 191: ! 192: ! 193: if (error->ERR_REFERRAL.DSE_ref_candidates == NULLCONTINUATIONREF) { ! 194: ps_print (ps,"*** Referral error (but no reference !!!) ***\n"); ! 195: return (0); ! 196: } ! 197: ! 198: for (ap = error->ERR_REFERRAL.DSE_ref_candidates->cr_accesspoints; ! 199: ap != NULLACCESSPOINT; ap=ap->ap_next) { ! 200: ! 201: if (chase_flag != 2) { ! 202: ps_print (ps,"Referral to "); ! 203: dn_print (ps,ap->ap_name,EDBOUT); ! 204: ! 205: if (yesno (". Chase ? ") == FALSE) ! 206: continue; ! 207: } else if (!frompipe) { ! 208: ps_print (ps,"Referring to "); ! 209: dn_print (ps,ap->ap_name,EDBOUT); ! 210: ps_print (ps,"...\n"); ! 211: (void) ps_flush (ps); ! 212: } ! 213: ! 214: if (referral_bind (ap->ap_address) != 0) ! 215: return (1); ! 216: ! 217: if (chase_flag == 2) ! 218: break; /* only try first - otherwise possible looping */ ! 219: } ! 220: return (0); ! 221: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.