+ /* is this a login? */
+ if (eq(call, "LOGIN")) {
+ char buf[MAXPACLEN+1];
+ int r;
+ int f = xopen("data", "issue", 0);
+ if (f > 0) {
+ while ((r = read(f, buf, paclen)) > 0) {
+ if (nl != '\n') {
+ char *p;
+ for (p = buf; p < &buf[r]; ++p) {
+ if (*p == '\n')
+ *p = nl;
+ }
+ }
+ write(0, buf, r);
+ }
+ close(f);
+ }
+ signal(SIGALRM, login_timeout);
+ alarm(timeout);
+ write(0, "login: ", 7);
+ r = read(0, buf, 20);
+ if (r <= 0)
+ die("No login or error (%d)", errno);
+ signal(SIGALRM, SIG_IGN);
+ alarm(0);
+ while (r > 0) {
+ if (buf[r-1] == ' ' || buf[r-1] == '\r' || buf[r-1] == '\n')
+ --r;
+ else
+ break;
+ }
+ buf[r] = 0;
+ call = strupper(buf);
+ if (!iscallsign(call)) {
+ die("Sorry, %s isn't a valid callsign", buf);
+ }
+ }
+
+ /* connect up stdin */