/* ARGSUSED */ int vl_setkey(int f GCC_UNUSED, int n GCC_UNUSED) { char result[NKEYLEN]; int rc = get_encryption_key(result, sizeof(result)); if (rc == TRUE) { TRACE(("set key for %s\n", curbp->b_bname)); (void) vl_strncpy(curbp->b_cryptkey, result, sizeof(curbp->b_cryptkey)); make_local_b_val(curbp, MDCRYPT); set_b_val(curbp, MDCRYPT, TRUE); curwp->w_flag |= WFMODE; } else if (rc == FALSE) { if (curbp->b_cryptkey[0] != EOS) { rc = mlyesno("Discard encryption key"); if (rc == TRUE) { TRACE(("reset key for %s\n", curbp->b_bname)); curbp->b_cryptkey[0] = EOS; if (global_b_val(MDCRYPT)) { make_local_b_val(curbp, MDCRYPT); set_b_val(curbp, MDCRYPT, FALSE); curwp->w_flag |= WFMODE; } else if (b_val(curbp, MDCRYPT)) { make_global_val(curbp->b_values.bv, global_b_values.bv, MDCRYPT); curwp->w_flag |= WFMODE; } } } } return (rc); }
static void not_found_msg(int wrapok, int dir) { if (wrapok || global_b_val(MDTERSE)) mlforce(notfoundmsg); else mlforce(hitendmsg, ((dir == FORWARD) ? "bottom" : "top")); }
static int ntconio_getch(void) { INPUT_RECORD ir; DWORD nr; int key; #ifdef VAL_AUTOCOLOR int milli_ac, orig_milli_ac; #endif if (saveCount > 0) { saveCount--; return savedChar; } #ifdef VAL_AUTOCOLOR orig_milli_ac = global_b_val(VAL_AUTOCOLOR); #endif for_ever { #ifdef VAL_AUTOCOLOR milli_ac = orig_milli_ac; while (milli_ac > 0) { if (PeekConsoleInput(hConsoleInput, &ir, 1, &nr) == 0) break; /* ?? system call failed ?? */ if (nr > 0) break; /* something in the queue */ Sleep(20); /* sleep a bit, but be responsive to keybd input */ milli_ac -= 20; } if (orig_milli_ac && milli_ac <= 0) { ac_active = TRUE; autocolor(); ac_active = FALSE; } #endif if (!ReadConsoleInput(hConsoleInput, &ir, 1, &nr)) imdying(0); switch (ir.EventType) { case KEY_EVENT: key = decode_key_event(&ir); if (key == NOKYMAP) continue; if (ir.Event.KeyEvent.wRepeatCount > 1) { saveCount = ir.Event.KeyEvent.wRepeatCount - 1; savedChar = key; } return key; case WINDOW_BUFFER_SIZE_EVENT: newscreensize( ir.Event.WindowBufferSizeEvent.dwSize.Y, ir.Event.WindowBufferSizeEvent.dwSize.X ); GetConsoleScreenBufferInfo(hConsoleOutput, &csbi); continue; case MOUSE_EVENT: handle_mouse_event(ir.Event.MouseEvent); continue; } } }
static BUFFER * gettagsfile(int n, int *endofpathflagp, int *did_read) { #ifdef MDCHK_MODTIME time_t current; #endif char *tagsfile; BUFFER *tagbp; char tagbufname[NBUFN]; char tagfilename[NFILEN]; *endofpathflagp = FALSE; *did_read = FALSE; (void) lsprintf(tagbufname, TAGFILE_BufName, n + 1); /* is the buffer around? */ if ((tagbp = find_b_name(tagbufname)) == NULL) { char *tagf = global_b_val_ptr(VAL_TAGS); nth_name(tagfilename, tagf, n); if (!doglob(tagfilename) || tagfilename[0] == EOS) { *endofpathflagp = TRUE; return NULL; } /* look up the tags file */ tagsfile = cfg_locate(tagfilename, LOCATE_TAGS); /* if it isn't around, don't sweat it */ if (tagsfile == NULL) { return NULL; } /* find the pointer to that buffer */ if ((tagbp = bfind(tagbufname, BFINVS)) == NULL) { mlforce("[Can't create tags buffer]"); return NULL; } if (readin(tagsfile, FALSE, tagbp, FALSE) != TRUE) { zotbuf(tagbp); return NULL; } *did_read = TRUE; } #ifdef MDCHK_MODTIME /* * Re-read the tags buffer if we are checking modification-times and * find that the tags file's been changed. We check the global mode * value because it's too awkward to set the local mode value for a * scratch buffer. */ if (global_b_val(MDCHK_MODTIME) && get_modtime(tagbp, ¤t) && tagbp->b_modtime != current) { if (!*did_read && readin(tagbp->b_fname, FALSE, tagbp, FALSE) != TRUE) { zotbuf(tagbp); return NULL; } set_modtime(tagbp, tagbp->b_fname); *did_read = TRUE; } #endif b_set_invisible(tagbp); return tagbp; }