int joinconneC(int leftbeg, int rightbeg, int direction, /* int *indeks[], */ int d) /* dimension */ { int sepnum, totbegsepary, apu; int i, j; /* Initialize the global variables */ for (i=1; i <= induksiInt; i++){ startpointsSx[i]=0; startpointsBx[i]=0; startpointsNewBleftx[i]=0; startpointsNewBrightx[i]=0; } for (i=1; i<=componumInt; i++) for (j=1; j<=componumInt; j++){ linkitx[i][j]=0; resx[i][j]=0; } mx=0; mleftx=0; mrightx=0; /* 1. new boundary: left bound. of left child, right b. of right child */ apu=startpoints(leftbeg, rightbeg); /* 2. We make "links" matrix and apply declev */ apu=makelinks(direction, /* mleftx, m, indeks, */ d); sepnum=declevnewC(); /* tulos will be filled */ /* resx is sepnum*m-matrix, 1 in some row indicates that set (atom) */ /* belongs to this component, 0 in other positions */ /* 3. We join the sets */ /* We join the sets whose startpoints are in */ /* startpointsSx and startpointsNewBleftx, startpointsNewBrightx */ /* We have pointers separyx[leftbeg] and separyx[rightbeg] */ /* which contain pointers to lists which we can utilize */ /* to make a new list (these two lists contain together at most as many */ /* elements as we need) */ /* cut first list or (join these two lists and cut second) */ totbegsepary=joinSets(leftbeg, rightbeg, sepnum); return totbegsepary; }
int rtloginl () { LINK *link; CIRCUIT *circuit; SADDR sp; char *buf, call[ln_axaddr+1]; if (MemLow) return cmd_exit; getpeername(CurProc->input, &sp); if (sp.type isnt TYPE_NETROM) return cmd_exit; ax2str(call, sp.a.nr.node); if (node_find(call)) return cmd_exit; // Already linked. for (link = link_hd; link; link = link->next) if (matchi(call, link->call)) break; if (!link) return cmd_exit; // We don't link with this system. if (link->flags & (p_linked | p_linkini)) return cmd_exit; // Already linked. // Accept the link request. puser(link->alias); buf = mallocw(LINE128); strcpy(buf, call); strlop(buf, '-'); puser(buf); free(buf); // Create a circuit for this link. circuit = circuit_new(p_linked, CurProc->output); if (!circuit) return cmd_exit; tputs("OK\n"); circuit->u.link = link; link->flags = p_linked; state_tell(circuit); makelinks(); // Run in circles, scream and shout. for (;;) if (getinp(circuit)) chkctl(circuit); else { link_drop(circuit); link->flags = p_nil; return cmd_exit; } }
int rtloginu () { CIRCUIT *c, *circuit; USER *user; // Is this user already logged in to RT somewhere else? if (user_find(CurProc->user)) { tputs("*** Already connected at another node.\n"); return cmd_exit; } if (log_rt) tlogp("RT Login"); // Create a circuit for this user. circuit = circuit_new(p_user, CurProc->output); if (!circuit) return cmd_exit; // Create the user entry. user = user_join(circuit, CurProc->user, Node->calls, Node->aliass); circuit->u.user = user; tputs("RoundTable Server.\nType /h for command summary.\nBringing up links to other nodes.\n"); tputs("This may take a minute or two.\nThe /p command shows what nodes are linked.\n"); text_tellu(user, rtjoin, NULL, o_all); user_tell(user, id_join); show_users(); makelinks(); // Run in circles, scream and shout. for (;;) if (getinp(circuit)) { if (circuit->buf[0] is '/') { if (!rt_cmd(circuit)) { tputs("Returned to node.\n"); logout(circuit); return cmd_ok; } } else { text_tellu(user, circuit->buf, NULL, o_topic); // To local users. // To remote users. for (c = circuit_hd; c; c = c->next) if ((c->flags & p_linked) && c->refcnt && ct_find(c, user->topic)) nprintf(c->s, "%c%c%s %s %s\n", FORMAT, id_data, Node->calls, user->call, circuit->buf); } } else { logout(circuit); return cmd_exit; } }