sam 18 KB

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