Commit | Line | Data |
---|---|---|
bfe13c81 KB |
1 | /* |
2 | * Copyright (c) 1988 Mark Nudleman | |
3 | * Copyright (c) 1988 Regents of the University of California. | |
4 | * All rights reserved. | |
5 | * | |
bfe13c81 KB |
6 | * Redistribution and use in source and binary forms are permitted |
7 | * provided that the above copyright notice and this paragraph are | |
8 | * duplicated in all such forms and that any documentation, | |
9 | * advertising materials, and other materials related to such | |
10 | * distribution and use acknowledge that the software was developed | |
a942b40b KB |
11 | * by Mark Nudleman and the University of California, Berkeley. The |
12 | * name of Mark Nudleman or the | |
bfe13c81 KB |
13 | * University may not be used to endorse or promote products derived |
14 | * from this software without specific prior written permission. | |
15 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR | |
16 | * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED | |
17 | * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. | |
18 | */ | |
19 | ||
20 | #ifndef lint | |
a942b40b | 21 | static char sccsid[] = "@(#)version.c 5.2 (Berkeley) %G%"; |
bfe13c81 KB |
22 | #endif /* not lint */ |
23 | ||
24 | /* | |
25 | * less | |
26 | * Copyright (c) 1984,1985 Mark Nudelman | |
27 | * | |
28 | * This program may be freely used and/or modified, | |
29 | * with the following provisions: | |
30 | * 1. This notice and the above copyright notice must remain intact. | |
31 | * 2. Neither this program, nor any modification of it, | |
32 | * may be sold for profit without written consent of the author. | |
33 | * | |
34 | * ----------------------------------------------------------------- | |
35 | * | |
36 | * This program is a paginator similar to "more", | |
37 | * but allows you to move both forward and backward in the file. | |
38 | * Commands are based on "more" and "vi". | |
39 | * | |
40 | * ----------------------- CHANGES --------------------------------- | |
41 | * | |
42 | * Allowed use on standard input 1/29/84 markn | |
43 | * Added E, N, P commands 2/1/84 markn | |
44 | * Added '=' command, 'stop' signal handling 4/17/84 markn | |
45 | * Added line folding 4/20/84 markn | |
46 | * v2: Fixed '=' command to use BOTTOM_PLUS_ONE, | |
47 | * instead of TOP, added 'p' & 'v' commands 4/27/84 markn | |
48 | * v3: Added -m and -t options, '-' command 5/3/84 markn | |
49 | * v4: Added LESS environment variable 5/3/84 markn | |
50 | * v5: New comments, fixed '-' command slightly 5/3/84 markn | |
51 | * v6: Added -Q, visual bell 5/15/84 markn | |
52 | * v7: Fixed jump_back(n) bug: n should count real | |
53 | * lines, not folded lines. Also allow number | |
54 | * on G command. 5/24/84 markn | |
55 | * v8: Re-do -q and -Q commands 5/30/84 markn | |
56 | * v9: Added "+<cmd>" argument 9/25/84 markn | |
57 | * v10: Fixed bug in -b<n> argument processing 10/10/84 markn | |
58 | * v11: Made error() ring bell if \n not entered. 10/18/84 markn | |
59 | * ----------------------------------------------------------------- | |
60 | * v12: Reorganized signal handling and made | |
61 | * portable to 4.2bsd. 2/13/85 mark | |
62 | * v13: Reword error message for '-' command. 2/16/85 mark | |
63 | * v14: Added -bf and -bp variants of -b. 2/22/85 mark | |
64 | * v15: Miscellaneous changes. 2/25/85 mark | |
65 | * v16: Added -u flag for backspace processing. 3/13/85 mark | |
66 | * v17: Added j and k commands, | |
67 | * changed -t default. 4/13/85 mark | |
68 | * v18: Rewrote signal handling code. 4/20/85 mark | |
69 | * v19: Got rid of "verbose" eq_message(). 5/2/85 mark | |
70 | * Made search() scroll in some cases. | |
71 | * v20: Fixed screen.c ioctls for System V. 5/21/85 mark | |
72 | * v21: Fixed some first_cmd bugs. 5/23/85 mark | |
73 | * v22: Added support for no RECOMP nor REGCMP. 5/24/85 mark | |
74 | * v23: Miscellanous changes and prettying up. 5/25/85 mark | |
75 | * Posted to USENET. | |
76 | * ----------------------------------------------------------------- | |
77 | * v24: Added ti,te terminal init & de-init 6/3/85 Mike Kersenbrock | |
78 | * v25: Added -U flag, standout mode underlining. 6/8/85 mark | |
79 | * v26: Added -M flag. 6/9/85 mark | |
80 | * Use underline termcap (us) if it exists. | |
81 | * v27: Renamed some variables to make unique in 6/15/85 mark | |
82 | * 6 chars. Minor fix to -m. | |
83 | * v28: Fixed right margin bug. 6/28/85 mark | |
84 | * v29: Incorporated M.Rose's changes to signal.c 6/28/85 mark | |
85 | * v30: Fixed stupid bug in argument processing. 6/29/85 mark | |
86 | * v31: Added -p flag, changed repaint algorithm. 7/15/85 mark | |
87 | * Added kludge for magic cookie terminals. | |
88 | * v32: Added cat_file if output not a tty. 7/16/85 mark | |
89 | * v33: Added -e flag and EDITOR. 7/23/85 mark | |
90 | * v34: Added -s flag. 7/26/85 mark | |
91 | * v35: Rewrote option handling; added option.c. 7/27/85 mark | |
92 | * v36: Fixed -e flag to work if not last file. 7/29/85 mark | |
93 | * v37: Added -x flag. 8/10/85 mark | |
94 | * v38: Changed prompting; created prompt.c. 8/19/85 mark | |
95 | * v39: (Not -p) does not initially clear screen. 8/24/85 mark | |
96 | * v40: Added "skipping" indicator in forw(). 8/26/85 mark | |
97 | * Posted to USENET. | |
98 | * ----------------------------------------------------------------- | |
99 | * v41: ONLY_RETURN, control char commands, 9/17/85 mark | |
100 | * faster search, other minor fixes. | |
101 | * v42: Added ++ command line syntax; 9/25/85 mark | |
102 | * ch_fsize for pipes. | |
103 | * v43: Added -h flag, changed prim.c algorithms. 10/15/85 mark | |
104 | * v44: Made END print in all cases of eof; 10/16/85 mark | |
105 | * ignore SIGTTOU after receiving SIGTSTP. | |
106 | * v45: Never print backspaces unless -u. 10/16/85 mark | |
107 | * v46: Backwards scroll in jump_loc. 10/24/85 mark | |
108 | * v47: Fixed bug in edit(): *first_cmd==0 10/30/85 mark | |
109 | * v48: Use TIOCSETN instead of TIOCSETP. 11/16/85 mark | |
110 | * Added marks (m and ' commands). | |
111 | * Posted to USENET. | |
112 | * ----------------------------------------------------------------- | |
113 | * v49: Fixed bug: signal didn't clear mcc. 1/9/86 mark | |
114 | * v50: Added ' (quote) to gomark. 1/15/86 mark | |
115 | * v51: Added + cmd, fixed problem if first_cmd | |
116 | * fails, made g cmd sort of "work" on pipes | |
117 | * even if bof is no longer buffered. 1/16/86 mark | |
118 | * v52: Made short files work better. 1/17/86 mark | |
119 | * v53: Added -P option. 1/20/86 mark | |
120 | * v54: Changed help to use HELPFILE. 1/20/86 mark | |
121 | * v55: Messages work better if not tty output. 1/23/86 mark | |
122 | * v56: Added -l option. 1/24/86 mark | |
123 | * v57: Fixed -l to get confirmation before | |
124 | * overwriting an existing file. 1/31/86 mark | |
125 | * v58: Added filename globbing. 8/28/86 mark | |
126 | * v59: Fixed some bugs with very long filenames. 9/15/86 mark | |
127 | * v60: Incorporated changes from Leith (Casey) | |
128 | * Leedom for boldface and -z option. 9/26/86 mark | |
129 | * v61: Got rid of annoying repaints after ! cmd. 9/26/86 mark | |
130 | * Posted to USENET. | |
131 | * ----------------------------------------------------------------- | |
132 | * v62: Added is_directory(); change -z default to | |
133 | * -1 instead of 24; cat-and-exit if -e and | |
134 | * file is less than a screenful. 12/23/86 mark | |
135 | * v63: Fixed bug in cat-and-exit if > 1 file. 1/8/87 mark | |
136 | * v64: Changed puts/putstr, putc/putchr, | |
137 | * getc/getchr to avoid name conflict with | |
138 | * stdio functions. 1/12/87 mark | |
139 | * v65: Allowed '-' command to change NUMBER | |
140 | * valued options (thanks to Gary Puckering) 1/26/87 mark | |
141 | * v66: Fixed bug: prepaint should use force=1. 2/13/87 mark | |
142 | * v67: Added !! and % expansion to ! command. 2/24/87 mark | |
143 | * v68: Added SIGWINCH and TIOCGWINSZ support; | |
144 | * changed is_directory to bad_file. | |
145 | * (thanks to J. Robert Ward) 2/25/87 mark | |
146 | * v69: Added SIGWIND and WIOCGETD (for Unix PC). 2/25/87 mark | |
147 | * v70: Changed help cmd from 'h' to 'H'; better | |
148 | * error msgs in bad_file, errno_message. 3/13/87 mark | |
149 | * v71: Changed -p to -c, made triple -c/-C | |
150 | * for clear-eol like more's -c. 5/11/87 mark | |
151 | * v72: Added -E, -L, use $SHELL in lsystem(). 6/26/87 mark | |
152 | * (thanks to Steve Spearman) | |
153 | * v73: Allow Examine "#" for previous file. 6/26/87 mark | |
154 | * Posted to USENET 8/25/87. | |
155 | * ----------------------------------------------------------------- | |
156 | * v74: Fix conflict in EOF symbol with stdio.h, 9/18/87 mark | |
157 | * Make os.c more portable to BSD. | |
158 | * v75: Fix problems in get_term (thanks to 9/23/87 mark | |
159 | * Paul Eggert); new backwards scrolling in | |
160 | * jump_loc (thanks to Marion Hakanson). | |
161 | * v76: Added -i flag; allow single "!" to 9/23/87 mark | |
162 | * invoke a shell (thanks to Franco Barber). | |
163 | * v77: Added -n flag and line number support. 9/24/87 mark | |
164 | * v78: Fixed problem with prompts longer than 9/25/87 mark | |
165 | * the screen width. | |
166 | * v79: Added the _ command. 9/29/87 mark | |
167 | * v80: Allow signal to break out of linenum scan. 10/6/87 mark | |
168 | * v81: Allow -b to be changed from within less. 10/6/87 mark | |
169 | * v82: Add cmd_decode to use a table for key 10/7/87 mark | |
170 | * binding (thanks to David Nason). | |
171 | * v83: Allow .less file for user-defined keys. 10/9/87 mark | |
172 | * v84: Fix -e/-E problems (thanks to Felix Lee). 10/11/87 mark | |
173 | * v85: Search now keeps track of line numbers. 10/15/87 mark | |
174 | * v86: Added -B option and autobuf; fixed 10/20/87 mark | |
175 | * "pipe error" bug. | |
176 | * v87: Fix bug re BSD signals while reading file. 3/1/88 mark | |
177 | * v88: Use new format for -P option (thanks to 3/12/88 mark | |
178 | * der Mouse), allow "+-c" without message, | |
179 | * fix bug re BSD hangup. | |
180 | * v89: Turn off line numbers if linenum scan 3/18/88 mark | |
181 | * is interrupted. | |
182 | * v90: Allow -P from within less. 3/30/88 mark | |
183 | * v91: Added tags file support (new -t option) 3/30/88 mark | |
184 | * (thanks to Brian Campbell). | |
185 | * v92: Added -+option syntax. 4/4/88 mark | |
186 | * v93: Add support for slow input (thanks to 4/11/88 mark | |
187 | * Joe Orost & apologies for taking almost | |
188 | * 3 years to get this in!) | |
189 | * v94: Redo reading/signal stuff. 4/11/88 mark | |
190 | * v95: Repaint screen better after signal. 4/20/88 mark | |
191 | * v96: Add /! and ?! commands. 4/21/88 mark | |
192 | * v97: Allow -l/-L from within less. 5/17/88 mark | |
193 | * Eliminate some static arrays (use calloc). | |
194 | */ | |
195 | ||
196 | char version[] = "@(#) less version 97"; |