1: /* 2: * less 3: * Copyright (c) 1984,1985 Mark Nudelman 4: * 5: * This program may be freely used and/or modified, 6: * with the following provisions: 7: * 1. This notice and the above copyright notice must remain intact. 8: * 2. Neither this program, nor any modification of it, 9: * may be sold for profit without written consent of the author. 10: * 11: * ----------------------------------------------------------------- 12: * 13: * This program is a paginator similar to "more", 14: * but allows you to move both forward and backward in the file. 15: * Commands are based on "more" and "vi". 16: * 17: * ----------------------- CHANGES --------------------------------- 18: * 19: * Allowed use on standard input 1/29/84 markn 20: * Added E, N, P commands 2/1/84 markn 21: * Added '=' command, 'stop' signal handling 4/17/84 markn 22: * Added line folding 4/20/84 markn 23: * v2: Fixed '=' command to use BOTTOM_PLUS_ONE, 24: * instead of TOP, added 'p' & 'v' commands 4/27/84 markn 25: * v3: Added -m and -t options, '-' command 5/3/84 markn 26: * v4: Added LESS environment variable 5/3/84 markn 27: * v5: New comments, fixed '-' command slightly 5/3/84 markn 28: * v6: Added -Q, visual bell 5/15/84 markn 29: * v7: Fixed jump_back(n) bug: n should count real 30: * lines, not folded lines. Also allow number 31: * on G command. 5/24/84 markn 32: * v8: Re-do -q and -Q commands 5/30/84 markn 33: * v9: Added "+<cmd>" argument 9/25/84 markn 34: * v10: Fixed bug in -b<n> argument processing 10/10/84 markn 35: * v11: Made error() ring bell if \n not entered. 10/18/84 markn 36: * ----------------------------------------------------------------- 37: * v12: Reorganized signal handling and made 38: * portable to 4.2bsd. 2/13/85 mark 39: * v13: Reword error message for '-' command. 2/16/85 mark 40: * v14: Added -bf and -bp variants of -b. 2/22/85 mark 41: * v15: Miscellaneous changes. 2/25/85 mark 42: * v16: Added -u flag for backspace processing. 3/13/85 mark 43: * v17: Added j and k commands, 44: * changed -t default. 4/13/85 mark 45: * v18: Rewrote signal handling code. 4/20/85 mark 46: * v19: Got rid of "verbose" eq_message(). 5/2/85 mark 47: * Made search() scroll in some cases. 48: * v20: Fixed screen.c ioctls for System V. 5/21/85 mark 49: * v21: Fixed some first_cmd bugs. 5/23/85 mark 50: * v22: Added support for no RECOMP nor REGCMP. 5/24/85 mark 51: * v23: Miscellanous changes and prettying up. 5/25/85 mark 52: * Posted to USENET. 53: * v24: Added ti,te terminal init & de-init 6/3/85 Mike Kersenbrock 54: * v25: Added -U flag, standout mode underlining. 6/8/85 mark 55: * v26: Added -M flag. 6/9/85 mark 56: * Use underline termcap (us) if it exists. 57: * v27: Renamed some variables to make unique in 6/15/85 mark 58: * 6 chars. Minor fix to -m. 59: * v28: Fixed right margin bug. 6/28/85 mark 60: * v29: Incorporated M.Rose's changes to signal.c 6/28/85 mark 61: * v30: Fixed stupid bug in argument processing. 6/29/85 mark 62: * v31: Added -p flag, changed repaint algorithm. 7/15/85 mark 63: * Added kludge for magic cookie terminals. 64: * v32: Added cat_file if output not a tty. 7/16/85 mark 65: * v33: Added -e flag and EDITOR. 7/23/85 mark 66: * v34: Added -s flag. 7/26/85 mark 67: * v35: Rewrote option handling; added option.c. 7/27/85 mark 68: * v36: Fixed -e flag to work if not last file. 7/29/85 mark 69: * v37: Added -x flag. 8/10/85 mark 70: * v38: Changed prompting; created prompt.c. 8/19/85 mark 71: * v39: (Not -p) does not initially clear screen. 8/24/85 mark 72: * v40: Added "skipping" indicator in forw(). 8/26/85 mark 73: * Posted to USENET. 74: * v41: ONLY_RETURN, control char commands, 9/17/85 mark 75: * faster search, other minor fixes. 76: * v42: Added ++ command line syntax; 9/25/85 mark 77: * ch_fsize for pipes. 78: * v43: Added -h flag, changed prim.c algorithms. 10/15/85 mark 79: * v44: Made END print in all cases of eof; 10/16/85 mark 80: * ignore SIGTTOU after receiving SIGTSTP. 81: * v45: Never print backspaces unless -u. 10/16/85 mark 82: * v46: Backwards scroll in jump_loc. 10/24/85 mark 83: * v47: Fixed bug in edit(): *first_cmd==0 10/30/85 mark 84: * v48: Use TIOCSETN instead of TIOCSETP. 11/16/85 mark 85: * Added marks (m and ' commands). 86: * Posted to USENET. 87: * ----------------------------------------------------------------- 88: * v49: Fixed bug: signal didn't clear mcc. 1/9/86 mark 89: * v50: Added ' (quote) to gomark. 1/15/86 mark 90: * v51: Added + cmd, fixed problem if first_cmd 91: * fails, made g cmd sort of "work" on pipes 92: * even if bof is no longer buffered. 1/16/86 mark 93: * v52: Made short files work better. 1/17/86 mark 94: * v53: Added -P option. 1/20/86 mark 95: * v54: Changed help to use HELPFILE. 1/20/86 mark 96: * v55: Messages work better if not tty output. 1/23/86 mark 97: * v56: Added -l option. 1/24/86 mark 98: * v57: Fixed -l to get confirmation before 99: * overwriting an existing file. 1/31/86 mark 100: * v58: Added filename globbing. 8/28/86 mark 101: * v59: Fixed some bugs with very long filenames. 9/15/86 mark 102: * v60: Incorporated changes from Leith (Casey) 103: * Leedom for boldface and -z option. 9/26/86 mark 104: * v61: Got rid of annoying repaints after ! cmd. 9/26/86 mark 105: * ----------------------------------------------------------------- 106: */ 107: 108: char version[] = "@(#) less version 61";