|
|
1.1 root 1: .TH "QED" 1
2: . \" /*% nroff -man %
3: .if t .ds q \(aa
4: .if n .ds q '
5: .SH NAME
6: qed \- multi-file text editor
7: .SH SYNOPSIS
8: .B qed
9: [
10: .B \-
11: ] [
12: .B \-i
13: ] [
14: .B \-q
15: ] [
16: .B \-e
17: ] [
18: .B \-x
19: startupfile
20: ] [ filename1 filename2 ... ]
21: .SH DESCRIPTION
22: \fIQed\fP
23: is a multiple-file programmable text editor based on
24: .IR ed .
25: .PP
26: .I Qed
27: operates on a copy of any file it is editing; changes made
28: in the copy have no effect on the file until a \fIw\fR
29: or \fIW\fR (write)
30: command is given.
31: The copy of the text being edited resides
32: in a scratch area called a
33: .I buffer.
34: There are 56 buffers, labeled by alphabetics `a' to `z' and `A' to `Z',
35: and the characters `{', `|', `}' and `~'
36: (the four ASCII characters following `z').
37: These 56 characters are called, for notational efficiency,
38: .I bnames.
39: The buffers can contain any ASCII character except NUL.
40: .PP
41: If
42: .I file
43: arguments are given,
44: .I qed
45: simulates an
46: .I r
47: command (see below) on each of the named files; that is to say,
48: the files are read into
49: .I qed's
50: buffers so that they can be edited.
51: The first is read into buffer `a', the second into buffer `b',
52: through `z',
53: then from `A' to `Z',
54: up to a maximum of 52 files.
55: The optional
56: .B \-
57: puts
58: .I qed
59: in non-\c
60: .I verbose
61: mode (described with the
62: .I o
63: command).
64: The
65: \fB\-q\fR, \fB\-e\fR
66: and
67: .B \-i
68: are equivalent to performing an initial
69: `oqs', `oes' or `ois' command (see the
70: .I o
71: command below).
72: .PP
73: When \fIqed\fP starts up,
74: the file named by the environment variable
75: .B QEDFILE
76: is read into
77: buffer `~' and executed
78: (i.e. read as command input), before
79: reading in files and accepting commands from the terminal.
80: The argument
81: .I filename\c
82: s are set in the buffers before the startup file is executed,
83: so the startup file can treat the \fIfilenames\fR as arguments.
84: The default startup file may be overridden with the \fB\-x\fR option.
85: .PP
86: Input to
87: .I qed
88: can be redirected, at any time,
89: to come from storage such as a buffer
90: by use of a
91: .I special
92: .I character
93: such as ``\eb''.
94: All the
95: .I qed special character
96: sequences are discussed in detail below;
97: they all begin with a
98: backslash `\\'.
99: .PP
100: .I Qed
101: has a
102: .I truth flag
103: which is set according to the success of certain commands
104: and which can be tested for conditional execution, and a
105: .I count
106: which is set to such values as the number of successful substitutions
107: performed in an
108: .I s
109: command.
110: Each buffer has associated with it a
111: (possibly null) filename and a
112: .I changed
113: flag, which is
114: set if the contents of the buffer are known to differ
115: from the contents of the named file in that buffer.
116: .PP
117: Commands to
118: .I qed
119: have a simple and regular structure: zero or
120: more
121: .I addresses
122: followed by a single character
123: \fIcommand\fP,
124: possibly
125: followed by parameters to the command.
126: These addresses specify one or more lines in the buffer.
127: Every command which requires addresses has default addresses,
128: so that the addresses can often be omitted.
129: .PP
130: In general, any number of commands can appear on a line.
131: Some commands require that the character following
132: the command be a separator, such as blank, tab or newline.
133: Usually, a
134: .I display
135: .IR character ,
136: .IR p ,
137: .IR P ,
138: .IR l ,
139: or
140: .I L
141: may precede the separator,
142: causing the resulting line to be displayed in the specified format
143: after the command.
144: Certain commands allow the input of text for placement in the buffer.
145: This text can be supplied in two forms:
146: either
147: on the same line, after the command,
148: or on lines following the command,
149: terminated by a line containing only a period `\fB.\fP'.
150: If the text is on the command line,
151: it is separated from the command by a space or a tab.
152: If the tab is used, it is considered part of the text.
153: .PP
154: .I Qed
155: supports a limited form of
156: \fIregular\fP \fIexpression\fP
157: notation.
158: A regular expression specifies
159: a set of strings of characters.
160: A member of this set of strings is said to be
161: .I matched
162: by the regular expression.
163: Regular expressions in
164: .I qed
165: are delimited by enclosing them in a pair of identical characters,
166: frequently slashes `/'.
167: In the following specification for regular expressions the word `character'
168: means any character but newline.
169: Note that special character interpretation always occurs
170: .I before
171: executing a command.
172: Thus, the backslashes mentioned below are those present
173: after special characters have been interpreted.
174: .IP 1.
175: Any character except a metacharacter matches itself.
176: Metacharacters are the regular expression delimiter plus
177: < [ \fB.\fP and \e | > ^ * \+ $
178: when another rule gives them a meaning.
179: .IP 2.
180: A \fB.\fP matches any character.
181: .IP 3.
182: A backslash \\ followed by
183: any metacharacter in the list given in rule 1
184: is a regular expression and matches that character.
185: A backslash followed by one of
186: ! _ { } ( )
187: or a non-zero digit
188: has a special meaning discussed below;
189: otherwise, backslashes have literal meaning in regular expressions.
190: .IP 4.
191: The metacharacter \e\|! matches any control character
192: except tab or newline.
193: .IP 5.
194: A non-empty string
195: .I s
196: enclosed in square brackets
197: [\fIs\fP] (or [^\fIs\fP]) matches any character in (or not in) \fIs\fP.
198: In
199: .IR s ,
200: \\ has no special meaning, and ] may only appear as the first character.
201: A substring
202: .IR a \- b ,
203: with
204: .I a
205: and
206: .I b
207: in ascending ASCII order, stands for the inclusive range of ASCII characters.
208: .IP 6.
209: A regular expression,
210: of the form <\fIx1\fP> or <\fIx1\fR|\|\fIx2\fR|\|...|\|\fIxn\fR>,
211: where the \fIx\fR's are regular expressions of form 1-12, matches what
212: the leftmost successful \fIx\fR
213: matches.
214: .IP 7.
215: A backslash followed by a non-zero digit
216: .I n
217: matches a copy of the string that the bracketed regular expression
218: (see rule 11)
219: beginning with the \fIn\fPth \e\|( matched.
220: .IP 8.
221: A regular expression of form 1-7 followed by * (\+)
222: matches a sequence of zero (one) or more matches of the regular expression.
223: .IP 9.
224: The metacharacter \\\|_ matches a non-empty
225: maximal-length sequence of blanks and tabs.
226: .IP 10.
227: The metacharacter \\\|{ (\\\|}) matches the empty string at the beginning
228: (end) of an identifier. An identifier is defined to be
229: an underscore _ or alphabetic followed by zero or more
230: underscores, alphabetics or digits.
231: .IP 11.
232: A regular expression,
233: .IR x ,
234: of form 1-12, bracketed \e\|(\|\fIx\fP\|\e\|) matches what
235: .I x
236: matches.
237: The nesting of these brackets in each regular expression of an
238: alternation (rule 6) must be identical.
239: An alternation with these brackets may not be iterated (rule 8).
240: .IP 12.
241: A regular expression of form 1-12,
242: .IR x ,
243: followed by a regular expression of form 1-11,
244: .IR y ,
245: matches a match for
246: .I x
247: followed by a match for
248: .IR y ,
249: with the
250: .I x
251: match being as long as possible while still permitting a
252: .I y
253: match.
254: .IP 13.
255: A regular expression of form 1-12 preceded by ^ (followed by $) is constrained
256: to matches that begin at the left (end at the right) end of a line.
257: .IP 14.
258: A regular expression of form 1-13 picks out the longest among the leftmost matches
259: in a line.
260: .IP 15.
261: An empty regular expression stands for a copy of the last regular expression encountered.
262: .PP
263: .i0
264: Regular expressions are used in addresses and the
265: .I g
266: and
267: .I v
268: commands
269: to specify
270: lines, in the
271: .I s
272: command
273: to specify a portion of a line which is to be replaced,
274: in the
275: .I G
276: and
277: .I V
278: commands to refer to buffers in which to perform commands,
279: and in general whenever text
280: is being specified.
281: .PP
282: To understand addressing in
283: .I qed
284: it is necessary to know that at any time there is a
285: \fIcurrent buffer\fR
286: and a
287: \fIcurrent line.\fR
288: When
289: .I qed
290: is invoked,
291: the current buffer is
292: buffer `a',
293: but may be changed at any time by a
294: .I b
295: (change buffer) command.
296: All addresses refer to lines in the current buffer,
297: except for a special case described under the
298: .I m
299: (move) command.
300: .PP
301: Generally speaking, the current line is
302: the last line affected by a command; however,
303: the exact effect on the current line
304: is discussed under the description of
305: the command.
306: Addresses are constructed as follows.
307: .IP 1.
308: The character `\fB.\fR' addresses the current line.
309: .IP 2.
310: The character `$' addresses the last line of the buffer.
311: .IP 3.
312: A decimal number
313: .I n
314: addresses the
315: \fIn\fR-th
316: line of the buffer.
317: .IP 4.
318: `\*q\fIx\fR' addresses the line marked with the
319: mark name character \fIx\fR,
320: which must be a bname.
321: Lines are marked with the
322: .I k
323: command described below.
324: It is an error for the marked line to be outside of the current buffer.
325: .IP 5.
326: A regular expression enclosed in slashes `/' addresses
327: the first matching line
328: found by searching forwards from the line after the current line.
329: If necessary, the search wraps around to the beginning of the
330: buffer.
331: If the trailing `/' would be followed by a newline,
332: it may be omitted.
333: .IP 6.
334: A regular expression enclosed in queries `?' addresses
335: the first matching line
336: found by searching backwards from the line before
337: the current line.
338: If necessary
339: the search wraps around to the end of the buffer.
340: If the trailing `?' would be followed by a newline,
341: it may be omitted.
342: .IP 7.
343: An address followed by a plus sign `+'
344: or a minus sign `\-' followed by a decimal number specifies that address plus
345: (resp. minus) the indicated number of lines.
346: The plus sign may be omitted.
347: .IP 8.
348: An address followed by `+' or `\-' followed by a
349: regular expression enclosed in slashes specifies the first
350: matching line following (resp. preceding) that address.
351: The search wraps around if necessary.
352: The `+' may be omitted.
353: Enclosing the regular expression in `?' reverses the search direction.
354: .IP 9.
355: If an address begins with `+' or `\-'
356: the addition or subtraction is taken with respect to the current line;
357: e.g. `\-5' is understood to mean `\fB.\fR\-5'.
358: .IP 10.
359: If an address ends with a `+' (or `\-') 1 is added (resp. subtracted).
360: As a consequence of this rule and rule 9,
361: the address `\-' refers to the line before the current line.
362: Moreover, trailing `+' and `\-' characters have cumulative effect, so `\-\-'
363: refers to the current line less 2.
364: .IP 11.
365: To maintain compatibility with earlier versions of the editor,
366: the character `^' in addresses is entirely
367: equivalent to `\-'.
368: .PP
369: .i0
370: Commands may require zero, one, or two addresses.
371: Commands which require no addresses regard the presence
372: of an address as an error.
373: Commands which accept one or two addresses
374: assume default addresses when none is given.
375: If more addresses are given than the command requires,
376: the last one or two (depending on what is accepted) are used.
377: The last addressed line must not precede the second-last addressed line.
378: .PP
379: Typically, addresses are separated from each other by a comma `,'.
380: They may instead be separated by a semicolon `;'
381: in which case the current line `\fB.\fR' is set to the first address
382: before the second address is interpreted.
383: The second of two separated addresses may not be a line
384: earlier in the buffer than the first.
385: If the address on the left (right) side of a comma or semicolon
386: is absent, it defaults to the first (resp. last) line.
387: .PP
388: Filename operands of commands may be made up of printing characters only.
389: However, when the filename appears as the argument to the invocation of
390: \fIqed\fP,
391: non-printing characters may be included.
392: When a filename is specified for a command,
393: it is terminated at the first blank, tab or newline.
394: .PP
395: In the following list of
396: .I qed
397: commands, the default addresses
398: are shown in parentheses.
399: The parentheses are not part of
400: the address, but are used to show that the given addresses are
401: the default.
402: .TP 5
403: ( \fB. \fR)\|a <text>
404: The append command accepts input text
405: and appends it after the addressed line.
406: `\fB.\fR' is left
407: on the last line input, if there
408: were any, otherwise at the addressed line.
409: Address `0' is legal for this command; text is placed
410: at the beginning of the buffer.
411: .TP 5
412: b<bname>
413: The change buffer command sets the current buffer
414: to be that named.
415: `\fB.\fR', `$' and the remembered
416: .I filename
417: are set to those of the new buffer;
418: upon return to a previously used buffer,
419: `\fB.\fR' will be set to its value when the buffer was last used.
420: .TP 5
421: ( \fB. \fR)\|b[+\-\^\fB.\fP\^][pagesize][display character]
422: The browse command provides page-oriented printing.
423: The optional `+', `\-', or
424: .RB ` . '
425: specifies whether the next,
426: previous,
427: or surrounding page
428: is to be printed; if absent, `+' is assumed.
429: .IB b .
430: also prints several carets `^^^^^'
431: immediately below the current line.
432: If a pagesize is given, it is used for the current browse
433: command and remembered as the default.
434: The pagesize is initially 22 lines.
435: If a display character is given,
436: the lines are printed in the specified format,
437: and the format is remembered as the default.
438: Initially, `p' is the default.
439: For
440: .I b+
441: and
442: .IR b\- ,
443: `\fB.\fP' is left at the last line displayed;
444: for
445: \fIb\fP\fB.\fP,
446: it is unchanged.
447: NOTE: The browse and change buffer commands are the same character!
448: The two commands can be syntactically distinguished
449: in all cases except for `b<display\ char>';
450: this ambiguity may be resolved by typing the (implicit) `+'
451: after the `b'.
452: .TP 5
453: ( \fB. \fR, \fB. \fR)\|c <text>
454: The change
455: command deletes the addressed lines, then accepts input
456: text which replaces these lines.
457: `\fB.\fR' is left at the last line input; if there were none,
458: it is left at the line preceding the deleted lines.
459: If an interrupt signal (usually ASCII DEL) is received during a
460: change command, the old lines are not deleted.
461: .TP 5
462: ( \fB. \fR, \fB. \fR)\|d
463: The delete command deletes the addressed lines from the buffer.
464: The line after the deleted section becomes the current line;
465: if the deleted lines were originally at the end,
466: the new last line becomes the current line.
467: The character after the `d' can only be one of
468: a blank, newline, tab, or display character.
469: Line 0 is a valid address for deletion;
470: deleting line 0 has no affect on any lines in the buffer.
471: .TP 5
472: e filename
473: The edit
474: command causes the entire contents of the current buffer to be deleted,
475: and then the named file to be read in.
476: `\fB.\fR' is set to the last line of the buffer.
477: The number of characters read is typed
478: if
479: .I qed
480: is in
481: .I verbose
482: mode.
483: The \fIfilename\fP is remembered for possible use as a default file name
484: in a subsequent
485: \fIf\fP, \fIr\fR, \fIw\fR, or \fIW\fR command.
486: .TP 5
487: E filename
488: The
489: .I E
490: command is like
491: .IR e ,
492: except that
493: .I qed
494: does not check to see
495: if the buffer has been modified
496: since the last
497: .I w
498: command.
499: .TP 5
500: f filename
501: The filename command prints information about the current buffer,
502: in the format used by the \fIn\fR command.
503: If \fIfilename\fP is given,
504: the currently remembered file name is changed to \fIfilename\fP.
505: If
506: .I qed
507: is not in verbose mode,
508: the information is only printed if the
509: .I filename
510: is not specified.
511: If it is not desired to set the
512: .I filename,
513: the character immediately after the f must be a newline.
514: Otherwise, the first token
515: (which may be the null string)
516: on the line, after a mandatory non-empty sequence of blanks and tabs,
517: is taken to be the
518: .I filename.
519: These rules apply to all
520: .I filename\c
521: -using commands,
522: .I e,
523: .I f,
524: .I r,
525: .I R,
526: .I S,
527: .I w
528: and
529: .I W,
530: although some regard specification of an explicitly null \fIfilename\fP as an
531: error.
532: .TP 5
533: ( 1 , $ )\|g/regular expression/command list
534: In the global
535: command, the first step is to mark every line in the range which matches
536: the regular expression.
537: Then for every such line, the
538: command list is executed with `\fB.\fR' initially set to that line.
539: Any embedded newlines in the command list
540: must be escaped with a backslash.
541: The
542: \fIa\fP,
543: \fIi\fP,
544: and
545: .I c
546: commands and associated input are permitted;
547: the `\fB.\fR' terminating input mode may be omitted if it would be on the
548: last line of the command list.
549: The commands
550: .I g
551: and
552: .I v
553: are not permitted in the command list.
554: If the command list is empty, `\fB.\fPp' is assumed.
555: The regular expression may be delimited by any character other than newline.
556: .TP 5
557: G/regular expression/command list
558: In the globuf
559: command, the first step is to mark every active buffer
560: whose output from an
561: .I f
562: command
563: (with the
564: .I filename
565: printed literally)
566: would match the regular expression.
567: (An active buffer is one which has either some text or
568: a remembered file name.)\
569: Then for every such buffer, the
570: command list is executed with the current buffer set to that buffer.
571: In other respects it is like the global command,
572: except that only the commands
573: .I G
574: and
575: .I V
576: are not permitted in the command list.
577: If the command list is empty, `f' is assumed.
578: .TP 5
579: h<option> command list
580: The until command provides a simple looping mechanism.
581: The command list is a newline-terminated command sequence which forms
582: the body of the loop; embedded newlines must be escaped with a backslash.
583: The option specifies the exit condition for the loop,
584: and is specified by the character(s) immediately following the `h':
585: .RS
586: .IP h[\fIN\fP]t 6
587: The loop is executed until the truth flag is true.
588: .PD 0
589: .IP h[\fIN\fP]f 6
590: The loop is executed until the truth flag is false.
591: .IP h[\fIN\fP] 6
592: The loop is executed indefinitely.
593: .RE
594: .PD
595: .IP
596: The loop condition is tested
597: .I after
598: execution, so the `ht' and `hf' forms execute at least once.
599: .I N
600: denotes an optional non-negative number which indicates the
601: maximum number of times to execute the loop.
602: .TP 5
603: ( \fB. \fR)\|i <text>
604: The insert command accepts input text
605: and inserts it before the addressed line.
606: `\fB.\fR' is left at the last line input; if there were none,
607: at the line before the addressed line.
608: This command differs from the
609: .I a
610: command only in the placement of the
611: text.
612: .TP 5
613: ( \fB.\fR\-1 , \fB. \fR)\|j
614: .PD 0
615: .TP 5
616: ( \fB.\fR\-1 , \fB. \fR)\|j\|/replacement/
617: .PD
618: The join command collapses all addressed lines into a single line by
619: deleting intermediate newlines.
620: The
621: .I replacement
622: (if any) is placed between joined lines.
623: Newlines, backslashes `\\', and slashes `/' within
624: .I replacement
625: must be preceded by a backslash.
626: Only slashes may delimit \fIreplacement\fP.
627: `\fB.\fP' is left at the resulting line.
628: NOTE: The join command in
629: .I qed
630: has a different default addressing from that in
631: .I ed.
632: .TP 5
633: ( \fB. \fR)\|k<bname>
634: The mark command marks the addressed line with
635: the given bname.
636: (The bname used in the mark has no relation to any buffer;
637: it is just a label.)\
638: The address form `\*q<bname>'
639: then addresses this line.
640: `\fB.\fR' is not changed.
641: The marks are global to
642: .I qed\c
643: ; marking a line `x' erases any previous mark `x' in any buffer.
644: .TP 5
645: ( \fB. \fR, \fB. \fR)\|l
646: The list command
647: prints the addressed lines in an unambiguous way:
648: a tab is printed as `\et', a backspace as `\\b',
649: a backslash as `\e\e',
650: a non-printing character is
651: printed as a backslash followed by three octal digits,
652: and a long line is folded,
653: with the second and subsequent sub-lines indented one tab stop.
654: If the last character in the line is a blank,
655: it is followed by `\\n'.
656: .TP 5
657: ( \fB. \fR, \fB. \fR)\|L
658: The \fIL\fP command
659: is similar to the \fIl\fP command,
660: but each line displayed is preceded by its line number,
661: any marks it has (which appear as `\*q\fIx\fR'),
662: and a tab.
663: .TP 5
664: ( \fB. \fR, \fB. \fR)\|m\fIa\fR
665: The move command repositions the addressed lines after the line
666: addressed by
667: \fIa\fP.
668: The last of the moved lines becomes the current line.
669: The address \fIa\fP can also be of the form
670: <bname>address,
671: in which case the text is moved after the address in the named
672: buffer.
673: The buffer to which the text was moved becomes the current buffer.
674: The original buffer (if different) has `\fB.\fR' left at the line before the moved lines.
675: .TP 5
676: n
677: The names command displays the bname,
678: dollar
679: and \fIfilename\fR (in `l' format) of the current buffer and all active buffers.
680: If the buffer's changed flag is set, an apostrophe `\*q' is printed
681: after the bname.
682: The current buffer is indicated by a period `\fB.\fP' before the
683: dollar value.
684: If present, the
685: .I filename
686: is preceded by a tab.
687: .TP 5
688: N
689: The \fIN\fP command is similar to the \fIn\fP command,
690: but the display is only given for those buffers
691: which have a \fIfilename\fP and for which the changed flag is set.
692: .TP 5
693: o\fIps\fP
694: The option command allows various options to be set.
695: The first argument, \fIp\fP,
696: specifies which option is being set.
697: The rest of the command, \fIs\fP,
698: specifies the setting.
699: Most options can be either enabled or disabled;
700: \fIs\fP is `s' to set the option,
701: or `r' to reset it.
702: The following table describes the available options.
703: The default setting is shown after the option's letter.
704: .RS
705: .IP b22p 5
706: Set the length and format of the page printed by the browse command.
707: Either the length or the format may be omitted.
708: .PD 0
709: .IP "B<null string>" 5
710: Set the default command sequence to be
711: performed when a newline command is typed at the terminal.
712: The command sequence is set by following the `B' with a newline-terminated
713: string.
714: If the string is null, the newline command resumes its default behaviour.
715: .IP cr 5
716: Set the changed flag of the current buffer.
717: .IP dr 5
718: Dualcase search mode
719: affects rule one of regular expression construction
720: so that a letter is matched without regard to its case.
721: .IP er 5
722: Error exit mode causes
723: .I qed
724: to exit if an error occurs (see the DIAGNOSTICS section).
725: This option is mainly intended for use of qed in shell files.
726: .IP ir 5
727: Interrupt catching mode causes
728: .I qed
729: to exit when interrupted. (This includes removing the temporary file).
730: .IP pr 5
731: Prompting mode causes `*' to be typed
732: immediately before a command (as opposed to text)
733: is read from the terminal.
734: .IP qr 5
735: Quit catching mode causes
736: .I qed
737: to dump core, leaving the temporary file intact,
738: when a QUIT signal is received.
739: .IP Tr 5
740: Tracing mode causes
741: all commands not typed directly by the user to be echoed on the terminal.
742: When a special character (other than `\eB or `\eN')
743: is encountered, a `[' is typed,
744: followed by a code specifying the character \(em
745: `za' for register `a', `g' for global command list,
746: `l' for `\el', `B' for browse pseudo-register, etc.
747: Then, an `=' is typed, followed by the interpretation
748: of the special character, followed by a `]'.
749: .IP us 5
750: Uppercase conversion mode enables case transformation in
751: substitute commands.
752: If the `u' flag is set, the character caret (`^')
753: becomes non-literal in the replacement text of a substitution.
754: It behaves just like `&', but with case switching of alphabetics
755: in the replaced text.
756: If the flag is `u', all alphabetics are mapped to upper case;
757: if `l', lower case; and if `s', the case is switched.
758: .IP vs 5
759: Verbose mode causes character counts to be typed
760: after
761: \fIe\fP,
762: \fIr\fP,
763: \fIw\fP,
764: \fIR\fP,
765: \fIS\fP,
766: and
767: .I W
768: commands.
769: It also causes `!' to be typed upon completion of the \fI!\fR,
770: \fI<\fR, \fI|\fR and \fI>\fR commands.
771: .IP ?\fIc\fP 5
772: \fIc\fP must be one of
773: `c', `d', `i', `p', `T' or `v'.
774: The value of the corresponding flag is stored in the truth.
775: .PD
776: .RE
777: .TP 5
778: ( \fB. \fR, \fB. \fR)\|p
779: The print command prints the addressed lines.
780: `\fB.\fR' is left at the last line printed.
781: .TP 5
782: ( \fB. \fR, \fB. \fR)\|P
783: The PRINT command is similar to the print command,
784: but each line displayed is preceded by its line number,
785: any marks it has (which appear as `\*q\fIx\fR'),
786: and a tab.
787: .TP 5
788: q
789: The quit command causes
790: .I qed
791: to exit.
792: No automatic write
793: of a file is done.
794: If the changed flag is set
795: in any buffer,
796: .I qed
797: prints `?q'
798: and refuses to quit.
799: A second
800: .I q
801: or a
802: .I Q
803: will get out regardless,
804: as will an end-of-file
805: on the standard input.
806: .TP 5
807: Q
808: Like
809: .IR q ,
810: but changed flags
811: are not checked.
812: .TP 5
813: ( $ )\|r filename
814: The read command
815: reads in the given file after the addressed line.
816: If no \fIfilename\fP is given,
817: the remembered \fIfilename\fP is used
818: (see
819: .I e
820: and
821: .I f
822: commands).
823: The \fIfilename\fP is remembered if there was not already a
824: remembered \fIfilename\fP in the current buffer.
825: Address `0' is legal for
826: .I r
827: and causes the
828: file to be read at the beginning of the buffer.
829: If
830: .I qed
831: is in
832: .I verbose
833: mode and the read is successful, the number of characters
834: read is typed,
835: except while
836: .I qed
837: is starting up,
838: in which case an
839: .I f
840: command is performed.
841: `\fB.\fR' is left at the last line read in from the file.
842: .TP 5
843: R filename
844: The restore command restores an environment saved by a save (\fIS\fR) command.
845: The changed flag in each buffer is restored from the files; all other flags
846: are unaffected.
847: The input stack is reset to the top (teletype input) level,
848: and the current buffer becomes `a'.
849: `\fB.\fP' is left at the saved value of `\fB.\fP' in buffer `a'\fB.\fP
850: If the \fIfilename\fP is not specified, `q' is used.
851: .TP 5
852: ( \fB. \fR, \fB. \fR)\|s\fIn\fR/regular expression/replacement/
853: .PD 0
854: .TP 5
855: ( \fB. \fR, \fB. \fR)\|s\fIn\fR/regular expression/replacement/g
856: .PD
857: The substitute command searches each addressed
858: line for occurrences of the specified regular expression.
859: The decimal number \fIn\fP defaults to 1 if missing.
860: On each line in which
861: .I n
862: matches are found,
863: the \fIn\fPth matched string is replaced with
864: \fIreplacement\fP.
865: If the global replacement indicator `g' follows the command,
866: all subsequent matches on the line are also replaced.
867: Within a line, a search starts from the character following the last match,
868: unless the last match was an empty string,
869: in which case the search starts at
870: the second character following the empty string
871: (to ensure a match is not repeated).
872: It is an error for the substitution to fail on all addressed lines
873: unless it is in a global command.
874: `\fB.\fR' is left at the last line substituted.
875: .PP
876: .RS
877: Any character other than newline or a numeral
878: may be used instead of `/' to delimit the regular expression
879: and \fIreplacement\fP.
880: If the trailing delimiter is missing
881: (i.e., an unescaped newline
882: in the
883: .IR replacement ),
884: its presence is assumed,
885: and the last line affected is printed,
886: as if the
887: substitute
888: was followed by a
889: .I p
890: command.
891: If delimiter following the expression
892: is omitted as well,
893: an empty
894: .I replacement
895: is assumed.
896: .PP
897: An ampersand `&' appearing in \fIreplacement\fP
898: is replaced by the string matching the regular expression.
899: As a more general feature,
900: the characters
901: `\\\fIn\fR',
902: where
903: .I n
904: is a digit,
905: are replaced by the text matched by the
906: \fIn\fR-th
907: regular subexpression
908: enclosed between `\e\|(' and `\e\|)'.
909: When nested parenthesized subexpressions are present,
910: .I n
911: is determined by counting occurrences of `\e\|(' starting from the left.
912: .PP
913: A caret `^' appearing in \fIreplacement\fP
914: behaves much like an ampersand,
915: but provides a mechanism for case switching of alphabetics,
916: as discussed under the \fIo\fR command.
917: To include an ampersand `&', caret `^', backslash `\\', newline,
918: or the delimiter literally in
919: \fIreplacement\fP,
920: the character must be preceded by a backslash.
921: Lines may be split by substituting newline characters into them.
922: .RE
923: .TP 5
924: S filename
925: The save command saves the full buffer and register information in two
926: files called `filename:aq' and `filename:bq'.
927: If the filename is absent, `q' is used.
928: If the filename has more than 12 characters after the last slash `/',
929: it is truncated to 12 characters to avoid overwriting the file.
930: .TP 5
931: ( \fB.\fR , \fB.\fR )\|t\fIa\fR
932: The copy command acts just like the move
933: .I m
934: command except that a copy of the addressed lines is placed after address
935: \fIa\fP.
936: `\fB.\fR' is left on the last line of the copy.
937: The buffer to which the text was copied becomes the current buffer.
938: .TP 5
939: u
940: The undo command restores the last line changed by a
941: \fIs\fP,
942: \fIu\fP,
943: or
944: .I x
945: command.
946: Any new lines created by splitting the original are left.
947: It is an error if the line is not in the current buffer.
948: `\fB.\fP' is left at the restored line.
949: .TP 5
950: ( 1 , $ )\|v/regular expression/command list
951: This command is the same as the global command
952: except that the command list is executed
953: with `\fB.\fR' initially set to every line
954: .I except
955: those
956: matching the regular expression.
957: .TP 5
958: V/regular expression/command list
959: This command is the same as the globuf command
960: except that the command list is executed
961: with the current buffer initially set to every active buffer
962: .I except
963: those
964: matching the regular expression.
965: .TP 5
966: ( 1 , $ )\|w filename
967: The write command writes the addressed lines onto
968: the given file.
969: If the file does not exist,
970: it is created.
971: The filename is remembered if there was not already a
972: remembered file name in the current buffer.
973: If no file name is given,
974: the remembered file name is used.
975: `\fB.\fR' is unchanged.
976: If
977: .I qed
978: is in
979: .I verbose
980: mode and
981: the command is successful, the number of characters written is
982: typed.
983: .TP 5
984: ( 1 , $ )\|W
985: The \fIW\fP command is the same as the \fIw\fP command except that
986: the addressed lines are appended to the file.
987: .PP
988: .TP 5
989: ( \fB. \fR, \fB. \fR)\|x
990: .RS
991: The xform command allows one line at a time to be modified according to
992: graphical requests.
993: The line to be modified is typed out,
994: and then the modify request is read from the terminal
995: (even if the xform command is in a global command or other
996: nested input source).
997: Generally each character in the request specifies how to
998: modify the character immediately above it, in the original line,
999: as described in the following table.
1000: .IP # 5
1001: Delete the above character.
1002: .PD 0
1003: .IP % 5
1004: Replace the above character with a space.
1005: .IP ^ 5
1006: Insert the rest of the request line before the above character.
1007: If the rest of the request line is empty, insert a newline character.
1008: .IP $ 5
1009: Delete the characters in the above line from this position on;
1010: replace them with the rest of the request line.
1011: .IP "space or tab:" 5
1012: Leave above character(s) unchanged.
1013: .IP "any other:" 5
1014: This character replaces the one above it.
1015: .PD
1016: .PP
1017: If the request line is longer than the line to be modified,
1018: the overhang is added to the end of the line
1019: without interpretation,
1020: that is, without treating `#', `%', `^' or `$' specially.
1021: Any characters after a `^' or `$' request are not interpreted either.
1022: .PP
1023: Xform will not process control characters other
1024: than tab and newline,
1025: except in contexts where it need not know their width
1026: (that is, after a `^' or `$' request, or in the part of
1027: either the request or the line that overhangs the other).
1028: Remember that the ERASE character (processed by the system)
1029: erases the last character typed,
1030: not the last column.
1031: .PP
1032: Some characters take more than one column of the terminal
1033: to enter or display.
1034: For example, entering the ERASE or KILL characters literally
1035: takes two columns because they must be escaped.
1036: To delete a multi-column character,
1037: one must type `#' under all its columns.
1038: To replace a multicolumn character,
1039: the replacement must be typed under the first column of the character.
1040: Similarly, if a replacement character is multi-columned,
1041: it replaces the character in its first column.
1042: .PP
1043: The tab character prints as a sequence of spaces, and may be
1044: modified as if it were that sequence.
1045: As long as the last space is unmodified, it and the
1046: remaining contiguous spaces will represent a tab.
1047: .PP
1048: The modification process is repeated until the request is empty.
1049: Only a newline may immediately follow the `x'.
1050: .RE
1051: .TP 5
1052: y<condition><type>
1053: The jump command controls execution nested input sources.
1054: The condition is compared to the truth flag to see if the jump
1055: should be performed;
1056: if a `t', the jump is performed if the truth flag is true,
1057: if an `f', the jump is performed if the truth flag is false,
1058: if absent the jump is always performed.
1059: Several types of jumps exist:
1060: .RS
1061: .IP y[tf]o
1062: Jump out of the current input source.
1063: If the current input source is the command line
1064: for a \fIg\fR, \fIG\fP, \fIv\fR, \fIV\fR or \fIh\fR command, the command is terminated.
1065: .PD 0
1066: .IP y[tf]\fIN\fR
1067: Control is transferred to absolute line \fIN\fR (an integer)
1068: in the executing buffer.
1069: The current input source must be a buffer.
1070: .IP y[tf]\(aa<label>
1071: Control is transferred to the first line found,
1072: searching forward in the buffer,
1073: that begins with a comment "<label>.
1074: The match of the labels must be exact;
1075: regular expressions are not used to define the control label.
1076: (A tab, blank or newline after the double quote specifies a null label:
1077: a line beginning `"\ \ LAB' cannot be transferred to by this form of jump.)\
1078: If no such label is found,
1079: control resumes at the character after the label in the jump command.
1080: The current input source must be a buffer.
1081: .IP y[tf]\(ga<label>
1082: Similar to `y\(aa<label>',
1083: but the search is in the opposite (reverse) direction.
1084: .IP y[tf]
1085: If no
1086: recognized type is given,
1087: input is skipped up to the next newline.
1088: .PD
1089: .RE
1090: .IP
1091: It is an error if reading the label or line number for a jump command
1092: causes the current input source (i.e. buffer) to be `popped.'\
1093: This can happen if the label is the last word in the buffer,
1094: but can be circumvented by putting an extra blank or newline after
1095: the jump command.
1096: .TP 5
1097: ( \fB.\fR , \fB.\fR )\|z\fIXc\fR
1098: \fIQed\fP has 56 registers labeled by bnames.
1099: Three of these,
1100: registers `T', `C', and `U',
1101: are reserved:
1102: `T' is the truth flag, `C' is the count,
1103: `U' contains the
1104: .SM UNIX
1105: command from the most recent
1106: bang, crunch, zap, or pipe command.
1107: The contents of register \fIX\fP,
1108: where \fIX\fR is a bname,
1109: can be inserted into the input
1110: stream with the special character ``\ez\fIX\fP''.
1111: The command ``z\fIX\fR''
1112: specifies register \fIX\fR
1113: as the argument to
1114: the operation character (signified above by \fIc\fR) that follows it.
1115: In the description below,
1116: \fIN\fR stands for a possibly signed decimal integer
1117: and \fIS\fR stands for a newline-terminated string.
1118: Newlines may be embedded in registers by escaping
1119: them with a backslash.
1120: Although some of the register commands refer to addressed lines,
1121: `\fB.\fP' is unaffected by a
1122: .I z
1123: command.
1124: The operations are as follows:
1125: .RS
1126: .IP p
1127: Print the contents of the register in `p' format.
1128: .PD 0
1129: .IP l
1130: Print the contents of the register in `l' format.
1131: .IP \fB.\fP
1132: Set the register to the contents of the addressed line.
1133: .IP /reg-exp/
1134: Set the register to the portion of
1135: current line that matches the regular expression in slashes.
1136: If no such pattern is found,
1137: the register is cleared.
1138: The truth flag is set according to whether a
1139: match was found.
1140: .IP \fB:\fR\fIS\fR
1141: Set register to the string following the colon.
1142: .IP \&\(aa\fIY\fR
1143: Make a direct copy of register \fIY\fR in register \fIX\fR,
1144: without interpreting special characters.
1145: \fIY\fR is any register bname.
1146: .IP +\fIN\fR
1147: Increment by \fIN\fR the ASCII value of each character in the register.
1148: Similarly, a `\-' decrements each character.
1149: .IP =\fIS\fR
1150: (Or `<' or `>' or `!=' or `!<' or `!>'.)\
1151: Set truth flag to the result of the lexical comparison
1152: of the register and the string \fIS\fR.
1153: .IP n
1154: Set the count to the length of the register.
1155: .IP )\|\fIN\fR
1156: (Or '('.)\
1157: `Take'
1158: the first \fIN\fR characters of the register, i.e. truncate at the \fIN\fR+1'th
1159: character.
1160: `(' (`drop') is the complementary operator;
1161: it deletes the first \fIN\fP characters from the register.
1162: If \fIN\fP is negative, the break point is |\|\fIN\fP| from the end.
1163: .IP [/reg-exp/
1164: Set the count to the starting index of the regular expression in
1165: the register.
1166: Set the truth to whether the expression matches any of the register.
1167: .IP s\fIn\fP/reg-exp/replacement/
1168: .IP s\fIn\fP/reg-exp/replacement/g
1169: Perform a substitute command with semantics identical to the \fIs\fR command,
1170: but in the text of the register, not a line of the buffer.
1171: .IP C
1172: `Clean' the register: collapse each occurrence of `white space' in the register
1173: to a single blank, and delete initial and trailing white space.
1174: .IP {\|\fIS\fR
1175: Set the register to the value of the shell environment variable \fIS\fR,
1176: whose name may be terminated by a space, tab, newline or `}'.
1177: .PD
1178: .PP
1179: The registers can also be manipulated as decimal numbers.
1180: Numerical operations are indicated by a number sign `#'
1181: after the register name:
1182: e.g. `zx#+2'.
1183: It is an error to attempt to perform arithmetic on a
1184: register containing non-numeric text other than a leading minus sign.
1185: The numerical operations are:
1186: .IP a
1187: Set the value of the register to be the value of
1188: the address given to the command; e.g. `$za#a' sets register `a'
1189: to the number of lines in the buffer.
1190: .PD 0
1191: .IP r
1192: Set register \fIX\fR to be the first address
1193: given the command,
1194: and \fIX\fR+1 to be the second. If \fIX\fR is `~', an error is generated.
1195: For example, `5,$zi#r' sets register `i' to 5, and
1196: register `j' to the value of `$'.
1197: `\fB.\fP' is unchanged.
1198: This command is usually used to pass addresses to a command buffer.
1199: .IP n
1200: Set register to the length of the addressed line.
1201: .IP \fB:\fIN\fR
1202: Set register to \fIN\fR.
1203: Scanning of the number stops at the first non-numeric character,
1204: not at the end of the line.
1205: .IP +\fIN\fR
1206: Increment register by \fIN\fR. `\-', `*', `/', and `%'
1207: decrement, multiply, divide, or modulo the register by \fIN\fR.
1208: .IP P
1209: Set register to the decimal value of the process id of
1210: .I qed.
1211: .IP =\fIN\fR
1212: (Or `<' or `>' or `!=' or `!<' or `!>'.)\
1213: Set truth flag to the result of the numeric comparison of the register
1214: and the number
1215: .I N.
1216: .PD
1217: .PP
1218: Several numerical operations may be combined in one command
1219: (and it is more efficient to do so when possible.)
1220: For example, `$zd#a\-3' sets register `d' to three less than the value
1221: of `$'.
1222: .RE
1223: .TP 5
1224: Z
1225: The zero command clears the current buffer.
1226: The contents, filename and all flags for the buffer are zeroed.
1227: The character after the `Z' must be a blank, tab or newline.
1228: .TP 5
1229: ( $ )\|=
1230: The line number of the addressed line is typed.
1231: `\fB.\fR' is unchanged.
1232: .TP 5
1233: !\|<\s-2UNIX\s+2 command>
1234: The bang command sends the
1235: command line after the `!'
1236: to the UNIX shell to be interpreted as a command.
1237: Embedded newlines must be preceded by a backslash.
1238: The signals INTR, QUIT, and HUP are enabled or disabled
1239: as on entry to
1240: \fIqed\fP.
1241: At the completion of the command,
1242: if
1243: .I qed
1244: is in
1245: .I verbose
1246: mode, an `!' is typed.
1247: The return status of the command is stored in the truth flag.
1248: `\fB.\fR' is unchanged.
1249: .IP
1250: The
1251: command line
1252: is stored in register `U'.
1253: If a second `!' immediately follows the first,
1254: it is replaced with the uninterpreted contents
1255: of this register.
1256: Thus `!!' repeats the most recent bang command,
1257: and `!! \(or wc'
1258: repeats the command with an additional pipeline element added.
1259: .TP 5
1260: ( 1 , $ )\|>\|<\s-2UNIX\s+2 command>
1261: The zap command is similar
1262: to the bang command,
1263: but the addressed lines become the default standard input of the command.
1264: The command is stored in register `U',
1265: as for bang;
1266: `>>' corresponds to `!!'.
1267: .TP 5
1268: ( $ )\|<\|<\s-2UNIX\s+2 command>
1269: The crunch command is similar to the bang command,
1270: but the standard output of the command is appended to the current buffer
1271: after the addressed line, as though read with an \fIr\fR command
1272: from a temporary file.
1273: The command is stored in register `U'
1274: as for bang;
1275: `<<' corresponds to `!!'.
1276: `\fB.\fP' is left at the last line read.
1277: .TP 5
1278: ( 1 , $ )\||\|<\s-2UNIX\s+2 command>
1279: The pipe command is similar to the bang command,
1280: but the addressed lines become the default standard input of the command,
1281: and are replaced by the standard output of the command.
1282: The command is stored in register `U'
1283: as for bang;
1284: `|\||' corresponds to `!!'.
1285: If the command returns non-zero status, the original lines are not deleted.
1286: `\fB.\fP' is left at the last line read.
1287: .TP 5
1288: ( \fB.\fR )"
1289: The comment command sets dot to the addressed line, and ignores
1290: the rest of the line up to the first following double quote or newline.
1291: If, however, the character immediately after the double quote is
1292: a second double quote (i.e. the command is ``""''),
1293: the text which would normally be ignored is typed on the standard output.
1294: Special characters in the text will be interpreted, whether or not
1295: the text is printed,
1296: so to print a message such as ``Type \\bx'' requires the command
1297: ``"\|"\|Type \\cbx''.
1298: Commented lines are used as labels by the
1299: .I y
1300: (jump) command.
1301: .TP 5
1302: %
1303: The register print command displays the name and value of all defined
1304: registers,
1305: followed by the \\p (`P') and \\r (`R') pseudo-registers,
1306: and the browse (`B') pseudo-register, if defined.
1307: .TP 5
1308: #
1309: The numeric register print command displays the name and value of all
1310: defined registers with numeric values.
1311: .TP 5
1312: ( \fB.\fR+1 , \fB.\fR+1 )<newline>
1313: An address or addresses alone on a line
1314: cause the addressed lines to be printed.
1315: If the last address separator before the newline was `;',
1316: only the final addressed line is printed.
1317: A blank line alone causes the contents of the
1318: browse pseudo-register (described with the
1319: .I o
1320: command) to be executed.
1321: If the register is null, as it is initially,
1322: the newline command behaves as though the register contains
1323: `\fB.\fP+1p'.
1324: .PP
1325: .ul
1326: Special Characters
1327: .PP
1328: \fIQed\fP has some special character sequences with non-literal
1329: interpretations.
1330: These sequences are processed at the
1331: .I lowest
1332: level of input, so their interpretation is completely transparent
1333: to the actual commands.
1334: Whenever input from the user is expected, a special character can appear and
1335: will be processed.
1336: Special characters can be nested in the sense that, for example,
1337: a buffer invoked by `\eb' can contain a register invocation `\e\|z'.
1338: Backslashed escape sequences such as `\e\|(' in regular expressions
1339: are
1340: .I not
1341: special characters, so are not interpreted at input.
1342: The sequence `\e\|(' is left untouched by the input mechanism of
1343: .I qed;
1344: any special meaning it receives is given it during regular expression
1345: processing.
1346: The special characters are:
1347: .RS
1348: .IP \eb<bname>
1349: The `b' must be followed by a bname.
1350: When `\eb\fIX\fR' is typed,
1351: the contents of buffer \fIX\fR, up to but \fInot including\fP the last
1352: newline, are read as if they were entered from the keyboard.
1353: Typically, the missing newline is replaced by the newline which
1354: appears after the buffer invocation.
1355: Changing the contents of an executing buffer may have bizarre effects.
1356: .PD 0
1357: .IP \e\|B
1358: Equivalent to current buffer's bname.
1359: .IP \ec
1360: The sequence \ec is replaced by a single backslash,
1361: which is not re-scanned.
1362: The effect of the `c' is to delay interpretation of a special
1363: character.
1364: .IP \e\|f
1365: Equivalent to current buffer's file name.
1366: .IP \e\|F<bname>
1367: Equivalent to the file name in the named buffer.
1368: .IP \e\|l
1369: One line is read from the standard input up to, but \fInot including\fP
1370: the terminal newline, which is discarded.
1371: Note that the first invocation will read the remainder of the last
1372: line entered from the keyboard.
1373: For example, if a buffer is invoked by typing the line:
1374: .br
1375: .ti +5
1376: \ebxjunk
1377: .br
1378: the first \e\|l in buffer `x' will return the string `junk'.
1379: .IP \e\|N
1380: Equivalent to a newline.
1381: Primarily useful when delayed.
1382: .IP \ep
1383: Equivalent to the most recent regular expression used.
1384: .IP \e\|r
1385: Equivalent to the replacement text of
1386: the most recent substitute or join command.
1387: .IP \e\|z<bname>
1388: Equivalent to the contents of register `\e\|z\fIX\fR'.
1389: If the register changes during execution, the changes appear immediately
1390: and affect execution.
1391: If a `+' (`\-') appears between the `z' and the bname,
1392: the ASCII values of the characters in the register are
1393: incremented (decremented) by one before interpretation.
1394: If a `#' precedes the `+' (`\-')
1395: the contents of the register are numerically incremented (decremented).
1396: .IP \e"
1397: The sequence \e" means `no character at all'!
1398: It is primarily used to delay interpretation of a period
1399: that terminates an append, until the second or third time
1400: it is read (e.g. in loading execution buffers):
1401: the sequence \ec"\fB.\fP at the beginning of a line
1402: puts a period on the line which will terminate
1403: an append the second time it is read.
1404: .IP \e\*q[bfFlprz]\
1405: If an apostrophe
1406: appears between the backslash and the identifying character
1407: for one of the special characters `\eb', `\e\|f', `\e\|F', `\e\|l', `\e\|p',
1408: `\e\|r' or `\e\|z', interpretation is as usual except that
1409: any further special characters \fIembedded\fP
1410: in the buffer, register, etc. are \fInot\fP interpreted.
1411: Actually, any special character may be quoted, but in forms such as
1412: `\e\*q\|B', the quote has no effect.
1413: .RE
1414: .PD
1415: .PP
1416: A special character is interpreted immediately when it appears
1417: in the input stream,
1418: whether it is currently coming from
1419: the teletype, a buffer, a register, etc.
1420: (This includes characters read when typing a special character:
1421: `\e\*qb\eza', with register `a' containing the character `X',
1422: invokes the literal contents of buffer `X'.)\
1423: Thus, interpretation is recursive unless the special character
1424: is `\ec'.
1425: Special characters appearing in text processed in a command such
1426: as move, read or write, are \fInot\fP interpreted.
1427: If the backslash-character pair is not a special character
1428: from the above list, it is passed unchanged.
1429: Interpretation may be delayed using `\ec'; for example,
1430: if a `\ebx' is to be appended to a buffer for later interpretation,
1431: the user must type `\ecbx'.
1432: To delay interpretation \fIn\fP times, \fIn\fP c's must be placed between the
1433: backslash and the identifying character.
1434: In regular expressions and substitutes,
1435: a backslash preceding a metacharacter turns off its special meaning.
1436: Even in these cases,
1437: a backslash preceding an ordinary character is not deleted,
1438: unlike in \fIed\fP.
1439: For example, since the `g' command must read its entire line,
1440: a `\e\|zx' in a substitute driven by a global must be delayed
1441: if the contents of the register are to be different for each line,
1442: but since `\e&' is not a special character except to the substitute,
1443: its interpretation need not be delayed:
1444: .sp
1445: .in +5
1446: zA#:1
1447: .br
1448: g/\|\e$/ s\|/\|\e.xyz\|/\|\eczA \e&/p zA#+1
1449: .sp
1450: .in
1451: globally searches for lines with a literal currency sign,
1452: and on each one substitutes for `.xyz' the contents
1453: of register `A'
1454: at the time of substitution,
1455: followed by a space and a literal ampersand,
1456: prints the result and increments register `A'.
1457: As a second example, the substitute
1458: .ti +5
1459: .sp
1460: s\|/xyz\|/\|\e\e\|N&/
1461: .sp
1462: replaces `xyz' with a newline followed by `xyz'.
1463: Note that the `\e\e\|N' is interpreted as
1464: `backslash followed by newline,'
1465: as the sequence `\\\\'
1466: .ft I
1467: has no special meaning in qed
1468: .ft R
1469: outside of regular expressions
1470: and replacement text.
1471: However,
1472: to match, say, `\e\e\|z' using a regular expression, it must be entered
1473: as `\e\e\ecz'.
1474: .PP
1475: .PP
1476: If an interrupt signal (ASCII DEL) is sent,
1477: .I qed
1478: prints `??' and returns to its command level.
1479: If a hangup signal is received,
1480: .I qed
1481: executes the command `S qed.hup'.
1482: .PP
1483: Some size limitations:
1484: 512 characters per line,
1485: 256 characters per global command list,
1486: 1024 characters of string storage area,
1487: used for storing registers, file names and regular expressions,
1488: 16 levels of input nesting,
1489: and 128K characters in the temporary file.
1490: The limit on the number of lines depends on the amount of core:
1491: each line takes 1 word.
1492: .SH FILES
1493: /tmp/q#, temporary;
1494: `#' is the process number (six decimal digits).
1495: .SH DIAGNOSTICS
1496: Diagnostics are in the form of `?' followed by a single letter code.
1497: If the diagnostic is because of an inaccessible file,
1498: the offending file name is also displayed.
1499: If input is not from the highest level (i.e. the standard input,
1500: usually the terminal), a traceback is printed, starting with the
1501: lowest level.
1502: The elements of the traceback
1503: are of the form ?b\fIXM.N\fR or ?z\fIXN\fR,
1504: where \fIX\fR is the buffer or register being executed when the
1505: error was encountered,
1506: \fIM\fR is the line number in the buffer and \fIN\fR is the character
1507: number in the line or register.
1508: The possible errors are:
1509: .PD 0
1510: .IP 0
1511: non-zero status return in \fI|\fR command
1512: .IP F
1513: bad bname for \e\|F
1514: .IP G
1515: nested globuf commands
1516: .IP N
1517: last line of input did not end with newline
1518: .IP O
1519: unknown option in the \fIo?c\fP command
1520: .IP R
1521: restore (\fIR\fR) command failed
1522: (file not found or bad format)
1523: .IP T
1524: I/O error or overflow in tempfile
1525: .IP Z
1526: out of string space; clear a few registers or file names
1527: .IP a
1528: address syntax
1529: .IP b
1530: bad bname in a \fIb\fR command or for \\b
1531: .IP c
1532: ran out of core
1533: .IP f
1534: filename syntax error
1535: .IP g
1536: nested global commands
1537: .IP i
1538: more than 52 files in initialization argument list
1539: .IP k
1540: bad bname in \fIk\fR command
1541: .IP l
1542: an internal table length was exceeded
1543: .IP m
1544: tried to move to an illegal place (e.g. 1,6m4)
1545: .IP o
1546: error opening or creating a file
1547: .IP p
1548: bad regular expression (pattern) syntax
1549: .IP q
1550: .I e
1551: with the current changed flag set,
1552: or
1553: .I q
1554: with any changed flag set
1555: .IP r
1556: read error from file
1557: .IP s
1558: no substitutions found
1559: .IP t
1560: bad \fIx\fR command data or single-case terminal
1561: .IP u
1562: no line for \fIu\fR command to undo
1563: .IP x
1564: command syntax error
1565: .IP w
1566: write error on file
1567: .IP y
1568: bad jump command (including popping the input buffer while scanning the label)
1569: .IP z
1570: bad register bname
1571: .IP |
1572: failure to create pipe for \fI<\fR, \fI|\fR or \fI>\fR command
1573: .IP #
1574: bad numeric register operation
1575: .IP $
1576: line address out of range
1577: .IP ?
1578: interrupt
1579: .IP /
1580: line search failed
1581: .IP [
1582: bad index in a register take or drop command
1583: .IP \e
1584: attempt to recursively append a buffer
1585: .IP !
1586: jackpot \(em you found a bug in regular expression matching
1587: .PD
1588: .PP
1589: .SH "SEE ALSO"
1590: qedbufs(1)
1591: .br
1592: A Tutorial Introduction to the ED Text Editor
1593: (B. W. Kernighan)
1594: .br
1595: Programming in
1596: .IR Qed :
1597: a Tutorial
1598: (Robert Pike)
1599: .br
1600: ed(1)
1601: .SH "U of T INFO"
1602: Written at U of T,
1603: based on several incarnations of
1604: .I ed,
1605: with contributions from
1606: Tom Duff, Robert Pike, Hugh Redelmeier and David Tilbrook.
1607: .SH BUGS
1608: The changed flag is not omniscient; changing the contents of
1609: the file outside of
1610: .I qed
1611: will fool it.
1612: .br
1613: Xform \fIcould\fP work on single-case terminals, but backslashes
1614: become very confusing for the user.
1615: .br
1616: On the PDP-11, numeric registers are 16-bit integers, but the
1617: count is a 32-bit integer.
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.