📄 ov.c
字号:
adjust_window(); /* set # rows, cols, etc */
getchr(); /* any keypress to continue */
menu_row = MENU_ROW; /* initialize menu subsystem */
menu_hilite = DIS_HIGH;
menu_lolite = DIS_NORM;
top_menu = top_file_menu;
setup_file_scr(); /* display the static screen image */
update_header(); /* display header info */
update_window(1); /* and a window of data */
grabbrk(&brkhit); /* grab the ^Break/^C interrupt handler */
/* call setjmp to establish the error handling jmp_buf, errors in
subfuntions will return here to start the next command */
setjmp(back_to_main);
/* main processing, obey each user command, terminate when done or
user enters the EOF character or hits ^Break/^C */
while (1) {
obey(); /* only returns after ^Z or ^Break/^C */
quit(); /* doesn't return if quitting */
}
}
/******************************************************************************
** O B E Y **
*****************************************************************************/
obey() { /* obey / process a user command */
register int ch, i;
char *dp, *dirplus();
menu_init(); /* display the initial menu */
while ((ch = getchr()) != EOF_CH) { /* get a char from the user */
brkhit = 0; /* clr brk flag before each ov command */
switch (ch) {
case LEFT: case RIGHT: /* left, right arrows */
case UP: case DOWN: /* up, down arrows */
case HOME: case END:
case PGDN: case PGUP:
if (dir_display)
dir_move(ch); /* move the dir pointer */
else if (view_display)
view_move(ch); /* move within the view buffer/file */
else if (def_display)
def_move(ch); /* move within define screen mode */
else if (!restricted)
move_file(ch); /* move the file pointer */
break;
case ' ': case 9: /* advance the menu selection pointer */
menu_advance();
break;
case 8: /* backup the menu selection pointer */
menu_backup();
break;
case RETURN: /* CR - do current menu selection */
menu_do_current();
break;
case 27: /* escape - return to top menu */
menu_init(); /* reset the menu subsystem */
break;
case TAG: /* single key command to tag current */
if (!restricted && !def_display) {
tag_current();
if (cw.curidx < cw.nfiles-1)
move_file(DOWN);
}
break;
case GOPAR: /* login to the parent dir */
if (dir_display)
dir_move(GOPAR);
else
if (!restricted) {
switch_dir(dp = dirplus(&files[cw.curidx],".."));
free(dp);
menu_init();
}
break;
case GOSUB: /* login to dir under file ptr */
if (dir_display) {
dir_login();
menu_init();
} else {
if (!restricted)
if (files[cw.curidx].flags & DIR) {
switch_dir(dp = dirplus(&files[cw.curidx],
files[cw.curidx].name));
free(dp);
menu_init();
} else
tone(100,5); /* beep the users mistake */
}
break;
case NEXTT: /* goto next tagged file/find string */
case PREVT: /* goto prev tagged file/find string */
if (view_display)
vfind(ch == NEXTT);
else if (!restricted)
tag_find(ch == NEXTT ? 1 : -1);
break;
case OPENW: /* open another file display window */
if (!restricted)
win_open();
break;
case CLOSEW: /* close current file display window */
if (!restricted)
win_close();
break;
case NEXTW: /* goto next file display window */
if (!restricted)
win_next();
break;
case PREVW: /* goto prev file display window */
if (!restricted)
win_prev();
break;
default: /* see if menu choice or UDK */
if (ch >= UDK_START && ch <= UDK_END) { /* UDK? */
if (!restricted && !def_display) {
do_udk(ch);
menu_init();
}
break;
}
/* is it a menu selection? */
if (!menu_do_char(ch)) /* do menu selection starting with ch */
tone(100,5); /* beep if not a valid selection */
break;
}
if (winupdate) { /* some commands ask for one or */
refresh_screen(1); /* more windows to be updated */
update_header(); /* make sure header is current */
winupdate = 0;
}
}
}
/******************************************************************************
** Q U I T **
*****************************************************************************/
quit() { /* exit from overview */
int ch;
/* Ask the user if he really wants to exit (default = N). If so, check
to see if we are still in the initial startup dir. If so, just exit.
If not, ask if we should return to the original dir before
quitting (default = return). */
ch = ask("Quit OVERVIEW and return to DOS? (y/N): ");
if (yes(ch)) {
getcwd(cw.dirbuf,MAX_PATHLEN); /* can mess cw.dibuf up cause quitting */
if (strcmp(initialdir,cw.dirbuf) != 0) {
ch = ask("Exit to current directory, or Return to original? (e/R): ");
if (toupper(ch) != 'E')
change_dir(initialdir);
}
reset_tty(); /* restore pre OV tty settings */
exit(); /* So long, thanks for all the fish */
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -