X-Git-Url: http://gb7djk.dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=src%2Fclient.c;h=74670241615d1ce8d12fca3fbe3b17b17770b4a2;hb=75807293ba2cc60c5f995cf034ab61eb6765fb0b;hp=d2ed0c473ed01731063a2a689e8825c75c37fe68;hpb=961ba05a38ad079e1fe72de96a59b036b98c35d2;p=spider.git diff --git a/src/client.c b/src/client.c index d2ed0c47..74670241 100644 --- a/src/client.c +++ b/src/client.c @@ -300,6 +300,26 @@ void send_msg(fcb_t *f, char let, UC *s, int l) f->sp->flags |= SEL_OUTPUT; } +/* + * send a file out to the user + */ +void send_file(char *name) +{ + int i; + char buf[MAXPACLEN+1]; + + FILE *f = xopen("data", name, "r"); + if (f) { + while (fgets(buf, paclen, f)) { + i = strlen(buf); + if (i && buf[i-1] == '\n') + buf[--i] = 0; + send_text(in, buf, i, 1); + } + fclose(f); + } +} + /* * the callback (called by sel_run) that handles all the inputs and outputs */ @@ -601,6 +621,7 @@ void process_stdin() send_msg(node, 'A', connsort, strlen(connsort)); chgstate(CONNECTED); + send_file("connected"); } cmsg_callback(mp, 0); @@ -852,19 +873,7 @@ main(int argc, char *argv[]) /* is this a login? */ if (eq(call, "LOGIN") || eq(call, "login")) { - - char buf[MAXPACLEN+1]; - int r, i; - FILE *f = xopen("data", "issue", "r"); - if (f) { - while (fgets(buf, paclen, f)) { - i = strlen(buf); - if (i && buf[i-1] == '\n') - buf[--i] = 0; - send_text(in, buf, i, 1); - } - fclose(f); - } + send_file("issue"); signal(SIGALRM, login_timeout); alarm(timeout); send_text(in, "login: ", 7, 0); @@ -880,6 +889,7 @@ main(int argc, char *argv[]) send_msg(node, 'A', connsort, strlen(connsort)); chgstate(CONNECTED); + send_file("connected"); }