int idxread (unit *ftnunit) { register int i; register char *keyval, *field; int newkeyid = 0, mode = ftnunit->f77idxlist.cimatch; keys = ftnunit->ukeys; ftnunit->f77recend = i = ftnunit->url; if (ftnunit->url > ftnunit->f77fio_size) check_buflen (ftnunit, ftnunit->url); while (i-- > 0) ftnunit->f77fio_buf[i] = '\0'; if (ftnunit->f77idxlist.cikeyid >= 0 && ftnunit->ukeyid != ftnunit->f77idxlist.cikeyid) { ftnunit->ukeyid = ftnunit->f77idxlist.cikeyid; newkeyid = 1; } /* 8/23/89 fix bug 4847 */ else if (ftnunit->ukeyid < 0) { ftnunit->ukeyid = ftnunit->f77idxlist.cikeyid >= 0 ? ftnunit->f77idxlist.cikeyid : 0; newkeyid = 1; } if (mode) { field = ftnunit->f77fio_buf + KEYOFF (ftnunit->ukeyid); if (KEYTYPE (ftnunit->ukeyid) != ftnunit->f77idxlist.cikeytype) err (ftnunit->f77errlist.cierr, 154, "indexed read"); if (KEYTYPE (ftnunit->ukeyid) == CHARTYPE) { keyval = ftnunit->f77idxlist.cikeyval.cicharval; /* fix bug 4779 */ if ((i = ftnunit->f77idxlist.cikeyvallen) > KEYLEN (ftnunit->ukeyid)) err (ftnunit->f77errlist.cierr, 155, "indexed read"); /* For Fortran, there's no such thing as null terminators for the string values, so use the string len value only while (*keyval && i-- > 0) *field++ = *keyval++; while (i-- > 0) *field++ = ' '; */ while (i-- > 0) *field++ = *keyval++; } else stlong (ftnunit->f77idxlist.cikeyval.ciintval, field); } else /* If the last read operation was locked try readign the same record again mode = (newkeyid ? ISFIRST : ISNEXT); */ mode = (newkeyid ? ISFIRST : ftnunit->uerror == F_ERLOCKED ? ISCURR : ISNEXT); ftnunit->uerror = 0; /* clear error for new operation */ if (newkeyid) { dokey (ftnunit->ukeyid, ONEKEY); if (isstart (ftnunit->isfd, &onekey, ftnunit->url, ftnunit->f77fio_buf, mode) < SUCCESS) ierr (ftnunit->f77errlist.cierr, iserrno, "indexed read"); } if (isread (ftnunit->isfd, ftnunit->f77fio_buf, mode) < SUCCESS) if (iserrno == EENDFILE) { ftnunit->uend = 1; err (ftnunit->f77errlist.ciend, EOF, "indexed read"); } else ierr (ftnunit->f77errlist.cierr, iserrno, "indexed read"); /* When the read is successful, make sure the EOF flag is not set */ ftnunit->uend = 0; return SUCCESS; }
int edloop(int flg) { int term = 0; int ret = 0; if (flg) { if (maint->curwin->watom->what == TYPETW) return 0; else maint->curwin->notify = &term; } while (!leave && (!flg || !term)) { MACRO *m; int c; if (exmsg && !flg) { vsrm(exmsg); exmsg = NULL; } edupd(1); if (!ahead && !have) ahead = 1; if (ungot) { if (ungot == 2) { c = ungotc2; ungot = 1; } else { c = ungotc; ungot = 0; } } else c = ttgetc(); if (!ahead && c == 10) c = 13; m = dokey(maint->curwin->kbd, c); if (maint->curwin->main && maint->curwin->main != maint->curwin) { int x = maint->curwin->kbd->x; maint->curwin->main->kbd->x = x; if (x) maint->curwin->main->kbd->seq[x - 1] = maint->curwin->kbd->seq[x - 1]; } if (m) ret = exemac(m); } if (term == -1) return -1; else return ret; }
/* * Read the next event and handle it. */ static void handleevent(GR_EVENT *ep) { switch (ep->type) { case GR_EVENT_TYPE_BUTTON_DOWN: dobutton(&ep->button); break; case GR_EVENT_TYPE_EXPOSURE: doexposure(&ep->exposure); break; case GR_EVENT_TYPE_KEY_DOWN: dokey(&ep->keystroke); break; case GR_EVENT_TYPE_CLOSE_REQ: GrClose(); exit(0); } }
int edloop(int flg) { int term = 0; int ret = 0; if (flg) { if (maint->curwin->watom->what == TYPETW) return 0; else maint->curwin->notify = &term; } while (!leave && (!flg || !term)) { W *w; MACRO *m; BW *bw; int c; int auto_off = 0; int word_off = 0; if (exmsg && !flg) { vsrm(exmsg); exmsg = NULL; } edupd(1); if (!ahead && !have) ahead = 1; if (ungot) { c = ungotc; ungot = 0; } else c = ttgetc(); /* Clear temporary messages */ w = maint->curwin; do { if (w->y != -1) { msgclr(w); } w = (W *) (w->link.next); } while (w != maint->curwin); if (!ahead && c == 10) c = 13; more_no_auto: /* Use special kbd if we're handing data to a shell window */ bw = (BW *)maint->curwin->object; if (shell_kbd && (maint->curwin->watom->what & TYPETW) && bw->b->pid && !bw->b->vt && piseof(bw->cursor)) m = dokey(shell_kbd, c); else if ((maint->curwin->watom->what & TYPETW) && bw->b->pid && bw->b->vt && bw->cursor->byte == bw->b->vt->vtcur->byte) m = dokey(bw->b->vt->kbd, c); else m = dokey(maint->curwin->kbd, c); /* leading part of backtick hack... */ /* should only do this if backtick is uquote, but you're not likely to get quick typeahead with ESC ' as uquote */ if (m && m->cmd && m->cmd->func == uquote && ttcheck()) { m = type_backtick; } /* disable autoindent if it looks like a mouse paste... */ if (m && m->cmd && (m->cmd->func == utype || m->cmd->func == urtn) && (maint->curwin->watom->what & TYPETW) && (bw->o.autoindent || bw->o.wordwrap) && ttcheck()) { auto_off = bw->o.autoindent; bw->o.autoindent = 0; word_off = bw->o.wordwrap; bw->o.wordwrap = 0; } if (maint->curwin->main && maint->curwin->main != maint->curwin) { int x = maint->curwin->kbd->x; maint->curwin->main->kbd->x = x; if (x) maint->curwin->main->kbd->seq[x - 1] = maint->curwin->kbd->seq[x - 1]; } if (!m) m = timer_play(); if (m) ret = exemac(m); /* trailing part of backtick hack... */ /* for case where ` is very last character of pasted block */ while (!leave && (!flg || !term) && m && (m == type_backtick || (m->cmd && (m->cmd->func == utype || m->cmd->func == urtn))) && ttcheck() && havec == '`') { ttgetc(); ret = exemac(type_backtick); } /* trailing part of disabled autoindent */ if (!leave && (!flg || !term) && m && (m == type_backtick || (m->cmd && (m->cmd->func == utype || m->cmd->func == urtn))) && ttcheck()) { if (ungot) { c = ungotc; ungot = 0; } else c = ttgetc(); goto more_no_auto; } if (auto_off) { auto_off = 0; bw->o.autoindent = 1; } if (word_off) { word_off = 0; bw->o.wordwrap = 1; } } if (term == -1) return -1; else return ret; }
void do_login(void) { register int i; register int users; register char *name; register struct tm *ltm; register struct user *tmpuser = 0; register int wrong = 0; register char *bbsname; char pas[9]; char temp[128]; char myname[MAXALIAS + 1]; printf("\nDOC (Dave's Own version of Citadel) Version 1.71\n\nWelcome to the ISCA BBS.\n\n%s", (bbsname = getenv("BBSNAME")) ? "" : "\nLogin as 'Guest' to just look around, or 'New' to create a new account.\n\n"); for (;;) { guest = 0; if (!bbsname) name = get_name("Name: ", 1); else strcpy(name = myname, bbsname); if (strcmp(name, "New")) { if ((tmpuser = getuser(name))) freeuser(tmpuser); if (tmpuser && (!bbsname || tty) && strcmp(name, "Guest")) get_string("Password: "******"Incorrect login.\n"); else printf("There is no user %s on this BBS.\n", name); if (++wrong > 3 || bbsname) { if (!bbsname) printf("\n\nToo many attempts. Goodbye.\n"); my_exit(3); } flush_input(wrong); continue; } else { xinit(); if (ouruser->keytime) { printf("\n\n\nYou have not yet registered your validation key...\n\n"); dokey(ouruser); if (ouruser->keytime && ouruser->f_trouble) { printf("\n\nYou will need to enter your validation key before you may gain access to the\nBBS. If you have not yet received your key and think you should, you may send\nE-mail to [email protected]. Please include your BBS username in this\nE-mail so the sysop who receives it knows who you are. Remember that it can\ntake several days from the time your account was originally created for the\nsysops to validate the information you have provided, if it has been less than\nfour days since you created your account please do not send E-mail yet, as it\nlikely they haven't finished with your account yet. Impatience won't make them\nwork any faster, and quite likely will make them decide to make you a special\ncase and work slower! Remember, this BBS is a privilege, not a right.\n\n\n"); my_exit(15); } } printf("\nIowa Student Computer Association BBS.\n"); if (ouruser->f_deleted) { if (ouruser->f_namechanged) printf("\a\nThis account has been marked for deletion because of a request to change the\nusername from '%s' to '%s'.\n\nYou may login as '%s' using the same password.\n\n", ouruser->name, ouruser->reminder, ouruser->reminder); else printf("\a\nThis account has been marked for deletion, either through your choice or\nbecause you violated ISCA BBS rules by doing something such as providing\nobviously bogus profile info. You will be logged off.\n\n"); my_exit(10); } else if (ouruser->f_inactive) { printf("You seem to have been denied access to the message system.\n"); printf("Please contact ISCA (e-mail address [email protected]) for more.\n"); my_exit(10); } i = ouruser->time; ltm = localtime(&ouruser->time); users = add_loggedin(ouruser); if (!guest && ouruser->time) { printf("Last on: %d/%d/%d %d:%02d ", ltm->tm_mon + 1, ltm->tm_mday, 1900 + ltm->tm_year, ltm->tm_hour, ltm->tm_min); ltm = localtime(&ouruser->timeoff); if (ouruser->timeoff >= i) printf("until %d:%02d from %s\n", ltm->tm_hour, ltm->tm_min, ouruser->remote); else printf("from %s\n", ouruser->remote); } strcpy(ouruser->loginname, ARGV[1] && ARGV[2] ? ARGV[2] : ""); strncpy(ouruser->remote, ARGV[1] ? ARGV[1] : "local", sizeof ouruser->remote - 1); if (ouruser->f_noclient) { printf("\n\nYou have been disallowed use of the BBS client, you must login using telnet.\n\n"); my_exit(10); } sprintf(temp, "%s %s%s%s/%d", client ? "CLIENT" : "LOGIN", ARGV[1] && ARGV[2] ? ARGV[2] : "", ARGV[1] && ARGV[2] ? "@" : "", ouruser->remote, mybtmp->remport); logevent(temp); ++ouruser->timescalled; if (!guest) printf("This is call %d. There are %d users.\n", ouruser->timescalled, users); if (ouruser->f_aide) validate_users(0); /* * Turn off expresses and tell the user this was done if user is * configured for this */ if (!guest && mybtmp->xstat) printf("\nNOTE: You have eXpress messages turned OFF as a default!\n"); if (mybtmp->elf) printf("\nYou are marked as available to help others.\n"); checkmail(FALSE); termset(); if (*ouruser->reminder) { printf("\n\aREMINDER:\n%s\n\n", ouruser->reminder); printf("Please hit 'Y' to acknowledge having seen this reminder -> "); get_single_quiet("yY"); } if (ouruser->f_badinfo || ouruser->f_duplicate) { help("badinfo", NO); mysleep(300); } if (guest) { help("guestwelcome", NO); hit_return_now(); } return; } } else if (!(i = new_user())) { printf("\n\nSorry, there was some problem setting up your BBS account.\n\nPlease try again later.\n\n"); my_exit(10); } else if (i > 0) return; } }
int idxopen (unit *ftnunit, char *name, int create, flag idxerr) { struct dictinfo info; int mode =(ftnunit->ureadonly ? ISINPUT : ISINOUT) + (ftnunit->ushared ? ISAUTOLOCK : ISEXCLLOCK); register int i; keys = ftnunit->ukeys; if (create) { if (ftnunit->url == 0) err (idxerr, 153, "indexed open"); if (ftnunit->unkeys == 0 || keys == NULL) err (idxerr, 161, "indexed open"); onekey.k_flags = ISNODUPS; KEYOFF (0)--; KEYEND (0)--; dokey (0, ONEKEY); if (ftnunit->unkeys == 1) { /* DLAI: need to change isbuild 2nd arg to XINT */ if ((ftnunit->isfd = isbuild (name, ftnunit->url, &onekey, mode)) < SUCCESS) ierr (idxerr, iserrno, "indexed open"); } else { if ((ftnunit->isfd = isbuild (name, ftnunit->url, &onekey, ISINOUT + ISEXCLLOCK)) < SUCCESS) ierr (idxerr, iserrno, "indexed open"); onekey.k_flags = ISDUPS; for (i = 1; i < ftnunit->unkeys; i++) { KEYOFF (i)--; KEYEND (i)--; dokey (i, ONEKEY); if (isaddindex (ftnunit->isfd, &onekey) < SUCCESS) ierr (idxerr, iserrno, "indexed open"); } if (ftnunit->ushared) { if (isclose (ftnunit->isfd) < SUCCESS) ierr (idxerr, iserrno, "indexed open"); if ((ftnunit->isfd = isopen (name, mode)) < SUCCESS) ierr (idxerr, iserrno, "indexed open"); } } } else { if ((ftnunit->isfd = isopen (name, mode)) < SUCCESS) ierr (idxerr, iserrno, "indexed open"); if (isindexinfo (ftnunit->isfd, &info, 0) < SUCCESS) ierr (idxerr, iserrno, "indexed open"); if (ftnunit->unkeys != info.di_nkeys) { if (ftnunit->unkeys) { err (idxerr, 148, "indexed open"); } else ftnunit->unkeys = info.di_nkeys; } if (!keys) keys = (Keyspec *) malloc (sizeof (Keyspec) * info.di_nkeys); for (i = 0; i < info.di_nkeys; i++) { if (isindexinfo (ftnunit->isfd, &onekey, i + 1) < SUCCESS) ierr (idxerr, iserrno, "indexed open"); /* LHL 5/4/89 * To fix bug 4428, problem about trying to open an existing indexed file. * This is put here because when the indexed file is created, the keys * are being stored like this. Refer to the above code. */ KEYOFF (i)--; KEYEND (i)--; /* end of fix */ if (ftnunit->ukeys && dokey (i, NOMATCH)) { err (idxerr, 148, "indexed open"); } else dokey (i, UNITKEY); } ftnunit->url = info.di_recsize; ftnunit->ukeys = keys; } return SUCCESS; }