X-Git-Url: http://gb7djk.dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=src%2Fclient.c;h=74670241615d1ce8d12fca3fbe3b17b17770b4a2;hb=75807293ba2cc60c5f995cf034ab61eb6765fb0b;hp=3404be9d9232b3600571118de6fec1e69180f67b;hpb=43d1c9f4ff26d0ee9afbb54e7fb90701a9d4e694;p=spider.git diff --git a/src/client.c b/src/client.c index 3404be9d..74670241 100644 --- a/src/client.c +++ b/src/client.c @@ -44,7 +44,7 @@ #define MAXPATHLEN 256 #endif -#define DEFPACLEN 128 +#define DEFPACLEN 236 #define MAXPACLEN 236 #define MAXCALLSIGN 9 @@ -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 */ @@ -452,10 +472,8 @@ int fcb_handler(sel_t *sp, int in, int out, int err) c = (ch - '0') << 4; else if (ch >= 'A' && ch <= 'F') c = (ch - 'A' + 10) << 4; - else if (ch >= 'a' && ch <= 'a') - c = (ch - 'a' + 10) << 4; else { - dbg(DMSG, "Illegal hex char (%c) received in state %d", ch, mp->state); + dbg(DMSG, "Illegal hex char (%c) received in state 1", ch); mp->inp = mp->data; mp->state = 0; } @@ -466,10 +484,8 @@ int fcb_handler(sel_t *sp, int in, int out, int err) *mp->inp++ = c | (ch - '0'); else if (ch >= 'A' && ch <= 'F') *mp->inp++ = c | (ch - 'A' + 10); - else if (ch >= 'a' && ch <= 'a') - *mp->inp++ = c | (ch - 'a' + 10); else { - dbg(DMSG, "Illegal hex char (%c) received in state %d", ch, mp->state); + dbg(DMSG, "Illegal hex char (%c) received in state 2", ch); mp->inp = mp->data; } mp->state = 0; @@ -605,6 +621,7 @@ void process_stdin() send_msg(node, 'A', connsort, strlen(connsort)); chgstate(CONNECTED); + send_file("connected"); } cmsg_callback(mp, 0); @@ -856,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); @@ -884,6 +889,7 @@ main(int argc, char *argv[]) send_msg(node, 'A', connsort, strlen(connsort)); chgstate(CONNECTED); + send_file("connected"); }