sam 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891
  1. .TH SAM 1
  2. .ds a \fR*\ \fP
  3. .SH NAME
  4. sam, B, sam.save, samterm \- screen editor with structural regular expressions
  5. .SH SYNOPSIS
  6. .B sam
  7. [
  8. .I option ...
  9. ] [
  10. .I files
  11. ]
  12. .PP
  13. .B sam
  14. .B -r
  15. .I machine
  16. .PP
  17. .B sam.save
  18. .PP
  19. .B B
  20. [
  21. .BI -nnnn
  22. ]
  23. .I file ...
  24. .SH DESCRIPTION
  25. .I Sam
  26. is a multi-file editor.
  27. It modifies a local copy of an external file.
  28. The copy is here called a
  29. .IR file .
  30. The files are listed in a menu available through mouse button 3
  31. or the
  32. .B n
  33. command.
  34. Each file has an associated name, usually the name of the
  35. external file from which it was read, and a `modified' bit that indicates whether
  36. the editor's file agrees with the external file.
  37. The external file is not read into
  38. the editor's file until it first becomes the current file\(emthat to
  39. which editing commands apply\(emwhereupon its menu entry is printed.
  40. The options are
  41. .TF -rmachine
  42. .TP
  43. .B -a
  44. Autoindent. In this mode, when a newline character is typed
  45. in the terminal interface,
  46. .I samterm
  47. copies leading white space on the current line to the new line.
  48. .TP
  49. .B -d
  50. Do not `download' the terminal part of
  51. .IR sam .
  52. Editing will be done with the command language only, as in
  53. .IR ed (1).
  54. .TP
  55. .BI -r " machine
  56. Run the host part remotely
  57. on the specified machine, the terminal part locally.
  58. .TP
  59. .BI -s " path
  60. Start the host part from the specified file on the remote host.
  61. Only meaningful with the
  62. .BI -r
  63. option.
  64. .TP
  65. .BI -t " path
  66. Start the terminal part from the specified file. Useful
  67. for debugging.
  68. .PD
  69. .SS Regular expressions
  70. Regular expressions are as in
  71. .IR regexp (6)
  72. with the addition of
  73. .BR \en
  74. to represent newlines.
  75. A regular expression may never contain a literal newline character.
  76. The empty
  77. regular expression stands for the last complete expression encountered.
  78. A regular expression in
  79. .I sam
  80. matches the longest leftmost substring formally
  81. matched by the expression.
  82. Searching in the reverse direction is equivalent
  83. to searching backwards with the catenation operations reversed in
  84. the expression.
  85. .SS Addresses
  86. An address identifies a substring in a file.
  87. In the following, `character
  88. .IR n '
  89. means the null string
  90. after the
  91. .IR n -th
  92. character in the file, with 1 the
  93. first character in the file.
  94. `Line
  95. .IR n '
  96. means the
  97. .IR n -th
  98. match,
  99. starting at the beginning of the file, of the regular expression
  100. .LR .*\en? .
  101. All files always have a current substring, called dot,
  102. that is the default address.
  103. .SS Simple Addresses
  104. .PD 0
  105. .TP
  106. .BI # n
  107. The empty string after character
  108. .IR n ;
  109. .B #0
  110. is the beginning of the file.
  111. .TP
  112. .I n
  113. Line
  114. .IR n ;
  115. .B 0
  116. is the beginning of the file.
  117. .TP
  118. .BI / regexp /
  119. .PD 0
  120. .TP
  121. .BI ? regexp ?
  122. The substring that matches the regular expression,
  123. found by looking toward the end
  124. .RB ( / )
  125. or beginning
  126. .RB ( ? )
  127. of the file,
  128. and if necessary continuing the search from the other end to the
  129. starting point of the search.
  130. The matched substring may straddle
  131. the starting point.
  132. When entering a pattern containing a literal question mark
  133. for a backward search, the question mark should be
  134. specified as a member of a class.
  135. .PD
  136. .TP
  137. .B 0
  138. The string before the first full line.
  139. This is not necessarily
  140. the null string; see
  141. .B +
  142. and
  143. .B -
  144. below.
  145. .TP
  146. .B $
  147. The null string at the end of the file.
  148. .TP
  149. .B .
  150. Dot.
  151. .TP
  152. .B \&'
  153. The mark in the file (see the
  154. .B k
  155. command below).
  156. .TP
  157. \fB"\f2regexp\fB"\f1\f1
  158. Preceding a simple address (default
  159. .BR . ),
  160. refers to the address evaluated in the unique file whose menu line
  161. matches the regular expression.
  162. .PD
  163. .SS Compound Addresses
  164. In the following,
  165. .I a1
  166. and
  167. .I a2
  168. are addresses.
  169. .TF a1+a2
  170. .TP
  171. .IB a1 + a2
  172. The address
  173. .I a2
  174. evaluated starting at the end of
  175. .IR a1 .
  176. .TP
  177. .IB a1 - a2
  178. The address
  179. .I a2
  180. evaluated looking in the reverse direction
  181. starting at the beginning of
  182. .IR a1 .
  183. .TP
  184. .IB a1 , a2
  185. The substring from the beginning of
  186. .I a1
  187. to the end of
  188. .IR a2 .
  189. If
  190. .I a1
  191. is missing,
  192. .B 0
  193. is substituted.
  194. If
  195. .I a2
  196. is missing,
  197. .B $
  198. is substituted.
  199. .TP
  200. .IB a1 ; a2
  201. Like
  202. .IB a1 , a2\f1,
  203. but with
  204. .I a2
  205. evaluated at the end of, and dot set to,
  206. .IR a1 .
  207. .PD
  208. .PP
  209. The operators
  210. .B +
  211. and
  212. .B -
  213. are high precedence, while
  214. .B ,
  215. and
  216. .B ;
  217. are low precedence.
  218. .PP
  219. In both
  220. .B +
  221. and
  222. .B -
  223. forms, if
  224. .I a2
  225. is a line or character address with a missing
  226. number, the number defaults to 1.
  227. If
  228. .I a1
  229. is missing,
  230. .L .
  231. is substituted.
  232. If both
  233. .I a1
  234. and
  235. .I a2
  236. are present and distinguishable,
  237. .B +
  238. may be elided.
  239. .I a2
  240. may be a regular
  241. expression; if it is delimited by
  242. .LR ? 's,
  243. the effect of the
  244. .B +
  245. or
  246. .B -
  247. is reversed.
  248. .PP
  249. It is an error for a compound address to represent a malformed substring.
  250. Some useful idioms:
  251. .IB a1 +-
  252. \%(\f2a1\fB-+\f1)
  253. selects the line containing
  254. the end (beginning) of a1.
  255. .BI 0/ regexp /
  256. locates the first match of the expression in the file.
  257. (The form
  258. .B 0;//
  259. sets dot unnecessarily.)
  260. .BI ./ regexp ///
  261. finds the second following occurrence of the expression,
  262. and
  263. .BI .,/ regexp /
  264. extends dot.
  265. .SS Commands
  266. In the following, text demarcated by slashes represents text delimited
  267. by any printable
  268. character except alphanumerics.
  269. Any number of
  270. trailing delimiters may be elided, with multiple elisions then representing
  271. null strings, but the first delimiter must always
  272. be present.
  273. In any delimited text,
  274. newline may not appear literally;
  275. .B \en
  276. may be typed for newline; and
  277. .B \e/
  278. quotes the delimiter, here
  279. .LR / .
  280. Backslash is otherwise interpreted literally, except in
  281. .B s
  282. commands.
  283. .PP
  284. Most commands may be prefixed by an address to indicate their range
  285. of operation.
  286. Those that may not are marked with a
  287. .L *
  288. below.
  289. If a command takes
  290. an address and none is supplied, dot is used.
  291. The sole exception is
  292. the
  293. .B w
  294. command, which defaults to
  295. .BR 0,$ .
  296. In the description, `range' is used
  297. to represent whatever address is supplied.
  298. Many commands set the
  299. value of dot as a side effect.
  300. If so, it is always set to the `result'
  301. of the change: the empty string for a deletion, the new text for an
  302. insertion, etc. (but see the
  303. .B s
  304. and
  305. .B e
  306. commands).
  307. .br
  308. .ne 1.2i
  309. .SS Text commands
  310. .PD 0
  311. .TP
  312. .BI a/ text /
  313. .TP
  314. or
  315. .TP
  316. .B a
  317. .TP
  318. .I lines of text
  319. .TP
  320. .B .
  321. Insert the text into the file after the range.
  322. Set dot.
  323. .PD
  324. .TP
  325. .B c\fP
  326. .br
  327. .ns
  328. .TP
  329. .B i\fP
  330. Same as
  331. .BR a ,
  332. but
  333. .B c
  334. replaces the text, while
  335. .B i
  336. inserts
  337. .I before
  338. the range.
  339. .TP
  340. .B d
  341. Delete the text in the range.
  342. Set dot.
  343. .TP
  344. .BI s/ regexp / text /
  345. Substitute
  346. .I text
  347. for the first match to the regular expression in the range.
  348. Set dot to the modified range.
  349. In
  350. .I text
  351. the character
  352. .B &
  353. stands for the string
  354. that matched the expression.
  355. Backslash behaves as usual unless followed by
  356. a digit:
  357. .BI \e d
  358. stands for the string that matched the
  359. subexpression begun by the
  360. .IR d -th
  361. left parenthesis.
  362. If
  363. .I s
  364. is followed immediately by a
  365. number
  366. .IR n ,
  367. as in
  368. .BR s2/x/y/ ,
  369. the
  370. .IR n -th
  371. match in the range is substituted.
  372. If the
  373. command is followed by a
  374. .BR g ,
  375. as in
  376. .BR s/x/y/g ,
  377. all matches in the range
  378. are substituted.
  379. .TP
  380. .BI m " a1
  381. .br
  382. .ns
  383. .TP
  384. .BI t " a1
  385. Move
  386. .RB ( m )
  387. or copy
  388. .RB ( t )
  389. the range to after
  390. .IR a1 .
  391. Set dot.
  392. .SS Display commands
  393. .PD 0
  394. .TP
  395. .B p
  396. Print the text in the range.
  397. Set dot.
  398. .TP
  399. .B =
  400. Print the line address and character address of the range.
  401. .TP
  402. .B =#
  403. Print just the character address of the range.
  404. .PD
  405. .SS File commands
  406. .PD 0
  407. .TP
  408. .BI \*ab " file-list
  409. Set the current file to the first file named in the list
  410. that
  411. .I sam
  412. also has in its menu.
  413. The list may be expressed
  414. .BI < "Plan 9 command"
  415. in which case the file names are taken as words (in the shell sense)
  416. generated by the Plan 9 command.
  417. .TP
  418. .BI \*aB " file-list
  419. Same as
  420. .BR b ,
  421. except that file names not in the menu are entered there,
  422. and all file names in the list are examined.
  423. .TP
  424. .B \*an
  425. Print a menu of files.
  426. The format is:
  427. .RS
  428. .TP 11
  429. .BR ' " or blank
  430. indicating the file is modified or clean,
  431. .TP 11
  432. .BR - " or \&" +
  433. indicating the file is unread or has been read
  434. (in the terminal,
  435. .B *
  436. means more than one window is open),
  437. .TP 11
  438. .BR . " or blank
  439. indicating the current file,
  440. .TP 11
  441. a blank,
  442. .TP 11
  443. and the file name.
  444. .RE
  445. .TP 0
  446. .BI \*aD " file-list
  447. Delete the named files from the menu.
  448. If no files are named, the current file is deleted.
  449. It is an error to
  450. .B D
  451. a modified file, but a subsequent
  452. .B D
  453. will delete such a file.
  454. .PD
  455. .SS I/O Commands
  456. .PD 0
  457. .TP
  458. .BI \*ae " filename
  459. Replace the file by the contents of the named external file.
  460. Set dot to the beginning of the file.
  461. .TP
  462. .BI r " filename
  463. Replace the text in the range by the contents of the named external file.
  464. Set dot.
  465. .TP
  466. .BI w " filename
  467. Write the range (default
  468. .BR 0,$ )
  469. to the named external file.
  470. .TP
  471. .BI \*af " filename
  472. Set the file name and print the resulting menu entry.
  473. .PP
  474. If the file name is absent from any of these, the current file name is used.
  475. .B e
  476. always sets the file name;
  477. .B r
  478. and
  479. .B w
  480. do so if the file has no name.
  481. .TP
  482. .BI < " Plan 9-command
  483. Replace the range by the standard output of the
  484. Plan 9 command.
  485. .TP
  486. .BI > " Plan 9-command
  487. Send the range to the standard input of the
  488. Plan 9 command.
  489. .TP
  490. .BI | " Plan 9-command
  491. Send the range to the standard input, and replace it by
  492. the standard output, of the
  493. Plan 9 command.
  494. .TP
  495. .BI \*a! " Plan 9-command
  496. Run the
  497. Plan 9 command.
  498. .TP
  499. .BI \*acd " directory
  500. Change working directory.
  501. If no directory is specified,
  502. .B $home
  503. is used.
  504. .PD
  505. .PP
  506. In any of
  507. .BR < ,
  508. .BR > ,
  509. .B |
  510. or
  511. .BR ! ,
  512. if the
  513. .I Plan 9 command
  514. is omitted the last
  515. .I Plan 9 command
  516. (of any type) is substituted.
  517. If
  518. .I sam
  519. is
  520. .I downloaded
  521. (using the mouse and raster display, i.e. not using option
  522. .BR -d ),
  523. .B !
  524. sets standard input to
  525. .BR /dev/null ,
  526. and otherwise
  527. unassigned output
  528. .RB ( stdout
  529. for
  530. .B !
  531. and
  532. .BR > ,
  533. .B stderr
  534. for all) is placed in
  535. .B /tmp/sam.err
  536. and the first few lines are printed.
  537. .SS Loops and Conditionals
  538. .PD 0
  539. .TP
  540. .BI x/ regexp / " command
  541. For each match of the regular expression in the range, run the command
  542. with dot set to the match.
  543. Set dot to the last match.
  544. If the regular
  545. expression and its slashes are omitted,
  546. .L /.*\en/
  547. is assumed.
  548. Null string matches potentially occur before every character
  549. of the range and at the end of the range.
  550. .TP
  551. .BI y/ regexp / " command
  552. Like
  553. .BR x ,
  554. but run the command for each substring that lies before, between,
  555. or after
  556. the matches that would be generated by
  557. .BR x .
  558. There is no default regular expression.
  559. Null substrings potentially occur before every character
  560. in the range.
  561. .TP
  562. .BI \*aX/ regexp / " command
  563. For each file whose menu entry matches the regular expression,
  564. make that the current file and
  565. run the command.
  566. If the expression is omitted, the command is run
  567. in every file.
  568. .TP
  569. .BI \*aY/ regexp / " command
  570. Same as
  571. .BR X ,
  572. but for files that do not match the regular expression,
  573. and the expression is required.
  574. .TP
  575. .BI g/ regexp / " command
  576. .br
  577. .ns
  578. .TP
  579. .BI v/ regexp / " command
  580. If the range contains
  581. .RB ( g )
  582. or does not contain
  583. .RB ( v )
  584. a match for the expression,
  585. set dot to the range and run the command.
  586. .PP
  587. These may be nested arbitrarily deeply, but only one instance of either
  588. .B X
  589. or
  590. .B Y
  591. may appear in a \%single command.
  592. An empty command in an
  593. .B x
  594. or
  595. .B y
  596. defaults to
  597. .BR p ;
  598. an empty command in
  599. .B X
  600. or
  601. .B Y
  602. defaults to
  603. .BR f .
  604. .B g
  605. and
  606. .B v
  607. do not have defaults.
  608. .PD
  609. .SS Miscellany
  610. .TF (empty)
  611. .TP
  612. .B k
  613. Set the current file's mark to the range. Does not set dot.
  614. .TP
  615. .B \*aq
  616. Quit.
  617. It is an error to quit with modified files, but a second
  618. .B q
  619. will succeed.
  620. .TP
  621. .BI \*au " n
  622. Undo the last
  623. .I n
  624. (default 1)
  625. top-level commands that changed the contents or name of the
  626. current file, and any other file whose most recent change was simultaneous
  627. with the current file's change.
  628. Successive
  629. .BR u 's
  630. move further back in time.
  631. The only commands for which u is ineffective are
  632. .BR cd ,
  633. .BR u ,
  634. .BR q ,
  635. .B w
  636. and
  637. .BR D .
  638. If
  639. .I n
  640. is negative,
  641. .B u
  642. `redoes,' undoing the undo, going forwards in time again.
  643. .TP
  644. (empty)
  645. If the range is explicit, set dot to the range.
  646. If
  647. .I sam
  648. is downloaded, the resulting dot is selected on the screen;
  649. otherwise it is printed.
  650. If no address is specified (the
  651. command is a newline) dot is extended in either direction to
  652. line boundaries and printed.
  653. If dot is thereby unchanged, it is set to
  654. .B .+1
  655. and printed.
  656. .PD
  657. .SS Grouping and multiple changes
  658. Commands may be grouped by enclosing them in braces
  659. .BR {} .
  660. Commands within the braces must appear on separate lines (no backslashes are
  661. required between commands).
  662. Semantically, an opening brace is like a command:
  663. it takes an (optional) address and sets dot for each sub-command.
  664. Commands within the braces are executed sequentially, but changes made
  665. by one command are not visible to other commands (see the next
  666. paragraph).
  667. Braces may be nested arbitrarily.
  668. .PP
  669. When a command makes a number of changes to a file, as in
  670. .BR x/re/c/text/ ,
  671. the addresses of all changes to the file are computed in the original file.
  672. If the changes are in sequence,
  673. they are applied to the file.
  674. Successive insertions at the same address are catenated into a single
  675. insertion composed of the several insertions in the order applied.
  676. .SS The terminal
  677. What follows refers to behavior of
  678. .I sam
  679. when downloaded, that is, when
  680. operating as a display editor on a raster display.
  681. This is the default
  682. behavior; invoking
  683. .I sam
  684. with the
  685. .B -d
  686. (no download) option provides access
  687. to the command language only.
  688. .PP
  689. Each file may have zero or more windows open.
  690. Each window is equivalent
  691. and is updated simultaneously with changes in other windows on the same file.
  692. Each window has an independent value of dot, indicated by a highlighted
  693. substring on the display.
  694. Dot may be in a region not within
  695. the window.
  696. There is usually a `current window',
  697. marked with a dark border, to which typed text and editing
  698. commands apply.
  699. Text may be typed and edited as in
  700. .IR rio (1);
  701. also the escape key (ESC) selects (sets dot to) text typed
  702. since the last mouse button hit.
  703. .PP
  704. The button 3 menu controls window operations.
  705. The top of the menu
  706. provides the following operators, each of which uses one or
  707. more
  708. .IR rio -like
  709. cursors to prompt for selection of a window or sweeping
  710. of a rectangle.
  711. `Sweeping' a null rectangle gets a large window, disjoint
  712. from the command window or the whole screen, depending on
  713. where the null rectangle is.
  714. .TF resize
  715. .TP
  716. .B new
  717. Create a new, empty file.
  718. .TP
  719. .B zerox
  720. Create a copy of an existing window.
  721. .TP
  722. .B resize
  723. As in
  724. .IR rio .
  725. .TP
  726. .B close
  727. Delete the window.
  728. In the last window of a file,
  729. .B close
  730. is equivalent to a
  731. .B D
  732. for the file.
  733. .TP
  734. .B write
  735. Equivalent to a
  736. .B w
  737. for the file.
  738. .PD
  739. .PP
  740. Below these operators is a list of available files, starting with
  741. .BR ~~sam~~ ,
  742. the command window.
  743. Selecting a file from the list makes the most recently
  744. used window on that file current, unless it is already current, in which
  745. case selections cycle through the open windows.
  746. If no windows are open
  747. on the file, the user is prompted to open one.
  748. Files other than
  749. .B ~~sam~~
  750. are marked with one of the characters
  751. .B -+*
  752. according as zero, one, or more windows
  753. are open on the file.
  754. A further mark
  755. .L .
  756. appears on the file in the current window and
  757. a single quote,
  758. .BR ' ,
  759. on a file modified since last write.
  760. .PP
  761. The command window, created automatically when
  762. .B sam
  763. starts, is an ordinary window except that text typed to it
  764. is interpreted as commands for the editor rather than passive text,
  765. and text printed by editor commands appears in it.
  766. The behavior is like
  767. .IR rio ,
  768. with an `output point' that separates commands being typed from
  769. previous output.
  770. Commands typed in the command window apply to the
  771. current open file\(emthe file in the most recently
  772. current window.
  773. .SS Manipulating text
  774. Button 1 changes selection, much like
  775. .IR rio .
  776. Pointing to a non-current window with button 1 makes it current;
  777. within the current window, button 1 selects text, thus setting dot.
  778. Double-clicking selects text to the boundaries of words, lines,
  779. quoted strings or bracketed strings, depending on the text at the click.
  780. .PP
  781. Button 2 provides a menu of editing commands:
  782. .TF /regexp
  783. .TP
  784. .B cut
  785. Delete dot and save the deleted text in the snarf buffer.
  786. .TP
  787. .B paste
  788. Replace the text in dot by the contents of the snarf buffer.
  789. .TP
  790. .B snarf
  791. Save the text in dot in the snarf buffer.
  792. .TP
  793. .B plumb
  794. Send the text in the selection as a plumb
  795. message. If the selection is empty,
  796. the white-space-delimited block of text is sent as a plumb message
  797. with a
  798. .B click
  799. attribute defining where the selection lies (see
  800. .IR plumb (6)).
  801. .TP
  802. .B look
  803. Search forward for the next occurrence of the literal text in dot.
  804. If dot is the null string, the text in the snarf buffer is
  805. used.
  806. The snarf buffer is unaffected.
  807. .TP
  808. .B <rio>
  809. Exchange snarf buffers with
  810. .IR rio .
  811. .TP
  812. .BI / regexp
  813. Search forward for the next match of the last regular expression
  814. typed in a command.
  815. (Not in command window.)
  816. .TP
  817. .B send
  818. Send the text in dot, or the snarf buffer if
  819. dot is the null string, as if it were typed to the command window.
  820. Saves the sent text in the snarf buffer.
  821. (Command window only.)
  822. .PD
  823. .SS External communication
  824. .I Sam
  825. listens to the
  826. .B edit
  827. plumb port.
  828. If plumbing is not active,
  829. on invocation
  830. .I sam
  831. creates a named pipe
  832. .BI /srv/sam. user
  833. which acts as an additional source of commands. Characters written to
  834. the named pipe are treated as if they had been typed in the command window.
  835. .PP
  836. .I B
  837. is a shell-level command that causes an instance of
  838. .I sam
  839. running on the same terminal to load the named
  840. .IR files .
  841. .I B
  842. uses either plumbing or the named pipe, whichever service is available.
  843. If plumbing is not enabled,
  844. the option allows a line number to be specified for
  845. the initial position to display in the last named file
  846. (plumbing provides a more general mechanism for this ability).
  847. .SS Abnormal termination
  848. If
  849. .I sam
  850. terminates other than by a
  851. .B q
  852. command (by hangup, deleting its window, etc.), modified
  853. files are saved in an
  854. executable file,
  855. .BR $home/sam.save .
  856. This program, when executed, asks whether to write
  857. each file back to a external file.
  858. The answer
  859. .L y
  860. causes writing; anything else skips the file.
  861. .SH FILES
  862. .TF /sys/src/cmd/samterm
  863. .TP
  864. .B $home/sam.save
  865. .TP
  866. .B $home/sam.err
  867. .TP
  868. .B /sys/lib/samsave
  869. the program called to unpack
  870. .BR $home/sam.save .
  871. .SH SOURCE
  872. .TF /sys/src/cmd/samterm
  873. .TP
  874. .B /sys/src/cmd/sam
  875. source for
  876. .I sam
  877. itself
  878. .TP
  879. .B /sys/src/cmd/samterm
  880. source for the separate terminal part
  881. .TP
  882. .B /rc/bin/B
  883. .SH SEE ALSO
  884. .IR ed (1),
  885. .IR sed (1),
  886. .IR grep (1),
  887. .IR rio (1),
  888. .IR regexp (6).
  889. .PP
  890. Rob Pike,
  891. ``The text editor sam''.