xref: /original-bsd/bin/ed/ed.1 (revision 05cf3734)
1.\" Copyright (c) 1990 Regents of the University of California.
2.\" All rights reserved.  The Berkeley software License Agreement
3.\" specifies the terms and conditions for redistribution.
4.\"
5.\"     @(#)ed.1	6.4 (Berkeley) 06/26/90
6.\"
7.Dd
8.Dt ED 1
9.Os ATT 7th
10.if t .ds q \(aa
11.if n .ds q '
12.Sh NAME
13.Nm ed
14.Nd text editor
15.Sh SYNOPSIS
16.Nm ed
17.Op Fl
18.Op Fl x
19.Op Ar file
20.Sh DESCRIPTION
21.Nm Ed
22is the standard text editor.
23.Pp
24If a
25.Ar file
26argument is given,
27.Nm ed
28simulates an
29.Ic e
30command (see below) on the named file; that is to say,
31the file is read into
32.Nm ed 's
33buffer so that it can be edited.
34.Tp Fl x
35An
36.Ic x
37command is simulated first to handle an encrypted file.
38.Tp Fl
39Suppresses the printing
40of explanatory output
41and should be used
42when the standard input is
43an editor script.
44.Tp
45.Pp
46.Nm Ed
47operates on a copy of any file it is editing; changes made
48in the copy have no effect on the file until a
49.Ic w
50(write) command is given.
51The copy of the text being edited resides
52in a temporary file called the
53.Ar buffer  .
54.Pp
55Commands to
56.Nm ed
57have a simple and regular structure: zero or
58more
59.Ar addresses
60followed by a single character
61.Ar command ,
62possibly
63followed by parameters to the command.
64These addresses specify one or more lines in the buffer.
65Missing addresses are supplied by default.
66.Pp
67In general, only one command may appear on a line.
68Certain commands allow the
69addition of text to the buffer.
70While
71.Nm ed
72is accepting text, it is said
73to be in
74.Ar input mode .
75In this mode, no commands are recognized;
76all input is merely collected.
77Input mode is left by typing a period
78.Sq Ic \&.
79alone at the
80beginning of a line.
81.Pp
82.Nm Ed
83supports a limited form of
84.Ar regular expression
85notation.
86A regular expression specifies
87a set of strings of characters.
88A member of this set of strings is said to be
89.Ar matched
90by the regular expression.
91In the following specification for regular expressions
92the word `character' means any character but newline.
93.Tw Ds
94.Tp 1.
95Any character except a special character
96matches itself.
97Special characters are
98the regular expression delimiter plus
99.Sq Li \e\[
100and sometimes
101.Sq Li ^*$ .
102.Tp 2.
103A
104.Sq Ic \&.
105matches any character.
106.Tp 3.
107A
108.Sq Li \e
109followed by any character except a digit or
110.Li (\)
111matches that character.
112.Tp 4.
113A nonempty string
114.Op Ar s
115or
116.Cx \&(
117.Op \&^ Ar s
118.Cx \&)
119.Cx
120matches any character in (or not in)
121.Ar s .
122In
123.Ar s ,
124.Sq Li \e
125has no special meaning, and
126may only appear as
127the first letter.
128A substring
129.Ar a\-b ,
130with
131.Ar a
132and
133.Ar b
134in ascending ASCII order, stands for the inclusive
135range of ASCII characters.
136.Tp 5.
137A regular expression of form 1\-4 followed by * matches a sequence of
1380 or more matches of the regular expression.
139.Tp 6.
140A regular expression,
141.Ar x ,
142of form 1\-8, bracketed
143.Cx Li \e(
144.Ar x
145.Li \e)
146.Cx
147matches what
148.Ar x
149matches.
150.Tp 7.
151A \e followed by a digit
152.Ar n
153matches a copy of the string that the
154bracketed regular expression beginning with the
155.Cx Ar n
156.Cx \'th
157.Cx
158.Li \e(
159matched.
160.Tp 8.
161A regular expression of form 1\-8,
162.Ar x ,
163followed by a regular expression of form 1\-7,
164.Ar y
165matches a match for
166.Ar x
167followed by a match for
168.Ar y ,
169with the
170.Ar x
171match being as long as possible while still permitting a
172.Ar y
173match.
174.Tp 9.
175A regular expression of form 1\-8 preceded by
176.Sq Li ^
177(or followed by
178.Sq Li $ ) ,
179is constrained to matches that
180begin at the left (or end at the right) end of a line.
181.Tp 10.
182A regular expression of form 1\-9 picks out the
183longest among the leftmost matches in a line.
184.Tp 11.
185An empty regular expression stands for a copy of the
186last regular expression encountered.
187.Tp
188.Pp
189Regular expressions are used in addresses to specify
190lines and in one command
191(see
192.Ar s
193below)
194to specify a portion of a line which is to be replaced.
195If it is desired to use one of
196the regular expression metacharacters as an ordinary
197character, that character may be preceded by
198.Sq Li \e .
199This also applies to the character bounding the regular
200expression (often
201.Sq Li \&/ )
202and to
203.Sq Li \e
204itself.
205.Pp
206To understand addressing in
207.Nm ed
208it is necessary to know that at any time there is a
209.Ar current line.
210Generally speaking, the current line is
211the last line affected by a command; however,
212the exact effect on the current line
213is discussed under the description of
214the command.
215Addresses are constructed as follows.
216.Tw Ds
217.Tp 1.
218The character
219.Sq Ic \&.
220addresses the current line.
221.Tp 2.
222The character
223.Cx `
224.Ic $
225.Cx \'
226.Cx
227addresses the last line of the buffer.
228.Tp 3.
229A decimal number
230.Ar n
231addresses the
232.Cx Ar n
233.Cx \'th
234.Cx
235line of the buffer.
236.Tp 4.
237.Cx `\(fm
238.Ar x
239.Cx \'
240.Cx
241addresses the line marked with the name
242.Ar x  ,
243which must be a lower-case letter.
244Lines are marked with the
245.Ar k
246command described below.
247.Tp 5.
248A regular expression enclosed in slashes
249.Cx `
250.Li /
251.Cx \'
252.Cx
253addresses
254the line found by searching forward from the current line
255and stopping at the first line containing a
256string that matches the regular expression.
257If necessary the search wraps around to the beginning of the
258buffer.
259.Tp 6.
260A regular expression enclosed in queries
261.Cx `
262.Li ?
263.Cx \'
264.Cx
265addresses
266the line found by searching backward from the current line
267and stopping at the first line containing
268a string that matches the regular expression.
269If necessary
270the search wraps around to the end of the buffer.
271.Tp 7.
272An address followed by a plus sign
273.Cx `
274.Li +
275.Cx \'
276.Cx
277or a minus sign
278.Cx `
279.Li \-
280.Cx \'
281.Cx
282followed by a decimal number specifies that address plus
283(resp. minus) the indicated number of lines.
284The plus sign may be omitted.
285.Tp 8.
286If an address begins with
287.Cx `
288.Li +
289.Cx \'
290.Cx
291or
292.Cx `
293.Li \-
294.Cx \'
295.Cx
296the addition or subtraction is taken with respect to the current line;
297e.g.
298.Cx `
299.Li \-5
300.Cx \'
301.Cx
302is understood to mean
303.Cx `
304.Li .\-5
305.Cx \'
306.Cx
307.Nm .
308.Tp 9.
309If an address ends with
310.Cx `
311.Li +
312.Cx \'
313.Cx
314.Cx `
315.Li \-
316.Cx \',
317.Cx
318then 1 is added (resp. subtracted).
319As a consequence of this rule and rule 8,
320the address
321.Cx `
322.Li \-
323.Cx \'
324.Cx
325refers to the line before the current line.
326Moreover,
327trailing
328.Cx `
329.Li +
330.Cx \'
331.Cx
332and
333.Cx `
334.Li \-
335.Cx \'
336.Cx
337characters
338have cumulative effect, so
339.Cx `
340.Li \-\-
341.Cx \'
342.Cx
343refers to the current
344line less 2.
345.Tp 10.
346To maintain compatibility with earlier versions of the editor,
347the character
348.Cx `
349.Li ^
350.Cx \'
351.Cx
352in addresses is
353equivalent to
354.Cx `
355.Li \-
356.Cx \'.
357.Cx
358.Tp
359.Pp
360Commands may require zero, one, or two addresses.
361Commands which require no addresses regard the presence
362of an address as an error.
363Commands which accept one or two addresses
364assume default addresses when insufficient are given.
365If more addresses are given than such a command requires,
366the last one or two (depending on what is accepted) are used.
367.Pp
368Addresses are separated from each other typically by a comma
369.Cx `
370.Li ,
371.Cx \'
372.Cx
373They may also be separated by a semicolon
374.Cx `
375.Li ;
376.Cx \'
377.Cx
378In this case the current line
379.Cx `
380.Li .
381.Cx \'
382.Cx
383.Nm .
384is set to
385the previous address before the next address is interpreted.
386This feature can be used to determine the starting
387line for forward and backward searches
388.Cx \&(`
389.Li /
390.Cx \'
391.Cx
392.Cx `
393.Li ?
394.Cx \').
395.Cx
396The second address of any two-address sequence
397must correspond to a line following the line corresponding to the first address.
398The special form
399.Cx `
400.Li \&%
401.Cx \'
402.Cx
403is an abbreviation for the address pair
404.Cx `
405.Li 1,$
406.Cx \'.
407.Cx
408.Pp
409In the following list of
410.Nm ed
411commands, the default addresses
412are shown in parentheses.
413The parentheses are not part of
414the address, but are used to show that the given addresses are
415the default.
416.Pp
417As mentioned, it is generally illegal for more than one
418command to appear on a line.
419However, most commands may be suffixed by `p'
420or by `l', in which case
421the current line is either
422printed or listed respectively
423in the way discussed below.
424Commands may also be suffixed by `n',
425meaning the output of the command is to
426be line numbered.
427These suffixes may be combined in any order.
428.Tw Ds
429.Tp Cx \&(
430.Ic .
431.Cx \&)
432.Ic a
433.Cx
434.Tp <text>
435.Tp Ic \&.
436The append command reads the given text
437and appends it after the addressed line.
438.Sq Ic \&.
439is left
440on the last line input, if there
441were any, otherwise at the addressed line.
442Address `0' is legal for this command; text is placed
443at the beginning of the buffer.
444.Tp Cx \&(
445.Ic \&.
446.Cx \&,
447.Ic \&.
448.Cx \&)
449.Ic \&c
450.Cx
451.Tp <text>
452.Tp Ic \&.
453The change
454command deletes the addressed lines, then accepts input
455text which replaces these lines.
456.Sq Ic \&.
457is left at the last line input; if there were none,
458it is left at the line preceding the deleted lines.
459.Tp Cx \&(
460.Ic \&.
461.Cx \&,
462.Ic \&.
463.Cx \&)
464.Ic \&d
465.Cx
466The delete command deletes the addressed lines from the buffer.
467The line originally after the last line deleted becomes the current line;
468if the lines deleted were originally at the end,
469the new last line becomes the current line.
470.Tp Cx Ic \&e
471.Cx \&\ \&
472.Ar filename
473.Cx
474The edit
475command causes the entire contents of the buffer to be deleted,
476and then the named file to be read in.
477.Sq Ic \&.
478is set to the last line of the buffer.
479The number of characters read is typed.
480.Ar filename
481is remembered for possible use as a default file name
482in a subsequent
483.Ic r
484or
485.Ic w
486command.
487If
488.Ar filename
489is missing, the remembered name is used.
490.Tp Cx Ic E
491.Cx \&\ \&
492.Ar filename
493.Cx
494This command is the same as
495.Ic e ,
496except that no diagnostic results when no
497.Ic w
498has been given since the last buffer alteration.
499.Tp Cx Ic f
500.Cx \&\ \&
501.Ar filename
502.Cx
503The filename command prints the currently remembered file name.
504If
505.Ar filename
506is given,
507the currently remembered file name is changed to
508.Ar filename .
509.Tp Cx \&(
510.Ic \&1
511.Cx \&,
512.Ic \&$
513.Cx \&)
514.Ic \&g
515.Ar/regular expression/command list
516.Cx
517In the global
518command, the first step is to mark every line which matches
519the given regular expression.
520Then for every such line, the
521given command list is executed with
522.Cx `
523.Ic \&.
524.Cx \'
525.Cx
526initially set to that line.
527A single command or the first of multiple commands
528appears on the same line with the global command.
529All lines of a multi-line list except the last line must be ended with
530.Cx `
531.Ic \&\e
532.Cx \'.
533.Cx
534.Ic A ,
535.Ic i,
536and
537.Ic c
538commands and associated input are permitted;
539the
540.Cx `
541.Ic \&.
542.Cx \'
543.Cx
544terminating input mode may be omitted if it would be on the
545last line of the command list.
546The commands
547.Ic g
548and
549.Ic v
550are not permitted in the command list.
551.Tp Cx \&(
552.Ic .
553.Cx \&)
554.Ic i
555.Cx
556.Tp <text>
557.Tp Ic \&.
558This command inserts the given text before the addressed line.
559.Cx `
560.Ic \&.
561.Cx \'
562.Cx
563is left at the last line input, or, if there were none,
564at the line before the addressed line.
565This command differs from the
566.Ic a
567command only in the placement of the
568text.
569.Tp Cx \&(
570.Ic \&.
571.Cx \&,
572.Ic \&.+1
573.Cx \&)
574.Ic \&j
575.Cx
576This command joins the addressed lines into a single line;
577intermediate newlines simply disappear.
578.Cx `
579.Ic \&.
580.Cx \'
581.Cx
582is left at the resulting line.
583.Tp Cx \&(
584.Ic .
585.Cx \&)
586.Ic k
587.Ar x
588.Cx
589The mark command marks the addressed line with
590name
591.Ar x ,
592which must be a lower-case letter.
593The address form
594.Cx `\(fm
595.Ar x
596.Cx \'
597.Cx
598then addresses this line.
599.Tp Cx \&(
600.Ic \&.
601.Cx \&,
602.Ic \&.
603.Cx \&)
604.Ic \&l
605.Cx
606The list command
607prints the addressed lines in an unambiguous way:
608non-graphic characters are
609printed in two-digit octal,
610and long lines are folded.
611The
612.Ar l
613command may be placed on the same line after any non-i/o
614command.
615.Tp Cx \&(
616.Ic \&.
617.Cx \&,
618.Ic \&.
619.Cx \&)
620.Ic \&m
621.Ar a
622.Cx
623The move command repositions the addressed lines after the line
624addressed by
625.Ar a  .
626The last of the moved lines becomes the current line.
627.Tp Cx \&(
628.Ic \&.
629.Cx \&,
630.Ic \&.
631.Cx \&)
632.Ic \&p
633.Cx
634The print command prints the addressed lines.
635.Cx `
636.Ic \&.
637.Cx \'
638.Cx
639is left at the last line printed.
640The
641.Ic p
642command
643may
644be placed on the same line after any non-i/o command.
645.Tp Cx \&(
646.Ic \&.
647.Cx \&,
648.Ic \&.
649.Cx \&)
650.Ic \&P
651.Cx
652This command is a synonym for
653.Ic p .
654.Tp Ic q
655The quit command causes
656.Nm ed
657to exit.
658No automatic write
659of a file is done.
660.Tp Ic Q
661This command is the same as
662.Ic q ,
663except that no diagnostic results when no
664.Ic w
665has been given since the last buffer alteration.
666.Tp Cx \&(
667.Ic $
668.Cx \&)
669.Ic r
670.Cx \&\ \&
671.Ar filename
672.Cx
673The read command
674reads in the given file after the addressed line.
675If no file name is given,
676the remembered file name, if any, is used
677(see
678.Ic e
679and
680.Ic f
681commands).
682The file name is remembered if there was no
683remembered file name already.
684Address `0' is legal for
685.Ic r
686and causes the
687file to be read at the beginning of the buffer.
688If the read is successful, the number of characters
689read is typed.
690.Cx `
691.Ic \&.
692.Cx \'
693.Cx
694is left at the last line read in from the file.
695.Tp Cx \&(
696.Ic \&.
697.Cx \&,
698.Ic \&.
699.Cx \&)
700.Ic \&s
701.Ar/regular expression/replacement/
702.Cx \&\tor
703.Cx
704.Tp Cx \&(
705.Ic \&.
706.Cx \&,
707.Ic \&.
708.Cx \&)
709.Ic \&s
710.Ar/regular expression/replacement/
711.Ic \&g
712.Cx
713The substitute command searches each addressed
714line for an occurrence of the specified regular expression.
715On each line in which a match is found,
716all matched strings are replaced by the replacement specified,
717if the global replacement indicator
718.Ic \&g
719appears after the command.
720If the global indicator does not appear, only the first occurrence
721of the matched string is replaced.
722It is an error for the substitution to fail on all addressed lines.
723Any punctuation character
724may be used instead of
725.Cx `
726.Ic \&/
727.Cx \'
728.Cx
729to delimit the regular expression
730and the replacement.
731.Cx `
732.Ic \&.
733.Cx \'
734.Cx
735is left at the last line substituted.
736An ampersand
737.Cx `
738.Ic \&&
739.Cx \'
740.Cx
741appearing in the replacement
742is replaced by the string matching the regular expression.
743The special meaning of
744.Cx `
745.Ic \&&
746.Cx \'
747.Cx
748in this context may be
749suppressed by preceding it by
750.Cx `
751.Ic \&\e
752.Cx \'.
753.Cx
754The characters
755.Cx `
756.Ic \&\e
757.Ar n
758.Cx \'
759.Cx
760where
761.Ar n
762is a digit,
763are replaced by the text matched by the
764.Cx Ar n
765.Cx \'th
766.Cx
767regular subexpression
768enclosed between
769.Cx `
770.Ic \&\e\&(
771.Cx \'.
772.Cx
773and
774.Cx `
775.Ic \&\e\&)
776.Cx \'.
777.Cx
778When
779nested, parenthesized subexpressions
780are present,
781.Ar n
782is determined by counting occurrences of
783.Cx `
784.Ic \&\e\&(
785.Cx \'.
786.Cx
787starting from the left.
788Lines may be split by substituting new-line characters into them.
789The new-line in the
790replacement string
791must be escaped by preceding it by
792.Cx `
793.Ic \&\e
794.Cx \'.
795.Cx
796One or two trailing delimiters may be omitted,
797implying the
798.Ic p
799suffix.
800The special form
801.Ic s
802followed by
803.Ar no
804delimiters
805repeats the most recent substitute command
806on the addressed lines.
807The
808.Ic s
809may be followed by the letters
810.Ic r
811(use the most recent regular expression for the
812left hand side, instead of the most recent
813left hand side of a substitute command),
814.Ic p
815(complement the setting of the
816.Ic p
817suffix from the previous substitution), or
818.Ic g
819(complement the setting of the
820.Ic g
821suffix).
822These letters may be combined in any order.
823.Tp Cx \&(
824.Ic \&.
825.Cx \&,
826.Ic \&.
827.Cx \&)
828.Ic \&t
829.Ar a
830.Cx
831This command acts just like the
832.Ic m
833command, except that a copy of the addressed lines is placed
834after address
835.Ad a
836(which may be 0).
837.Cx `
838.Ic \&.
839.Cx \'
840.Cx
841is left on the last line of the copy.
842.Tp Cx \&(
843.Ic \&.
844.Cx \&,
845.Ic \&.
846.Cx \&)
847.Ic \&u
848.Cx
849The undo command restores the buffer to it's state
850before the most recent buffer modifying command.
851The current line is also restored.
852Buffer modifying commands are
853.Ic a , c , d , g , i , k , m , r , s , t ,
854and
855.Ic v .
856For purposes of undo,
857.Ic g
858and
859.Ic v
860are considered to be a single buffer modifying command.
861Undo is its own inverse.
862When
863.Nm ed
864runs out of memory
865(at about 8000 lines on any 16 bit mini-computer
866such as the PDP-11)
867This full undo is not possible, and
868.Ic u
869can only undo the effect of the most recent
870substitute on the current line.
871This restricted undo also applies to editor scripts
872when
873.Nm ed
874is invoked with the
875.Fl
876option.
877.Tp Cx \&(
878.Ic \&1
879.Cx \&,
880.Ic \&$
881.Cx \&)
882.Ic \&v
883.Ar/regular expression/command list
884.Cx
885This command is the same as the global command
886.Ic g
887except that the command list is executed
888.Ic g
889with
890.Cx `
891.Ic \&.
892.Cx \'
893.Cx
894initially set to every line
895.Em except
896those
897matching the regular expression.
898(1, $)\w filename
899.Tp Cx \&(
900.Ic \&1
901.Cx \&,
902.Ic \&$
903.Cx \&)
904.Ic \&w
905.Cx \&\ \&
906.Ar filename
907.Cx
908The write command writes the addressed lines onto
909the given file.
910If the file does not exist,
911it is created.
912The file name is remembered if there was no
913remembered file name already.
914If no file name is given,
915the remembered file name, if any, is used
916(see
917.Ic e
918and
919.Ic f
920commands).
921.Cx `
922.Ic \&.
923.Cx \'
924.Cx
925is unchanged.
926If the command is successful, the number of characters written is
927printed.
928.Tp Cx \&(
929.Ic \&1
930.Cx \&,
931.Ic \&$
932.Cx \&)
933.Ic \&W
934.Cx \&\ \&
935.Ar filename
936.Cx
937This command is the same as
938.Ic w ,
939except that the addressed lines are appended to the file.
940.Tp Cx \&(
941.Ic \&1
942.Cx \&,
943.Ic \&$
944.Cx \&)
945.Ic \&wq
946.Cx \&\ \&
947.Ar filename
948.Cx
949This command is the same as
950.Ic w
951except that afterwards a
952.Ic q
953command is done,
954exiting the editor
955after the file is written.
956.Tp x
957A key string is demanded from the standard input.
958Later
959.Ic r , e
960and
961.Ic w
962commands will encrypt and decrypt the text
963with this key by the algorithm of
964.Xr crypt  1  .
965An explicitly empty key turns off encryption.
966.Ic \&1
967.Ic \&+1
968.Cx \&)
969.Ic \&z
970.Cx \&\ \ \&or,
971.Cx
972.Tp Cx \&(
973.Ic \&1
974.Ic \&+1
975.Cx \&)
976.Ic \&z
977.Ar n
978.Cx
979This command scrolls through the buffer starting at the addressed line.
98022 (or
981.Ar n ,
982if given)
983lines are printed.
984The last line printed becomes the current line.
985The value
986.Ar n
987is sticky, in that it becomes the default for
988future
989.Ic z
990commands.
991.Tp Cx \&(
992.Ic \&$
993.Cx \&)
994.Ic \&=
995.Cx
996The line number of the addressed line is typed.
997.Cx `
998.Ic \&.
999.Cx \'
1000.Cx
1001is unchanged by this command.
1002.Tp Cx Ic \&!
1003.Cx <shell\ command>
1004.Cx
1005The remainder of the line after the `!' is sent
1006to
1007.Xr sh  1
1008to be interpreted as a command.
1009.Cx `
1010.Ic \&.
1011.Cx \'
1012.Cx
1013is unchanged.
1014.Tp Cx \&(
1015.Ic \&.+1
1016.Cx \&,
1017.Ic \&.+1
1018.Cx \&)
1019.Cx <newline>
1020.Cx
1021An address alone on a line causes the addressed line to be printed.
1022A blank line alone is equivalent to
1023.Ic .+1
1024it is useful
1025for stepping through text.
1026If two addresses are present with no
1027intervening semicolon,
1028.Nm ed
1029prints the range of lines.
1030If they are separated by a semicolon,
1031the second line is printed.
1032.Tp
1033.Pp
1034If an interrupt signal (ASCII DEL) is sent,
1035.Nm ed
1036prints
1037.Sq Li ?interrupted
1038and returns to its command level.
1039.Pp
1040Some size limitations:
1041512 characters per line,
1042256 characters per global command list,
104364 characters per file name,
1044and, on mini computers,
1045128K characters in the temporary file.
1046The limit on the number of lines depends on the amount of core:
1047each line takes 2 words.
1048.Pp
1049When reading a file,
1050.Nm ed
1051discards ASCII NUL characters
1052and all characters after the last newline.
1053It refuses to read files containing non-ASCII characters.
1054.Sh FILES
1055.Dw edhup
1056.Di L
1057.Dp Pa /tmp/e*
1058.Dp Pa edhup
1059work is saved here if terminal hangs up
1060.Dp
1061.Sh SEE ALSO
1062.Xr ex 1 ,
1063.Xr sed 1 ,
1064.Xr crypt 1
1065.br
1066B. W. Kernighan,
1067.Em A Tutorial Introduction to the ED Text Editor
1068.br
1069B. W. Kernighan,
1070.Em Ar Advanced editing on UNIX
1071.Sh HISTORY
1072The
1073.Nm ed
1074command appeared in Version 6 AT&T UNIX.
1075.Sh DIAGNOSTICS
1076.Sq Li name
1077for inaccessible file;
1078.Sq Li ?self-explanatory message
1079for other errors.
1080.Pp
1081To protect against throwing away valuable work,
1082a
1083.Ic q
1084or
1085.Ic e
1086command is considered to be in error, unless a
1087.Ic w
1088has occurred since the last buffer change.
1089A second
1090.Ic q
1091or
1092.Ic e
1093will be obeyed regardless.
1094.Sh BUGS
1095The
1096.Ic l
1097command mishandles
1098.Li DEL .
1099.br
1100The
1101.Ic undo
1102command causes marks to be lost on affected lines.
1103.br
1104The
1105.Ic x
1106command,
1107.Fl x
1108option,
1109and
1110special treatment of hangups
1111only work on UNIX.
1112