$! ................... Cut between dotted lines and save. ................... $!........................................................................... $! VAX/VMS archive file created by VMS_SHARE V06.10 7-FEB-1989. $! $! VMS_SHARE was written by James Gray (Gray:OSBUSouth@Xerox.COM) from $! VMS_SHAR by Michael Bednarek (U3369429@ucsvc.dn.mu.oz.au). $! $! To unpack, simply save, concatinate all parts into one file and $! execute (@) that file. $! $! This archive was created by user DAVIS $! on 6-JUN-1992 19:09:30.13. $! $! ATTENTION: To keep each article below 50 blocks (25600 bytes), this $! program has been transmitted in 8 parts. You should $! concatenate ALL parts to ONE file and execute (@) that file. $! $! It contains the following 32 files: $! BUFFER.C $! CMD.C $! DIR.C $! DISPLAY.C $! EDIT.C $! FILE.C $! HELP.C $! KEYM.C $! LINE.C $! MAIN.C $! MOST.C $! SEARCH.C $! SYSDEP.C $! WINDOW.C $! BUFFER.H $! DISPLAY.H $! EXTERNS.H $! FILE.H $! KEYM.H $! LINE.H $! MOST.H $! SEARCH.H $! SYSDEP.H $! WINDOW.H $! MAKE.COM $! MAKECOM.COM $! MAKEFILE. $! MOST.1 $! MOST.DOC $! CHANGES.TXT $! AAA_READ.ME $! RTL.OPT $! $!============================================================================ $ SET SYMBOL/SCOPE=( NOLOCAL, NOGLOBAL ) $ VERSION = F$GETSYI( "VERSION" ) $ IF VERSION .GES "V4.4" THEN GOTO VERSION_OK $ WRITE SYS$OUTPUT "You are running VMS ''VERSION'; ", - "VMS_SHARE V06.10 7-FEB-1989 requires VMS V4.4 or higher." $ EXIT 44 ! SS$_ABORT $VERSION_OK: $ GOTO START $! $UNPACK_FILE: $ WRITE SYS$OUTPUT "Creating ''FILE_IS'" $ DEFINE/USER_MODE SYS$OUTPUT NL: $ EDIT/TPU/COMMAND=SYS$INPUT/NODISPLAY/OUTPUT='FILE_IS'/NOSECTION - VMS_SHARE_DUMMY.DUMMY b_part := CREATE_BUFFER( "{Part}", GET_INFO( COMMAND_LINE, "file_name" ) ) ; s_file_spec := GET_INFO( COMMAND_LINE, "output_file" ); SET( OUTPUT_FILE , b_part, s_file_spec ); b_errors := CREATE_BUFFER( "{Errors}" ); i_errors := 0; pat_beg_1 := ANCHOR & "-+-+-+ Beginning"; pat_beg_2 := LINE_BEGIN & "+-+-+-+ Beginning"; pat_end := ANCHOR & "+-+-+-+-+ End"; POSITION ( BEGINNING_OF( b_part ) ); LOOP EXITIF SEARCH( SPAN( ' ' )@r_trail & LINE_END, FORWARD) = 0; POSITION( r_trail ); ERASE( r_trail ); ENDLOOP ; POSITION( BEGINNING_OF( b_part ) ); i_append_line := 0; LOOP EXITIF MARK ( NONE ) = END_OF( b_part ); s_x := ERASE_CHARACTER( 1 ) ; IF s_x = '+' THEN r_skip := SEARCH( pat_beg_1, FORWARD, EXACT ); IF r_skip <> 0 THEN s_x := ''; MOVE_HORIZONTAL( -CURRENT_OFFSET ); ERASE_LINE; ENDIF ; ENDIF; IF s_x = '-' THEN r_skip := SEARCH( pat_end, FORWARD, EXACT ) ; IF r_skip <> 0 THEN s_x := ''; MOVE_HORIZONTAL( -CURRENT_OFFSET ); m_skip := MARK( NONE ); r_skip := SEARCH( pat_beg_2, FORWARD, EXACT ); IF r_skip <> 0 THEN POSITION( END_OF( r_skip ) ); MOVE_HORIZONTAL( -CURRENT_OFFSET ) ; MOVE_VERTICAL( 1 ); MOVE_HORIZONTAL( -1 ); ELSE POSITION( END_OF( b_part ) ); ENDIF; ERASE( CREATE_RANGE( m_skip, MARK( NONE ), NONE ) ); ENDIF; ENDIF ; IF s_x = 'V' THEN s_x := ''; IF i_append_line <> 0 THEN APPEND_LINE ; MOVE_HORIZONTAL( -CURRENT_OFFSET ); ENDIF; i_append_line := 1 ; MOVE_VERTICAL( 1 ); ENDIF; IF s_x = 'X' THEN s_x := ''; IF i_append_line <> 0 THEN APPEND_LINE; MOVE_HORIZONTAL( -CURRENT_OFFSET ); ENDIF ; i_append_line := 0; MOVE_VERTICAL( 1 ); ENDIF; IF s_x <> '' THEN i_errors := i_errors + 1; s_text := CURRENT_LINE; POSITION( b_errors ); COPY_TEXT ( "The following line could not be unpacked properly:" ); SPLIT_LINE ; COPY_TEXT( s_x ); COPY_TEXT( s_text ); POSITION( b_part ); MOVE_VERTICAL ( 1 ); ENDIF; ENDLOOP; POSITION( BEGINNING_OF( b_part ) ); LOOP r_x := SEARCH ( "`", FORWARD, EXACT ); EXITIF r_x = 0; POSITION( r_x ); ERASE_CHARACTER( 1 ); COPY_TEXT( ASCII( INT( ERASE_CHARACTER( 3 ) ) ) ); ENDLOOP ; IF i_errors = 0 THEN SET( NO_WRITE, b_errors, ON ); ELSE POSITION ( BEGINNING_OF( b_errors ) ); COPY_TEXT( FAO ( "The following !UL errors were detected while unpacking !AS", i_errors , s_file_spec ) ); SPLIT_LINE; SET( OUTPUT_FILE, b_errors, "SYS$COMMAND" ) ; ENDIF; EXIT; $ DELETE VMS_SHARE_DUMMY.DUMMY;* $ CHECKSUM 'FILE_IS $ WRITE SYS$OUTPUT " CHECKSUM ", - F$ELEMENT( CHECKSUM_IS .EQ. CHECKSUM$CHECKSUM, ",", "failed!!,passed." ) $ RETURN $! $START: $ FILE_IS = "BUFFER.C" $ CHECKSUM_IS = 1852083041 $ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY X#include "buffer.h" X#include "externs.h" X#include "display.h" X#include "line.h" X `032 Xint MOST_W_OPT = 0; X Xunsigned char *BEG; /* beginning of current buffer */ Xunsigned char *EOB; /* end of current buffer */ Xunsigned char MINI_BUF[132]; X XBuffer *BUF; X Xextern int SQUEEZE_LINES; Xint NUM_LINES; Xint ACTUAL_LINES; X Xunsigned char *C_POS; Xint C_LINE; X Xunsigned char *beg_of_line1() X`123 X unsigned char *pos; X `032 X if (C_POS == BEG) return BEG; X X pos = C_POS; X if (pos == EOB) pos--; X X if ((*pos != '\n') && (*(pos-1) == '\n')) return(pos); X `032 X if ((*pos == '\n') && (pos == BEG)) return(BEG); X /* suppose BEG[] is "....\nabcde\n\n\n\n\n..." and we are somwhere in X the middle of the \n's. Then we want to return the 2nd \n if the X SQUEEZE is on otherwise just return where we are. */ X if ((*pos-- == '\n') && (*pos == '\n')) X `123 X if (SQUEEZE_LINES) X `123 X /* if we are between '\n's then skip past all of them. */ X while ((pos > BEG) && (*pos == '\n')) pos--; X if ((pos == BEG) && (*pos == '\n')) return (BEG); X pos++; X `125 X return (++pos); X `125 `032 X `032 X while((pos > BEG) && (*pos != '\n')) pos--; X if (pos != BEG) pos++; X else if ((pos == BEG) && (*pos == '\n')) pos++; X return pos; X`125 X Xunsigned char *beg_of_line() X`123 X unsigned char *b; X int d,n; X `032 X if (!MOST_W_OPT) return beg_of_line1(); X b = beg_of_line1(); X d = C_POS - b; X n = d / SCREEN_WIDTH_M1; X return(b + (int) (n * SCREEN_WIDTH_M1)); X`125 X X/* does not move point */ Xunsigned char *end_of_line1() X`123 X unsigned char *pos; X X pos = C_POS; X if (pos >= EOB) return(EOB); X /* if ((pos == BEG) && (*pos == '\n')) return (BEG); */ X `032 X /* find the first '\n' */ X if (*pos != '\n') X `123 X while ((pos < EOB) && (*pos != '\n')) pos++; X return(pos); X `125 X `032 X if (!SQUEEZE_LINES) return (pos); X X /* if BEG = "....abc\n\n\n\n\ndef..." then we are at some first \n. We X want to return the last '\n' unless we wre at the first '\n'. */ X X if ((pos > BEG) && ( pos--, *pos++ != '\n')) return (pos);`032 X `032 X while ((pos < EOB) && (*pos == '\n')) pos++; X if (pos-- == EOB) return (pos); X if (pos < BEG) pos = BEG; X return pos; X`125 X Xunsigned char *end_of_line() X`123 X unsigned char *b, *e; X int n; X `032 X if (!MOST_W_OPT) return end_of_line1(); X X b = beg_of_line(); X e = end_of_line1(); X n = (e - b) / SCREEN_WIDTH_M1; X if (n) return(b + SCREEN_WIDTH_M1); X return (e); X`125 X Xint forward_line(int n) X`123 X int m, ok; X int save = n; X unsigned char *p; X if (n > 0)`032 X `123 X if (MOST_B_OPT) X `123 X m = (EOB - C_POS)/16; X if (n > m) n = m; X C_POS += n * 16; X C_LINE += n; X return n; X `125 X else while (n--) X `123 X C_POS = end_of_line(); X /* next step handles newline at the EOB */ V if ((C_POS == EOB) `124`124 ((C_POS == EOB - 1) && (*C_POS == X '\n'))) return (save - n - 1); X C_LINE++; X C_POS++; X if (MOST_S_OPT) X `123 X p = C_POS; X ok = 1; X while ((*p <= ' ') && ok) X `123 X if (*p != '\n') p++; X if (p >= EOB) break; V if ((*p == '\n') `124`124 (apparant_distance(p) > X= MOST_S_OPT)) X `123 X ok = 0; X C_LINE--; X n++; X `125 X `125 X `125 /* MOST_S_OPT */ X `125 X `125 X else X `123 X if (MOST_B_OPT) X `123 X m = (BEG - C_POS)/16; X if (n < m) n = m; X C_POS += n * 16; X C_LINE += n; X return n; X `125 X else while (n++) X `123 X C_POS = beg_of_line(); X if (C_POS == BEG) return (n - save - 1); X C_POS--; X C_LINE--; X if (MOST_S_OPT) X `123 X C_POS = beg_of_line(); X p = C_POS; X ok = 1; X while ((*p <= ' ') && ok) X `123 X if (*p != '\n') p++; X if (p >= EOB) break; V if ((*p == '\n') `124`124 (apparant_distance(p) > X= MOST_S_OPT)) X `123 X ok = 0; X C_LINE++; X n--; X `125 X `125 X `125 /* MOST_S_OPT */ X `125 X `125 X return(save); X`125 X Xint count_lines(unsigned char *beg, unsigned char *end) X`123 X int save_line = C_LINE, n; X unsigned char *save_beg = beg, *save_eob = EOB, *save_pos = C_POS; X X if (MOST_B_OPT) return((int)(end - beg) / 16); X BEG = C_POS = beg; X EOB = end; X n = 1; X while(forward_line(1)) n++; X if (*end == '\n') n--; X if (!n) n = 1; X C_POS = save_pos; X EOB = save_eob; X BEG = save_beg; X C_LINE = save_line; X return(n); X`125 X Xvoid goto_line(int line) X`123 X register int i,j; X unsigned char *pos; X int dif_c, dif_b,dif_t; X X if (line < 1) line = 1; X if (line > NUM_LINES) line = NUM_LINES; X X if (MOST_B_OPT) X `123 X C_POS = BEG + (16 * (line - 1)); X C_LINE = line; X return; X `125 X `032 X dif_c = line - C_LINE; X dif_b = line - NUM_LINES; X dif_t = line - 1; X X /* 4 possibilites */ X if (dif_c <= 0) X `123 X if (dif_t < -dif_c) /* go from top */ X `123 X C_LINE = 1; X C_POS = BEG; X (void) forward_line(dif_t); X `125 X else /* from curr back */ X `123 X (void) forward_line(dif_c); X `125 X `125 X else if (dif_c > 0) X `123 X if ((dif_c + dif_b) < 0) /* go from curr */ X `123 X (void) forward_line(dif_c); X `125 X else X `123 X C_LINE = NUM_LINES; X C_POS = EOB; X (void) forward_line(dif_b); X `125 X `125 X`125 `032 X X/* return line the point is on without the final '\n's X unless beg = end in which case we take care of it later ... X X returns 1 if the line should be wrapped */ Xint extract_line(unsigned char **beg, unsigned char **end) X`123 X *beg = beg_of_line(); X *end = end_of_line(); X if (**end != '\n') return(1); X while ((*end > BEG) && (**end == '\n')) *end = *end - 1; X return(0); X`125 `032 X Xint what_line(unsigned char *pos) X`123 X `032 X unsigned char *save_pos; X int save_line, dir; X register int dif_c, dif_b,dif_t; X int ret; X X if (MOST_B_OPT) X `123 X return (1 + (pos - BEG)/16); X `125 X `032 X `032 X save_pos = C_POS; X save_line = C_LINE; X `032 X dif_c = pos - C_POS; X dif_b = pos - EOB; X dif_t = pos - BEG; X X /* 4 possibilites */ X if (dif_c <= 0) X `123 X if (dif_t < -dif_c) /* go from top */ X `123 X C_LINE = 1; X C_POS = BEG; X dir = 1; X `125 X else /* from curr back */ X `123 X dir = -1; X `125 X `125 X else if (dif_c > 0) X `123 X if ((dif_c + dif_b) < 0) /* go from curr */ X `123 X dir = 1; X `125 X else X `123 X C_LINE = NUM_LINES; X C_POS = EOB; X dir = -1; X `125 X `125 X if (dir == 1) X `123 X while(C_POS = end_of_line(), C_POS < pos) X `123 X C_POS++; X C_LINE++; X `125 X `125 X else X `123 X while(C_POS = beg_of_line(), pos < C_POS) X `123 X C_LINE--; X C_POS--; X `125 X `125 X X ret = C_LINE; X C_POS = save_pos; X C_LINE = save_line; X return(ret); X`125 X X/* given a buffer position, find the line and column */ Xvoid find_row_column(unsigned char *pos, int *r, int *c) X`123 X unsigned char *beg, *save_pos; X int save_line; X X X if (pos <= BEG) X `123 X *r = 1; X *c = 1; X return; X `125 X X save_line = C_LINE; X save_pos = C_POS; X *r = what_line(pos); X `032 X if (MOST_B_OPT) X `123 X *c = (int) (pos - BEG) - *r * 16 + 1; X return; X `125 X C_LINE = *r; X C_POS = pos; X `032 X /* Now we have found the line it is on so.... */ X beg = beg_of_line(); X *c = 1; X while (beg++ < pos) *c = *c + 1; X C_LINE = save_line; X C_POS = save_pos; X`125 `032 X XBuffer *switch_to_buffer(Buffer *new) X`123 X Buffer *old; X old = BUF; X BUF = new; X BEG = BUF->beg; X EOB = BUF->end; X return(old); X`125 X Xvoid delete_buffer(Buffer *old) X`123 X (void) free(BUF); X BUF = old; X BEG = BUF->beg; X EOB = BUF->end; X`125 X XBuffer *create_buffer(char *file) X`123 X Buffer *buf; X X buf = (Buffer *) malloc(sizeof(Buffer)); X strcpy(buf->file,file); X return(buf); X`125 X $ GOSUB UNPACK_FILE $ FILE_IS = "CMD.C" $ CHECKSUM_IS = 791612008 $ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY X#include X#include X#include "sysdep.h" X#include "search.h" X#include "window.h" X#include "file.h" X#include "keym.h" X#include "externs.h" X X/* returns zero if not quit */ X `032 Xint do_extended_key() X`123 X char ch; X static int next = 1; X int quit = 0, n; X unsigned char *save; X `032 X select_minibuffer(); putc(':',stdout); fflush(stdout); X ch = getkey(); X putc(ch,stdout); fflush(stdout); X if (ch == 'n') X `123 X if (!NUM_FILES) X `123 X message("File ring is empty.",1); X `125 X quit = next_file(&next); X if (next == -1) quit = 1; X `125 V else if ((ch == 'c') `124`124 (ch == 'C')) /* toggle case sensitive sea Xrch */ X `123 X CASE_SENSITIVE = !CASE_SENSITIVE; X if (CASE_SENSITIVE) X message("Searches now respect case.",0); X else X message("Searches nolonger respect case.",0); X `125 X else if ((ch == 'D') && MOST_D_OPT) /* delete file */ X `123 X /* notice the missing D. */ X fprintf(stdout,"elete %s? [n]:", BUF->file); X fflush(stdout); X ch = getkey(); X if (ch == 'y') X `123 X if (!sys_delete_file(BUF->file)) X message("File could not be deleted.",1); X else X message("File deleted.",0); X `125 X else X message("File not deleted.",0); X `125 X else if (ch == 'o') X `123 X fputs("\rToggle option: b d t v w",stdout); fflush(stdout); X ch = getkey(); V if ((ch == 'd') `124`124 (ch == 'w') `124`124 (ch == 'b') `124`124 X (ch == 't') `124`124 (ch == 'v') `124`124 (ch == 's')) X `123 X if (ch == 'b') X `123 X MOST_B_OPT = !MOST_B_OPT; X NUM_LINES = count_lines(BEG,EOB); X `125 X else if (ch == 'd') X `123 X if (DIGIT_ARG == NULL) X `123 X message("Selective Display off.",0); X n = 0; X `125 X else n = abs( *DIGIT_ARG ); X if (MOST_S_OPT != n) X `123 X MOST_S_OPT = n; X NUM_LINES = count_lines(BEG,EOB); X `125 X `125 X else if ((ch == 's') && !MOST_B_OPT) X `123 X SQUEEZE_LINES = !SQUEEZE_LINES; X NUM_LINES = count_lines(BEG,EOB); X `125 X else if (ch == 'w') X `123 X MOST_W_OPT = !MOST_W_OPT; X NUM_LINES = count_lines(BEG,EOB); X `125 X else if (ch == 'v') MOST_V_OPT = !MOST_V_OPT; X else if (ch == 't') MOST_T_OPT = !MOST_T_OPT; X X if (!NUM_LINES) NUM_LINES = 1; X `032 X save_win_flags(WIN); X save = C_POS; X C_POS = BEG; X C_LINE = 1; X C_LINE = what_line(save); X C_POS = save; X WIN->beg_line = C_LINE; X delete_line(1); X exit_minibuffer(); X redraw_window(); X update_status(0); X return(quit); X `125 X `125 X else X `123 X putc('\007',stdout); X delete_line(1); X `125 X fflush(stdout); X `032 X exit_minibuffer(); X return(quit); X`125 X X/* returns zero if not quit */ X Xint do_extended_cmd() X`123 X char cmd[80]; X int quit = 0; X cmd[0] = 0; X if (!read_from_minibuffer("Cmd:",cmd)) return 0; X `032 X if (!strcmp(cmd,"cd")) X `123 X cd(); X `125 X else if ((!strncmp(cmd,"quit",strlen(cmd))) `124`124`032 X`009 (!strncmp(cmd,"exit",strlen(cmd)))) X `123 X quit = -1; X `125 X else X `123 X strcat(cmd," not understood."); X message(cmd,1); X `125 X return(quit); X`125 X $ GOSUB UNPACK_FILE $ FILE_IS = "DIR.C" $ CHECKSUM_IS = 391802538 $ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY X/* directory functions-- mainly unix stuff, needs work for VMS */ X#ifndef VMS X#include X#include X#endif X X#include "buffer.h" X#include "window.h" X#include "file.h" X Xvoid get_cdir(char *dir) X`123 X int i; X#ifndef VMS X getwd(dir); X i = strlen(dir); dir[i] = '/'; dir[i] = '\0'; X#else X getcwd(dir,80); X#endif X`125 X X X#ifndef VMS X/* This is a cheap routine-- should be replaced!!!! */ Xbubble_sort() X`123 X unsigned char *this, *next, *save; X char tmp[80], *t; X int change; X `032 X change = 1; X while(change) X `123 X next = this = BEG; X while((next < EOB) && (*next++ != 0)); X if (next == EOB) return; X change = 0; X while(next < EOB) X `123 X if (strcmp((char *)this,(char *) next) > 0) X `123 X change = 1; X strcpy(tmp,(char *) this); X t = tmp; X while(*next != 0) *this++ = *next++; X *this++ = 0; X save = this; X /* now next points at a null */ X next++; X while(*t != 0) *this++ = *t++; X *this = 0; X this = save; X `125 X else X `123 X this = next; X while(next < EOB && *next++ != 0); X `125 X `125 X `125 X`125 X Xvoid get_dir(char *dir) X`123 X DIR *dirp; X struct direct *dp; X char *p; X unsigned char *pos; X int dsize, len, size = 4096, i; X `032 X if (*dir == 0) X dirp = opendir("."); X else X dirp = opendir(dir); X X if (dirp == NULL) X `123 X message("Unable to open directory.",1); X return; X `125 X `032 X `032 X BEG = (unsigned char *) malloc(size); X strcpy(BUF->file,dir); X pos = BEG; X dsize = size; X EOB = BEG + size; X `032 X for(dp = readdir(dirp); dp != NULL; dp = readdir(dirp)) X `123 X p = dp->d_name; X len = dp->d_namlen; X if (pos + len >= EOB - 1) X `123 X size += dsize; X BEG = (unsigned char *) realloc(BEG,size); X `032 X EOB = BEG + size; X pos = EOB - dsize; X `125 X strcpy(pos,p); X pos += len; X /* *pos++ = '\n'; */ X *pos++ = '\0'; X `125 X X BUF->end = EOB = pos; X BUF->beg = BEG; X closedir(dirp); X bubble_sort(); X i = 0; X for (pos = BEG; pos < EOB; pos++) X if (*pos == '\0') X `123 X if (i = !i, i) *pos = '\t'; else *pos = '\n'; X `125 X `032 X`125 X#endif X X $ GOSUB UNPACK_FILE $ FILE_IS = "DISPLAY.C" $ CHECKSUM_IS = 1046544782 $ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY X#include X#include "buffer.h" `032 X#include "display.h" `032 X#include "sysdep.h" `032 X Xint SCREEN_WIDTH = 80; Xint SCREEN_WIDTH_M1 = 79; Xint SCREEN_HEIGHT = 24; Xint SCREEN_ROWS = 23; /* height - 1 */ X Xextern int MOST_L_OPT; X Xchar *INS_MODE_STR = "\033[4h"; /* ins mode (im) */ Xchar *EINS_MODE_STR = "\033[4l"; /* end ins mode (ei) */ Xchar *SCROLL_R_STR = "\033[%d;%dr"; /* scroll region */ Xchar *CLS_STR = "\033[2J\033[H"; /* cl termcap STR for ansi terminals */ Xchar *CLR_BOS_STR = "\033[1J"; /* erase to beg of screen */ Xchar *REV_INDEX_STR = "\033M"; /* sr termcap string */ Xchar *REV_VID_STR = "\033[7m"; /* mr,so termcap string */ Xchar *BOLD_VID_STR = "\033[1m"; /**/ Xchar *UNDL_VID_STR = "\033[4m"; /**/ Xchar *NORM_VID_STR = "\033[m"; /* me,se termcap string */ Xchar *DEL_BOL_STR = "\033[1K\r"; /* cb termcap entry */ Xchar *DEL_EOL_STR = "\033[K";`032 Xchar *HOME_CURS_STR = "\033[H"; /* ho termcap string */ Vchar *DEL_LINE_STR = "\r\033[K"; /* dl termcap string except cursor at bol X */ Xchar *DEL_CHAR_STR = "\033[P"; /* dc */ Xchar *DEL_N_LINES_STR = "\033[%dM"; /* DL */ Xchar *ADD_N_LINES_STR = "\033[%dL"; /* AL */ Xchar *CURS_F_STR = "\033[%dC"; /* RI termcap string */ Xchar *CURS_B_STR = "\033[%dD"; /* RI termcap string */ Xchar *CURS_U_STR = "\033[%dA"; /* RI termcap string */ Xchar *CURS_D_STR = "\033[%dB"; /* RI termcap string */ X/* cm string has %i%d since termcap numbers columns from 0 */ X/* char *CURS_POS_STR = "\033[%d;%df"; ansi-- hor and vert pos */ Xchar *CURS_POS_STR = "\033[%d;%dH"; /* cm termcap string */ X X Xvoid set_scroll_region(int r1, int r2) X`123 X fprintf(stdout,SCROLL_R_STR,r1,r2); X`125 X Xvoid goto_rc(int r, int c) X`123 X fprintf(stdout,CURS_POS_STR,r,c); X`125 Xvoid curs_bol() X`123 X fputc('\015',stdout); X`125 X Xvoid cursor_forward(int n) X`123 X fprintf(stdout,CURS_F_STR,n); X`125 X Xvoid cursor_backward(int n) X`123 X fprintf(stdout,CURS_B_STR,n); X`125 X Xvoid cursor_up(int n) X`123 X fprintf(stdout,CURS_U_STR,n); X`125 X Xvoid cursor_down(int n) X`123 X fprintf(stdout,CURS_D_STR,n); X`125 X Xvoid begin_insert() X`123 X fputs(INS_MODE_STR,stdout); X`125 X Xvoid end_insert() X`123 X fputs(EINS_MODE_STR,stdout); X`125 X Xvoid delete_char() X`123 X fputs(DEL_CHAR_STR,stdout); X`125 X Xvoid delete_line(int n) X`123 X fprintf(stdout,DEL_LINE_STR); X`125 X Xvoid delete_nlines(int n) X`123 X if (n) fprintf(stdout,DEL_N_LINES_STR,n); X`125 X Xvoid clr_bos() /* delete to beg of screen */ X`123 X fputs(CLR_BOS_STR,stdout); X`125 X Xvoid set_attribute(int attr) X`123 X fprintf(stdout,"\033[%dm",attr); X`125 X Xvoid cls() X`123 X fputs(CLS_STR,stdout); X`125 X Xvoid reverse_index(int n) X`123 X while(n--) X fputs(REV_INDEX_STR,stdout); X`125 X X/* assumes both old and new are the same length */ Xsmart_puts(char *new,char *old,FILE *fp) X`123 X char out[250], ch, ch1; X int ii,max_len,i,mark; X X i = 0; X ii = 0; X while(ch = *new++, ch1 = *old++, (ch == ch1) && (ch != '\0')) i++; X if (ch == '\0') return; X X max_len = strlen(CURS_F_STR); X if (i) fprintf(fp, CURS_F_STR, i); X X while(1) X `123 X i = 1; ii = 0; X out[ii++] = ch; V while (ch = *new++, ch1 = *old++, ch != ch1 && ch != '\0') out[ii++ X] = ch; X mark = ii; X out[ii++] = ch; X while (ch = *new++, ch1 = *old++, ch == ch1 && ch != '\0') X `123 X i++; X out[ii++] = ch; X `125 X out[ii] = '\0'; X if (ii > max_len) X `123 X out[mark] = '\0'; X fputs(out,fp); X if (ch == '\0') return; X if (i) fprintf(fp, CURS_F_STR, i); X `125 X else X `123 X fputs(out,fp); X if (ch == '\0') return; X `125 `032 X `125 `032 X`125 `032 X `032 X X#ifndef VMS X/* This routine may be problematic when there are more windows than X the new screen size can support. Until I think of what to do, X I have not touched this routine. */ Xvoid resize_display() X`123 X char c; X X get_term_dimensions(&SCREEN_WIDTH, &SCREEN_HEIGHT); X if (SCREEN_WIDTH == 0) SCREEN_WIDTH = 80; X if (SCREEN_HEIGHT == 0) SCREEN_HEIGHT = 24; X SCREEN_ROWS = SCREEN_HEIGHT - 1; X SCREEN_WIDTH_M1 = SCREEN_WIDTH - 1; X c = 'R'; /* force a redraw of screen */ X ioctl(0,TIOCSTI,&c); X`125 X#endif X Xvoid get_terminfo() X`123 X X#ifndef VMS X (void) signal(SIGWINCH,resize_display);`032 X#endif X `032 X get_term_dimensions(&SCREEN_WIDTH, &SCREEN_HEIGHT);`032 X if (SCREEN_WIDTH == 0) SCREEN_WIDTH = 80; X if (SCREEN_HEIGHT == 0) SCREEN_HEIGHT = 24; X SCREEN_ROWS = SCREEN_HEIGHT - 1; X SCREEN_WIDTH_M1 = SCREEN_WIDTH - 1; X X /* someday I will add something here for non-dec terminals X perhaps a 'most-cap' terminal entry :`094) X X For the time being we do it in this rather primitive manner */ X X if (MOST_L_OPT) /* dumb terminal */ X `123 X CLS_STR = "\014"; /* a formfeed */ X REV_INDEX_STR = ""; X REV_VID_STR = ""; X BOLD_VID_STR = ""; /**/ X UNDL_VID_STR = ""; /**/ X NORM_VID_STR = ""; X HOME_CURS_STR = ""; X DEL_LINE_STR = ""; X DEL_BOL_STR = DEL_LINE_STR; /* for our purposes */ X CURS_F_STR = ""; X CURS_POS_STR = ""; X `125 X `032 X`125 X X X Xvoid narrow_width() X`123 X fputs("\033[?3l",stdout); X`125 X Xvoid wide_width() X`123 X fputs("\033[?3h",stdout); X`125 X X Xvoid set_width(int width, int redraw) X`123 X#ifdef VMS X short fd; X int status; X iosb iostatus; X static termchar tc; /* Terminal characteristics */ X $DESCRIPTOR( devnam, "SYS$ERROR"); X#else X struct winsize wind_struct; X#endif `032 X X /* Switching physical terminal to narrow/wide mode.*/ X `032 X if(width<=80) X `123 X width = 80; X narrow_width(); X `125 X else X `123 X width = 132; X wide_width(); X `125 X SCREEN_WIDTH = width; X SCREEN_WIDTH_M1 = width - 1; X `032 X#ifdef VMS X /* Assign input to a channel */ X status = sys$assign(&devnam, &fd, 0, 0); X if ((status & 1) == 0) X exit(status); X /* Get current terminal characteristics */ X status = sys$qiow( /* Queue and wait */ X 0, /* Wait on event flag zero */ X fd, /* Channel to input terminal */ X IO$_SENSEMODE, /* Get current characteristic */ X &iostatus, /* Status after operation */ X 0, 0, /* No AST service */ X &tc, /* Terminal characteristics buf */ X sizeof(tc), /* Size of the buffer */ X 0, 0, 0, 0); /* P3-P6 unused */ X `032 X /*set terminal characteristics */ X tc.t_width=width; X status = sys$qiow( /* Queue and wait */ X 0, /* Wait on event flag zero */ X fd, /* Channel to input terminal */ X IO$_SETMODE, /* Get current characteristic */ X &iostatus, /* Status after operation */ X 0, 0, /* No AST service */ X &tc, /* Terminal characteristics buf */ X sizeof(tc), /* Size of the buffer */ X 0, 0, 0, 0); /* P3-P6 unused */ X `032 X if( (sys$dassgn(fd) & 1)==0) X exit(status); X X /* here we redraw the screen, on unix, we assume that the terminal X driver sends the appropriate signal that most catches to redraw so we V do not redraw because it is likely that screen will be redrawn twice * X/ X X if (redraw) redraw_display(); X#else X /* this may need work on other unix-- works for sun4 */ X ioctl(2,TIOCGWINSZ,&wind_struct); X wind_struct.ws_col = width; X ioctl(2,TIOCSWINSZ,&wind_struct); X `032 X#endif /* VMS */ X`125 X X X $ GOSUB UNPACK_FILE $ FILE_IS = "EDIT.C" $ CHECKSUM_IS = 1533661795 $ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY X/* editor functions */ X X#include "externs.h" X#include "window.h" X#include "sysdep.h" X X#ifdef VMS X Xint call_edt_tpu(char *file, int line, int what) X`123 X char the_file[100]; X extern void edt$edit(); X extern void tpu$tpu(); X struct dsc$descriptor_s file_desc; X if (what == 1) /* tpu */ X strcpy(the_file,"TPU "); X else X the_file[0] = '\0'; X `032 X strcat(the_file,file); X `032 X file_desc.dsc$w_length = strlen(the_file); X file_desc.dsc$a_pointer = the_file; X file_desc.dsc$b_class = DSC$K_CLASS_S; /* scalar, string type */ X file_desc.dsc$b_dtype = DSC$K_DTYPE_T; /* ascii string */ X X if (what == 1) X tpu$tpu(&file_desc); X else X edt$edit(&file_desc); X X return(1); X`125 X Xint call_emacs(char *file, int line) X`123 X int status; X char lstr[40]; X (void) sprintf(lstr,"%d",line); X define_logical_name("EMACS_FILE_LINE",lstr); X define_logical_name("EMACS_FILE_NAME",file); X status = do_emacs_command(); X delete_logical_name("EMACS_FILE_NAME"); X delete_logical_name("EMACS_FILE_LINE"); X return(status); X`125 X Xvoid edit_cmd() X`123 X char *editor, file[80], *strp; X int status; X `032 X if ((editor = getenv("MOST_EDITOR")) == NULL) editor = "EDT"; X `032 X strcpy(file,WIN->buf->file); X strp = file; X /* lose the version number */ X while((*strp != '\0') && (*strp != ';')) strp++; X *strp = '\0'; X `032 X reset_tty(); X reset_display(); X fflush(stdout); X `032 X if (!strcmp(editor,"EMACS")) X `123 X status = call_emacs(file,C_LINE); X `125 X else if (!strcmp(editor,"EDT")) X `123 X status = call_edt_tpu(file,C_LINE,0); X `125 X else if (!strcmp(editor,"TPU")) X `123 X status = call_edt_tpu(file,C_LINE,1); X `125 X else message("Unknown editor.",1); X if (status) X `123 X redraw_display(); X `125 X else message("Unable to edit.",1); X`125 X `032 X#else X Xvoid edit_cmd() X `123 X ; X `125 X X#endif X $ GOSUB UNPACK_FILE $ FILE_IS = "FILE.C" $ CHECKSUM_IS = 437374781 $ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY X#include X#include X#ifndef VMS X#include X#include X#include X#else X#include X#include X#include X#endif X X#ifndef O_RDONLY X#define O_RDONLY 0 X#endif X `032 X#include "externs.h" X#include "file.h" X#include "keym.h" `032 X#include "buffer.h" X#include "window.h" X Xchar *FILE_RING[500]; Xchar C_DIR[80]; /* current working dir */ Xint NUM_FILES; X Xextern int SCREEN_WIDTH; X Xint insert_file(char *file) X`123 X struct stat st; X int i,n,size, fd, dsize; X unsigned char *pos; X X if (file[0] == '\0') /* assume stdin */ X `123 X fd = 0; X strcpy(BUF->file,"(Standard Input)"); X `125 X else X `123 X stat(file, &st); X if (st.st_mode & S_IFDIR) /* S_IFDIR = 0040000 */ X `123 X#ifndef VMS X get_dir(file); X#endif `032 X return(1); X `125 X size = st.st_size; X#ifdef VMS `032 V /* VMS share options (shr=put) suggested by Henk D. Davids */ V /* VMS share options (shr=upi,get,put) suggested by Mark Pizzolato X */ V fd = open(file,O_RDONLY,"ctx=rec","mbf=8","mbc=16","rop=RAH","shr=u Xpi,get,put"); X#else X fd = open(file,O_RDONLY); X#endif `032 X `125 X `032 X `032 X if (fd >= 0) X `123 X if (!fd) size = 16384; X BEG = BUF->beg = (unsigned char *) malloc(size); X n = 0; X pos = BUF->beg; X dsize = size; X while ((i = read(fd, (char *) pos, size - n)) > 0 ) X `123 X n += i; X if ((fd == 0) && (size == n)) X `123 X size += dsize; V BEG = (unsigned char *) realloc(BEG,size * sizeof(char) X); X pos = BEG + n; X `125 X else pos += i; X `125 X BUF->end = pos; X BUF->beg = BEG; X close(fd); X return (1); X `125 X return(0); X`125 X Xint find_file(char *file) X`123 X Buffer *new_buf, *old_buf; X int a,n; X unsigned char *pos; X `032 X `032 X new_buf = create_buffer(file); X old_buf = switch_to_buffer(new_buf); X `032 X if (insert_file(file) == 0) X `123 X message("File could not be opened.",1); X BUF->beg = (unsigned char *) "File could Not be opened."; X BUF->end = BUF->beg + strlen((char *) BUF->beg); X `125 X BEG = BUF->beg; X EOB = BUF->end; X if (!MOST_B_OPT && !MOST_K_OPT) X for (pos = BEG; (pos < (BEG + 32)) && (pos < EOB); pos++) X `123 X if ((*pos == 0) `124`124 (*pos > 127)) MOST_B_OPT = 1; X `125 X `032 X n = count_lines(BEG,EOB); X `032 X NUM_LINES = n; X C_POS = BEG; X C_LINE = 1; X COLUMN = 1; X return(1); X`125 X X/* if the file is visible in a window, move to the window and return 1 X else return 0 */ Xint file_visible(char *file) X`123 X Window *w; X w = WIN; X WIN = TOP_WIN; X do X `123 X if (!strcmp(WIN->buf->file,file)) X `123 X set_window(WIN); X return(1); X `125 X WIN = WIN->next; X `125 X while (WIN != TOP_WIN); X WIN = w; X return(0); X`125 X X Xvoid find_file_in_window(char *file) X`123 X if (file_visible(file)) return; X `032 X if (-1 == access(file,0)) /* does it exist? */ X message("File not found.",1); X else if (-1 == access(file,4)) /* can we read it? */ X message("File exists but not readable.",1); X else`032 X `123 X free_window_buffer(); X (void) find_file(file); X X window_buffer(); X CURS_ROW = WIN->curs_line = 1; X CURS_POS = WIN->curs_pos = C_POS; X CURS_COL = WIN->curs_col = 1; X X redraw_window(); X update_status(0); X `125 X`125 X X X Xint next_file(int *j) X`123 X char mbuf[132], ch, *curr_file; X int i; X `032 X mbuf[0] = '\0'; X select_minibuffer(); X delete_line(1); X X for (i = 0; i < SCREEN_WIDTH; i++) MINI_BUF[i] = ' '; X X if (*j >= NUM_FILES) *j = 0; X curr_file = FILE_RING[*j]; X strcat(mbuf,"Next file: "); X strcat(mbuf, curr_file); X fputs(mbuf,stdout); X fputc('\r',stdout); X fflush(stdout); X while(ch = mbuf[i], ch != '\0') i++; X while(i < SCREEN_WIDTH) mbuf[i++] = ' '; X mbuf[i] = '\0'; X strcpy((char *) MINI_BUF,mbuf); X while (1) X `123 X ch = getkey(); X if (ch != '\033') break; X if (ch = getkey(), (ch != 'O') && (ch != '[')) continue; X if (ch = getkey(), (ch != 'A') && (ch != 'B')) continue; X `032 X if (ch == 'B') X `123 X if (*j == 0) *j = NUM_FILES; X (*j)--; X `125 X else /* ch == 'A' */ X `123 X (*j)++; X if (*j == NUM_FILES) *j = 0; X `125 X curr_file = FILE_RING[*j]; X mbuf[0] = '\0'; X strcat(mbuf,"Next file: "); X strcat(mbuf, curr_file); X i = 0; X while(ch = mbuf[i], ch != '\0') i++; X while(i < SCREEN_WIDTH) mbuf[i++] = ' '; X mbuf[i] = '\0'; X `032 X smart_puts(mbuf,MINI_BUF,stdout); X fputc('\r',stdout); X strcpy((char *) MINI_BUF,mbuf); X fflush(stdout); X `125 X delete_line(1); X exit_minibuffer(); X MINI_BUF[0] = 0; X (*j)++; X if ((ch == 'Q') `124`124 (ch == 'q')) return(-1); X `032 X find_file_in_window(curr_file); X return(0); X`125 X X/* extracts directory from file string, returns false if no dir */ Xint head(char *file, char *dir) X`123 X int n; X (void) strcpy(dir,file); X n = strlen(file) - 1; X#ifdef VMS `032 X while((n > -1) && (file[n] != ']') && (file[n] != ':')) n--; X#else `032 X while((n > -1) && file[n] != '/') n--; X#endif X n++; X dir[n] = '\0'; X return(n); X`125 X X/* returns a pointer to the tail of file */ Xint tail(char *filed, char **filep) X`123 X int n; X n = strlen(filed) - 1; X#ifdef VMS `032 X while((n > -1) && (filed[n] != ']') `124`124 (filed[n] != ':')) n--; X#else `032 X while((n > -1) && filed[n] != '/') n--; X#endif X n++; X *filep = (filed + n); X return(n); X`125 X X/* assume path is big enough to hold new expanded version */ Xint expand_path(char *path) X`123 X int n; X /* really cheat here-- let system do it. The path must exist!! */ X if (chdir(path)) X `123 X message(path,1); X return(0); X `125 X else X `123 X get_cdir(path); X chdir(C_DIR); X#ifndef VMS X n = strlen(path); X if (path[n-1] == '/') return(1); X path[n++] = '/'; path[n] = 0; X#endif X `125 X return(1); X`125 X X X Xvoid cd() X`123 X char tmp_dir[80]; X int n; X `032 X strcpy(tmp_dir,C_DIR); X if (read_from_minibuffer("cd: ",C_DIR) == -1) return; X if (!chdir(C_DIR)) X `123 X get_cdir(C_DIR); /* expands ../ etc... */ X n = strlen(C_DIR); X#ifndef VMS X if (C_DIR[n-1] == '/') return; X C_DIR[n++] = '/'; C_DIR[n] = 0; X#endif `032 X return; X `125 X strcpy(C_DIR,tmp_dir); X chdir(C_DIR); X message("Unable to change directory.",1); X`125 X Xvoid user_get_file() X`123 X char path[80], file[80], *name; X `032 X if (!head(WIN->buf->file,file)) X strcpy(file,C_DIR); X X if (read_from_minibuffer("Find File: ",file) == -1) return; X X if (head(file,path)) X `123 X expand_path(path); X tail(file,&name); X strcat(path,name); X name = path; X `125 X else name = file; X find_file_in_window(name); X`125 X X $ GOSUB UNPACK_FILE $ FILE_IS = "HELP.C" $ CHECKSUM_IS = 1076505520 $ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY X#include X#ifdef VMS X#include X#else X#include X#include X#endif X#include "window.h" X#include "file.h" `032 X#include "display.h" `032 X#include "line.h" X#include "most.h" `032 X `032 X#ifndef MOST_HELP_USE_DOC X/* This section provided by Mats Akerberg (mats@efd.lth.se) */ X `032 Xstatic char *help[] = `123 X"SPACE,`094D,D,d *Scroll down one Screen.", X"RETURN, DOWN *Move forward one line.", X"u,U,`094U, DELETE *Move Up one screen.", X"UP *Move up one line.", X"R, r, `094R Redraw Screen.", X"T,t Top of File.", X"B,b Bottom of file.", V"RIGHT Scroll Screen Left (to view lines right of right margin X)", V"LEFT Scroll Screen Right (To view lines left of left margin) X", X"F,f,/ *Find forward", X"? *Find Backward", X"n,N *Find next in current search direction.", X"J,j,g,G Goto line.", X"% Goto percent.", X"q,Q Quit MOST.", X":N,:n Quit this file and view next.", V" *Note: This command may be repeated `096n' times By entering a number then X", X" the command key, e.g., '5 SPACE' moves 5 screens forward.", XNULL `125; X Xvoid do_help_command() X`123 X int i,ct; X char *beg, *end; X char line[80]; X char attr[80]; X `032 X i = 1; X ct = 0; X set_scroll_region(1,SCREEN_HEIGHT); X cls(); X while( ifile,buf_name); X window_buffer(); X redraw_window(); X update_status(1); X `125 X else X `123 V message("You must set the environment variable 'MOST_HELP' to point X to the help file.",1); X `125 X`125 `032 X#endif X $ GOSUB UNPACK_FILE $ FILE_IS = "KEYM.C" $ CHECKSUM_IS = 454147953 $ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY X#include X#include "externs.h" `032 X#include "keym.h" X#include "sysdep.h" X#include "display.h" X#include "buffer.h" X#include "window.h" X#include "search.h" X Xint *DIGIT_ARG; Xchar LAST_CHAR; Xint EDT_DIRECTION = 1; X Xvoid (*root_map[128])() = X `123 X beep_cmd, /* `094@ */ X beep_cmd, /* `094A */ X beep_cmd, /* `094B */ X beep_cmd, /* `094C */ X page_down_cmd, /* `094D */ X beep_cmd, /* `094E */ X search_cmd, /* `094F */ X beep_cmd, /* `094G */ X help_cmd, /* `094H */ X page_right_cmd, /* `094I */ X next_line_cmd, /* `094J */ X ctrl_k_map_cmd, /* `094K */ X beep_cmd, /* `094L */ X next_line_cmd, /* `094M */ X next_line_cmd, /* `094N */ X beep_cmd, /* `094O */ X previous_line_cmd, /* `094P */ X beep_cmd, /* `094Q */ X redraw_cmd, /* `094R */ X beep_cmd, /* `094S */ X time_cmd, /* `094T */ X page_up_cmd, /* `094U */ X page_down_cmd, /* `094V */ X ctrl_w_map_cmd, /* `094W */ X ctrl_x_map_cmd, /* `094X */ X beep_cmd, /* `094Y */ X sys_spawn_cmd, /* `094Z */ X esc_map_cmd, /* `094[ */ X beep_cmd, /* `094\ */ X beep_cmd, /* `094] */ X beep_cmd, /* `094`094 */ X beep_cmd, /* `094_ */ X page_down_cmd, /* */ X beep_cmd, /* ! */ X beep_cmd, /* " */ X beep_cmd, /* # */ X sys_spawn_cmd, /* $ */ X goto_percent_cmd, /* % */ X beep_cmd, /* & */ X beep_cmd, /* ' */ X beep_cmd, /* ( */ X beep_cmd, /* ) */ X beep_cmd, /* * */ X beep_cmd, /* + */ X goto_mark_cmd, /* , */ X digit_arg_cmd, /* - */ X beep_cmd, /* . */ X search_cmd, /* / */ X digit_arg_cmd, /* 0 */ X digit_arg_cmd, /* 1 */ X digit_arg_cmd, /* 2 */ X digit_arg_cmd, /* 3 */ X digit_arg_cmd, /* 4 */ X digit_arg_cmd, /* 5 */ X digit_arg_cmd, /* 6 */ X digit_arg_cmd, /* 7 */ X digit_arg_cmd, /* 8 */ X digit_arg_cmd, /* 9 */ X extended_key_cmd, /* : */ X beep_cmd, /* ; */ X page_left_cmd, /* < */ X beep_cmd, /* = */ X page_right_cmd, /* > */ X search_back_cmd, /* ? */ X beep_cmd, /* @ */ X beep_cmd, /* A */ X end_of_buffer_cmd, /* B */ X beep_cmd, /* C */ X page_down_cmd, /* D */ X edit_cmd, /* E */ X search_cmd, /* F */ X goto_line_cmd, /* G */ X help_cmd, /* H */ X beep_cmd, /* I */ X goto_line_cmd, /* J */ X beep_cmd, /* K */ X toggle_lock, /* L */ X set_mark_cmd, /* M */ X find_next_cmd, /* N */ X other_window_cmd, /* O */ X beep_cmd, /* P */ X exit_cmd, /* Q */ X redraw_cmd, /* R */ X beep_cmd, /* S */ X top_of_buffer_cmd, /* T */ X page_up_cmd, /* U */ X next_line_cmd, /* V */ X toggle_width_cmd, /* W */ X exit_cmd, /* X */ X beep_cmd, /* Y */ X beep_cmd, /* Z */ X beep_cmd, /* [ */ X beep_cmd, /* \ */ X beep_cmd, /* ] */ X beep_cmd, /* `094 */ X beep_cmd, /* _ */ X beep_cmd, /* `096 */ X beep_cmd, /* a */ X end_of_buffer_cmd, /* b */ X beep_cmd, /* c */ X page_down_cmd, /* d */ X edit_cmd, /* e */ X search_cmd, /* f */ X goto_line_cmd, /* g */ X help_cmd, /* h */ X beep_cmd, /* i */ X goto_line_cmd, /* j */ X beep_cmd, /* k */ X toggle_lock, /* l */ X set_mark_cmd, /* m */ X find_next_cmd, /* n */ X other_window_cmd, /* o */ X beep_cmd, /* p */ X exit_cmd, /* q */ X redraw_cmd, /* r */ X beep_cmd, /* s */ X top_of_buffer_cmd, /* t */ X page_up_cmd, /* u */ X next_line_cmd, /* v */ X toggle_width_cmd, /* w */ X exit_cmd, /* x */ X beep_cmd, /* y */ X beep_cmd, /* z */ X beep_cmd, /* `123 */ X beep_cmd, /* `124 */ X beep_cmd, /* `125 */ X beep_cmd, /* `126 */ X page_up_cmd /* `094? */ X `125; X X/* escape map */ Xvoid (*escape_map[128])() = X `123 X beep_cmd, /* `094@ */ X beep_cmd, /* `094A */ X beep_cmd, /* `094B */ X beep_cmd, /* `094C */ X beep_cmd, /* `094D */ X beep_cmd, /* `094E */ X beep_cmd, /* `094F */ X beep_cmd, /* `094G */ X beep_cmd, /* `094H */ X beep_cmd, /* `094I */ X beep_cmd, /* `094J */ X beep_cmd, /* `094K */ X beep_cmd, /* `094L */ X beep_cmd, /* `094M */ X beep_cmd, /* `094N */ X beep_cmd, /* `094O */ X beep_cmd, /* `094P */ X beep_cmd, /* `094Q */ X beep_cmd, /* `094R */ X beep_cmd, /* `094S */ X beep_cmd, /* `094T */ X beep_cmd, /* `094U */ X beep_cmd, /* `094V */ X beep_cmd, /* `094W */ X beep_cmd, /* `094X */ X beep_cmd, /* `094Y */ X beep_cmd, /* `094Z */ X beep_cmd, /* `094[ */ X beep_cmd, /* `094\ */ X beep_cmd, /* `094] */ X beep_cmd, /* `094`094 */ X beep_cmd, /* `094_ */ X beep_cmd, /* */ X beep_cmd, /* ! */ X beep_cmd, /* " */ X beep_cmd, /* # */ X sys_spawn_cmd, /* $ */ X beep_cmd, /* % */ X beep_cmd, /* & */ X beep_cmd, /* ' */ X beep_cmd, /* ( */ X beep_cmd, /* ) */ X beep_cmd, /* * */ X beep_cmd, /* + */ X beep_cmd, /* , */ X digit_arg_cmd, /* - */ X beep_cmd, /* . */ X beep_cmd, /* / */ X beep_cmd, /* 0 */ X digit_arg_cmd, /* 1 */ X digit_arg_cmd, /* 2 */ X digit_arg_cmd, /* 3 */ X digit_arg_cmd, /* 4 */ X digit_arg_cmd, /* 5 */ X digit_arg_cmd, /* 6 */ X digit_arg_cmd, /* 7 */ X digit_arg_cmd, /* 8 */ X digit_arg_cmd, /* 9 */ X beep_cmd, /* : */ X beep_cmd, /* ; */ X beep_cmd, /* < */ X beep_cmd, /* = */ X beep_cmd, /* > */ X beep_cmd, /* ? */ X beep_cmd, /* @ */ X beep_cmd, /* A */ X beep_cmd, /* B */ X beep_cmd, /* C */ X beep_cmd, /* D */ X beep_cmd, /* E */ X beep_cmd, /* F */ X beep_cmd, /* G */ X beep_cmd, /* H */ X beep_cmd, /* I */ X beep_cmd, /* J */ X beep_cmd, /* K */ X beep_cmd, /* L */ X beep_cmd, /* M */ X beep_cmd, /* N */ X O_map_cmd, /* O */ X beep_cmd, /* P */ X beep_cmd, /* Q */ X beep_cmd, /* R */ X beep_cmd, /* S */ X beep_cmd, /* T */ X beep_cmd, /* U */ X beep_cmd, /* V */ X beep_cmd, /* W */ X extended_cmd_cmd, /* X */ X beep_cmd, /* Y */ X beep_cmd, /* Z */ X O_map_cmd, /* [ */ X beep_cmd, /* \ */ X beep_cmd, /* ] */ X beep_cmd, /* `094 */ X beep_cmd, /* _ */ X beep_cmd, /* `096 */ X beep_cmd, /* a */ X beep_cmd, /* b */ X beep_cmd, /* c */ X beep_cmd, /* d */ X beep_cmd, /* e */ X beep_cmd, /* f */ X beep_cmd, /* g */ X beep_cmd, /* h */ X beep_cmd, /* i */ X beep_cmd, /* j */ X beep_cmd, /* k */ X beep_cmd, /* l */ X beep_cmd, /* m */ X beep_cmd, /* n */ X beep_cmd, /* o */ X beep_cmd, /* p */ X beep_cmd, /* q */ X beep_cmd, /* r */ X beep_cmd, /* s */ X beep_cmd, /* t */ X beep_cmd, /* u */ X beep_cmd, /* v */ X beep_cmd, /* w */ X extended_cmd_cmd, /* x */ X beep_cmd, /* y */ X beep_cmd, /* z */ X beep_cmd, /* `123 */ X beep_cmd, /* `124 */ X beep_cmd, /* `125 */ X beep_cmd, /* `126 */ X beep_cmd /* `094? */ X `125; X Xvoid (*ctrl_x_map[128])() = X `123 X beep_cmd, /* `094@ */ X beep_cmd, /* `094A */ X beep_cmd, /* `094B */ X exit_cmd, /* `094C */ X beep_cmd, /* `094D */ X beep_cmd, /* `094E */ X find_file_cmd, /* `094F */ X beep_cmd, /* `094G */ X beep_cmd, /* `094H */ X beep_cmd, /* `094I */ X beep_cmd, /* `094J */ X beep_cmd, /* `094K */ X beep_cmd, /* `094L */ X beep_cmd, /* `094M */ X beep_cmd, /* `094N */ X beep_cmd, /* `094O */ X beep_cmd, /* `094P */ X beep_cmd, /* `094Q */ X beep_cmd, /* `094R */ X beep_cmd, /* `094S */ X beep_cmd, /* `094T */ X beep_cmd, /* `094U */ X beep_cmd, /* `094V */ X beep_cmd, /* `094W */ X beep_cmd, /* `094X */ X beep_cmd, /* `094Y */ X beep_cmd, /* `094Z */ X beep_cmd, /* `094[ */ X beep_cmd, /* `094\ */ X beep_cmd, /* `094] */ X beep_cmd, /* `094`094 */ X beep_cmd, /* `094_ */ X beep_cmd, /* */ X beep_cmd, /* ! */ X beep_cmd, /* " */ X beep_cmd, /* # */ X beep_cmd, /* $ */ X beep_cmd, /* % */ X beep_cmd, /* & */ X beep_cmd, /* ' */ X beep_cmd, /* ( */ X beep_cmd, /* ) */ X beep_cmd, /* * */ X beep_cmd, /* + */ X beep_cmd, /* , */ X beep_cmd, /* - */ X beep_cmd, /* . */ X beep_cmd, /* / */ X del_window_cmd, /* 0 */ X one_window_cmd, /* 1 */ X two_window_cmd, /* 2 */ X beep_cmd, /* 3 */ X beep_cmd, /* 4 */ X beep_cmd, /* 5 */ X beep_cmd, /* 6 */ X beep_cmd, /* 7 */ X beep_cmd, /* 8 */ X beep_cmd, /* 9 */ X beep_cmd, /* : */ X beep_cmd, /* ; */ X beep_cmd, /* < */ X beep_cmd, /* = */ X beep_cmd, /* > */ X beep_cmd, /* ? */ X beep_cmd, /* @ */ X beep_cmd, /* A */ X beep_cmd, /* B */ X beep_cmd, /* C */ X beep_cmd, /* D */ X beep_cmd, /* E */ X beep_cmd, /* F */ X beep_cmd, /* G */ X beep_cmd, /* H */ X beep_cmd, /* I */ X beep_cmd, /* J */ X beep_cmd, /* K */ X beep_cmd, /* L */ X beep_cmd, /* M */ X beep_cmd, /* N */ X other_window_cmd, /* O */ X beep_cmd, /* P */ X beep_cmd, /* Q */ X beep_cmd, /* R */ X beep_cmd, /* S */ X beep_cmd, /* T */ X beep_cmd, /* U */ X beep_cmd, /* V */ X beep_cmd, /* W */ X beep_cmd, /* X */ X beep_cmd, /* Y */ X beep_cmd, /* Z */ X beep_cmd, /* [ */ X beep_cmd, /* \ */ X beep_cmd, /* ] */ X beep_cmd, /* `094 */ X beep_cmd, /* _ */ X beep_cmd, /* `096 */ X beep_cmd, /* a */ X beep_cmd, /* b */ X beep_cmd, /* c */ X beep_cmd, /* d */ X beep_cmd, /* e */ X beep_cmd, /* f */ X beep_cmd, /* g */ X beep_cmd, /* h */ X beep_cmd, /* i */ X beep_cmd, /* j */ X beep_cmd, /* k */ X beep_cmd, /* l */ X beep_cmd, /* m */ X beep_cmd, /* n */ X other_window_cmd, /* o */ X beep_cmd, /* p */ X beep_cmd, /* q */ X beep_cmd, /* r */ X beep_cmd, /* s */ X beep_cmd, /* t */ X beep_cmd, /* u */ X beep_cmd, /* v */ X beep_cmd, /* w */ X beep_cmd, /* x */ X beep_cmd, /* y */ X beep_cmd, /* z */ X beep_cmd, /* `123 */ X beep_cmd, /* `124 */ X beep_cmd, /* `125 */ X beep_cmd, /* `126 */ X beep_cmd /* `094? */ X `125; X Xvoid (*ctrl_w_map[128])() = X `123 X beep_cmd, /* `094@ */ X beep_cmd, /* `094A */ X beep_cmd, /* `094B */ X beep_cmd, /* `094C */ X beep_cmd, /* `094D */ X beep_cmd, /* `094E */ X beep_cmd, /* `094F */ X beep_cmd, /* `094G */ X beep_cmd, /* `094H */ X beep_cmd, /* `094I */ X beep_cmd, /* `094J */ X beep_cmd, /* `094K */ X beep_cmd, /* `094L */ X beep_cmd, /* `094M */ X beep_cmd, /* `094N */ X beep_cmd, /* `094O */ X beep_cmd, /* `094P */ X beep_cmd, /* `094Q */ X beep_cmd, /* `094R */ X beep_cmd, /* `094S */ X beep_cmd, /* `094T */ X beep_cmd, /* `094U */ X beep_cmd, /* `094V */ X beep_cmd, /* `094W */ X beep_cmd, /* `094X */ X beep_cmd, /* `094Y */ X beep_cmd, /* `094Z */ X beep_cmd, /* `094[ */ X beep_cmd, /* `094\ */ X beep_cmd, /* `094] */ X beep_cmd, /* `094`094 */ X beep_cmd, /* `094_ */ X beep_cmd, /* */ X beep_cmd, /* ! */ X beep_cmd, /* " */ X beep_cmd, /* # */ X beep_cmd, /* $ */ X beep_cmd, /* % */ X beep_cmd, /* & */ X beep_cmd, /* ' */ X beep_cmd, /* ( */ X beep_cmd, /* ) */ X beep_cmd, /* * */ X beep_cmd, /* + */ X beep_cmd, /* , */ X beep_cmd, /* - */ X beep_cmd, /* . */ X beep_cmd, /* / */ X del_window_cmd, /* 0 */ X one_window_cmd, /* 1 */ X two_window_cmd, /* 2 */ X beep_cmd, /* 3 */ X beep_cmd, /* 4 */ X beep_cmd, /* 5 */ X beep_cmd, /* 6 */ X beep_cmd, /* 7 */ X beep_cmd, /* 8 */ X beep_cmd, /* 9 */ X beep_cmd, /* : */ X beep_cmd, /* ; */ X beep_cmd, /* < */ X beep_cmd, /* = */ X beep_cmd, /* > */ X beep_cmd, /* ? */ X beep_cmd, /* @ */ X beep_cmd, /* A */ X beep_cmd, /* B */ X beep_cmd, /* C */ X beep_cmd, /* D */ X beep_cmd, /* E */ X beep_cmd, /* F */ X beep_cmd, /* G */ X beep_cmd, /* H */ X beep_cmd, /* I */ X beep_cmd, /* J */ X beep_cmd, /* K */ X beep_cmd, /* L */ X beep_cmd, /* M */ X beep_cmd, /* N */ X other_window_cmd, /* O */ X beep_cmd, /* P */ X beep_cmd, /* Q */ X beep_cmd, /* R */ X beep_cmd, /* S */ X beep_cmd, /* T */ X beep_cmd, /* U */ X beep_cmd, /* V */ X beep_cmd, /* W */ X beep_cmd, /* X */ X beep_cmd, /* Y */ X beep_cmd, /* Z */ X beep_cmd, /* [ */ X beep_cmd, /* \ */ X beep_cmd, /* ] */ X beep_cmd, /* `094 */ X beep_cmd, /* _ */ X beep_cmd, /* `096 */ X beep_cmd, /* a */ X beep_cmd, /* b */ X beep_cmd, /* c */ X beep_cmd, /* d */ X beep_cmd, /* e */ X beep_cmd, /* f */ X beep_cmd, /* g */ X beep_cmd, /* h */ X beep_cmd, /* i */ X beep_cmd, /* j */ X beep_cmd, /* k */ X beep_cmd, /* l */ X beep_cmd, /* m */ X beep_cmd, /* n */ X other_window_cmd, /* o */ X beep_cmd, /* p */ X beep_cmd, /* q */ X beep_cmd, /* r */ X beep_cmd, /* s */ X beep_cmd, /* t */ X beep_cmd, /* u */ X beep_cmd, /* v */ X beep_cmd, /* w */ X beep_cmd, /* x */ X beep_cmd, /* y */ X beep_cmd, /* z */ X beep_cmd, /* `123 */ X beep_cmd, /* `124 */ X beep_cmd, /* `125 */ X beep_cmd, /* `126 */ X beep_cmd /* `094? */ X `125; X Xvoid (*ctrl_k_map[128])() = X `123 X beep_cmd, /* `094@ */ X beep_cmd, /* `094A */ X set_mark_cmd, /* `094B */ X beep_cmd, /* `094C */ X beep_cmd, /* `094D */ X beep_cmd, /* `094E */ X beep_cmd, /* `094F */ X beep_cmd, /* `094G */ X beep_cmd, /* `094H */ X beep_cmd, /* `094I */ X goto_mark_cmd, /* `094J */ X beep_cmd, /* `094K */ X beep_cmd, /* `094L */ X goto_mark_cmd, /* `094M */ X beep_cmd, /* `094N */ X beep_cmd, /* `094O */ X beep_cmd, /* `094P */ X beep_cmd, /* `094Q */ X beep_cmd, /* `094R */ X beep_cmd, /* `094S */ X beep_cmd, /* `094T */ X beep_cmd, /* `094U */ X beep_cmd, /* `094V */ X beep_cmd, /* `094W */ X beep_cmd, /* `094X */ X beep_cmd, /* `094Y */ X beep_cmd, /* `094Z */ X beep_cmd, /* `094[ */ X beep_cmd, /* `094\ */ X beep_cmd, /* `094] */ X beep_cmd, /* `094`094 */ X beep_cmd, /* `094_ */ X beep_cmd, /* */ X beep_cmd, /* ! */ X beep_cmd, /* " */ X beep_cmd, /* # */ X beep_cmd, /* $ */ X beep_cmd, /* % */ X beep_cmd, /* & */ X beep_cmd, /* ' */ X beep_cmd, /* ( */ X beep_cmd, /* ) */ X beep_cmd, /* * */ X beep_cmd, /* + */ X beep_cmd, /* , */ X beep_cmd, /* - */ X beep_cmd, /* . */ X beep_cmd, /* / */ X beep_cmd, /* 0 */ X beep_cmd, /* 1 */ X beep_cmd, /* 2 */ X beep_cmd, /* 3 */ X beep_cmd, /* 4 */ X beep_cmd, /* 5 */ X beep_cmd, /* 6 */ X beep_cmd, /* 7 */ X beep_cmd, /* 8 */ X beep_cmd, /* 9 */ X beep_cmd, /* : */ X beep_cmd, /* ; */ X beep_cmd, /* < */ X beep_cmd, /* = */ X beep_cmd, /* > */ X beep_cmd, /* ? */ X beep_cmd, /* @ */ X beep_cmd, /* A */ X beep_cmd, /* B */ X beep_cmd, /* C */ X extended_cmd_cmd, /* D */ X exit_cmd, /* E */ X beep_cmd, /* F */ X find_file_cmd, /* G */ X beep_cmd, /* H */ X beep_cmd, /* I */ X beep_cmd, /* J */ X beep_cmd, /* K */ X beep_cmd, /* L */ X set_mark_cmd, /* M */ X beep_cmd, /* N */ X beep_cmd, /* O */ X beep_cmd, /* P */ X beep_cmd, /* Q */ X beep_cmd, /* R */ X beep_cmd, /* S */ X beep_cmd, /* T */ X beep_cmd, /* U */ X beep_cmd, /* V */ X beep_cmd, /* W */ X beep_cmd, /* X */ X beep_cmd, /* Y */ X beep_cmd, /* Z */ X beep_cmd, /* [ */ X beep_cmd, /* \ */ X beep_cmd, /* ] */ X beep_cmd, /* `094 */ X beep_cmd, /* _ */ X beep_cmd, /* `096 */ X beep_cmd, /* a */ X beep_cmd, /* b */ X beep_cmd, /* c */ X extended_cmd_cmd, /* d */ X exit_cmd, /* e */ X beep_cmd, /* f */ X find_file_cmd, /* g */ X beep_cmd, /* h */ X beep_cmd, /* i */ X beep_cmd, /* j */ X beep_cmd, /* k */ X beep_cmd, /* l */ X set_mark_cmd, /* m */ X beep_cmd, /* n */ X beep_cmd, /* o */ X beep_cmd, /* p */ X beep_cmd, /* q */ X beep_cmd, /* r */ X beep_cmd, /* s */ X beep_cmd, /* t */ X beep_cmd, /* u */ X beep_cmd, /* v */ X beep_cmd, /* w */ X beep_cmd, /* x */ X beep_cmd, /* y */ X beep_cmd, /* z */ X beep_cmd, /* `123 */ X beep_cmd, /* `124 */ X beep_cmd, /* `125 */ X beep_cmd, /* `126 */ X beep_cmd /* `094? */ X `125; X Xvoid (*esc_O_map[128])() = X `123 X beep_cmd, /* `094@ */ X beep_cmd, /* `094A */ X beep_cmd, /* `094B */ X beep_cmd, /* `094C */ X beep_cmd, /* `094D */ X beep_cmd, /* `094E */ X beep_cmd, /* `094F */ X beep_cmd, /* `094G */ X beep_cmd, /* `094H */ X beep_cmd, /* `094I */ X beep_cmd, /* `094J */ X beep_cmd, /* `094K */ X beep_cmd, /* `094L */ X beep_cmd, /* `094M */ X beep_cmd, /* `094N */ X beep_cmd, /* `094O */ X beep_cmd, /* `094P */ X beep_cmd, /* `094Q */ X beep_cmd, /* `094R */ X beep_cmd, /* `094S */ X beep_cmd, /* `094T */ X beep_cmd, /* `094U */ X beep_cmd, /* `094V */ X beep_cmd, /* `094W */ X beep_cmd, /* `094X */ X beep_cmd, /* `094Y */ X beep_cmd, /* `094Z */ X beep_cmd, /* `094[ */ X beep_cmd, /* `094\ */ X beep_cmd, /* `094] */ X beep_cmd, /* `094`094 */ X beep_cmd, /* `094_ */ X beep_cmd, /* */ X beep_cmd, /* ! */ X beep_cmd, /* " */ X beep_cmd, /* # */ X beep_cmd, /* $ */ X beep_cmd, /* % */ X beep_cmd, /* & */ X beep_cmd, /* ' */ X beep_cmd, /* ( */ X beep_cmd, /* ) */ X beep_cmd, /* * */ X beep_cmd, /* + */ X beep_cmd, /* , */ X beep_cmd, /* - */ X beep_cmd, /* . */ X beep_cmd, /* / */ X dec_extended_map_cmd, /* 0 */ X dec_extended_map_cmd, /* 1 */ X dec_extended_map_cmd, /* 2 */ X dec_extended_map_cmd, /* 3 */ X dec_extended_map_cmd, /* 4 */ X dec_extended_map_cmd, /* 5 */ X dec_extended_map_cmd, /* 6 */ X dec_extended_map_cmd, /* 7 */ X dec_extended_map_cmd, /* 8 */ X dec_extended_map_cmd, /* 9 */ X beep_cmd, /* : */ X beep_cmd, /* ; */ X beep_cmd, /* < */ X beep_cmd, /* = */ X beep_cmd, /* > */ X beep_cmd, /* ? */ X beep_cmd, /* @ */ X previous_line_cmd, /* A */ X next_line_cmd, /* B */ X page_right_cmd, /* C */ X page_left_cmd, /* D */ X beep_cmd, /* E */ X beep_cmd, /* F */ X beep_cmd, /* G */ X beep_cmd, /* H */ X beep_cmd, /* I */ X beep_cmd, /* J */ X beep_cmd, /* K */ X beep_cmd, /* L */ X next_line_cmd, /* M */ X beep_cmd, /* N */ X beep_cmd, /* O */ X pf1_map_cmd, /* P */`009/* PF1 */ X help_cmd, /* Q */ /* PF2 */ X edt_find_next_cmd, /* R */ /* PF3 */ X beep_cmd, /* S */ /* PF4 */ X beep_cmd, /* T */ X beep_cmd, /* U */ X beep_cmd, /* V */ X beep_cmd, /* W */ X beep_cmd, /* X */ X beep_cmd, /* Y */ X beep_cmd, /* Z */ X beep_cmd, /* [ */ X beep_cmd, /* \ */ X beep_cmd, /* ] */ X beep_cmd, /* `094 */ X beep_cmd, /* _ */ X beep_cmd, /* `096 */ X beep_cmd, /* a */ X beep_cmd, /* b */ X beep_cmd, /* c */ X beep_cmd, /* d */ X beep_cmd, /* e */ X beep_cmd, /* f */ X beep_cmd, /* g */ X beep_cmd, /* h */ X beep_cmd, /* i */ X beep_cmd, /* j */ X beep_cmd, /* k */ X beep_cmd, /* l */ X beep_cmd, /* m */ X set_mark_cmd, /* n */ X beep_cmd, /* o */ X edt_line_cmd, /* p */ /* KP0 */ X beep_cmd, /* q */ /* KP1 */ X beep_cmd, /* r */ /* KP2 */ X beep_cmd, /* s */ /* KP3 */ X edt_forward_cmd, /* t */ /* KP4 */ X edt_back_cmd, /* u */ /* KP5 */ X beep_cmd, /* v */ /* KP6 */ X beep_cmd, /* w */ /* KP7 */ X edt_page_cmd, /* x */ /* KP8 */ X beep_cmd, /* y */ /* KP9 */ X beep_cmd, /* z */ X beep_cmd, /* `123 */ X beep_cmd, /* `124 */ X beep_cmd, /* `125 */ X beep_cmd, /* `126 */ X beep_cmd /* `094? */ X `125; X Xvoid (*pf1_map[128])() =`009/* Gold */ X `123 X beep_cmd, /* `094@ */ X beep_cmd, /* `094A */ X beep_cmd, /* `094B */ X beep_cmd, /* `094C */ X beep_cmd, /* `094D */ X beep_cmd, /* `094E */ X beep_cmd, /* `094F */ X beep_cmd, /* `094G */ X beep_cmd, /* `094H */ X beep_cmd, /* `094I */ X beep_cmd, /* `094J */ X beep_cmd, /* `094K */ X beep_cmd, /* `094L */ X beep_cmd, /* `094M */ X beep_cmd, /* `094N */ X beep_cmd, /* `094O */ X beep_cmd, /* `094P */ X beep_cmd, /* `094Q */ X beep_cmd, /* `094R */ X beep_cmd, /* `094S */ X beep_cmd, /* `094T */ X beep_cmd, /* `094U */ X beep_cmd, /* `094V */ X beep_cmd, /* `094W */ X beep_cmd, /* `094X */ X beep_cmd, /* `094Y */ X beep_cmd, /* `094Z */ X pf1_esc_map_cmd, /* `094[ */ X beep_cmd, /* `094\ */ X beep_cmd, /* `094] */ X beep_cmd, /* `094`094 */ X beep_cmd, /* `094_ */ X beep_cmd, /* */ X beep_cmd, /* ! */ X beep_cmd, /* " */ X beep_cmd, /* # */ X beep_cmd, /* $ */ X beep_cmd, /* % */ X beep_cmd, /* & */ X beep_cmd, /* ' */ X beep_cmd, /* ( */ X beep_cmd, /* ) */ X beep_cmd, /* * */ X beep_cmd, /* + */ X beep_cmd, /* , */ X beep_cmd, /* - */ X beep_cmd, /* . */ X beep_cmd, /* / */ X digit_arg_cmd, /* 0 */ X digit_arg_cmd, /* 1 */ X digit_arg_cmd, /* 2 */ X digit_arg_cmd, /* 3 */ X digit_arg_cmd, /* 4 */ X digit_arg_cmd, /* 5 */ X digit_arg_cmd, /* 6 */ X digit_arg_cmd, /* 7 */ X digit_arg_cmd, /* 8 */ X digit_arg_cmd, /* 9 */ X beep_cmd, /* : */ X beep_cmd, /* ; */ X beep_cmd, /* < */ X beep_cmd, /* = */ X beep_cmd, /* > */ X beep_cmd, /* ? */ X beep_cmd, /* @ */ X beep_cmd, /* A */ X beep_cmd, /* B */ X beep_cmd, /* C */ X beep_cmd, /* D */ X beep_cmd, /* E */ X beep_cmd, /* F */ X beep_cmd, /* G */ X beep_cmd, /* H */ X beep_cmd, /* I */ X beep_cmd, /* J */ X beep_cmd, /* K */ X beep_cmd, /* L */ X beep_cmd, /* M */ X beep_cmd, /* N */ X one_window_cmd, /* O */ X beep_cmd, /* P */ X exit_cmd, /* Q */ X beep_cmd, /* R */ X sys_spawn_cmd, /* S */ X beep_cmd, /* T */ X beep_cmd, /* U */ X del_window_cmd, /* V */ X beep_cmd, /* W */ X two_window_cmd, /* X */ X beep_cmd, /* Y */ X beep_cmd, /* Z */ X beep_cmd, /* [ */ X beep_cmd, /* \ */ X beep_cmd, /* ] */ X beep_cmd, /* `094 */ X beep_cmd, /* _ */ X beep_cmd, /* `096 */ X beep_cmd, /* a */ X beep_cmd, /* b */ X beep_cmd, /* c */ X beep_cmd, /* d */ X beep_cmd, /* e */ X beep_cmd, /* f */ X beep_cmd, /* g */ X beep_cmd, /* h */ X beep_cmd, /* i */ X beep_cmd, /* j */ X beep_cmd, /* k */ X beep_cmd, /* l */ X beep_cmd, /* m */ X beep_cmd, /* n */ X one_window_cmd, /* o */ X beep_cmd, /* p */ X exit_cmd, /* q */ X beep_cmd, /* r */ X sys_spawn_cmd, /* s */ X beep_cmd, /* t */ X beep_cmd, /* u */ X del_window_cmd, /* v */ X beep_cmd, /* w */ X two_window_cmd, /* x */ X beep_cmd, /* y */ X beep_cmd, /* z */ X beep_cmd, /* `123 */ X beep_cmd, /* `124 */ X beep_cmd, /* `125 */ X beep_cmd, /* `126 */ X beep_cmd /* `094? */ X `125; X Xvoid execute_key() X`123 X char ch; X int r,c; X c = CURS_COL - COLUMN + 1; X r = CURS_ROW; X if (MINI_BUF[0] != '\0') put_message(); X if (r < 1) r = 1; X else if (r > (WIN->bot - WIN->top + 1)) X r = WIN->bot - WIN->top + 1; X if (c > SCREEN_WIDTH) c = SCREEN_WIDTH; X else if (c < 1) c = 1; X goto_rc(r,c); X fflush(stdout); X DIGIT_ARG = (int *) NULL; X ch = getkey(); X if (MINI_BUF[0] != '\0') clear_minibuffer(); X LAST_CHAR = ch; X (*root_map[ (int) ch ])(); X`125 X Xvoid ctrl_x_map_cmd() X`123 X char ch; X X ch = getkey(); X (*ctrl_x_map[ (int) ch ])(); X`125 X Xvoid ctrl_k_map_cmd() X`123 X char ch; X X ch = getkey(); X (*ctrl_k_map[ (int) ch ])(); X`125 X Xvoid ctrl_w_map_cmd() X`123 X char ch; X X ch = getkey(); X (*ctrl_w_map[ (int) ch ])(); X`125 X Xvoid O_map_cmd() X`123 X char ch; X X ch = getkey(); X LAST_CHAR = ch; X (*esc_O_map[ (int) ch ])(); X`125 X Xvoid esc_map_cmd() X`123 X char ch; X X ch = getkey(); X LAST_CHAR = ch; X (*escape_map[ (int) ch ])(); X`125 X X/* weird sequences of form `094[[n`126 where n is an integer */ Xvoid dec_extended_map_cmd() X`123 X char ch, numstr[5]; X int i, num; X `032 X ch = LAST_CHAR; /* should be integer */ X i = 0; X numstr[i++] = ch; X`032 X while (ch = getkey(), isdigit(ch)) numstr[i++] = ch; X if (ch == '`126') X `123 X numstr[i++] = '\0'; X sscanf(numstr,"%d",&num); X switch (num) X `123 X case 5: X page_up_cmd(); break; /* prev screen */ X case 6: X page_down_cmd(); break; /* next screen */ X case 1: X search_cmd(); break; /* find */ X case 4: X set_mark_cmd(); break; /* select */ X case 2: `032 X goto_mark_cmd(); break; /* insert here */ X case 28: X help_cmd(); break; /* Help */ X case 29: /* do */ X extended_cmd_cmd(); break; X default: X beep_cmd(); break; X `125 X `125 X else beep_cmd(); X`125 X X/* weird sequences of form `094[[n`126 where n is an integer */ Xvoid pf1_esc_map_cmd() X`123 X char ch, numstr[5]; X int i, num; X `032 X LAST_CHAR = ch = getkey(); X switch (ch) X`009`123 X`009case 'O': X`009 LAST_CHAR = ch = getkey(); X`009 switch (ch) X`009`009`123 X`009`009case 't': /* KP4 */ X`009`009 end_of_buffer_cmd(); break; X`009`009case 'u': /* KP5 */ X`009`009 top_of_buffer_cmd(); break; X`009`009case 'w': /* KP7 */ X`009`009 extended_cmd_cmd(); break; X`009`009case 'n': /* KP7 */ X`009`009 goto_mark_cmd(); break; X`009`009case 'R': /* PF3 */ X`009`009 edt_find_cmd(); break; X`009`009default : X`009`009 beep_cmd(); break; X`009`009`125 X`009 break; X`009case '[': X`009 LAST_CHAR = ch = getkey(); X`009 switch (ch) X`009`009`123 X`009`009case 'A': X`009`009 other_window_cmd(); break; X`009`009case 'B': X`009`009 other_window_cmd(); break; X`009`009case 'C': X`009`009 page_left_cmd(); break; X`009`009case 'D': X`009`009 page_right_cmd(); break; X`009`009default : X`009`009 beep_cmd(); break; X`009`009`125; X`009 break; X`009default : X beep_cmd(); break; X`009`125 X`125 X Xvoid pf1_map_cmd() X`123 X char ch; X X ch = getkey(); X LAST_CHAR = ch; X (*pf1_map[ (int) ch ])(); X`125 X Xvoid beep_cmd() X`123 X fputc('\007',stdout); X`125 X Xvoid page_down_cmd() X`123 X int n = 1; X if (DIGIT_ARG != (int *) NULL) n = *DIGIT_ARG; X update_windows(C_LINE + n * (WIN->bot - WIN->top + 1)); X`125 Xvoid page_up_cmd() X`123 X int n = 1; X if (DIGIT_ARG != (int *) NULL) n = *DIGIT_ARG; X update_windows(C_LINE - n * (WIN->bot - WIN->top + 1)); X`125 X Xvoid page_right_cmd() X`123 X int n = 1; X if (DIGIT_ARG != (int *) NULL) n = *DIGIT_ARG; X COLUMN = COLUMN + n * 59; X update_windows(C_LINE); X`125 X Xvoid page_left_cmd() X`123 X int n = 1; X if (DIGIT_ARG != (int *) NULL) n = *DIGIT_ARG; X COLUMN = COLUMN - n * 59; X update_windows(C_LINE); X`125 X Xvoid next_line_cmd() X`123 X int n = 1; X if (DIGIT_ARG != (int *) NULL) n = *DIGIT_ARG; X update_windows(C_LINE + n); X`125 X Xvoid previous_line_cmd() X`123 X int n = 1; X if (DIGIT_ARG != (int *) NULL) n = *DIGIT_ARG; X update_windows(C_LINE - n); X`125 X Xvoid top_of_buffer_cmd() X`123 X update_windows(1); X`125 X Xvoid end_of_buffer_cmd() X`123 X update_windows(NUM_LINES); X`125 X Xextern void sys_spawn_cmd() X`123 X int update = 0; X reset_tty(); X reset_display(); X fflush(stdout); X#ifdef VMS X if (LAST_CHAR == '\032') exit(0); V if (do_shell_command()) update = 1; /* scroll region reset by message fac Xility */ X#else `032 X killpg(getpgrp(0),18); X update = 1; X#endif X init_tty(); X if (update) redraw_display(); X`125 X Xvoid redraw_cmd() X`123 X redraw_display(); X`125 X Xvoid goto_line_cmd() X`123 X int n = C_LINE; X if (DIGIT_ARG != (int *) NULL) n = *DIGIT_ARG; X else X `123 X MINI_BUF[0] = 0; X if (!read_from_minibuffer("Line: ", MINI_BUF)) return; X sscanf(MINI_BUF,"%d",&n); X MINI_BUF[0] = 0; X `125 X update_windows(n); X`125 X Xvoid goto_percent_cmd() X`123 X unsigned char *pos; X int n; X if (DIGIT_ARG != (int *) NULL) n = *DIGIT_ARG; X else X `123 X MINI_BUF[0] = 0; X if (!read_from_minibuffer("%: ", MINI_BUF)) return; X sscanf(MINI_BUF,"%d",&n); X MINI_BUF[0] = 0; X `125 X if (n < 0) n = 0; else if (n > 100) n = 100; X pos = BEG + (int) (n * (int) (EOB - BEG)) / 100; X n = what_line(pos); X update_windows(n); X`125 X Xvoid extended_key_cmd() X`123 X if (-1 == do_extended_key()) exit_cmd(); X`125 X Xvoid extended_cmd_cmd() X`123 X if (-1 == do_extended_cmd()) exit_cmd(); X`125 X Xvoid set_mark_cmd() X`123 X BUF->mark = C_LINE; X message("Mark Set.",0); X`125 X Xvoid goto_mark_cmd() X`123 X int mark = BUF->mark; X BUF->mark = C_LINE; X update_window(mark); X message("Mark Set.",0); X`125 X Xvoid one_window_cmd() X`123 X one_window(); X`125 X Xvoid two_window_cmd() X`123 X two_windows(); X`125 X Xvoid del_window_cmd() X`123 X delete_window(); X`125 X Xvoid other_window_cmd() X`123 X int n = 1; X if (DIGIT_ARG != (int *) NULL) n = *DIGIT_ARG; X other_window(n); X`125 X X Xvoid find_next_cmd() X`123 X int col, line, n = 1; X unsigned char *pos; X `032 X if (DIGIT_ARG != NULL) n = *DIGIT_ARG; X line = search(CURS_POS + SEARCH_DIR, n, &col); X if (line < 1) return; X pos = CURS_POS; V if ((line < WIN->beg_line) `124`124 (line > WIN->beg_line + WIN->bot - WI XN->top)) X update_window(line); X CURS_POS = pos; X CURS_ROW = line - C_LINE + 1; X CURS_COL = col; X`125 X Xvoid search_cmd() X`123 X SEARCH_DIR = 1; X if (read_from_minibuffer("Search: ",SEARCH_STR) == -1) X return; X CURS_POS = C_POS; X find_next_cmd(); X`125 X Xvoid search_back_cmd() X`123 X SEARCH_DIR = -1; X if (read_from_minibuffer("Search: ",SEARCH_STR) == -1) X return; X find_next_cmd(); X`125 X Xvoid help_cmd() X`123 X do_help_command(); X`125 X Xvoid find_file_cmd() X`123 X user_get_file(); X`125 X Xvoid time_cmd() X`123 X message(get_time(),0); X`125 X Xvoid exit_cmd() X`123 X reset_tty(); X reset_display(); X#ifndef VMS X fputc('\n',stdout); X#endif `032 X exit(0); X`125 X Xvoid digit_arg_cmd() X`123 X char num[15], ch; X int j = 0; X static int digits; X `032 X num[j++] = LAST_CHAR; X ch = getkey(); X while ((ch >= '0') && (ch <= '9')) X `123 X num[j++] = ch; X ch = getkey(); X `125 X `032 X if (((j == 1) && (LAST_CHAR != '-')) `124`124 (j > 1)) X `123 X num[j] = '\0'; X sscanf(num,"%d",&digits); X DIGIT_ARG = &digits; X `125 X LAST_CHAR = ch; X (*root_map[ (int) ch ])(); X`125 X X `032 Xvoid toggle_width_cmd() X`123 X if (SCREEN_WIDTH == 80) X `123 X if (!RESTORE_WIDTH_TO) RESTORE_WIDTH_TO = 80; X set_width(132, 1); X `125 `032 X else if (SCREEN_WIDTH == 132) X `123 X if (!RESTORE_WIDTH_TO) RESTORE_WIDTH_TO = 132; X set_width(80, 1); X `125 `032 X`125 X Xvoid edt_forward_cmd() X`123 X EDT_DIRECTION = 1; X`125 X Xvoid edt_back_cmd() X`123 X EDT_DIRECTION = 0; X`125 X Xvoid edt_page_cmd() X`123 X if (EDT_DIRECTION == 0) X`009`123 X`009 page_up_cmd(); X`009`125 X else X`009`123 X`009 page_down_cmd(); X`009`125 X`125 X Xvoid edt_line_cmd() X`123 X if (EDT_DIRECTION == 0) X`009`123 X`009 previous_line_cmd(); X`009`125 X else X`009`123 X`009 next_line_cmd(); X`009`125 X`125 X Xvoid edt_find_cmd() X`123 X if (EDT_DIRECTION == 0) X`009`123 X`009 search_back_cmd(); X`009`125 X else X`009`123 X`009 search_cmd(); X`009`125 X`125 X Xvoid edt_find_next_cmd() X`123 X if (EDT_DIRECTION == 0) X`009`123 X`009 SEARCH_DIR = -1; X`009`125 X else X`009`123 X`009 SEARCH_DIR = 1; X`009`125 X find_next_cmd(); X`125 X $ GOSUB UNPACK_FILE $ FILE_IS = "LINE.C" $ CHECKSUM_IS = 895419679 $ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY X#include X#include "buffer.h" X#include "externs.h" X#include "display.h" X#include "line.h" X `032 Xextern int COLUMN; X X#define MAX_LINE_LEN 500 Xint MOST_S_OPT = 0; X/* take 16 binary characters and put them in displayable form */ Xint ascii_format_line(char *buff, char *str) X`123 X int i,ii,j,k,ch,di,flag; X char num_str[4]; X X ii = 0; X di = 40; X flag = 1; X X for (i = 35;i<=di;i++) str[i] = ' '; /* a gap */ X `032 X for (j = 0; j < 4; j++) X `123 X `032 X for (k = 0; k < 4; k++) X `123 X i = 4 * j + k; X ch = buff[i]; X if (MOST_V_OPT) X `123 X if (((ch < 32) && (ch >= 0)) `124`124 (ch == 127)) X `123 X str[ii++] = '`094'; X if (ch == 127) X str[ii++] = '?'; X else X str[ii++] = ch + 'A' - 1; X str[i + di] = '.'; X `125 X else if (ch < 0) X `123 X ch = ch + 256;`032 X sprintf(num_str,"%02X", ch); X str[ii++] = num_str[0]; X str[ii++] = num_str[1]; X str[i + di] = '.'; X `125 X else X `123 X str[ii++] = ' '; X str[ii++] = ch; X str[i + di] = ch; X `125 X `125 X else X `123 X if (ch < 32) X `123 X if (ch < 0) ch = ch + 256; X str[i + di] = '.'; X `125 X else str[i+di] = ch; X `032 X sprintf(num_str,"%02X", ch); X str[ii++] = num_str[0]; X str[ii++] = num_str[1]; X `125 X `032 X `125 /* k */ X str[ii++] = ' '; X `125 X di += 16; X str[di] = '\0'; X return(di); X`125 X `032 X Vint analyse_line(unsigned char *beg, unsigned char *end, char *out, char *att Xributes) X`123 X int test, ii, fold, ii_max, j, ok; X unsigned char ch,attr; X X test = 0; X ii = 0; X ii_max = 0; X fold = 0; X while(ch = *beg, (beg <= end) && (ch != '\n') && (ch != '\0')) X `123 X beg++; X if (ii > ii_max) fold = 0; /* beyond previous high */ X attr = ' '; X if (!MOST_V_OPT && ch == '\015') /* `094M */ X `123 X if (beg <= end) X `123 X fold = 1; V if (ii > ii_max) ii_max = ii - 1; /* `094M contributes X nil */ X ii = 0; X `125 X `125 X else if (!MOST_V_OPT && ch == '\b') X `123 X test = 1; X ii--; X `125 X else if (test `124`124 fold) X `123 X test = 0; X if (ch == out[ii]) X attr = 'b'; X else if (out[ii] == '_') X attr = 'u'; X X if (fold && ch == ' ') X ii++; X else X `123 X attributes[ii] = attr; X out[ii++] = ch; X `125 X `032 X `125 X else if (!MOST_T_OPT && ch == '\t') X `123 X j = 8 * (ii/8 + 1) - ii; /* 8 column tabs */ X while(j--) X `123 X out[ii] = ' '; X attributes[ii++] = attr; X `125 X `125 X else X `123 X out[ii] = ch; X attributes[ii++] = attr; X `125 X `125 X if (fold) ii = ii_max + 1; X if ((beg > end) && MOST_S_OPT && !MOST_W_OPT) X `123 X ok = 1; X if (*beg == '\n') beg++; X while ((*beg <= ' ') && ok) X `123 X if (*beg != '\n') beg++; X if (beg >= EOB) break; V if ((*beg == '\n') `124`124 (apparant_distance(beg) >= MOST_S X_OPT)) X `123 X ok = 0; X `125 X `125 X if (!ok) X `123 X ok = 3; X while(ok--) X `123 X out[ii] = '.';`032 X attributes[ii++] = ' '; X `125 X `125 X `032 X `125 /* MOST_S_OPT */ X out[ii] = '\0'; X return(ii); X`125 X X Xvoid output(char *line, int len, char *attr, char d_char) X`123 X int X i,ii,k, bold,b_len,n_len, s_len, u_len, work_len, j, mark, ok, quit, X count, max_col, save, dollar; X char ch, at, out[500], *n_str, *b_str, *s_str, *u_str, work[20]; X V b_str = "\033[1m"; n_str = "\033[0m"; s_str = "\033[%dC"; u_str = "\033[4 Xm"; X b_len = strlen(b_str); X n_len = strlen(n_str); X u_len = strlen(u_str); X s_len = strlen(s_str); X i = 0; X ii = 0; X bold = 0; X quit = 0; X ok = 0; /* 1 if ok to start filling the out line */ X max_col = COLUMN + SCREEN_WIDTH - 1; X count = 0; X dollar = 0; X while (ch = line[i], (i <= len) && ch != '\0' && ch != '\n' && !quit) X `123 X count++; X if (MOST_V_OPT && ((ch < ' ') `124`124 (ch > 126))) count++; X `032 X if (count >= COLUMN) ok = 1; X if (count > max_col) break; X `032 X if (!MOST_V_OPT) X `123 X at = attr[i]; X if ((at != ' ') && !bold) X `123 X bold = 1; X /* u and b have same length */ X if (ok) for (j = 0; j < b_len; j++) X `123 X if (at == 'b') out[ii++] = b_str[j]; X else out[ii++] = u_str[j]; X `125 X `032 X `125 X else if ((at == ' ') && bold) X `123 X bold = 0; V if (ok) for (j = 0; j < n_len; j++) out[ii++] = n_str[j X]; X `125 X `125 X `032 X if (ch == ' ') X `123 X j = 0; X mark = ii; X /* we always make this loop once */ X while ((i <= len) && (line[i++] == ' ')) X `123 X j++; X if (ok) out[ii++] = ' '; X `125 X if (i > len) quit = 1; X i = i - 2; X save = count; X count += j - 1; /* counted one at top of while */ X X if (!ok) X `123 X if (count >= COLUMN) X `123 X ok = 1; X j = count - COLUMN + 1; X k = j; X while (k--) out[ii++] = ' '; X `125 X `125 X `032 X if (count >= max_col) X `123 X quit = 1; X j = max_col - save; X `125 X `032 X if (ok && (j > s_len))`032 X `123 X ii = mark; X sprintf(work,s_str,j); X work_len = strlen(work); X for (j = 0; j < work_len; j++) out[ii++] = work[j]; X if (count >= max_col) dollar = ii++; X `125 X else if (count >= max_col) X `123 X dollar = mark + j; X `125 X `032 X `125 V else if (ok && ((ch == '\014') `124`124 ((ch < ' ') && MOST_V_OPT)) X) X `123 X out[ii++] = '`094'; X out[ii++] = ch + 'A' - 1; X `125 X else if (ok)`032 X `123 X out[ii++] = ch; X `125 X `032 X i++; X `125 X if (dollar) out[ii = dollar, ii++] = d_char; X else if (ok && count >= max_col) out[ii - 1] = d_char; X out[ii] = '\0'; X if (ii) fputs(out,stdout); X `032 X if (ok && bold) fputs(n_str,stdout); X`125 X X Xvoid display_line() X`123 X unsigned char *beg, *end; X int i, len, v, t; X char buff[16]; V char the_line[MAX_LINE_LEN], *p, the_attr[MAX_LINE_LEN], *line,*attr, ch X; X line = the_line; X attr = the_attr; X /* This needs fixed for files with really big lines */ X if (!MOST_B_OPT) X `123 V if(extract_line(&beg, &end) && MOST_W_OPT) ch = '\\'; else ch = '$' X; X `032 X len = end - beg + 1; X if (len > MAX_LINE_LEN) X `123 X v = MOST_V_OPT; X t = MOST_T_OPT; X MOST_V_OPT = 1; X MOST_T_OPT = 1; X line = (char *) beg; X `125 X else len = analyse_line(beg, end, line, attr); X `125 X else X `123 X ch = '$'; X i = 0; X beg = C_POS; X end = C_POS + 16; X if (end > EOB) end = EOB; X while(beg < end) buff[i++] = (char) *beg++; X while(i < 15) buff[i++] = 0; X len = ascii_format_line(buff,the_line); X i = 0; while(i<80) attr[i++] = ' '; X `125 X `032 X `032 X output(line,len,attr, ch); X if (len > MAX_LINE_LEN) X `123 X MOST_V_OPT = v; X MOST_T_OPT = t; X `125 X`125 X X X/* given a position in a line, return apparant distance from bol X expanding tabs, etc... up to pos */ Xint apparant_distance(unsigned char *pos) X`123 X int i; X unsigned char *cur_pos, *save_pos, ch; X cur_pos = C_POS; X save_pos = pos; X C_POS = pos; X pos = beg_of_line(); X C_POS = cur_pos; X X i = 1; X while(ch = *pos, pos++ < save_pos) X `123 X if (!MOST_V_OPT && ch == '\b') X `123 X if (i > 1) i--; X `125 X else if (!MOST_V_OPT && ch == '\015') /* `094M */ X `123 X if (i != 1) i = 1; X `125 X else if (!MOST_T_OPT && ch == '\t') X `123 X i = 8 * ((i - 1)/8 + 1) + 1; /* 8 column tabs */ X `125 X else if (ch < ' ' `124`124 ch > 126) X `123 X if (ch == '\012' `124`124 MOST_V_OPT) /* `094L */ X `123 X i += 2; X `125 /* otherwise they have no width */ X `125 X else i++; X `125 X return (i); X`125 X X X X $ GOSUB UNPACK_FILE $ FILE_IS = "MAIN.C" $ CHECKSUM_IS = 2099891446 $ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY X#define __MOST_VERSION__ "3.2" X#define __MOST_USAGE__ "most [-bstvw] [+line] [+/string] [+[C][D]] filename" X/* X Most ---- a more/less paging type program. X X Copyright (C) 1991 by John E. Davis. (davis@pacific.ms.ohio-state.edu) X X The following disclaimer from GNU emacs. X X NO WARRANTY X X BECAUSE THIS PROGRAM IS LICENSED FREE OF CHARGE, WE PROVIDE ABSOLUTELY NO XWARRANTY, TO THE EXTENT PERMITTED BY APPLICABLE STATE LAW. EXCEPT WHEN XOTHERWISE STATED IN WRITING, JOHN E. DAVIS AND/OR OTHER PARTIES PROVIDE THIS XPROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, XINCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND XFITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND XPERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, XYOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. X X IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL JOHN E. DAVIS, AND/OR ANY XOTHER PARTY WHO MAY MODIFY AND REDISTRIBUTE THIS PROGRAM AS PERMITTED BELOW, XBE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY LOST PROFITS, LOST MONIES, OR XOTHER SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR XINABILITY TO USE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING XRENDERED INACCURATE OR LOSSES SUSTAINED BY THIRD PARTIES OR A FAILURE OF THE XPROGRAM TO OPERATE WITH ANY OTHER PROGRAMS) THIS PROGRAM, EVEN IF YOU HAVE VBEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES, OR FOR ANY CLAIM BY ANY OTHE XR XPARTY. X X GENERAL PUBLIC LICENSE TO COPY X X 1. You may copy and distribute verbatim copies of this source file as you Xreceive it, in any medium, provided that you conspicuously and appropriately Xpublish on each copy a valid copyright notice "Copyright (C) 1990 John E. XDavis"; and include following the copyright notice a verbatim copy of the Xabove disclaimer of warranty and of this License. You may charge a Xdistribution fee for the physical act of transferring a copy. X X 2. You may modify your copy or copies of this source file or Xany portion of it, and copy and distribute such modifications under Xthe terms of Paragraph 1 above, provided that you also do the following: X X a) cause the modified files to carry prominent notices stating X that you changed the files and the date of any change; and X X b) cause the whole of any work that you distribute or publish, X that in whole or in part contains or is a derivative of this X program or any part thereof, to be licensed at no charge to all X third parties on terms identical to those contained in this X License Agreement (except that you may choose to grant more extensive X warranty protection to some or all third parties, at your option). X X c) You may charge a distribution fee for the physical act of X transferring a copy, and you may at your option offer warranty X protection in exchange for a fee. X XMere aggregation of another unrelated program with this program (or its Xderivative) on a volume of a storage or distribution medium does not bring Xthe other program under the scope of these terms. X X 3. You may copy and distribute this program (or a portion or derivative Xof it, under Paragraph 2) in object code or executable form under the terms Xof Paragraphs 1 and 2 above provided that you also do one of the following: X X a) accompany it with the complete corresponding machine-readable X source code, which must be distributed under the terms of X Paragraphs 1 and 2 above; or, X X b) accompany it with a written offer, valid for at least three X years, to give any third party free (except for a nominal X shipping charge) a complete machine-readable copy of the X corresponding source code, to be distributed under the terms of X Paragraphs 1 and 2 above; or, X X c) accompany it with the information you received as to where the X corresponding source code may be obtained. (This alternative is X allowed only for noncommercial distribution and only if you X received the program in object code or executable form alone.) X XFor an executable file, complete source code means all the source code for Xall modules it contains; but, as a special exception, it need not include Xsource code for modules which are standard libraries that accompany the Xoperating system on which the executable file runs. X X 4. You may not copy, sublicense, distribute or transfer this program Xexcept as expressly provided under this License Agreement. Any attempt Votherwise to copy, sublicense, distribute or transfer this program is void an Xd Xyour rights to use the program under this License agreement shall be Xautomatically terminated. However, parties who have received computer Xsoftware programs from you with this License Agreement will not have Xtheir licenses terminated so long as such parties remain in full compliance. X XIn other words, you are welcome to use, share and improve this program. XYou are forbidden to forbid anyone else to use, share and improve Xwhat you give them. Help stamp out software-hoarding! */ X Xchar *MOST_VERSION = __MOST_VERSION__ ; X#include X#include "externs.h" X#include "window.h" X#include "buffer.h" X#include "file.h" X#include "sysdep.h" X#include "most.h" X Xint MOST_K_OPT = 0; /* Display 8 bit unformatted (Kanji) */ Xint CASE_SENSITIVE, STARTING_LINE; Xchar SEARCH_STR[80]; Xchar *MOST_PROGRAM;`009/* Program Name (argv[0]) */ X X#ifdef VMS X#ifndef isalpha X#define isalpha(x) \ X (((x >= 'A') && (x <= 'Z'))`124`124((x >= 'a') && (x <= 'z')) ? 1 : 0) X#endif X#endif X Xvoid do_extended_switches(char *str) X`123 X int i; X char ch,numstr[7]; X `032 X i = 0; X ch = *(++str); X if ( ch == '/') X `123 X strcpy(SEARCH_STR,++str); X `125 X else if (ch >= '0' && ch <= '9') X `123 X while (ch >= '0' && ch <= '9') X `123 X numstr[i++] = ch; X ch = *(++str); X `125 X numstr[i] = '\0'; X (void) sscanf(numstr,"%d",&STARTING_LINE); X `125 X else if (isalpha(ch)) X `123 X while (isalpha(ch)) X `123 X if ((ch == 'C') `124`124 (ch == 'c')) X CASE_SENSITIVE = 1; X else if ((ch == 'D') `124`124 (ch == 'd')) X MOST_D_OPT = 1; /* delete file mode */ X ch = *(++str); X `125 X `125 X `032 X else X `123 X fprintf(stdout,"switch '+%s' not valid.\n",str); X exit(0); X `125 X`125 X X X Xvoid do_switches(char *str) X`123 X X while (*str != '\0') X `123 X switch (*str++) X `123 X case 'a': X case 'A': X MOST_A_OPT = 1; break; /* check to see if file is binary */ X case 's': X case 'S': X SQUEEZE_LINES = 1; break; X case 'c': X case 'C': X MOST_C_OPT = 1; break; X case 'V': X case 'v': V MOST_V_OPT = 1; /* verbose-- convert control chars to '`094' X 'ch' */ X break; X case 'W': X case 'w': MOST_W_OPT = 1; break; X case 'K': X case 'k': MOST_K_OPT = 1; break; X case 'B': X case 'b': X MOST_B_OPT = 1; /* Binary display 8 bit */ X break; X case 't': V case 'T': /* expand tabs to '`094I'; meaningful only with 'v' * X/ X MOST_T_OPT = 1; X break; X case 'L': X case 'l': X MOST_L_OPT = 1; /* use `094L to clear screen */ X break; X `125 X `125 X`125 X `032 Xint main(int argc, char *argv[]) X`123 X char file[80],ch, *switches,outstr[180], *curr_file,filename[80]; X int file_i, quit,i,piped,a_opt, j; X unsigned long context; X extern char *getenv(char *); X extern int isatty(int); X extern void sysinit(void); X X MOST_PROGRAM = argv[0]; X piped = 0; X switches = getenv("MOST_SWITCHES"); X if (switches != NULL) do_switches(switches); X `032 X i = 1; X if (argc > 1) X `123 X quit = 0; X while ((!quit) && (i < argc)) X `123 X if (argv[i][0] == '-') X do_switches(argv[i++]); X else if (argv[i][0] == '+') X do_extended_switches(argv[i++]); X else quit = 1; X `125 X `125 X X `032 X if (i == argc) X `123 X if (isatty(0)) /* 1 if stdin is a terminal, 0 otherwise */ X `123 V fprintf(stderr,"MOST(%s) Usage: %s\n",MOST_VERSION,__MOST_USA XGE__); X exit(0); X `125 X /* assume input is from stdin */ X file[0] = '\0'; /* tells most this is stdin */ X piped = 1; X MOST_A_OPT = 0; /* in this version since we cannot do an fseek */ X `125 X else X strcpy(file,argv[i]); X X NUM_FILES = 0; X context = 0; X X get_terminfo(); /* set up esc sequences etc... */ X init_tty();`032 X if (MOST_B_OPT) MOST_A_OPT = 0; /* explicit b overrides a */ X a_opt = MOST_A_OPT; X X if (!piped) X `123 X file_i = i; X#ifdef VMS X while(i < argc) X `123 X if (argv[i][0] == '.') strcpy(file,"*"); else *file = 0; X strcat(file,unix2vms(argv[i++])); X while (expand_file_name(file,filename)) X `123 V FILE_RING[NUM_FILES] = (char*) malloc(strlen(filename) X + 1); X strcpy(FILE_RING[NUM_FILES++], filename); X `125 X `125 X if (NUM_FILES) strcpy(file,FILE_RING[0]); X `032 X#else X j = 0; X NUM_FILES = argc - i; X while (i < argc) X `123 X FILE_RING[j++] = argv[i++]; X `125 X#endif X `125 X X if (NUM_FILES) quit = 0; else quit = 1; X if (!quit `124`124 piped) most(file,STARTING_LINE); X if (quit) fprintf(stderr,"File %s not found\n", argv[file_i]); X X reset_tty(); X reset_display(); X#ifndef VMS X fputc('\n',stdout); X#endif `032 X exit(0); X return (0); X`125 X $ GOSUB UNPACK_FILE $ FILE_IS = "MOST.C" $ CHECKSUM_IS = 51728493 $ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY X#include X#include "externs.h" X#include "window.h" X#include "buffer.h" X#include "file.h" X#include "sysdep.h" X#include "keym.h" X#include "most.h" X#include "search.h" `032 X Xint SQUEEZE_LINES = 0; /* switch parameters */ Xint MOST_A_OPT = 0; /* automatically choose -b if necessary */ Xint MOST_C_OPT = 0; /* begin pages at top of screen */ Xint MOST_V_OPT = 0; /* display control chars */ Xint MOST_B_OPT = 0; /* display Binary File */ Vint MOST_T_OPT = 0; /* display tab as `094I-- valid only with V o Xption */ Xint MOST_D_OPT = 0; /* delete file mode (see ':D') */ Xint MOST_L_OPT = 0; /* use `094L (formfeed) to clear screen */ X Xvoid most(char *file, int start) X`123 X char input_s[20],ch,outstr[80], *strp; X int line, update, quit, j, repeat, mark, piped, next, row, col, r; X `032 X init_display(); X get_cdir(C_DIR); X X row = col = 0; X if (file[0] == '\0') piped = 1; else piped = 0; X `032 X find_file(file); X goto_line(start); X CURS_POS = C_POS; X if (*SEARCH_STR != '\0' && (row = search(C_POS,1,&col), row > 0)) X `123 X goto_line(row); X `125 X else X `123 X row = C_LINE; X col = 1; X `125 X `032 X window_buffer(); X CURS_ROW = WIN->curs_line = row - C_LINE + 1; X WIN->curs_pos = CURS_POS; X CURS_COL = WIN->curs_col = col; X redraw_window(); X update_status(1); X X while (1) X `123 X execute_key(); X `125`032 X`125 X $ GOSUB UNPACK_FILE $ FILE_IS = "SEARCH.C" $ CHECKSUM_IS = 521231739 $ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY X#include "most.h" X#include "externs.h" X#include "buffer.h" X#include "line.h" X Xint CASE_SENSITIVE = 0; Xchar SEARCH_STR[80]; Xint SEARCH_DIR = 1; X V#define upcase(ch) ((!CASE_SENSITIVE && (ch <= 'z') && (ch >= 'a')) ? ch &= 0 XxDF : ch) X X/* This routine returns the 1 + position of first match of key in str. X key is modified to match the case of str. */ X/* We should try to optimize this routine */ X/* searches from beg up to but not including end */ Vunsigned char *forw_search_region(unsigned char *beg,unsigned char *end, unsi Xgned char *key) X`123 X char ch, ch2,char1,work[80]; X unsigned char *pos; X int key_len,j, str_len; X X if (CASE_SENSITIVE) X `123 X strcpy(work,key); X key_len = strlen(key); X `125 X else X `123 X /* upcase key */ X key_len = 0; X while (ch = key[key_len],ch != '\0') X `123 X ch = upcase(ch); X work[key_len++] = ch; /* null char is ok */ X `125 X `125 X `032 X str_len = (int) (end - beg); X if (str_len < key_len) return (EOB); X str_len = str_len - key_len; /* effective length */ X end -= key_len; X `032 X char1 = work[0]; X `032 X while(1) X `123 X while (ch = *beg, ch = upcase(ch), ch != char1) X `123 X if (beg > end) return(EOB); X beg++; X `125 X beg++; X /* so we have a position of possible match */ X X j = 1; X pos = beg; /* save this position so we start from here again */ X while(ch = *beg++, ch = upcase(ch), X ch2 = work[j++], (ch == ch2) && (j <= key_len)); X X if (j > key_len) X `123 X /* make key match 'key' in beg */ X beg = pos - 1; /* skip back to beginning of match */ X for (j = 0; j < key_len; j++) key[j] = *beg++; X return(pos - 1); X `125 X `032 X else beg = pos; X `125 X`125 X X Vunsigned char *back_search_region(unsigned char *beg,unsigned char *end, unsi Xgned char *key) X`123 X char ch, ch2,char1,work[80]; X unsigned char *pos; X int key_len,j, str_len; X X if (CASE_SENSITIVE) X `123 X strcpy(work,key); X key_len = strlen(key); X `125 X else X `123 X /* upcase key */ X key_len = 0; X while (ch = key[key_len],ch != '\0') X `123 X ch = upcase(ch); X work[key_len++] = ch; /* null char is ok */ X `125 X `125 X `032 X str_len = (int) (end - beg); X if (str_len < key_len) return (EOB); X str_len = str_len - key_len; /* effective length */ X beg += key_len; X `032 X char1 = work[key_len - 1]; X `032 X while(1) X `123 X while (ch = *end, ch = upcase(ch), ch != char1) X `123 X if (beg > end) return(EOB); X end--; X `125 X end--; X /* so we have a position of possible match */ X X j = key_len - 2; X pos = end; /* save this position so we start from here again */ X while(ch = *end--, ch = upcase(ch), X ch2 = work[j], (ch == ch2) && (j >= 0)) j--; X X if (j < 0) X `123 X /* make key match 'key' in beg */ X end = pos + 1; /* skip back to beginning of match */ X for (j = key_len; j > 0; j--) key[j - 1] = *end--; X return(end + 1); X `125 X `032 X else end = pos; X `125 X`125 X X X Xint search(unsigned char *from, int repeat, int *col) X`123 X /* return the line match was found as well as line number, X search from i on; assume that line_array match the i so we need X no initial lookup */ X X int test,j,save_line, the_col, row; X char ch, string[80]; X unsigned char *pos, *save_pos, *found_at; X X if ((from < BEG) `124`124 (from > EOB)) return(-1); X save_pos = C_POS; X save_line = C_LINE; X found_at = EOB; X *col = 0; X X pos = from; X if (SEARCH_STR[0] != '\0') X `123 X test = repeat && (pos < EOB) && (pos >= BEG); X while(test) X `123 X if (SEARCH_DIR == 1) V pos = forw_search_region(pos,EOB,(unsigned char*) SEARCH_ST XR); X else V pos = back_search_region(BEG,pos,(unsigned char*) SEARCH_ST XR); X `032 X `032 X if (pos < EOB) X `123 X repeat--; X found_at = pos; X if (SEARCH_DIR == 1) X pos += strlen(SEARCH_STR); X else pos--; X `125 X test = repeat && (pos < EOB) && (pos >= BEG); X `125 X `125 X `032 X if (repeat) /* not found */ X `123 X *col = 0; X if (SEARCH_STR[0] == '\0') X message("Search string not specified.",1); X else X `123 X (void) sprintf(string,"%s NOT FOUND.",SEARCH_STR); X message(string,1); X `125 X `032 X row = -1; X `125 V else /* if ( !MOST_T_OPT && !MOST_B_OPT) */ /* expand tabs to get col c Xorrect */ X `123 X find_row_column(found_at,&row,&the_col); X *col = apparant_distance(found_at); X `125 X C_POS = save_pos; X C_LINE = save_line; X if (row > 0) CURS_POS = found_at; X return( row ); X`125 X $ GOSUB UNPACK_FILE $ FILE_IS = "SYSDEP.C" $ CHECKSUM_IS = 72803294 $ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY X/* X * HISTORY X * `1231`125`00919-Mar-91 Henk D. Davids X * `009History started. Added default input file name so you do not X *`009have to specify name or type if you want it to be *. X * `009Changes indicated by "-hdd" in comment. X *`032 X * 2. 4/4/91 John E. Davis X * I added code to read the teminal size for unix systems-- at least it X * works on a sun4 (BSD ?). In addition I have also recently added file X * deletion code for both unix and vms. X */ X#include "sysdep.h" X X X/*`032 X * `032 X * `032 X * SHELL COMMANDS X * `032 X */ X `032 X#ifdef VMS X X/* these two from emacs source */ `032 Xvoid define_logical_name (char *varname, char *string) X`123 X struct dsc$descriptor_s strdsc = X `123strlen (string), DSC$K_DTYPE_T, DSC$K_CLASS_S, string`125; X struct dsc$descriptor_s envdsc = X `123strlen (varname), DSC$K_DTYPE_T, DSC$K_CLASS_S, varname`125; X struct dsc$descriptor_s lnmdsc = X `1237, DSC$K_DTYPE_T, DSC$K_CLASS_S, "LNM$JOB"`125; X X LIB$SET_LOGICAL (&envdsc, &strdsc, &lnmdsc, 0, 0); X`125 X Xvoid delete_logical_name (char *varname) X`123 X struct dsc$descriptor_s envdsc = X `123strlen (varname), DSC$K_DTYPE_T, DSC$K_CLASS_S, varname`125; X struct dsc$descriptor_s lnmdsc = X `1237, DSC$K_DTYPE_T, DSC$K_CLASS_S, "LNM$JOB"`125; X `032 X LIB$DELETE_LOGICAL (&envdsc, &lnmdsc); X`125 X X Xint do_emacs_command() X`123 X unsigned long pid; X char *pidstr; X `032 X if((pidstr = getenv("EMACS_PID")) != NULL) X `123 X`009 (void) sscanf(pidstr,"%X",&pid); X`009 if (lib$attach(&pid) == SS$_NORMAL) /* we attach to emacs */ X return(1); X else X return(0); X /* `009 printf("Can't attach to pid %X\n",pid); */ X `125 X else return(0); X`125 X Xunsigned long SHELL_PID = 0; `032 X X/* returns 0 on success */ Xint do_shell_command() X`123 X /* here we try to attach to the parent otherwise just spawn a new one */ X unsigned long parent_pid; X unsigned long status = 0; X char str[80]; X `032 X `032 X parent_pid = getppid(); X `032 X if (parent_pid && parent_pid != 0xffffffff) `032 X /* we attach to parent */ X status = lib$attach(&parent_pid); X X else if (SHELL_PID && SHELL_PID != 0xffffffff) X /* try to attach to previous shell */ X status = lib$attach (&SHELL_PID); X `032 X if (status != SS$_NORMAL)`009`009/* others fail so spawn a new shell */ X `123 X status = 0; X`009 fputs("Spawning Subprocess...",stdout); X fflush(stdout); X`009 lib$spawn(0,0,0,0,0,&SHELL_PID,&status); X /* if we attach back, status may come back unchanged */ X if ((status != 0) && (status != SS$_NORMAL)) X `123 V sprintf(str,"Unable to spawn subprocess. Error = %X", status) X; X message(str,1); X return(0); X `125 X `125 X return(1); X`125 X X X#endif /* VMS */ X X/*`032 X * FILE IO X * `032 X */ X X#ifdef VMS Xint expand_file_name(char *file,char *expanded_file) X`123 X unsigned long status; X static int context = 0; X static char inputname[255] = ""; X $DESCRIPTOR(file_desc,inputname); X $DESCRIPTOR(default_dsc,"SYS$DISK:[]*.*;"); X static struct dsc$descriptor_s result =`032 X`009 `1230, DSC$K_DTYPE_T, DSC$K_CLASS_D, NULL`125; X X if (strcmp(inputname, file)) X `123 X`009 if (context) X`009 `123 X`009`009lib$find_file_end(&context); X`009 `125 X`009 context = 0; X`009 strcpy(inputname, file); X`009 file_desc.dsc$w_length = strlen(inputname); X `125 X `032 X if (RMS$_NORMAL == lib$find_file(&file_desc,&result,&context, X`009 `009`009 &default_dsc,0,0,&0)) X `123 X`009 memcpy(expanded_file, result.dsc$a_pointer, result.dsc$w_length); X`009 expanded_file[result.dsc$w_length] = '\0'; X return (1); X `125 X else X `123 V expanded_file[0] = '\0'; /* so file comes back as zero width X */ X return(0); X `125 X`125 X#endif /* VMS */ X X/*`032 X * `032 X * `032 X * Terminal IO X * `032 X */ X X#ifdef VMS X/* X * Exit Handler Control Block X */ Xstatic struct argument_block X `123 X int forward_link; X int (*exit_routine)(); X int arg_count; X int *status_address; X int exit_status; X `125 exit_block X = `123 X 0, X NULL, X 1, X &exit_block.exit_status, X 0 X `125; X#endif Xvoid init_tty() X`123 X#ifdef VMS X $DESCRIPTOR ( Term, "SYS$ERROR"); X if (sys$assign ( &Term, &TTY_CHANNEL_GLOBAL, 0, 0 ) X != SS$_NORMAL) X `123 X fprintf(stderr,"Unable to assign input channel\n"); X exit(0); X `125 X if (NULL == exit_block.exit_routine) X`009`123 X`009void reset_tty(); X X`009exit_block.exit_routine = reset_tty; X`009SYS$DCLEXH(&exit_block); X`009`125 X#else `032 X#ifdef BSD X struct sgttyb newtty; X struct tchars tc; X struct ltchars lc; X X ioctl(TTY_DESCR, TIOCGLTC,&OLDTTY_LC); X ioctl(TTY_DESCR, TIOCGETC,&OLDTTY_TC); X ioctl(TTY_DESCR, TIOCGETP, &OLDTTY); X newtty = OLDTTY; X newtty.sg_flags `124= CBREAK; X newtty.sg_flags &= `126(ECHO `124 XTABS); X newtty.sg_erase = 0; X newtty.sg_kill = 0; X tc.t_intrc = 0; X tc.t_quitc = 0; X tc.t_eofc = 0; X tc.t_brkc = 0; X lc.t_suspc = 0; X lc.t_dsuspc = 0; X ioctl(TTY_DESCR, TIOCSETP, &newtty); X ioctl(TTY_DESCR, TIOCSLTC,&lc); X ioctl(TTY_DESCR, TIOCSETC,&tc); X#else /* other unix */ `032 X struct termio newtty; X`009 `032 X ioctl(TTY_DESCR, TCGETA, &OLDTTY); X ioctl(TTY_DESCR, TCGETA, &newtty); X newtty.c_iflag &= `126(ECHO); `032 X newtty.c_iflag &= `126(INLCR); `032 X newtty.c_iflag &= `126(ICRNL); `032 X newtty.c_lflag = 00000000;`032 X newtty.c_cc[VMIN] = 1;`032 X newtty.c_cc[VTIME] = 0; X newtty.c_cc[VEOF] = 1; `032 X ioctl(TTY_DESCR, TCSETA, &newtty); X X#endif /* other unix */ X#endif X fputs("\033=", stdout); /* Enable the Application Keypad */ X`125 X Xsys_flush(int fd) X`123 X#ifdef BSD X ioctl(fd, TIOCFLUSH, (char *) NULL); X#else X#ifndef VMS `032 X ioctl(fd, TCFLSH, (char *) NULL); X#endif `032 X#endif `032 X`125 X Xvoid reset_tty() X`123 X fputs("\033=", stdout); /* Enable the Numeric Keypad */ X#ifndef VMS X#ifdef BSD X`009ioctl(TTY_DESCR, TIOCSETP, &OLDTTY); X`009ioctl(TTY_DESCR, TIOCSLTC, &OLDTTY_LC); X`009ioctl(TTY_DESCR, TIOCSETC, &OLDTTY_TC); X#else `032 X `009ioctl(TTY_DESCR, TCSETA, &OLDTTY); X#endif /* BSD */ X#endif /* not vms*/ X`125 X Xint INPUT_BUFFER_LEN = 0; Xchar INPUT_BUFFER[80]; X Xchar sys_getkey() X`123 X char c; X `032 X#ifndef VMS X if (read(TTY_DESCR, &c, 1) < 0) X `123 X fprintf(stderr,"getkey(): read failed.\n"); X reset_tty(); X exit(0); X `125 X `032 X#else X /* VMS */ X /* see Guide to Programming VAX/VMS */ X int status; X static int trmmsk [2] = `123 0, 0 `125; X short iosb [4]; X`009 X status = sys$qiow ( 0, TTY_CHANNEL_GLOBAL, X IO$_READVBLK + IO$M_NOECHO `124 IO$_TTYREADALL, X iosb, 0, 0, X &c, 1, 0, trmmsk, 0, 0 ); X X#endif /* VMS */ X`009 X return(c);`032 X`125 X Xchar getkey() X`123 X int i; X char ch; X if (!INPUT_BUFFER_LEN) return(sys_getkey()); X ch = INPUT_BUFFER[0]; X INPUT_BUFFER_LEN--; X for (i = 0; i < INPUT_BUFFER_LEN; i++) X `123 X INPUT_BUFFER[i] = INPUT_BUFFER[i + 1]; X `125 X return(ch); X`125 X Xvoid ungetkey(char ch) X`123 X int i; X for (i = 0; i < INPUT_BUFFER_LEN; i++) X `123 X INPUT_BUFFER[i+1] = INPUT_BUFFER[i]; X `125 X INPUT_BUFFER[0] = ch; X INPUT_BUFFER_LEN++; X`125 X X X/*`032 X * `032 X * Misc Termial stuff `032 X * `032 X * `032 X */ X X X/* This is to get the size of the terminal */ Xvoid get_term_dimensions(int *cols, int *rows) X`123 X#ifdef VMS X int status; X iosb iostatus; X $DESCRIPTOR(devnam, "SYS$ERROR"); X struct X`009`123 X`009short row_buflen; X`009short row_itmcod; X`009int *row_bufadr; X`009short *row_retlen; X`009short col_buflen; X`009short col_itmcod; X`009int *col_bufadr; X`009short *col_retlen; X`009int listend; X`009`125 itmlst = X`009`123 X`009sizeof(*rows), DVI$_TT_PAGE, rows, 0, X`009sizeof(*cols), DVI$_DEVBUFSIZ, cols, 0, X`0090 X`009`125; X `032 X /* Get current terminal characteristics */ X status = sys$getdviw(0, /* Wait on event flag zero */ X 0, /* Channel to input terminal */ X &devnam, /* device name */ X`009`009`009 &itmlst,`009 /* Item descriptor List */ X &iostatus, /* Status after operation */ X 0, 0, /* No AST service */ X 0); /* nullarg */ X if (status&1) X`009status = iostatus.i_cond; X /* Jump out if bad status */ X if ((status & 1) == 0) X exit(status); X#else /* this may need work on other unix-- works for sun4 */ X struct winsize wind_struct; X `032 X ioctl(2,TIOCGWINSZ,&wind_struct); X *cols = (int) wind_struct.ws_col; X *rows = (int) wind_struct.ws_row; X `032 X#endif /* VMS */ X`125 X X/* returns 0 on failure, 1 on sucess */ Xint sys_delete_file(char *filename) X`123 X#ifdef VMS X return (1 + delete(filename)); /* 0: sucess; -1 failure */ X#else /* unix not ready yet */ X return(1 + unlink(filename)); X#endif X`125 X X X/* This routine converts unix type names to vms names */ X#ifdef VMS Xint locate(char ch, char *string) X`123 X int i; X char c; X X i = 0; X while (c = string[i++], (c != ch) && (c != '\0')); X if (c == ch) return(i); else return (0); X`125 X Xchar *unix2vms(char *file) X`123 X int i,device,j,first,last; X static char vms_name[80]; X char ch; X X if (locate('[',file)) return(file); /* vms_name syntax */ X if (!locate('/',file)) return(file); /* vms_name syntax */ X X /* search for the ':' which means a device is present */ X device = locate(':',file); X X i = 0; X if (device) X `123 X while (ch = file[i], i < device) vms_name[i++] = ch; X `125 X j = i; X `032 X /* go from the end looking for a '/' and mark it */ X i = strlen(file) - 1; X while(ch = file[i], ch != '/' && i-- >= 0); X if (ch == '/') X `123 X file[i] = ']'; X last = 0; X `125 X else last = 1; X X i = j; X vms_name[j++] = '['; X vms_name[j++] = '.'; X first = 0; X while(ch = file[i++], ch != '\0') X `123 X switch (ch) X `123 X case '.': X if (last) vms_name[j++] = '.'; X if (last) break; X ch = file[i++]; X if (ch == '.') X `123 X if (!first) j--; /* overwrite the dot */ X vms_name[j++] = '-'; X `125 X else if (ch == '/'); /* './' combinations-- do nothing */ X else if (ch == ']') X `123 X last = 1; X if (vms_name[j-1] == '.') j--; X vms_name[j++] = ']'; X `125 X `032 X else vms_name[j++] = '.'; X break; X case '/': X if (first) X `123 X vms_name[j++] = '.'; X `125 X else X `123 X first = 1; V /* if '/' is first char or follows a colon do nothing * X/ X if ((i!=1) && (file[i-2] != ':')) X `123 X vms_name[j++] = '.'; X `125 X else j--; /* overwrite the '.' following '[' */ X `125 X break; X case ']': X last = 1; X if (vms_name[j-1] == '.') j--; X vms_name[j++] = ']'; X break; X default: X vms_name[j++] = ch; X `125 X `125 X return (vms_name); X`125 X X/* Xmain(int argc, char **argv) X`123 X puts(unix2vms(argv[1])); X`125 X*/ `032 X X#endif /* VMS */ X X#include X Xchar *get_time() X`123`032 X time_t clock; X char *the_time; X X clock = time((long *) 0); V the_time = ctime(&clock); /* returns the form Sun Sep 16 01:03:52 1985\n\ X0 */ X the_time[24] = '\0'; X return(the_time); X`125 X $ GOSUB UNPACK_FILE $ FILE_IS = "WINDOW.C" $ CHECKSUM_IS = 1830641736 $ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY X#include X#include "externs.h" X#include "window.h" X#include "line.h" X#include "display.h" X XWindow *WIN; XWindow *TOP_WIN; Xint COLUMN = 1; Xint BEEP_MINI_B = 0; Xint MINIBUFFER_SELECTED = 0; Xint CURS_ROW; Xint CURS_COL; Xint RESTORE_WIDTH_TO = 0; Xunsigned char *CURS_POS; X Xint read_string(char *str) X`123 X char ch; X int i; X X i = strlen(str); X do`032 X `123 X ch = getkey(); X if ((ch == '\b') `124`124 (ch == 127)) X `123 X if (i > 0) X `123 V if (str[--i] < 32) fputs("\b \b",stdout); /* erase the X `094 */ X fputs("\b \b",stdout); X `125 X else fputc('\007',stdout); X `125 X else if ((ch < 32) && (ch != 10) && (ch != 13)) X `123 V`009`009if ((ch == '\007') `124`124 (ch == '\025')) /* `094G or `094U aborts X */ X`009`009 `123 X`009`009 fputc('\007',stdout); X`009`009 return(-1); /* `094G quits */ X`009`009 `125 X`009`009if (ch == '\033') /* Allow KP ENTER as a terminator */ X`009`009 `123 X`009`009 ch = getkey(); X`009`009 if (ch == 'O') X`009`009`009 `123 X`009`009`009 ch = getkey(); X`009`009`009 if (ch == 'M') X`009`009`009 `123 X`009`009`009`009 str[i] = '\0'; X`009`009`009`009 return(i); X`009`009`009 `125 X`009`009`009 else X`009`009`009 `123 X`009`009`009 fputc('`094',stdout); X`009`009`009 fputc('[',stdout); X`009`009`009 fputc(str[i++] = 'O', stdout); X`009`009`009 fputc(str[i++] = ch, stdout); X`009`009`009 `125 X`009`009`009 `125 X`009`009 else X`009`009`009 `123 X`009`009`009 fputc('`094',stdout); X`009`009`009 fputc('[',stdout); X`009`009`009 fputc(str[i++] = ch, stdout); X`009`009`009 `125 X`009`009 `125 X`009`009else X`009`009 `123 X`009`009 str[i++] = ch; X`009`009 fputc('`094',stdout); X`009`009 fputc(ch + '@',stdout); X`009`009 `125 X `125 X else if (ch == '`096') /* quoted insert */ X `123 X ch = getkey(); X str[i++] = ch; X if ((ch < ' ') `124`124 (ch == 127))`032 X `123 X if (ch == 127) ch = '?'; else ch = ch + '@'; X fputc('`094',stdout); X `125 X fputc(ch,stdout); X `125 X`009 else if ((ch != 10) && (ch != 13)) X `123 X str[i++] = ch; X fputc(ch,stdout); X `125 X `032 X fflush(stdout); X `125 X while ((ch != 10) && (ch != 13)); X `032 X str[i] = '\0'; X return(i); X`125 X X Xvoid message(char *what, int how) X`123 X strcpy(MINI_BUF,what); X if (how) BEEP_MINI_B = 1; else BEEP_MINI_B = 0; X`125 X Xvoid select_minibuffer() X`123 X if (MINIBUFFER_SELECTED) return; X MINIBUFFER_SELECTED = 1; X set_scroll_region(1,SCREEN_HEIGHT); X goto_rc(SCREEN_HEIGHT,1); X fflush(stdout); X`125 X Xvoid exit_minibuffer() X`123 X if (!MINIBUFFER_SELECTED) return; X MINIBUFFER_SELECTED = 0; X set_scroll_region(WIN->top,WIN->bot); X fflush(stdout); X`125 X X/* put out string, expanding control chars */ Xvoid nicely_puts(char *str, FILE *fp) X`123 X while (*str != '\0') X `123 X if ((*str < ' ') `124`124 (*str == 127)) X `123 X fputc('`094',fp); X if (*str != 127) fputc(*str + '@',fp); else fputc('?',fp); X `125 X else fputc(*str,fp); X str++; X `125 X`125 X Xvoid put_message() X`123 X select_minibuffer(); X delete_line(1); X if (BEEP_MINI_B) fputc('\007',stdout); X BEEP_MINI_B = 0; X if (*MINI_BUF != '\0') nicely_puts((char *) MINI_BUF, stdout); X exit_minibuffer(); X`125 X X/* puts 'what in the minibuffer to be edited. */ X/* returns number of chars read */ Xint read_from_minibuffer(char *prompt, char *what) X`123 X int i; X char str[132]; X `032 X select_minibuffer(); X fputs(prompt,stdout); X if (*what != '\0') X nicely_puts(what,stdout); X fflush(stdout); X strcpy(str,what); X i = read_string(str); X if (i > 0) strcpy(what,str); X delete_line(1); X exit_minibuffer(); X return(i); X`125 X X `032 Xvoid clear_minibuffer() X`123 X MINI_BUF[0] = '\0'; X BEEP_MINI_B = 0; X put_message(); X`125 X X Xint get_scroll(int *line) X`123 X /* line is the line we want at the topo of the window if possible */ X int dtop, dbot,n,top,bot,wsize; X X top = WIN->beg_line; X wsize = WIN->bot - WIN->top; /* actually 1 less than window size */ X bot = top + wsize; X X if ((*line == 1) && (top == 1)) X `123 X message("Top of Buffer.",1); X return(0); X `125 X `032 X /* handles endof file in a window */ X if ((bot > NUM_LINES) && *line > C_LINE) X `123 X *line = top; X message("End of Buffer.",1); X return(0); X `125 X `032 X if (NUM_LINES <= wsize) /* short file */ X `123 X *line = 1; X return(0); X `125 X X dtop = top - 1; X dbot = NUM_LINES - bot; X n = *line - top; X X if ((n>0) && (dbot < n)) X `123 X n = dbot; X *line = top + n; X if (!n) message("End of buffer.",1); X `125 X else if ((n < 0) && (dtop + n < 0)) X `123 X n = -dtop; X if (!n) message("Top of buffer.",1); X *line = n + top; X `125 X return(n); X`125 X X Xvoid update_window(int line) X`123 X int n,max_n, save_line, save_col, npos; X unsigned char *save_pos; X X if (COLUMN != WIN->col) X `123 X if (COLUMN < 1) COLUMN = 1; X if (COLUMN != WIN->col) X `123 V save_pos = CURS_POS; save_line = CURS_ROW; save_col = CURS_CO XL; X redraw_window(); X update_status(0); X WIN->curs_pos = CURS_POS = save_pos; X WIN->curs_line = CURS_ROW = save_line; X WIN->curs_col = CURS_COL = save_col; X `125 X return; X `125 X X `032 X n = get_scroll(&line); X max_n = WIN->bot - WIN->top; X if (abs(n) > max_n) X `123 X goto_line(line); X redraw_window(); X update_status(0); X return; X `125 X if (!n) return; X X goto_rc(1,1); X forward_line(n); X WIN->beg_pos = C_POS; X WIN->beg_line = C_LINE; X X if (n>0) X `123 X npos = 1; X delete_nlines(n); X goto_rc(WIN->bot - WIN->top - n + 2,1); X forward_line(max_n - n + 1); X `125 X else X `123 X npos = 0; X CURS_ROW = 1; CURS_COL = 1; CURS_POS = C_POS; X n = -n; X reverse_index(n); X `125 X n = n - 1; X display_line(); X while(n--) X `123 X forward_line(1); X fputc('\n',stdout); X display_line(); X `125 X if (npos)`032 X `123 X `032 X CURS_ROW = C_LINE - WIN->beg_line + 1; X CURS_COL = 1; CURS_POS = C_POS; X `125 X `032 X C_POS = WIN->beg_pos; X C_LINE = WIN->beg_line; X update_status(0); X fflush(stdout); X`125 X X/* updates current window as well as scroll lock ones */ X/* Although current window is update in an absolute fashion, scroll locked X ones are updated in a relative fashion */ Xvoid update_windows(int line) X`123 X int dline,flg; X Window *w; X `032 X dline = line - C_LINE; X update_window(line); X if (!WIN->lock) return; X flg = 0; X w = WIN; X while(WIN = WIN->next, WIN != w) X `123 X if (WIN->lock) X `123 X flg = 1; X set_window(WIN); X line = C_LINE + dline; X update_window(line); X `125 X `125 X WIN = w; X if (flg) set_window(WIN); X`125 X X Xvoid redraw_window() X`123 X int n,t; X t = WIN->top; X if (t == 1) clear_window(); X goto_rc(1, 1); X n = WIN->bot - WIN->top; X if ((C_LINE + n) > NUM_LINES) goto_line(NUM_LINES - n); X WIN->curs_pos = CURS_POS = WIN->beg_pos = C_POS; X WIN->beg_line = C_LINE; X WIN->col = COLUMN; X WIN->curs_col = CURS_COL = 1; X WIN->curs_line = CURS_ROW = 1; X if (t != 1) delete_line(1); X display_line(); X while(n--) X `123 X fputc('\n',stdout); X if (t != 1) delete_line(1); X if (forward_line(1)) display_line(); X `125 X `032 X `032 X C_POS = WIN->beg_pos; X C_LINE = WIN->beg_line; X`125 X X/* associates current window with current buffer */ Xvoid save_win_flags(Window *w) X`123 X w->flags = 0; X if (MOST_V_OPT) w->flags `124= _MOST_V_OPT; X if (MOST_B_OPT) w->flags `124= _MOST_B_OPT; X if (MOST_T_OPT) w->flags `124= _MOST_T_OPT; X if (MOST_W_OPT) w->flags `124= _MOST_W_OPT; X if (SQUEEZE_LINES) w->flags `124= _MOST_SQ_OPT; X w->n_lines = NUM_LINES; X w->display = MOST_S_OPT; X`125 X Xvoid window_buffer() X`123 X WIN->beg_line = C_LINE; X WIN->beg_pos = C_POS; X WIN->col = COLUMN; X WIN->buf = BUF; X MOST_S_OPT = 0; X save_win_flags(WIN); X`125 X Xvoid clear_window() X`123 X int i,n; X i = WIN->top; X n = WIN->bot - WIN->top; X if (i == 1) X `123 X goto_rc(WIN->bot - WIN->top + 1,SCREEN_WIDTH); X clr_bos(); X `125 X else X `123 X goto_rc(i - WIN->top + 1,1); X delete_line(1); X while(n--) X `123 X fputc('\n',stdout); X delete_line(1); X `125 X `125 X `032 X goto_rc(i - WIN->top + 1,1); X fflush(stdout); X`125 X Xvoid restore_win_flags() X`123 X MOST_V_OPT = WIN->flags & _MOST_V_OPT; X MOST_B_OPT = WIN->flags & _MOST_B_OPT; X MOST_T_OPT = WIN->flags & _MOST_T_OPT; X MOST_W_OPT = WIN->flags & _MOST_W_OPT; X SQUEEZE_LINES = WIN->flags & _MOST_SQ_OPT; X NUM_LINES = WIN->n_lines; X MOST_S_OPT = WIN->display; X`125 X X XWindow *make_window(int r1,int r2) X`123 X int i; X Window *new; X new = (Window *) malloc(sizeof(Window)); X new->status = (char *) malloc(135); X for (i = 0; i <= SCREEN_WIDTH; i++) new->status[i] = '\0'; X new->col = COLUMN; X new->top = r1; X new->bot = r2; X new->lock = 0; X save_win_flags(new); X return(new); X`125 X Xvoid init_display() X`123 X int i; X fputs("\033[?6h",stdout); X TOP_WIN = WIN = make_window(1,SCREEN_HEIGHT - 2); X WIN->prev = WIN->next = WIN; X cls(); X set_scroll_region(WIN->top, WIN->bot); X goto_rc(1,1); X fflush(stdout); X`125 X Xvoid reset_display() X`123 X set_scroll_region(1,SCREEN_HEIGHT); X fputs("\033[?6l",stdout); /* normal origin mode */ X goto_rc(SCREEN_HEIGHT,1); X if (RESTORE_WIDTH_TO) X `123 X set_width(RESTORE_WIDTH_TO, 0); X RESTORE_WIDTH_TO = 0; X `125 X `032 X fflush(stdout); X`125 X Xupdate_status1(int new_status) X`123 X char str[30], ch, *strp; X static char new[135]; X int i,ii,r,x,line_p = 60; X X r = WIN->bot + 1; X goto_rc(r,1); X X i = ii = 0; X new[ii++] = '-'; X if (WIN->lock) new[ii++] = '*'; else new[ii++] = '-'; X strp = " MOST: "; X while(*strp != '\0') new[ii++] = *strp++; X `032 X while(ch = WIN->buf->file[i++], ch != '\0') new[ii++] = ch; X X while(ii < line_p) new[ii++] = ' '; X X x = (C_LINE + WIN->bot - WIN->top) * 100; x = x / NUM_LINES; X V /* for files with end of file above the bottom row (due to window manipul Xations) */ X if (x > 100) x = 100; X sprintf(str,"(%d,%d) %d%%",C_LINE,COLUMN,x); X i = 0; while(ch = str[i++], ch != '\0') new[ii++] = ch; X X while(ii < SCREEN_WIDTH) new[ii++] = '-'; X new[SCREEN_WIDTH] = '\0'; X set_attribute(7); X if (new_status) X fputs(new,stdout); X else X smart_puts(new,WIN->status,stdout); X set_attribute(0); X strcpy(WIN->status,new); X`125 X Xvoid update_status(int new_status) X`123 X X C_LINE = WIN->beg_line; X C_POS = WIN->beg_pos; X set_scroll_region(1,SCREEN_HEIGHT); X update_status1(new_status); X set_scroll_region(WIN->top,WIN->bot); X fflush(stdout); X`125 X X/* splits window-- no screen update, does not affect scrolling region */ Xint split_window() X`123 X Window *new, *old; X int b2,t2,b1, line; X X b2 = WIN->bot; X b1 = (WIN->bot + WIN->top) / 2 - 1; X t2 = b1 + 2; X if ((b1 == WIN->top) `124`124 (t2 == b2)) return(0); X X /* line is top line of new window. */ X line = WIN->beg_line + t2 - WIN->top; X old = WIN; X WIN->bot = b1; X new = make_window(t2,b2); X /* add to ring */ X WIN->next->prev = new; X new->next = WIN->next; X new->prev = WIN; X WIN->next = new; X X new->beg_line = line; X new->buf = BUF; X /* new window status line is at same position as old */ X strcpy(new->status,WIN->status); X return(1); X`125 X X `032 Xvoid two_windows() X`123 X int line; X Window *new, *old; X if (!split_window()) return; X X old = WIN; X new = WIN->next; X line = new->beg_line; X if (line + new->bot - new->top > NUM_LINES) X `123 X other_window(1); X /* since split window left new window undefined... */ X C_POS = old->beg_pos; X C_LINE = old->beg_line; X if (NUM_LINES <= new->bot - new->top + 1) X `123 X C_LINE = new->beg_line = 1; X C_POS = new->beg_pos = BUF->beg; X redraw_window(); X update_status(0); X `125 X else if (line > NUM_LINES) X `123 X goto_line(NUM_LINES - new->bot + new->top); X WIN->beg_pos = C_POS; X WIN->beg_line = C_LINE; X redraw_window(); X update_status(0); X `125 `032 X else X `123 X goto_line(line); X WIN->beg_pos = C_POS; X WIN->beg_line = C_LINE; X update_window(NUM_LINES - new->bot + new->top); X `125 X WIN->curs_line = 1; X WIN->curs_col = COLUMN; X WIN->curs_pos = C_POS; X other_window(-1); X `125 X else X `123 X WIN = new; X (void) forward_line(line - old->beg_line); X new->beg_pos = C_POS; X new->beg_line = C_LINE; X new->curs_line = 1; X new->curs_col = COLUMN; X new->curs_pos = C_POS; X update_status(0); X WIN = old; X `125 `032 X update_status(1); X`125 X Xvoid expand_window1(int dn) X`123 X int l, save_top, save_line; X unsigned char *save_pos; X X /* l is line after last line of current window (where status line is) */ X l = WIN->beg_line + WIN->bot - WIN->top + 1; X save_top = WIN->top; X WIN->top = WIN->bot + 1; X WIN->bot = WIN->bot + dn; X set_scroll_region(WIN->top, WIN->bot); X if (l > NUM_LINES) X `123 X clear_window(); X `125 X else X `123 X /* should add something here for smarter scrolling... X if ((WIN->next->BUF == BUF) && (l >= WIN->next->beg_line) X && (l <= (WIN->next->beg_line + WIN->next) X */ X `032 X save_line = C_LINE; X save_pos = C_POS; X goto_line(l); X redraw_window(); X WIN->beg_line = C_LINE = save_line; X WIN->beg_pos = C_POS = save_pos; X `125 X WIN->top = save_top; X set_scroll_region(WIN->top, WIN->bot); X`125 X Xvoid one_window() X`123 X Window *w, *tmp; X int diff; X `032 X if (WIN->next == WIN) return; X w = WIN; X WIN = WIN->next; X /* delete other windows preserving the ring! */ X while(WIN != w) X `123 X free_window_buffer(); /* needs a ring */ X tmp = WIN->next; X /* if this is the bottom window, save its status line */ X if (tmp == TOP_WIN) strcpy(w->status,WIN->status); X tmp->prev = WIN->prev; X WIN->prev->next = tmp; X free(WIN); X WIN = tmp; X `125 X WIN = w; X /* slide the window to the top and expand it */ X diff = WIN->top - 1; X if (diff) X `123 X set_scroll_region(1,SCREEN_HEIGHT - 2); X goto_rc(1,1); X delete_nlines(diff); X WIN->top = 1; X WIN->bot -= diff; X TOP_WIN = WIN; X `125 X expand_window1(SCREEN_HEIGHT - 2 - WIN->bot); X update_status(0); X`125 X X `032 Xvoid set_window(Window *w) X`123 X WIN = w; X CURS_ROW = WIN->curs_line; X CURS_COL = WIN->curs_col; X CURS_POS = WIN->curs_pos; X C_LINE = WIN->beg_line; X C_POS = WIN->beg_pos; X COLUMN = WIN->col; X BUF = WIN->buf; X switch_to_buffer(BUF); X set_scroll_region(WIN->top,WIN->bot); X restore_win_flags(); X fflush(stdout); X`125 X Xvoid other_window(int n) X`123 X if (!n) return; X WIN->beg_pos = C_POS; X WIN->curs_pos = CURS_POS; X WIN->curs_line = CURS_ROW; X WIN->curs_col = CURS_COL; X WIN->beg_line = C_LINE; X save_win_flags(WIN); X if (n < 0) X while (n++) WIN = WIN->prev; X else X while (n--) WIN = WIN->next; X set_window(WIN); X`125 X X X X/* kills window by moving lower window up */ Xdelete_as_top_window() X`123 X int t1,t2,b1,b2; X t1 = WIN->top; X t2 = WIN->next->top; X b1 = WIN->bot; X b2 = WIN->next->bot; X WIN->prev->next = WIN->next; X WIN->next->prev = WIN->prev; X X /* scroll contents of window below to top */ X set_scroll_region(t1,b2); X goto_rc(1,1); X delete_nlines(t2 - t1); X other_window(1); X WIN->top = t1; X WIN->bot = b2 - t2 + t1; X expand_window1(b2 - WIN->bot); X update_status(0); X`125 X X/* free buffer for this window if no other windows are viewing it. */ Xfree_window_buffer() X`123 X Window *w; X int f = 1; X w = WIN; X WIN = w->next; X while((WIN != w) && f) X `123 X if (!strcmp(WIN->buf->file,w->buf->file)) f = 0; X WIN = WIN->next; X `125 X WIN = w; X if (f) free(WIN->buf); X`125 X X Xdelete_window() X`123 X int new_b, old_b; X Window *w; X `032 X w = WIN; X if (WIN->next == WIN) return; X free_window_buffer(); X if (WIN->next != TOP_WIN) X `123 X if (WIN == TOP_WIN) X `123 X delete_as_top_window(); X TOP_WIN = WIN; /* not anymore, this one is */ X `125 X else X delete_as_top_window(); X `032 X free(w); X return; X `125 X old_b = WIN->top - 2; X new_b = WIN->bot; X other_window(-1); X expand_window1(new_b - old_b); X strcpy(WIN->status,w->status); /* share the same line */ X `032 X WIN->next = w->next; X WIN->next->prev = WIN; X free(w); X update_status(0); X`125 X Xvoid redraw_display() X`123 X Window *w; X int n,t; X fputs("\033[?6h",stdout); /* relative origins */ X set_scroll_region(1,SCREEN_HEIGHT); X cls(); X save_win_flags(WIN); X w = WIN; X do X `123 X WIN = WIN->next; X t = WIN->top; X goto_rc(t, 1); X C_POS = WIN->beg_pos; X C_LINE = WIN->beg_line; X COLUMN = WIN->col; X switch_to_buffer(WIN->buf); X restore_win_flags(); X n = WIN->bot - WIN->top; X display_line(); X while(n--) X `123 X fputc('\n',stdout); X if (forward_line(1)) display_line(); X `125 X C_LINE = WIN->beg_line; X C_POS = WIN->beg_pos; X update_status1(1); X `125 X while(WIN != w); X set_window(w); X`125 X Xvoid toggle_lock() X`123 X WIN->lock = !(WIN->lock); X update_status(0); X`125 X $ GOSUB UNPACK_FILE $ FILE_IS = "BUFFER.H" $ CHECKSUM_IS = 1577674117 $ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY X#ifndef _DAVIS_BUFFER_H_ X#define _DAVIS_BUFFER_H_ X Xtypedef struct X `123 X char file[80]; /* filename */ X unsigned char *beg; /* beginning of buffer */ X unsigned char *end; /* end of buffer */ X int mark; /* marked line in buffer */ X `125 Buffer; X X Xextern int NUM_LINES; Xextern Buffer *BUF; Xextern unsigned char *BEG, *EOB; Xextern unsigned char MINI_BUF[132]; X/* The buffer. X X The beginning of the first character is at BUF. The last character X in the file is located at position EOB-1. So if we are at position EOB, X then we can insert a character past the last point. EOB = BUF + BUF_SIZE; X. X*/ X `032 Xextern unsigned char *C_POS; X/*`032 X * current position of point. Considered to be between the previous X * character and the next character. There is no current character. X * If we are at the beginning of the buffer BUF, then its value is BUF. X * If we are at the end of the buffer it is BUF + BUF_SIZE = EOB. X */ X Xextern int C_LINE; X/*`032 X * Current line number. If at the beginning of the buffer, it is 1. If X * we are at the last point of the buffer it is the number of lines. X */ X X/* These two routines do not move the point */ `032 Xextern unsigned char *beg_of_line(); Xextern unsigned char *end_of_line(); X Xextern int forward_line(int); X/* This routine moves the point forward n lines. n can be negative.`032 X It returns the number moved. */ X Xextern void goto_line(int); X/* Move the point somewhere on the nth line of the buffer returning X C_POS */ X Xextern int what_line(unsigned char *); X/* return the line number of position 'argument'. Does not move point */ X X/* count the number of lines in the region delimited by beg and end. X Counts lines from beg up to end but does not count end. X Does not move point. */ Xextern int count_lines(unsigned char *, unsigned char *); Xextern int extract_line(unsigned char **, unsigned char **); X Xextern Buffer *switch_to_buffer(Buffer *); Xextern void delete_buffer(Buffer *); Xextern Buffer *create_buffer(char *); X X X#endif X `032 X $ GOSUB UNPACK_FILE $ FILE_IS = "DISPLAY.H" $ CHECKSUM_IS = 1815365359 $ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY X `032 X#ifndef VMS X#include X#endif X Xextern int SCREEN_WIDTH; Xextern int SCREEN_WIDTH_M1; Xextern int SCREEN_HEIGHT; Xextern int SCREEN_ROWS; /* height - 1 */ X Xextern void set_scroll_region(int, int); Xextern void goto_rc(int, int); Xextern void curs_bol(); Xextern void cursor_forward(int); Xextern void cursor_backward(int); Xextern void cursor_up(int); Xextern void cursor_down(int); Xextern void begin_insert(); Xextern void end_insert(); Xextern void delete_char(); Xextern void delete_line(int); Xextern void set_attribute(int); Xextern void cls(); Xextern void reverse_index(); Xextern void set_width(int, int); Xextern void get_terminfo(); X#ifndef VMS Xextern void resize_display(); X#endif X $ GOSUB UNPACK_FILE $ FILE_IS = "EXTERNS.H" $ CHECKSUM_IS = 1247435957 $ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY Xextern char SEARCH_STR[80]; Xextern int SEARCH_DIRECTION; Xextern int STARTING_LINE; /* begin at this line upon startup of most */ Xextern int CASE_SENSITIVE; X Xextern int NUM_LINES; Xextern int ACTUAL_LINES; Xextern int CURS_ROW; Xextern int CURS_COL; Xextern unsigned char *CURS_POS; X Xextern int SQUEEZE_LINES; /* switch parameters */ Xextern int MOST_L_OPT; /* use `094L (formfeed) to clear screen */ Xextern int MOST_V_OPT; /* display control chars */ Xextern int MOST_B_OPT; /* display Binary File */ Vextern int MOST_T_OPT; /* display tab as `094I-- valid only with X V option */ Xextern int MOST_W_OPT; /* wrap lines if true */ Xextern int MOST_S_OPT; /* selective display */ Xextern int MOST_K_OPT; /* Kanji option */ X Xextern int MOST_D_OPT; /* delete file mode (see ':D') */ X X#define _MOST_V_OPT 1 X#define _MOST_T_OPT 2 X#define _MOST_B_OPT 4 X#define _MOST_SQ_OPT 8 X#define _MOST_W_OPT 16 X $ GOSUB UNPACK_FILE $ FILE_IS = "FILE.H" $ CHECKSUM_IS = 1511264704 $ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY Xextern int insert_file(char *); Xextern int find_file(char *); Xextern void find_file_in_window(char *); Xextern char *FILE_RING[500]; Xextern char C_DIR[80]; Xextern int NUM_FILES; X $ GOSUB UNPACK_FILE $ FILE_IS = "KEYM.H" $ CHECKSUM_IS = 1074473702 $ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY X `032 Xextern void beep_cmd(); Xextern void ctrl_x_map_cmd(); Xextern void ctrl_k_map_cmd(); Xextern void ctrl_w_map_cmd(); Xextern void pf1_map_cmd(); Xextern void pf1_esc_map_cmd(); Xextern void dec_extended_map_cmd(); Xextern void esc_map_cmd(); Xextern void page_down_cmd(); Xextern void search_cmd(); Xextern void help_cmd(); Xextern void next_line_cmd(); Xextern void previous_line_cmd(); Xextern void extended_cmd_cmd(); Xextern void redraw_cmd(); Xextern void goto_line_cmd(); Xextern void time_cmd(); Xextern void page_up_cmd(); Xextern void page_left_cmd(); Xextern void page_right_cmd(); Xextern void sys_spawn_cmd(); Xextern void set_mark_cmd(); Xextern void top_of_buffer_cmd(); Xextern void goto_mark_cmd(); Xextern void extended_key_cmd(); Xextern void search_back_cmd(); Xextern void find_next_cmd(); Xextern void end_of_buffer_cmd(); Xextern void exit_cmd(); Xextern void one_window_cmd(); Xextern void two_window_cmd(); Xextern void del_window_cmd(); Xextern void other_window_cmd(); Xextern void O_map_cmd(); Xextern void find_file_cmd(); Xextern void digit_arg_cmd(); Xextern void edit_cmd(); Xextern void toggle_width_cmd(); Xextern void goto_percent_cmd(); Xextern void edt_page_cmd(); Xextern void edt_forward_cmd(); Xextern void edt_back_cmd(); Xextern void edt_line_cmd(); Xextern void edt_find_cmd(); Xextern void edt_find_next_cmd(); X Xextern int *DIGIT_ARG; X X#ifdef VMS X#ifndef isdigit X#define isdigit(x) \ X (((x >= '0') && (x <= '9')) ? 1 : 0) X#endif X#endif X X $ GOSUB UNPACK_FILE $ FILE_IS = "LINE.H" $ CHECKSUM_IS = 1627542514 $ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY X#ifndef _DAVIS_LINE_H_ X#define _DAVIS_LINE_H_ Xextern int ascii_format_line(char *, char *); Xextern void expand_tabs(char *, char *); Xextern int analyse_line(unsigned char *, unsigned char *, char *, char *); Xextern void output(char *, int, char *, char); Xextern void display_line(); Xextern int apparant_distance(unsigned char *); X#endif X $ GOSUB UNPACK_FILE $ FILE_IS = "MOST.H" $ CHECKSUM_IS = 1162020864 $ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY Xextern int SQUEEZE_LINES; /* switch parameters */ Xextern int MOST_A_OPT; /* automatically choose -b if necessary */ Xextern int MOST_C_OPT; /* begin pages at top of screen */ Xextern int MOST_V_OPT; /* display control chars */ Xextern int MOST_B_OPT; /* display Binary File */ Vextern int MOST_T_OPT; /* display tab as `094I-- valid only with X V option */ Xextern int MOST_D_OPT; /* delete file mode (see ':D') */ Xextern int MOST_L_OPT; /* use `094L (formfeed) to clear screen */ X Xextern char *MOST_PROGRAM;`009 /* Program Name (argv[0]) */ Xextern void most( char *, int); X $ GOSUB UNPACK_FILE $ FILE_IS = "SEARCH.H" $ CHECKSUM_IS = 794428094 $ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY X#ifndef _DAVIS_SEARCH_H_ X#define _DAVIS_SEARCH_H_ X#include X#include X Xextern int SEARCH_DIR; X Xextern int search(unsigned char *, int, int *); Xextern int substring(char *, char *); X#endif X X $ GOSUB UNPACK_FILE $ FILE_IS = "SYSDEP.H" $ CHECKSUM_IS = 1635061083 $ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY X#ifndef __DAVIS_SYSDEP_H__ X#define __DAVIS_SYSDEP_H__ X X#include X `032 X#ifdef VMS X#include X#include X#include X#include X#include X#include X#include X#include X#include X#else Xextern char *getenv( char *); Xextern int read (int, char *, int); Xextern int unlink( char *); Xextern int sleep(unsigned); X#endif `032 X `032 X#ifdef VMS Xextern unsigned long SHELL_PID; `032 X Xextern int do_shell_command(); Xextern int expand_file_name(char *,char *); Xextern char *unix2vms(char *); X X#endif /* VMS */ X X#ifdef VMS Xtypedef struct `123 /* I/O status block */ X short i_cond; /* Condition value */ X short i_xfer; /* Transfer count */ X long i_info; /* Device information */ X`125 iosb; X`032 Xtypedef struct `123 /* Terminal characteristics */ X char t_class; /* Terminal class */ X char t_type; /* Terminal type */ X short t_width; /* Terminal width in characters */ X long t_mandl; /* Terminal's mode and length */ X long t_extend; /* Extended terminal characteristics */ X`125 termchar; `032 X Xshort TTY_CHANNEL_GLOBAL; X X#else X#define TTY_DESCR 2 Xextern int ioctl(int, int, ...); X X#ifdef BSD X#include X struct ltchars OLDTTY_LC; X struct tchars OLDTTY_TC; X struct sgttyb OLDTTY; X#else X#include X struct termio OLDTTY; X#endif X#endif /* VMS */ X Xextern int INPUT_BUFFER_LEN; Xextern char INPUT_BUFFER[80]; X Xextern void init_tty(); Xextern void reset_tty(); Xextern char getkey(); Xextern void ungetkey(char); Xextern void sys_resume(); Xextern void get_term_dimensions(int *, int *); Xextern int sys_delete_file(char *); X Xextern char *get_time(); X#endif /* __DAVIS_SYSDEP_H__ */ X $ GOSUB UNPACK_FILE $ FILE_IS = "WINDOW.H" $ CHECKSUM_IS = 862408591 $ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY X#ifndef _DAVIS_WINDOW_H_ X#define _DAVIS_WINDOW_H_ X#include "buffer.h" X Xstruct Window_Type X `123 X unsigned char *beg_pos; /* buffer pos of top line */ X int beg_line; /* line number of top */ X int curs_line; /* line number of curs pos */ X int curs_col; /* column number of curs pos */ X unsigned char *curs_pos; /* pos of curs pos */ X int col; /* column offset */ V int n_lines; /* number of lines of buffer (mode dependent) X */ X int top; /* screen location of top */ X int bot; /* screen location of bot */ V int display; /* value of MOST_S_OPT for selective display X */ X char *status; /* status line */ X Buffer *buf; /* buffer structure in window */ X struct Window_Type *next; /* next window */ X struct Window_Type *prev; /* prev window */ X int flags; /* Squeeze lines, etc.. */ X int lock; /* true if locked */ X `125; Xtypedef struct Window_Type Window; X Xextern Window *WIN; Xextern Window *TOP_WIN; Xextern int COLUMN; Xextern int CURS_ROW; Xextern int CURS_COL; Xextern unsigned char *CURS_POS; Xextern int RESTORE_WIDTH_TO; Vextern void update_window(int); /* moves window to have arg lines on the top X */ Xextern void update_status(); Xextern void redraw_window(); /* redraws window updating the structure */ Xextern void clear_window(); Xextern void window_buffer(); Xextern void init_display(); Xextern void reset_display(); Xextern void other_window(int); Xextern void toggle_lock(); Xextern void set_window(Window *); X Xextern void message(char *, int); Xextern void clear_minibuffer(); X#endif X $ GOSUB UNPACK_FILE $ FILE_IS = "MAKE.COM" $ CHECKSUM_IS = 1701516493 $ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY X$ files = "" X$ files = files + ",main.c" - ".c" X$ files = files + ",buffer.c" - ".c" X$ files = files + ",file.c" - ".c" X$ files = files + ",window.c" - ".c" X$ files = files + ",line.c" - ".c" X$ files = files + ",display.c" - ".c" X$ files = files + ",sysdep.c" - ".c" X$ files = files + ",keym.c" - ".c" X$ files = files + ",most.c" - ".c" X$ files = files + ",search.c" - ".c" X$ files = files + ",help.c" - ".c" X$ files = files + ",dir.c" - ".c" X$ files = files + ",cmd.c" - ".c" X$ files = files + ",edit.c" - ".c" X$ files = files - "," X$! X$! if you do not want the doc file used as help, but want a short one page X$! help summary then comment out the following line: X$ cc := cc/define=MOST_HELP_USE_DOC X$! X$ if (p1 .eqs. "LINK") then goto do_link X$ write sys$output "Compiling..." X$ cc 'files' X$ do_link: X$ write sys$output "Linking..." X$ link/exec = most 'files',sys$input/opt XSYS$LIBRARY:VAXCRTL/SHARE X$ write sys$output "Setting up MOST... X$ curr_dir = f$environment("DEFAULT") X$ most = "$" + curr_dir + "most.exe" X$ most :== 'most' X$ most_h = curr_dir + "most.doc" X$ define MOST_HELP 'most_h' X$ type := type X$ type sys$input X `032 X MOST is now setup for this login session. `032 X `032 X Type 'most filename' to view the file 'filename'. X In particular, type 'most most.doc' to read the doc file. X X$ exit X $ GOSUB UNPACK_FILE $ FILE_IS = "MAKECOM.COM" $ CHECKSUM_IS = 1527932967 $ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY X$! X$! if you do not want the doc file used as help, but want a short one page X$! help summary then comment out the following line: X$ cc := cc/define=MOST_HELP_USE_DOC X$! X$ if (p1 .eqs. "LINK") then goto do_link X$ write sys$output "Compiling..." X$ cc 'files' X$ do_link: X$ write sys$output "Linking..." X$ link/exec = most 'files',sys$input/opt XSYS$LIBRARY:VAXCRTL/SHARE X$ write sys$output "Setting up MOST... X$ curr_dir = f$environment("DEFAULT") X$ most = "$" + curr_dir + "most.exe" X$ most :== 'most' X$ most_h = curr_dir + "most.doc" X$ define MOST_HELP 'most_h' X$ type := type X$ type sys$input X `032 X MOST is now setup for this login session. `032 X `032 X Type 'most filename' to view the file 'filename'. X In particular, type 'most most.doc' to read the doc file. X X$ exit X $ GOSUB UNPACK_FILE $ FILE_IS = "MAKEFILE." $ CHECKSUM_IS = 141974691 $ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY X# if you do not want the foc file used as help, but want a short one page X# help summary then comment out the following line: XHELP = -DMOST_HELP_USE_DOC X# and uncomment the next line: X# HELP = X XCFILES = main.c buffer.c file.c window.c line.c display.c \ X sysdep.c keym.c most.c search.c help.c dir.c cmd.c edit.c XOBJS = main.o buffer.o file.o window.o line.o display.o \ X sysdep.o keym.o most.o search.o help.o dir.o cmd.o edit.o XHFILES = buffer.h file.h window.h line.h display.h \ X sysdep.h keym.h most.h search.h externs.h XMISC = most.1 most.doc make.com aaa_read.me rtl.opt changes.txt makefile\ X makecom.com X XCC = cc`032 XCFLAGS = -g $(HELP) XEXEC = m X X$(EXEC): $(OBJS) X`009$(CC) $(CFLAGS) $(OBJS) -o $(EXEC) X Xunix: X`009shar -b $(CFILES) $(HFILES) $(MISC) > most.shar X Xmost.doc:`009most.1 X`009`009nroff -man $? > $@ X Xvms: X`009(echo "\$$ files = \"\"" ) > make.com X`009for file in $(CFILES); do\ X`009 (echo "\$$ files = files + \",$$file\" - \".c\"")\ X >> make.com; \ X`009done X`009(echo "\$$ files = files - \",\"" ) >> make.com X`009(cat makecom.com) >> make.com X`009pack $(CFILES) $(HFILES) $(MISC) -o most.com X Xlpr: X`009for file in $(CFILES) $(HFILES); do\ X`009`009pprint north $$file -l c -p; \ X`009done X X X X X X X $ GOSUB UNPACK_FILE $ FILE_IS = "MOST.1" $ CHECKSUM_IS = 1549145168 $ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY X.\"-------------------------------------------------------------------- X.\" UX - UNIX macro, to append \(rg to the first usage X.\"-------------------------------------------------------------------- X.de UX X.ie \\n(UX \s-1UNIX\s0\\$1 X.el \`123\s-1UNIX\s0\\$1\*(Rg X. nr UX 1 X.\`125 X.. X.\"-------------------------------------------------------------------- X.\" Ds - start indented display X.\" De - end indented display X.\"-------------------------------------------------------------------- X.de Ds X.nf X'in +0.5i X.. X.de De X'in X.fi X.. X.TH MOST 1 "1 June 1992" X.SH NAME Xmost \- browse or page through a text file X.SH SYNOPSIS X.B most X.RB [ \-bstvw ] X.RB [ +\fIlineno\fB ] X.RB [ +c ] X.RB [ +d ] X.RB [ +/\fIstring\fB ] X.RI [ filename ...] X.SH DESCRIPTION X.I most Xis a paging program that displays, Xone windowful at a time, Xthe contents of a file on a X.RI vt xxx Xcompatable terminal. XIt pauses after each windowful and prints on the window status line Xthe screen the file name, current line number, Xand the percentage of the file so far displayed. X.PP XUnlike other paging programs, X.I most Xis capable of displaying an arbitrary number of windows Xas long as each window occupies at least two screen lines. XEach window may contain the same file or a different file. XIn addition, each window has its own mode. XFor example, one window may display a file with its lines wrapped while Xanother may be truncating the lines. XWindows may be `096locked' Xtogether in the sense that if one of the locked windows scrolls, Xall locked windows will scroll. X.I most Xis also capable of ignoring lines Xthat are indented beyond a user specified value. XThis is useful when viewing computer programs to pick out Xgross features of the code. XSee the X.RB `096 :o ' Xcommand for a description of this feature. X.PP XIn addition to displaying ordinary text files, X.I most Xcan also display binary files as well as files with arbitrary ascii Xcharacters. XWhen a file is read into a buffer, X.I most Xexamines the first 32 bytes of Xthe file to determine if the file is a binary file and then switches Xto the appropriate mode. XHowever, this feature may be disabled with the X.B \-k Xoption. XSee the description of the X.BR \-b , X.BR \-k , X.BR \-v , Xand X.B \-t Xoptions for further details. X.PP XText files may contain combinations of underscore and backspace Xcharacters causing a printer to underline or overstrike. XWhen X.I most Xrecognizes this, Xit inserts the appropriate escape sequences to Xachieve these the desired effect on X.RI vt xxx Xcompatable terminals. XIn addition, Xsome files cause the printer to overstrike some characters Xby embedding carriage return characters in the middle of a line. XWhen this occurs, X.I most Xdisplays the overstruck character with a bold Xattribute. XThis feature facilitates the reading of X.UX Xman pages or a document produced by X.IR runoff . XIn particular, Xviewing this document with X.I most Xshould illustrate this behavior provided that the Xunderline characters have not been stripped. XThis may be turned off with the X.B \-v Xoption. X.PP XBy default, lines with more characters than the terminal width are Xnot wrapped but are instead truncated. XWhen truncation occurs, this Xis indicated by a `096$' in the far right column of the terminal Xscreen. XThe RIGHT and LEFT arrow keys may be used to view lines Xwhich extend past the margins of the screen. XThe X.B \-w Xoption may be used to override this feature. XWhen a window is wrapped, Xthe character `096\e' will appear at the right edge of the window. X.PP XCommands are listed below. X.SH OPTIONS X.TP X.B \-b XBinary mode. XUse this switch when you want to view files Xcontaining 8 bit characters. X.I most Xwill display the file 16 bytes per line in hexidecimal notation. XA typical line looks like: X.IP X.Ds X01000000 40001575 9C23A020 4000168D ....@..u.#. @... X.De X.IP XWhen used with the X.B \-v Xoption, the same line looks like: X.IP X.Ds V`094A`094@`094@`094@ @`094@`094U u 9C #A0 @`094@`094V8D ....@..u.#. @ X... X.De X.TP X.B \-k X`096Kanji' option. XOrdinarily, X.I most Xwill go into binary mode if the file consists of non-ascii characters. XSometimes this feature is not desirable since some Xterminals have a special interpretation for eight bit Xcharacters. XThe X.B \-k Xoption turns off the automatic sensing. X.TP X.B \-s XSqueeze. XReplace multiple blank lines with a single blank line. X.TP X.B \-v XDisplay control characters as in `096`094A' for control A. XNormally X.I most Xdoes not interpret control characters. X.TP X.B \-t XDisplay tabs as `096`094I'. XThis option is meaningful only when used with the X.B \-v Xoption. X.BI + lineno XStart up at X.IR lineno . X.TP X.B +c XMake search case sensitive. XBy default, they are not. X.TP X.B +d XThis switch should only be used if you want the option to Xdelete a file while viewing it. XThis makes it easier to Xclean unwanted files out of a directory. XThe file is Xdeleted with the interactive key sequence X.RB `096 :D ' Xand then confirming with X.RB `096 y '. X.TP X.BI +/ string XStart up at the line containing the first occurrence of X.IR string . X.SH "COMMAND USAGE" XThe commands take effect immediately; it is not necessary to type a Xcarriage return. X.PP XIn the following commands, X.I i Xis a numerical argument X(1 by default). X.TP X.BR SPACE ", " CTRL-D ", " NEXT_SCREEN XDisplay another windowful, or jump X.I i Xwindowfuls if X.I i Xis specified. X.TP X\fBRETURN\fR, \fBDOWN_ARROW\fR, \fBV\fR, \fBCTRL-N\fR XDisplay another line, or X.I i Xmore lines, if specified. X.TP X.BR UP_ARROW ", " `094 ", " CTRL-P XDisplay previous line, or X.I i Xprevious lines, if specified. X.TP X.BR T ", " ESCAPE < XMove to top of buffer. X.TP X.BR B ", " ESCAPE > XMove to bottom of buffer. X.TP X.BR RIGHT_ARROW ", " TAB ", " > XScroll window left X.RI 60 i Xcolumns to view lines that are beyond the right margin of the window. X.TP X.BR LEFT_ARROW ", " CTRL-B ", " < XScroll window right X.RI 60 i Xcolumns to view lines that are beyond the left margin of the window. X.TP X\fBU\fR, \fBCTRL-U\fR, \fBDELETE\fR, \fBPREV_SCREEN\fR XSkip back X.I i Xwindowfuls and then print a windowful. X.TP X.BR R ", " CTRL-R XRedraw the window. X.TP X.BR J ", " G XIf X.I i Xis not specified, then prompt for a line number then jump to that line Xotherwise just jump to line X.IR i . X.TP X.B % XIf X.I i Xis not specified, then prompt for a Xpercent number then jump to that percent of the Xfile otherwise just jump to X.I i Xpercent of the file. X.TP X.BR W ", " w XIf the current screen width is 80, make it 132 and vice-versa. XFor other values, this command is ignored. X.TP X\fBQ\fR, \fBCTRL-X CTRL-C\fR, \fBCTRL-K E\fR XExit from X.IR most . XOn VMS, `094Z also exits. X.TP X.BR h ", " CTRL-H ", " HELP ", " PF2 XHelp. XGive a description of all the X.I most Xcommands. XThe X.I most Xenvironment variable X.B MOST_HELP Xmust be set for this to be meaningful. X.TP X\fBf\fR, \fB/\fR, \fBCTRL-F\fR, \fBFIND\fR, \fBGOLD PF3\fr XPrompt for a string and search forward from the Xcurrent line for X.IR i th Xdistinct line containing the string. X.B CTRL-G Xaborts. X.TP X.B ? XPrompt for a string and search backward for the X.IR i th Xdistinct line containing the string. X.B CTRL-G Xaborts. X.TP X.B n XSearch for the next X.I i Xlines containing an occurrence of the last search string in the Xdirection of the previous search. X.\"------- X.\" The '@' causes problems when included in a paragraph tag X.\" in my system's -man macro set, so jump though some hoops to X.\" avoid doing this. X.\"------- X.PP X\fBm\fR, \fBSELECT\fR, \fBCTRL-@\fR, \fBCTRL-K M\fR, \fBPERIOD\fR X.PD 0 X.IP X.PD XSet a mark on the current line for later reference. X.TP X.BR "INSERT_HERE, CTRL-X CTRL-X, COMMA, CTRL-K RETURN, GOLD PERIOD" XSet a mark on the current line but return to previous mark. XThis allows the user to toggle back and forth between two positions Xin the file. X.TP X.BR l ", " L XToggle locking for this window. XThe window is locked if there is a `096*' at the left edge Xof the status line. XWindows locked together, scroll together. X.TP X.BR "CTRL-X 2" ", " "CTRL-W 2" ", " "GOLD X" XSplit this window in half. X.TP X.BR "CTRL-X o" ", " "CTRL-W o" ", " o ", " GOLD UP ", " GOLD DOWN`032 XMove to other window. X.TP X.BR "CTRL-X 0" ", " "CTRL-W 0" ", " "GOLD V" XDelete this window. X.TP X.BR "CTRL-X 1" ", " "CTRL-W 1" ", " "GOLD O" XDelete all other windows, leaving only one window. X.TP X.BR E ", " e XEdit this file. XThis does not spawn an editor, rather X.I most Xuses callable EDT and TPU routines to perform the editing task. XIn addition, X.I most Xcan attach to a kept editor. XSee the above discussion of the environment variable X.BR MOST_EDITOR . X.TP X.BR $ ", " "ESC $" XThis is system dependent. XOn VMS, this causes X.I most Xto spawn a subprocess. XWhen the user exits the process, X.I most Xis resumed. XOn X.UX Xsystems, X.I most Xsimply suspends itself. X.TP X.B :n XSkip to the next filename given in the command line. XUse the arrow keys to scroll forward or backward Xthrough the file list. X.RB `096 Q ' Xquits X.I most Xand any other key selects the given file. X.TP X.B :c XToggle case sensitive search. X.TP X.B :D XDelete current file. XThis command is only meaningful with the X.B +d Xswitch. X.TP X.BR :o ", " :O XToggle various options. XWith this key sequence, X.I most Xdisplays a prompt asking the user to hit Xone of: X.BR bdtvw . XThe X.RB `096 b ', X.RB `096 t ', X.RB `096 v ', Xand X.RB `096 w ' Xoptions have the same meaning as the command Xline switches. XFor example, the X.RB `096 w ' Xoption will toggle wrapping on and off for the current window. X.IP XThe X.RB `096 d ' Xoption must be used with a prefix integer X.IR i . XAll lines indented beyond X.I i Xcolumns will not be displayed. XFor example, consider the fragment: X.IP X.Ds X.ne 11 Xint main(int argc, char **argv) X`123 X`009int i; X X`009for (i = 0; i < argc, i++) X`009`123 X`009`009fprintf(stdout,"%i: %s\en",i,argv[i]); X`009`125 X`009return 0; X`125 X.De X.IP XThe key sequence X.RB `096 1:od ' Xwill cause X.I most Xto display the file ignoring all lines indented beyond the first column. XSo for the example above, X.I most Xwould display: X.IP X.Ds X.ne 2 Xint main(int argc, char **argv)... X`125 X.De X.IP Xwhere the `096...' indicates lines follow are not displayed. X.SH HINTS X.B CTRL-G Xaborts the commands requiring the user to type something Xin at a prompt. XThe backquote key has a special meaning here. XIt is used to quote certain characters. XThis is useful when search for Xthe occurrence of a string with a control character or a string at Xthe beginning of a line. XIn the latter case, to find the occurrence Xof `096The' at the beginning of a line, enter X.B `096`094JThe Xwhere X.B `096 Xquotes the X.BR CTRL-J . X.SH ENVIRONMENT X.I most Xuses the following environment variables: X.TP X.B MOST_SWITCHES XThis variable sets commonly used switches. XFor example, Xsome people prefer to use X.I most Xwith the X.B \-s Xoption so that excess blank lines are not displayed. XOn VMS this is normally done done in the login.com through the line: X.IP X.Ds X$ define MOST_SWITCHES "-s" X.De X.TP X.BR MOST_EDITOR " (VMS only)" XSet this logical to one of three values: EDT, TPU, or EMACS. XThe default is EDT. X.I most Xdoes not spawn an editor. XRather, it uses callable EDT and TPU to perform the editing task. XSince VMS does not support callable EMACS, X.I most Xwill attempt to attach to a kept EMACS. XFor this case, X.I most Xlooks for the logical name EMACS_PID and attaches to the process with Xthat pid. XIt then defines the logicals EMACS_FILE_NAME and XEMACS_FILE_LINE which EMACS can check upon attaching to it. X.TP X.B MOST_HELP XThis variable must be setup to point to the X.I most Xhelpfile. XWithout this X.I most Xwill not be able to provide online help. XHowever, this behavior may be changed at compile time. XSee the Makefile for more information. X.SH BUGS XAlmost all of the known bugs or limitations of X.I most Xare due to a desire to read and interpret control characters in files. XOne problem concerns the use of backspace characters to underscore or Xoverstrike other characters. X.I most Xmakes an attempt to use terminal Xescape sequences to simulate this behavior. XOne side effect is the Xone does not always get what one expects when scrolling right and Xleft through a file. XWhen in doubt, use the X.B \-v Xand X.B \-b Xoptions of X.IR most . X.PP XString may not work properly with binary files. X.PP XAt this time, X.I most Xonly works well with terminals understanding Xvt100 escape sequences. X.I most Xdoes not seem to have any problem with X.IR xterm . X.PP X.IR malloc (3) Xfailures are not checked. X.I most Xmay crash if there is not Xenough room to hold the file. X.SH AUTHOR XJohn E. Davis X.br XThe Ohio State University X.br XDepartment of Physics X.br Xdavis@pacific.mps.ohio-state.edu X.SH ACKNOWLEDGEMENTS XI would like to thank the users of X.I most Xfor valuable comments and criticisms. XI would especially like to thank those individuals Xwho have contributed code to X.IR most : X.PP XMats Akerberg, Henk D. Davids, Rex O. Livingston, and Mark Pizzolato X.PP XI would also like to thank Shinichi Hama for his valuable criticisms of X.IR most . X.PP XThanks to David W. Sanderson (dws@cs.wisc.edu) for adapting the Xdocumentation to nroff man page source format. X $ GOSUB UNPACK_FILE $ FILE_IS = "MOST.DOC" $ CHECKSUM_IS = 1128217201 $ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY X X X X 1 June 1992 MOST(1) X X X X NAME X most - browse or page through a text file X X SYNOPSIS V most [-bstvw] [+_`008l_`008i_`008n_`008e_`008n_`008o] [+c] [+d] [+/ V_`008s_`008t_`008r_`008i_`008n_`008g] [_`008f_`008i_`008l_`008e_`008n_`008a_` X008m_`008e...] X X DESCRIPTION V _`008m_`008o_`008s_`008t is a paging program that displays, one win Xdowful at a time, V the contents of a file on a vt_`008x_`008x_`008x compatable termina Xl. It pauses X after each windowful and prints on the window status line the X screen the file name, current line number, and the percentage of X the file so far displayed. X V Unlike other paging programs, _`008m_`008o_`008s_`008t is capable o Xf displaying an X arbitrary number of windows as long as each window occupies at X least two screen lines. Each window may contain the same file or X a different file. In addition, each window has its own mode. X For example, one window may display a file with its lines wrapped X while another may be truncating the lines. Windows may be X `096locked' together in the sense that if one of the locked windows V scrolls, all locked windows will scroll. _`008m_`008o_`008s_`008t X is also capable of X ignoring lines that are indented beyond a user specified value. X This is useful when viewing computer programs to pick out gross X features of the code. See the `096:o' command for a description of X this feature. X V In addition to displaying ordinary text files, _`008m_`008o_`008s_` X008t can also X display binary files as well as files with arbitrary ascii char- V acters. When a file is read into a buffer, _`008m_`008o_`008s_`008 Xt examines the X first 32 bytes of the file to determine if the file is a binary X file and then switches to the appropriate mode. However, this X feature may be disabled with the -k option. See the description X of the -b, -k, -v, and -t options for further details. X X Text files may contain combinations of underscore and backspace X characters causing a printer to underline or overstrike. When V _`008m_`008o_`008s_`008t recognizes this, it inserts the appropriat Xe escape sequences V to achieve these the desired effect on vt_`008x_`008x_`008x compata Xble termi- X nals. In addition, some files cause the printer to overstrike X some characters by embedding carriage return characters in the V middle of a line. When this occurs, _`008m_`008o_`008s_`008t displ Xays the overstruck X character with a bold attribute. This feature facilitates the V reading of UNIX man pages or a document produced by _`008r_`008u_`0 X08n_`008o_`008f_`008f. In V particular, viewing this document with _`008m_`008o_`008s_`008t sho Xuld illustrate X this behavior provided that the underline characters have not X been stripped. This may be turned off with the -v option. X X By default, lines with more characters than the terminal width X are not wrapped but are instead truncated. When truncation V occurs, this is indicated by a `096$' in the far right column of th Xe X terminal screen. The RIGHT and LEFT arrow keys may be used to X view lines which extend past the margins of the screen. The -w X option may be used to override this feature. When a window is X X X 1 X X X X X X X MOST(1) 1 June 1992 X X X wrapped, the character `096\' will appear at the right edge of the X window. X X Commands are listed below. X X OPTIONS X X -b Binary mode. Use this switch when you want to view files V containing 8 bit characters. _`008m_`008o_`008s_`008t will di Xsplay the file 16 X bytes per line in hexidecimal notation. A typical line X looks like: X X X 01000000 40001575 9C23A020 4000168D ....@..u.#. @... X X When used with the -v option, the same line looks like: X X V `094A`094@`094@`094@ @`094@`094U u 9C #A0 @`094@`094V X8D ....@..u.#. @... X V -k `096Kanji' option. Ordinarily, _`008m_`008o_`008s_`008t will X go into binary mode X if the file consists of non-ascii characters. Sometimes X this feature is not desirable since some terminals have a X special interpretation for eight bit characters. The -k X option turns off the automatic sensing. X X -s Squeeze. Replace multiple blank lines with a single blank X line. X V -v Display control characters as in `096`094A' for control A. No Xr- V mally _`008m_`008o_`008s_`008t does not interpret control char Xacters. X V -t Display tabs as `096`094I'. This option is meaningful only wh Xen V used with the -v option. +_`008l_`008i_`008n_`008e_`008n_`008 Xo Start up at _`008l_`008i_`008n_`008e_`008n_`008o. X X +c Make search case sensitive. By default, they are not. X X +d This switch should only be used if you want the option to X delete a file while viewing it. This makes it easier to X clean unwanted files out of a directory. The file is V deleted with the interactive key sequence `096:D' and then con X- X firming with `096y'. X X +/_`008s_`008t_`008r_`008i_`008n_`008g X Start up at the line containing the first occurrence of X _`008s_`008t_`008r_`008i_`008n_`008g. X X COMMAND USAGE X The commands take effect immediately; it is not necessary to type X a carriage return. X X In the following commands, _`008i is a numerical argument (1 by X default). X X X X 2 X X X X X X X 1 June 1992 MOST(1) X X X SPACE, CTRL-D, NEXT_SCREEN V Display another windowful, or jump _`008i windowfuls if _`008i X is X specified. X X RETURN, DOWN_ARROW, V, CTRL-N X Display another line, or _`008i more lines, if specified. X X UP_ARROW, `094, CTRL-P X Display previous line, or _`008i previous lines, if specified. X X T, ESCAPE< X Move to top of buffer. X X B, ESCAPE> X Move to bottom of buffer. X X RIGHT_ARROW, TAB, > V Scroll window left 60_`008i columns to view lines that are bey Xond X the right margin of the window. X X LEFT_ARROW, CTRL-B, < X Scroll window right 60_`008i columns to view lines that are X beyond the left margin of the window. X X U, CTRL-U, DELETE, PREV_SCREEN X Skip back _`008i windowfuls and then print a windowful. X X R, CTRL-R X Redraw the window. X X J, G If _`008i is not specified, then prompt for a line number then X jump to that line otherwise just jump to line _`008i. X V % If _`008i is not specified, then prompt for a percent number t Xhen X jump to that percent of the file otherwise just jump to _`008i X percent of the file. X X W, w If the current screen width is 80, make it 132 and vice- X versa. For other values, this command is ignored. X X Q, CTRL-X CTRL-C, CTRL-K E X Exit from _`008m_`008o_`008s_`008t. On VMS, `094Z also exits. X X h, CTRL-H, HELP, V Help. Give a description of all the _`008m_`008o_`008s_`008t X commands. The V _`008m_`008o_`008s_`008t environment variable MOST_HELP must b Xe set for this to X be meaningful. X X f, /, CTRL-F, FIND, GOLD PF3 X Prompt for a string and search forward from the current line V for _`008ith distinct line containing the string. CTRL-G abor Xts. X V ? Prompt for a string and search backward for the _`008ith disti Xnct X line containing the string. CTRL-G aborts. X X X 3 X X X X X X X MOST(1) 1 June 1992 X X V n Search for the next _`008i lines containing an occurrence of t Xhe X last search string in the direction of the previous search. X X m, SELECT, CTRL-@, CTRL-K M, PERIOD X Set a mark on the current line for later reference. X X INSERT_HERE, CTRL-X CTRL-X, COMMA, CTRL-K RETURN, GOLD PERIOD X Set a mark on the current line but return to previous mark. X This allows the user to toggle back and forth between two X positions in the file. X X l, L Toggle locking for this window. The window is locked if V there is a `096*' at the left edge of the status line. Window Xs X locked together, scroll together. X X CTRL-X 2, CTRL-W 2, GOLD X X Split this window in half. X X CTRL-X o, CTRL-W o, o, X Move to other window. X X CTRL-X 0, CTRL-W 0, GOLD V X Delete this window. X X CTRL-X 1, CTRL-W 1, GOLD O X Delete all other windows, leaving only one window. X V E, e Edit this file. This does not spawn an editor, rather _`008m_ X`008o_`008s_`008t X uses callable EDT and TPU routines to perform the editing V task. In addition, _`008m_`008o_`008s_`008t can attach to a k Xept editor. See X the above discussion of the environment variable X MOST_EDITOR. X X $, ESC $ V This is system dependent. On VMS, this causes _`008m_`008o_`0 X08s_`008t to spawn V a subprocess. When the user exits the process, _`008m_`008o_` X008s_`008t is V resumed. On UNIX systems, _`008m_`008o_`008s_`008t simply sus Xpends itself. X X :n Skip to the next filename given in the command line. Use X the arrow keys to scroll forward or backward through the V file list. `096Q' quits _`008m_`008o_`008s_`008t and any othe Xr key selects the X given file. X X :c Toggle case sensitive search. X X :D Delete current file. This command is only meaningful with X the +d switch. X X :o, :O V Toggle various options. With this key sequence, _`008m_`008o_ X`008s_`008t X displays a prompt asking the user to hit one of: bdtvw. The V `096b', `096t', `096v', and `096w' options have the same meani Xng as the X command line switches. For example, the `096w' option will X toggle wrapping on and off for the current window. X X X 4 X X X X X X X 1 June 1992 MOST(1) X X V The `096d' option must be used with a prefix integer _`008i. X All V lines indented beyond _`008i columns will not be displayed. F Xor X example, consider the fragment: X X X int main(int argc, char **argv) X `123 X int i; X X for (i = 0; i < argc, i++) X `123 X fprintf(stdout,"%i: %s\n",i,argv[i]); X `125 X return 0; X `125 X V The key sequence `0961:od' will cause _`008m_`008o_`008s_`008t X to display the file X ignoring all lines indented beyond the first column. So for X the example above, _`008m_`008o_`008s_`008t would display: X X X int main(int argc, char **argv)... X `125 X X where the `096...' indicates lines follow are not displayed. X X HINTS X CTRL-G aborts the commands requiring the user to type something X in at a prompt. The backquote key has a special meaning here. X It is used to quote certain characters. This is useful when X search for the occurrence of a string with a control character or X a string at the beginning of a line. In the latter case, to find V the occurrence of `096The' at the beginning of a line, enter `096`0 X94JThe X where `096 quotes the CTRL-J. X X ENVIRONMENT X _`008m_`008o_`008s_`008t uses the following environment variables: X X MOST_SWITCHES X This variable sets commonly used switches. For example, V some people prefer to use _`008m_`008o_`008s_`008t with the -s X option so that X excess blank lines are not displayed. On VMS this is nor- X mally done done in the login.com through the line: X X X $ define MOST_SWITCHES "-s" X X MOST_EDITOR (VMS only) X Set this logical to one of three values: EDT, TPU, or EMACS. V The default is EDT. _`008m_`008o_`008s_`008t does not spawn a Xn editor. Rather, X it uses callable EDT and TPU to perform the editing task. V Since VMS does not support callable EMACS, _`008m_`008o_`008s_ X`008t will attempt V to attach to a kept EMACS. For this case, _`008m_`008o_`008s_ X`008t looks for X the logical name EMACS_PID and attaches to the process with X X X 5 X X X X X X X MOST(1) 1 June 1992 X X X that pid. It then defines the logicals EMACS_FILE_NAME and X EMACS_FILE_LINE which EMACS can check upon attaching to it. X X MOST_HELP V This variable must be setup to point to the _`008m_`008o_`008s X_`008t helpfile. V Without this _`008m_`008o_`008s_`008t will not be able to prov Xide online help. X However, this behavior may be changed at compile time. See X the Makefile for more information. X X BUGS V Almost all of the known bugs or limitations of _`008m_`008o_`008s_` X008t are due to a X desire to read and interpret control characters in files. One X problem concerns the use of backspace characters to underscore or V overstrike other characters. _`008m_`008o_`008s_`008t makes an att Xempt to use termi- X nal escape sequences to simulate this behavior. One side effect X is the one does not always get what one expects when scrolling X right and left through a file. When in doubt, use the -v and -b X options of _`008m_`008o_`008s_`008t. X X String may not work properly with binary files. X V At this time, _`008m_`008o_`008s_`008t only works well with termina Xls understanding V vt100 escape sequences. _`008m_`008o_`008s_`008t does not seem to X have any problem X with _`008x_`008t_`008e_`008r_`008m. X V _`008m_`008a_`008l_`008l_`008o_`008c(3) failures are not checked. X _`008m_`008o_`008s_`008t may crash if there is X not enough room to hold the file. X X AUTHOR X John E. Davis X The Ohio State University X Department of Physics X davis@pacific.mps.ohio-state.edu X X ACKNOWLEDGEMENTS V I would like to thank the users of _`008m_`008o_`008s_`008t for val Xuable comments and X criticisms. I would especially like to thank those individuals X who have contributed code to _`008m_`008o_`008s_`008t: X X Mats Akerberg, Henk D. Davids, Rex O. Livingston, and Mark Pizzo- X lato X X I would also like to thank Shinichi Hama for his valuable criti- X cisms of _`008m_`008o_`008s_`008t. X X Thanks to David W. Sanderson (dws@cs.wisc.edu) for adapting the X documentation to nroff man page source format. X X X X X X X X X X 6 X X X`0279`0279 $ GOSUB UNPACK_FILE $ FILE_IS = "CHANGES.TXT" $ CHECKSUM_IS = 158341783 $ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY XNew Features in MOST version 3.2 (June 1, 1992) X X1. Some Bugs fixed. X2. EDT editor keypad keymappings now available (Thanks to Mark Pizzolato) X3. New most.1 man page (Thanks to David W. Sanderson) X XJohn E. Davis Xdavis@amy.tch.harvard.edu Xdavis@ohstpy.bitnet X X $ GOSUB UNPACK_FILE $ FILE_IS = "AAA_READ.ME" $ CHECKSUM_IS = 506041968 $ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY XThe following files should be present in this distribution: X X aaa_read.me --- This file X X most.c main.c buffer.c file.c window.c display.c sysdep.c keym.c X search.c help.c edit.c dir.c cmd.c line.c --- C files X X most.h buffer.h file.h window.h display.h sysdep.h keym.h X search.h externs.h --- Header files X X makefile -- makefile for unix systems X make.com -- `096makefile' for VMS X rtl.opt -- options file for VMS linking X changes.txt -- summary of recent changes X most.doc -- main documentation for most X most.1 -- nroff source X X XTo make MOST requires an ansi compatable c compiler. It compiles fine with X`096cc most.c' on Ultrix and VMS, and `096CC +V most.c -o most' on a sun4. XOther than this, I do not know what else to say. X X INSTALLATION INSTRUCTIONS X VOn VMS, type `096@make' at the DCL prompt to build most. On unix, `096make' X should Xwork--- if not, the makefile may need edited. X `032 XThen to run most, just type `096most "filename"' (eg. `096most login.com'). X VMOST has online help which is invoked with the `096h' key. To get online hel Xp Vfunctioning properly, the logical name `096MOST_HELP' must be defined to poin Xt Vthe correct doc file. To do this, put the following in your .cshrc (or equiv X) Xfile: X Xsetenv MOST_HELP most.doc X Xand if you are on VMS put X X$ define/nolog MOST_HELP MOST.DOC X XFor example, I have X Xsetenv MOST_HELP /u2/davis/most/most.doc X Xin my .cshrc on a unix host. X VThe other logical that most reads is `096MOST_SWITCHES'. This allows the use Xr to Xrun MOST with whatever switches are defined by this logical. I use most with Xthe -s and -c switches so I have X Xsetenv MOST_SWITCHES "-sca" X Xin my .cshrc file for unix and X X$ define/nolog MOST_SWITCHES "-sca" X Xin my login.com file on VMS. X X VI suggest that you first build MOST then view the doc file using MOST (`096mo Xst Vmost.doc'). If you need help, hit the `096h' key from within MOST. The `096 Xh' key Xsimply locates the part of the doc file that describes what the various key Xdo. One person has suggested that I use a one page help screen. However, I Vchose not to do this. Most has very few key sequences to memorize and the on Xe Xpage help screen will quickly outgrow it usefulness. X $ GOSUB UNPACK_FILE $ FILE_IS = "RTL.OPT" $ CHECKSUM_IS = 1914511182 $ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY XSYS$LIBRARY:VAXCRTL/SHARE X $ GOSUB UNPACK_FILE $ EXIT