home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume1 / rn / part01 next >
Encoding:
Internet Message Format  |  1986-11-30  |  61.8 KB

  1. Date: Tue, 7 May 85 13:32:51 pdt
  2. From: allegra!sdcrdcf!RDCF.SDC.UUCP!lwall (Larry Wall)
  3. Newsgroups: mod.sources
  4. Subject: rn version 4.3 (kit 1 of 9)
  5. Reply-To: lwall@sdcrdcf.UUCP
  6. Organization: System Development Corporation R&D, Santa Monica
  7.  
  8. #! /bin/sh
  9.  
  10. # Make a new directory for the rn sources, cd to it, and run kits 1 thru 9 
  11. # through sh.  When all 9 kits have been run, read README.
  12.  
  13. echo "This is rn kit 1 (of 9).  If kit 1 is complete, the line"
  14. echo '"'"End of kit 1 (of 9)"'" will echo at the end.'
  15. echo ""
  16. export PATH || (echo "You didn't use sh, you clunch." ; kill $$)
  17. echo Extracting rn.1
  18. cat >rn.1 <<'!STUFFY!FUNK!'
  19. ''' $Header: rn.1,v 4.3 85/05/01 11:48:26 lwall Exp $
  20. ''' 
  21. ''' $Log:    rn.1,v $
  22. ''' Revision 4.3  85/05/01  11:48:26  lwall
  23. ''' Baseline for release with 4.3bsd.
  24. ''' 
  25. ''' 
  26. .de Sh
  27. .br
  28. .ne 5
  29. .PP
  30. \fB\\$1\fR
  31. .PP
  32. ..
  33. .de Sp
  34. .if t .sp .5v
  35. .if n .sp
  36. ..
  37. .de Ip
  38. .br
  39. .ie \\n.$>=3 .ne \\$3
  40. .el .ne 3
  41. .IP "\\$1" \\$2
  42. ..
  43. '''
  44. '''     Set up \*(-- to give an unbreakable dash;
  45. '''     string Tr holds user defined translation string.
  46. '''     Bell System Logo is used as a dummy character.
  47. '''
  48. .tr \(bs-|\(bv\*(Tr
  49. .ie n \{\
  50. .ds -- \(bs-
  51. .if (\n(.H=4u)&(1m=24u) .ds -- \(bs\h'-12u'\(bs\h'-12u'-\" diablo 10 pitch
  52. .if (\n(.H=4u)&(1m=20u) .ds -- \(bs\h'-12u'\(bs\h'-8u'-\" diablo 12 pitch
  53. .ds L" ""
  54. .ds R" ""
  55. .ds L' '
  56. .ds R' '
  57. 'br\}
  58. .el\{\
  59. .ds -- \(em\|
  60. .tr \*(Tr
  61. .ds L" ``
  62. .ds R" ''
  63. .ds L' `
  64. .ds R' '
  65. 'br\}
  66. .TH RN 1 LOCAL
  67. .SH NAME
  68. rn - new read news program
  69. .SH SYNOPSIS
  70. .B rn [options] [newsgroups]
  71. .SH DESCRIPTION
  72. .I Rn
  73. is a replacement for the readnews(1) program that was written to be as
  74. efficient as possible, particularly in human interaction.
  75. .I Rn
  76. attempts to minimize the amount of \*(L"dead\*(R" time spent reading
  77. news\*(--it tries to get things done while the user is reading or deciding
  78. whether to read, and attempts to get useful information onto the screen as
  79. soon as possible, highlighting spots that the eye makes frequent reference
  80. to, like subjects and previously read lines.
  81. Whether or not it's faster, it SEEMS faster.
  82. .PP
  83. If no newsgroups are specified, all the newsgroups which have unread news
  84. are displayed, and then the user is asked for each one whether he wants to
  85. read it, in the order in which the newsgroups occur in the
  86. .I .newsrc
  87. file.
  88. With a list of newsgroups,
  89. .I rn
  90. will start up in \*(L"add\*(R" mode, using the list as a set of patterns to
  91. add new newsgroups and restrict which newsgroups are displayed.
  92. See the discussion of the \*(L'a\*(R' command on the newsgroup selection
  93. level.
  94. .PP
  95. .I Rn
  96. operates on three levels: the newsgroup selection level, the article
  97. selection level, and the paging level.
  98. Each level has its own set of commands, and its own help menu.
  99. At the paging level (the bottom level),
  100. .I rn
  101. behaves much like the
  102. .IR more (1)
  103. program.
  104. At the article selection level, you may specify which article you want
  105. next, or read them in the default order, which is either in order of
  106. arrival on your system, or by subject threads.
  107. At the newsgroup selection level (the top level), you may specify which
  108. newsgroup you want next, or read them in the default order, which is the
  109. order that the newsgroups occur in your
  110. .I .newsrc
  111. file.
  112. (You will therefore want to rearrange your
  113. .I .newsrc
  114. file to put the most interesting newsgroups first.
  115. This can be done with the \*(L'm\*(R' command on the Newsgroup Selection level.
  116. WARNING: invoking readnews/vnews (the old user interface) in any way (including
  117. as a news checker in your login sequence!) will cause your
  118. .I .newsrc
  119. to be disarranged again.)
  120. .PP
  121. On any level, at ANY prompt, an \*(L'h\*(R' may be typed for a list of
  122. available commands.
  123. This is probably the most important command to remember, so don't you
  124. forget it.
  125. Typing space to any question means to do the normal thing.
  126. You will know what that is because
  127. every prompt has a list of several plausible commands enclosed in
  128. square brackets.
  129. The first command in the list is the one which will be done if you type
  130. a space.
  131. (All input is done in cbreak mode, so carriage returns should not be typed
  132. to terminate anything except certain multi-character commands.
  133. Those commands will be obvious in the discussion below because they take an
  134. argument.)
  135. .PP
  136. Upon startup,
  137. .I rn
  138. will do several things:
  139. .Ip 1. 4
  140. It will look for your
  141. .I .newsrc
  142. file, which is your list of subscribed-to
  143. newsgroups.
  144. If
  145. .I rn
  146. doesn't find a
  147. .IR .newsrc ,
  148. it will create one.
  149. If it does find one, it will back it up under the name \*(L".oldnewsrc\*(R".
  150. .Ip 2. 4
  151. It will input your
  152. .I .newsrc
  153. file, listing out the first several newsgroups
  154. with unread news.
  155. .Ip 3. 4
  156. It will perform certain consistency checks on your
  157. .IR .newsrc .
  158. If your
  159. .I .newsrc
  160. is out of date in any of several ways,
  161. .I rn
  162. will warn you and patch it up for you, but you may have to wait a little
  163. longer for it to start up.
  164. .Ip 4. 4
  165. .I Rn
  166. will next check to see if any new newsgroups have been created, and give
  167. you the opportunity to add them to your
  168. .IR .newsrc .
  169. .Ip 5. 4
  170. .I Rn
  171. goes into the top prompt level\*(--the newsgroup selection level.
  172. .Sh "Newsgroup Selection Level"
  173. In this section the words \*(L"next\*(R" and \*(L"previous\*(R" refer to
  174. the ordering of the newsgroups in your
  175. .I .newsrc
  176. file.
  177. On the newsgroup selection level, the prompt looks like this:
  178. .Sp
  179. ******** 17 unread articles in net.blurfl\*(--read now? [ynq]
  180. .Sp
  181. and the following commands may be given at this level:
  182. .Ip y,SP 8
  183. Do this newsgroup now.
  184. .Ip .command 8
  185. Do this newsgroup now, but execute
  186. .I command
  187. before displaying anything.
  188. The command will be interpreted as if given on the article selection level.
  189. .Ip = 8
  190. Do this newsgroup now, but list subjects before displaying articles.
  191. .Ip n 8
  192. Go to the next newsgroup with unread news.
  193. .Ip N 8
  194. Go to the next newsgroup.
  195. .Ip p 8
  196. Go to the previous newsgroup with unread news.
  197. If there is none, stay at the current newsgroup.
  198. .Ip P 8
  199. Go to the previous newsgroup.
  200. .Ip \- 8
  201. Go to the previously displayed newsgroup (regardless of whether it is
  202. before or after the current one in the list).
  203. .Ip 1 8
  204. Go to the first newsgroup.
  205. .Ip ^ 8
  206. Go to the first newsgroup with unread news.
  207. .Ip $ 8
  208. Go to the end of the newsgroups list.
  209. .Ip "g newsgroup" 8
  210. Go to
  211. .IR newsgroup .
  212. If it isn't currently subscribed to, you will be asked if you want to
  213. subscribe.
  214. .Ip "/pattern" 8
  215. Scan forward for a newsgroup matching
  216. .IR pattern .
  217. Patterns do globbing like filenames, i.e., use ? to match a single
  218. character, * to match any sequence of characters, and [] to specify a list
  219. of characters to match.
  220. (\*(L"all\*(R" may be used as a synonym for \*(L"*\*(R".)
  221. Unlike normal filename globbing, newsgroup searching is not anchored to
  222. the front and back of the filename, i.e. \*(L"/jok\*(R" will find
  223. net.jokes.
  224. You may use ^ or $ to anchor the front or back of the search:
  225. \*(L"/^test$\*(R" will find newsgroup test and nothing else
  226. If you want to include newsgroups with 0 unread articles, append /r.
  227. If the newsgroup is not found between the current newsgroup and the last
  228. newsgroup, the search will wrap around to the beginning.
  229. .Ip "?pattern" 8
  230. Same as /, but search backwards.
  231. .Ip u 8
  232. Unsubscribe from current newsgroup.
  233. .Ip "l string" 8
  234. List newsgroups not subscribed to which contain the string specified.
  235. .Ip L 8 13v
  236. Lists the current state of the
  237. .IR .newsrc ,
  238. along with status information.
  239. .Sp
  240. .nf
  241.     \h'|0.5i'Status    \h'|2i'Meaning
  242.     \h'|0.5i'<number>  \h'|2i'Count of unread articles in newsgroup.
  243.     \h'|0.5i'READ      \h'|2i'No unread articles in newsgroup.
  244.     \h'|0.5i'UNSUB     \h'|2i'Unsubscribed newsgroup.
  245.     \h'|0.5i'BOGUS     \h'|2i'Bogus newsgroup.
  246.     \h'|0.5i'JUNK      \h'|2i'Ignored line in .newsrc
  247. \h'|2i'(e.g. readnews \*(L"options\*(R" line).
  248. .fi
  249. .Sp
  250. (A bogus newsgroup is one that is not in the list of active newsgroups
  251. in the active file, which on most systems is /usr/lib/news/active.)
  252. .Ip "m name" 8
  253. Move the named newsgroup somewhere else in the
  254. .IR .newsrc .
  255. If no name is given, the current newsgroup is moved.
  256. There are a number of ways to specify where you want the newsgroup\*(--type
  257. h for help when it asks where you want to put it.
  258. .Ip c 8
  259. Catch up\*(--mark all unread articles in this newsgroup as read.
  260. .Ip "o pattern" 8
  261. Only display those newsgroups whose name matches
  262. .IR pattern .
  263. Patterns are the same as for the \*(L'/\*(R' command.
  264. Multiple patterns may be separated by spaces, just as on the
  265. command line.
  266. The restriction will remain in effect either until there are no articles
  267. left in the restricted set of newsgroups, or another restriction command
  268. is given.
  269. Since
  270. .I pattern
  271. is optional, \*(L'o\*(R' by itself will remove the
  272. restriction.
  273. .Ip "a pattern" 8
  274. Add new newsgroups matching
  275. .IR pattern .
  276. Newsgroups which are already in your
  277. .I .newsrc
  278. file, whether subscribed to or
  279. not, will not be listed.
  280. If any new newsgroups are found, you will be asked for each one whether
  281. you would like to add it.
  282. After any new newsgroups have been added, the \*(L'a\*(R' command also
  283. restricts the current set of newsgroups just like the \*(L'o\*(R' command
  284. does.
  285. .Ip & 8
  286. Print out the current status of command line switches and any newsgroup
  287. restrictions.
  288. .Ip "&switch {switch}" 8
  289. Set additional command line switches.
  290. .Ip && 8
  291. Print out the current macro definitions.
  292. .Ip "&&keys commands" 8
  293. Define additional macros.
  294. .Ip !command 8
  295. Escape to a subshell.
  296. One exclamation mark (!) leaves you in your own news directory.
  297. A double exclamation mark (!!) leaves you in the spool
  298. directory for news, which on most systems is /usr/spool/news.
  299. The environment variable SHELL will be used if defined.
  300. If
  301. .I command
  302. is null, an interactive shell is started.
  303. .Ip q 8
  304. Quit.
  305. .Ip x 8
  306. Quit, restoring .newsrc to its state at startup of
  307. .IR rn .
  308. The .newsrc you would have had if you had exited with \*(L'q\*(R' will be
  309. called .newnewsrc, in case you didn't really want to type \*(L'x\*(R'.
  310. .Ip ^K 8
  311. Edit the global KILL file.
  312. This is a file which contains /pattern/j commands (one per line) to be
  313. applied to every newsgroup as it is started up, that is, when it is
  314. selected on the newsgroup selection level.
  315. The purpose of a KILL file is to mark articles as read on the basis of some
  316. set of patterns.
  317. This saves considerable wear and tear on your \*(L'n\*(R' key.
  318. There is also a local KILL file for each newsgroup.
  319. Because of the overhead involved in searching for articles to kill, it is
  320. better if possible to use a local KILL file.
  321. Local KILL files are edited with a \*(L'^K\*(R' on the article selection level.
  322. There are also automatic ways of adding search commands to the local KILL
  323. file\*(--see the \*(L'K\*(R' command and the K search modifier on the
  324. article selection level.
  325. .Sp
  326. If either of the environment variables VISUAL or EDITOR is set, the
  327. specified editor will be invoked; otherwise a default editor (normally vi(1))
  328. is invoked on the KILL file.
  329. .Sh "Article Selection Level"
  330. On the article selection level,
  331. .I rn
  332. selects (by default) unread articles in numerical order (the order in which
  333. articles have arrived at your site).
  334. If you do a subject search (^N), the default order is modified to be
  335. numerical order within each subject thread.
  336. You may switch back and forth between numerical order and subject thread
  337. order at will.
  338. The
  339. .B \-S
  340. switch can be used to make subject search mode the default.
  341. .Sp
  342. On the article selection level you are
  343. .I not
  344. asked whether you want to read an article before the article is displayed;
  345. rather,
  346. .I rn
  347. simply displays the first page (or portion of a page, at low baud rates) of the
  348. article and asks if you want to continue.
  349. The normal article selection prompt comes at the END of the article
  350. (though article selection commands can be given from within the middle
  351. of the article (the pager level) also).
  352. The prompt at the end of an article looks like this:
  353. .Sp 
  354. End of article 248 (of 257)\*(--what next? [npq]
  355. .Sp
  356. The following are the options at this point:
  357. .Ip n,SP 8
  358. Scan forward for next unread article.
  359. (Note: the \*(L'n\*(R' (next) command when typed at the end of an article
  360. does not mark the article as read, since an article is automaticaly marked
  361. as read after the last line of it is printed.
  362. It is therefore possible to type a sequence such as \*(L'mn\*(R' and leave
  363. the article marked as unread.
  364. The fact that an article is marked as read by typing \*(L'n\*(R',
  365. \&\*(L'N\*(R', \*(L'^N\*(R', \*(L's\*(R', or \*(L'S\*(R' within the MIDDLE of
  366. the article is in fact a special case.)
  367. .Ip N 8
  368. Go to the next article.
  369. .Ip ^N 8
  370. Scan forward for the next article with the same subject, and make ^N default
  371. (subject search mode).
  372. .Ip p 8
  373. Scan backward for previous unread article.
  374. If there is none, stay at the current article.
  375. .Ip P 8
  376. Go to the previous article.
  377. .Ip \- 8
  378. Go to the previously displayed article (regardless of whether that article
  379. is before or after this article in the normal sequence).
  380. .Ip ^P 8
  381. Scan backward for the previous article with the same subject, and make
  382. ^N default (subject search mode).
  383. .Ip ^R 8
  384. Restart the current article.
  385. .Ip v 8
  386. Restart the current article verbosely, displaying the entire header.
  387. .Ip ^L 8
  388. Refresh the screen.
  389. .Ip ^X 8
  390. Restart the current article, and decrypt as a rot13 message.
  391. .Ip X 8
  392. Refresh the screen, and decrypt as a rot13 message.
  393. .Ip b 8
  394. Back up one page.
  395. .Ip q 8
  396. Quit this newsgroup and go back to the newsgroup selection level.
  397. .Ip ^ 8
  398. Go to the first unread article.
  399. .Ip $ 8
  400. Go to the last article (actually, one past the last article).
  401. .Ip "number" 8
  402. Go to the numbered article.
  403. .Ip "range{,range} command{:command}" 8
  404. Apply a set of commands to a set of articles.
  405. A range consists of either <article number> or
  406. <article\ number>\-<article\ number>.
  407. A dot \*(L'.\*(R' represents the current article, and a dollar
  408. sign \*(L'$\*(R' represents the last article.
  409. .Sp
  410. Applicable commands include \*(L'm\*(R' (mark as unread), \*(L'M\*(R'
  411. (delayed mark as unread), \*(L'j\*(R' (mark as read), \*(L"s dest\*(R"
  412. (save to a destination), \*(L"!command\*(R" (shell escape), \*(L"=\*(R"
  413. (print the subject) and \*(L"C\*(R" (cancel).
  414. .Ip j 8
  415. Junk the current article\*(--mark it as read.
  416. If this command is used from within an article, you are left at the end of
  417. the article, unlike \*(L'n\*(R', which looks for the next article.
  418. .Ip m 8
  419. Mark the current article as still unread.
  420. (If you are in subject search mode you probably want to use M instead of m.
  421. Otherwise the current article may be selected as the beginning of the next
  422. subject thread.)
  423. .Ip M 8
  424. Mark the current article as still unread, but not until the newsgroup
  425. is exited.
  426. Until then, the current article will be marked as read.
  427. This is useful for returning to an article in another session, or in another
  428. newsgroup.
  429. .Ip /pattern 8
  430. Scan forward for article containing
  431. .I pattern
  432. in the subject.
  433. See the section on Regular Expressions.
  434. Together with the escape substitution facility described later, it becomes
  435. easy to search for various attributes of the current article, such as
  436. subject, article ID, author name, etc.
  437. The previous pattern can be recalled with \*(L"<esc>/\*(R".
  438. If
  439. .I pattern
  440. is omitted, the previous pattern is assumed.
  441. .Ip /pattern/h 8
  442. Scan forward for article containing
  443. .I pattern
  444. in the header.
  445. .Ip /pattern/a 8
  446. Scan forward for article containing
  447. .I pattern
  448. anywhere in article.
  449. .Ip /pattern/r 8
  450. Scan read articles also.
  451. .Ip /pattern/c 8
  452. Make search case sensitive.
  453. Ordinarily upper and lower case are considered the same.
  454. .Ip "/pattern/modifiers:command{:command}" 8
  455. Apply the commands listed to articles matching the search command (possibly
  456. with h, a, or r modifiers).
  457. Applicable commands include \*(L'm\*(R' (mark as unread), \*(L'M\*(R'
  458. (delayed mark as unread), \*(L'j\*(R' (mark as read), \*(L"s dest\*(R"
  459. (save to a destination), \*(L"!command\*(R" (shell escape), \*(L"=\*(R"
  460. (print the subject) and \*(L"C\*(R" (cancel).
  461. If the first command is \*(L'm\*(R' or \*(L'M\*(R', modifier r is assumed.
  462. A K may be included in the modifiers (not the commands) to cause the
  463. entire command (sans K) to be saved to the local KILL file, where it will
  464. be applied to every article that shows up in the newsgroup.
  465. .Sp
  466. For example, to save all articles in a given newsgroup to the line printer
  467. and mark them read, use \*(L"/^/\||\|lpr:j\*(R".
  468. If you say \*(L"/^/K\||\|lpr:j\*(R", this will happen every time you enter the
  469. newsgroup.
  470. .Ip ?pattern 8
  471. Scan backward for article containing
  472. .I pattern
  473. in the subject.
  474. May be modified as the forward search is: ?pattern?modifiers[:commands].
  475. It is likely that you will want an r modifier when scanning backward.
  476. .Ip k 8
  477. Mark as read all articles with the same subject as the current article.
  478. (Note: there is no single character command to temporarily mark as read (M
  479. command) articles matching the current subject.
  480. That can be done with \*(L"/<esc>s/M\*(R", however.)
  481. .Ip K 8
  482. Do the same as the k command, but also add a line to the local KILL file for
  483. this newsgroup to kill this subject every time the newsgroup is started up.
  484. For a discussion of KILL files, see the \*(L'^K\*(R' command below.
  485. See also the K modifier on searches above.
  486. .Ip ^K 8
  487. Edit the local KILL file for this newsgroup.
  488. Each line of the KILL file should be a command of the form /pattern/j.
  489. (With the exception that
  490. .I rn
  491. will insert a line at the beginning of the form \*(L"THRU <number>\*(R",
  492. which tells
  493. .I rn
  494. the maximum article number that the KILL file has been applied to.  You
  495. may delete the THRU line to force a rescan of current articles.)
  496. You may also have reason to use the m, h, or a modifiers.
  497. Be careful with the M modifier in a kill file\*(--there are more efficient
  498. ways to never read an article.
  499. You might have reason to use it if a particular series of articles is posted
  500. to multiple newsgroups.
  501. In this case, M would force you to view the article in a different newsgroup.
  502. .Sp
  503. To see only newgroup articles in the control newsgroup, for instance, you
  504. might put
  505. .Sp
  506. /^/j
  507. .br
  508. /newgroup/m
  509. .Sp
  510. which kills all subjects not containing \*(L"newgroup\*(R".
  511. You can add lines automatically via the K command and K search modifiers,
  512. but editing is the only way to remove lines.
  513. If either of the environment variables VISUAL or EDITOR is set, the
  514. specified editor will be invoked; otherwise a default editor (normally vi)
  515. is invoked on the KILL file.
  516. .Sp
  517. The KILL file may also contain switch setting lines beginning with \*(L'&\*(R'.
  518. Additionally, any line beginning with \*(L'X\*(R' is executed on exit
  519. from the newsgroup rather than on entrance.
  520. This can be used to set switches back to a default value.
  521. .Ip r 8
  522. Reply through net mail.
  523. The environment variables MAILPOSTER and MAILHEADER may be used to modify
  524. the mailing behavior of
  525. .I rn
  526. (see environment section).
  527. .Ip R 8
  528. Reply, including the current article in the header file generated.
  529. (See \*(L'F\*(R' command below).
  530. The YOUSAID environment variable controls the format of the attribution line.
  531. .Ip f 8
  532. Submit a followup article.
  533. .Ip F 8
  534. Submit a followup article, and include the old article, with lines prefixed
  535. either by \*(L">\*(R" or by the argument to a
  536. .B \-F
  537. switch.
  538. .I Rn
  539. will attempt to provide an attribution line in front of the quoted article,
  540. generated from the From: line of the article.
  541. Unfortunately, the From: line doesn't always contain the right name; you
  542. should double check it against the signature and change it if necessary,
  543. or you may have to apologize for quoting the wrong person.
  544. The environment variables NEWSPOSTER, NEWSHEADER and ATTRIBUTION may be
  545. used to modify the posting behavior of
  546. .I rn
  547. (see environment section).
  548. .Ip C 8
  549. Cancel the current article, but only if you are the contributor or superuser.
  550. .Ip c 8
  551. Catch up in this newsgroup; i.e., mark all articles as read.
  552. .Ip u 8
  553. Unsubscribe to this newsgroup.
  554. .Ip "s destination" 8
  555. Save to a filename or pipe using sh.
  556. If the first character of the destination is a vertical bar, the rest of
  557. the command is considered a shell command to which the article is passed
  558. through standard input.
  559. The command is subject to filename expansion.
  560. (See also the environment variable PIPESAVER.)
  561. If the destination does not begin with a vertical bar, the rest of the
  562. command is assumed to be a filename of some sort.
  563. An initial tilde \*(L'~\*(R' will be translated to the name of the home
  564. directory, and an initial environment variable substitution is also allowed.
  565. If only a directory name is specified, the environment variable SAVENAME
  566. is used to generate the actual name.
  567. If only a filename is specified (i.e. no directory), the environment variable
  568. SAVEDIR will be used to generate the actual directory.
  569. If nothing is specified, then obviously both variables will be used.
  570. Since the current directory for rn while doing a save command is your
  571. private news directory, saying \*(L"s ./filename\*(R" will force the file
  572. to your news directory.
  573. Save commands are also run through % interpretation, so that you can
  574. say \*(L"s %O/filename\*(R" to save to the directory you were in when you ran
  575. .IR rn ,
  576. and \*(L"s %t\*(R" to save to a filename consisting of the Internet address
  577. of the sender.
  578. .Sp
  579. After generating the full pathname of the file to save to,
  580. .I rn
  581. determines if the file exists already, and if so, appends to it.
  582. .I Rn
  583. will attempt to determine if an existing file is a mailbox or a normal file,
  584. and save the article in the same format.
  585. If the output file does not yet exist,
  586. .I rn
  587. will by default ask you which format you want, or you can make it skip the
  588. question with either the
  589. .B \-M
  590. or
  591. .B \-N
  592. switch.
  593. If the article is to be saved in mailbox format, the command to do so is
  594. generated from the environment variable MBOXSAVER.
  595. Otherwise, NORMSAVER is used.
  596. .Ip "S destination" 8
  597. Save to a filename or pipe using a preferred shell, such as csh.
  598. Which shell is used depends first on what you have the environment variable
  599. SHELL set to, and in the absence of that, on what your news administrator
  600. set for the preferred shell when he or she installed
  601. .IR rn .
  602. .Ip "| command" 8
  603. Shorthand for \*(L"s | command\*(R".
  604. .Ip "w destination" 8
  605. The same as \*(L"s destination\*(R", but saves without the header.
  606. .Ip "W destination" 8
  607. The same as \*(L"S destination\*(R", but saves without the header.
  608. .Ip & 8
  609. Print out the current status of command line switches.
  610. .Ip "&switch {switch}" 8
  611. Set additional command line switches.
  612. .Ip && 8
  613. Print out current macro definitions.
  614. .Ip "&&keys commands" 8
  615. Define an additional macro.
  616. .Ip !command 8
  617. Escape to a subshell.
  618. One exclamation mark (!) leaves you in your own news directory.
  619. A double exclamation mark (!!) leaves you in the spool
  620. directory of the current newsgroup.
  621. The environment variable SHELL will be used if defined.
  622. If
  623. .I command
  624. is null, an interactive shell is started.
  625. .Sp
  626. You can use escape key substitutions described later to get to many
  627. run-time values.
  628. The command is also run through % interpretation, in case it is being called
  629. from a range or search command.
  630. .Ip = 8
  631. List subjects of unread articles.
  632. .Ip # 8
  633. Print last article number.
  634. .Sh "Pager Level"
  635. At the pager level (within an article), the prompt looks like this:
  636. .Sp
  637. \*(--MORE\*(--(17%)
  638. .Sp
  639. and a number of commands may be given:
  640. .Ip SP 8
  641. Display next page.
  642. .Ip x 8
  643. Display next page and decrypt as a rot13 message.
  644. .Ip d,^D 8
  645. Display half a page more.
  646. .Ip CR 8
  647. Display one more line.
  648. .Ip q 8
  649. Go to the end of the current article (don't mark it either read or unread).
  650. Leaves you at the \*(L"What next?\*(R" prompt.
  651. .Ip j 8
  652. Junk the current article.
  653. Mark it read and go to the end of the article.
  654. .Ip ^L 8
  655. Refresh the screen.
  656. .Ip X 8
  657. Refresh the screen and decrypt as a rot13 message.
  658. .Ip b,^B 8
  659. Back up one page.
  660. .Ip gpattern 8
  661. Goto (search forward for)
  662. .I pattern
  663. within current article.
  664. Note that there is no space between the command and the pattern.
  665. If the pattern is found, the page containing the pattern will be displayed.
  666. Where on the page the line matching the pattern goes depends on the value
  667. of the
  668. .B \-g
  669. switch.
  670. By default the matched line goes at the top of the screen.
  671. .Ip G 8
  672. Search for g pattern again.
  673. .Ip ^G 8
  674. This is a special version of the \*(L'g\*(R' command that is for skipping
  675. articles in a digest.
  676. It is equivalent to setting \*(L"\-g4\*(R" and then executing the command
  677. \*(L"g^Subject:\*(R".
  678. .Ip TAB 8
  679. This is another special version of the \*(L'g\*(R' command that is for
  680. skipping inclusions of older articles.
  681. It is equivalent to setting \*(L"\-g4\*(R" and then executing the command
  682. \*(L"g^[^c]\*(R", where \fIc\fR is the first character of the last line
  683. on the screen.
  684. It searches for the first line that doesn't begin with the same character
  685. as the last line on the screen.
  686. .Ip !command 8
  687. Escape to a subshell.
  688. .PP
  689. The following commands skip the rest of the current article, then behave just
  690. as if typed to the \*(L"What next?\*(R" prompt at the end of the article.
  691. See the documentation at the article selection level for these commands.
  692. .Sp    
  693.     # $ & / = ? c C f F k K ^K m M r R ^R u v Y ^
  694. .br
  695.     number
  696. .br
  697.     range{,range} command{:command}
  698. .Sp
  699. The following commands also skip to the end of the article, but have the
  700. additional effect of marking the current article as read:
  701. .Sp
  702.     n N ^N s S | w W
  703. .Sp
  704. .Sh "Miscellaneous facts about commands"
  705. An \*(L'n\*(R' typed at either the \*(L"Last newsgroup\*(R" prompt or a
  706. \*(L"Last article\*(R" prompt will cycle back to the top of the newsgroup
  707. or article list, whereas a \*(L'q\*(R' will quit the level.
  708. (Note that \*(L'n\*(R' does not mean \*(L"no\*(R", but rather
  709. \*(L"next\*(R".)
  710. A space will of course do whatever is shown as the
  711. default, which will vary depending on whether rn thinks you have more
  712. articles or newsgroups to read.
  713. .PP
  714. The \*(L'b\*(R' (backup page) command may be repeated until the beginning of
  715. the article is reached.
  716. If
  717. .I rn
  718. is suspended (via a ^Z), then when the job is resumed, a refresh (^L) will
  719. automatically be done (Berkeley-type systems only).
  720. If you type a command such as \*(L'!\*(R' or \*(L's\*(R' which takes you
  721. from the middle of the article to the end, you can always get back into the
  722. middle by typing \*(L'^L\*(R'.
  723. .PP
  724. In multi-character commands such as \*(L'!\*(R', \*(L's\*(R', \*(L'/\*(R',
  725. etc, you can interpolate various run-time values by typing escape and a
  726. character.
  727. To find out what you can interpolate, type escape and \*(L'h\*(R', or check
  728. out the single character % substitutions for environment variables in the
  729. Interpretation and Interpolation section, which are the same.
  730. Additionally, typing a double escape will cause any % substitutions in the
  731. string already typed in to be expanded.
  732. .Sh "Options"
  733. .I Rn
  734. has a nice set of options to allow you to tailor the interaction
  735. to your liking.
  736. (You might like to know that the author swears by \*(L"\-e \-m \-S \-/\*(R".)
  737. These options may be set on the command line, via the RNINIT
  738. environment variable, via a file pointed to by the RNINIT variable, or
  739. from within rn via the & command.
  740. Options may generally be unset by saying \*(L"+switch\*(R".
  741. Options include:
  742. .TP 5
  743. .B \-c
  744. checks for news without reading news.
  745. If a list of newsgroups is given on the command line, only those newsgroups
  746. will be checked; otherwise all subscribed-to newsgroups are checked.
  747. Whenever the
  748. .B \-c
  749. switch is specified, a non-zero exit status from
  750. .I rn
  751. means that there is unread news in one of the checked newsgroups.
  752. The
  753. .B \-c
  754. switch does not disable the printing of newsgroups with unread news;
  755. this is controlled by the
  756. .B \-s
  757. switch.
  758. (The
  759. .B \-c
  760. switch is not meaningful when given via the & command.)
  761. .TP 5
  762. .B \-C<number>
  763. tells
  764. .I rn
  765. how often to checkpoint the
  766. .IR .newsrc ,
  767. in articles read.
  768. Actually, this number says when to start thinking about doing a checkpoint
  769. if the situation is right.
  770. If a reasonable checkpointing situation doesn't arise within 10 more
  771. articles, the
  772. .I .newsrc
  773. is checkpointed willy-nilly.
  774. .TP 5
  775. .B \-d<directory name>
  776. sets the default save directory to something other than ~/News.
  777. The directory name will be globbed (via csh) if necessary (and if possible).
  778. Articles saved by
  779. .I rn
  780. may be placed in the save directory or in a subdirectory thereof depending
  781. on the command that you give and the state of the environment variables
  782. SAVEDIR and SAVENAME.
  783. Any KILL files (see the K command in the Article Selection section)
  784. also reside in this directory and its subdirectories, by default.
  785. In addition, shell escapes leave you in this directory.
  786. .TP 5
  787. .B \-D<flags>
  788. enables debugging output.
  789. See common.h for flag values.
  790. Warning: normally
  791. .I rn
  792. attempts to restore your
  793. .I .newsrc
  794. when an unexpected signal or internal error occurs.
  795. This is disabled when any debugging flags are set.
  796. .TP 5
  797. .B \-e
  798. causes each page within an article to be started at the top of the screen,
  799. not just the first page.
  800. (It is similar to the
  801. .B \-c
  802. switch of
  803. .IR more (1).)
  804. You never have to read scrolling text with this switch.
  805. This is helpful especially at certain baud rates because you can start reading
  806. the top of the next page without waiting for the whole page to be printed.
  807. It works nicely in conjuction with the
  808. .B \-m
  809. switch, especially if you use half-intensity for your highlight mode.
  810. See also the
  811. .B \-L
  812. switch.
  813. .TP 5
  814. .B \-E<name>=<val>
  815. sets the environment variable <name> to the value specified.
  816. Within
  817. .IR rn ,
  818. \*(L"&\-ESAVENAME=%t\*(R" is similar to \*(L"setenv SAVENAME '%t'\*(R" in
  819. .IR csh ,
  820. or \*(L"SAVENAME='%t'; export SAVENAME\*(R" in
  821. .IR sh .
  822. Any environment variables set with
  823. .B \-E
  824. will be inherited by subprocesses of
  825. .IR rn .
  826. .TP 5
  827. .B \-F<string>
  828. sets the prefix string for the \*(L'F\*(R' followup command to use in
  829. prefixing each line of the quoted article.
  830. For example, \*(L"\-F<tab>\*(R" inserts a tab on the front of each line
  831. (which will cause long lines to wrap around, unfortunately),
  832. \*(L"\-F>>>>\*(R" inserts \*(L">>>>\*(R" on every line, and
  833. \*(L"\-F\*(R" by itself causes nothing to be inserted, in case you want to
  834. reformat the text, for instance.
  835. The initial default prefix is \*(L">\*(R".
  836. .TP 5
  837. .B \-g<line>
  838. tells
  839. .I rn
  840. which line of the screen you want searched-for strings to show up on when
  841. you search with the \*(L'g\*(R' command within an article.
  842. The lines are numbered starting with 1.
  843. The initial default is \*(L"\-g1\*(R", meaning the first line of the screen.
  844. Setting the line to less than 1 or more than the number of lines on the screen
  845. will set it to the last line of the screen.
  846. .TP 5
  847. .B \-h<string>
  848. hides (disables the printing of) all header lines beginning with
  849. .I string.
  850. For instance, \-hexp will disable the printing of the \*(L"Expires:\*(R" line.
  851. Case is insignificant.
  852. If <string> is null, all header lines except Subject are hidden, and you
  853. may then use
  854. .B +h
  855. to select those lines you want to see.
  856. You may wish to use the baud-rate switch modifier below to hide more lines
  857. at lower baud rates.
  858. .TP 5
  859. .B \-H<string>
  860. works just like
  861. .B \-h
  862. except that instead of setting the hiding flag for a header line, it sets
  863. the magic flag for that header line.
  864. Certain header lines have magic behavior that can be controlled this way.
  865. At present, the following actions are caused by the flag for the particular
  866. line:
  867. the Newsgroups line will only print when there are multiple newsgroups,
  868. the Subject line will be underlined, and the Expires line will always be
  869. suppressed if there is nothing on it.
  870. In fact, all of these actions are the default, and you must use
  871. .B +H
  872. to undo them.
  873. .TP 5
  874. .B \-i=<number>
  875. specifies how long (in lines) to consider the initial page of an
  876. article\*(--normally this is determined automatically depending on baud rate.
  877. (Note that an entire article header will always be printed regardless of the
  878. specified initial page length.
  879. If you are working at low baud rate and wish to reduce the size of the
  880. headers, you may hide certain header lines with the
  881. .B \(bsh
  882. switch.)
  883. .TP 5
  884. .B \-l
  885. disables the clearing of the screen at the beginning of each
  886. article, in case you have a bizarre terminal.
  887. .TP 5
  888. .B \-L
  889. tells
  890. .I rn
  891. to leave information on the screen as long as possible by not blanking
  892. the screen between pages, and by using clear to end-of-line.
  893. (The
  894. .IR more (1)
  895. program does this.)
  896. This feature works only if you have the requisite termcap
  897. capabilities.
  898. The switch has no effect unless the
  899. .B \-e
  900. switch is set.
  901. .TP 5
  902. .B \-m=<mode>
  903. enables the marking of the last line of the previous page
  904. printed, to help the user see where to continue reading.
  905. This is most helpful when less than a full page is going to be displayed.
  906. It may also be used in conjunction with the
  907. .B \-e
  908. switch, in which case the page is erased, and the first line (which is
  909. the last line of the previous page) is highlighted.
  910. If
  911. .B \-m=s
  912. is specified, the standout mode will be used, but if
  913. .B \-m=u
  914. is specified, underlining will be used.
  915. If neither
  916. .B =s
  917. or
  918. .B =u
  919. is specified, standout is the default.
  920. Use
  921. .B +m
  922. to disable highlighting.
  923. .TP 5
  924. .B \-M
  925. forces mailbox format in creating new save files.
  926. Ordinarily you are asked which format you want.
  927. .TP 5
  928. .B \-N
  929. forces normal (non-mailbox) format in creating new save files.
  930. Ordinarily you are asked which format you want.
  931. .TP 5
  932. .B \-r
  933. causes
  934. .I rn
  935. to restart in the last newsgroup read during a previous session with
  936. .I rn.
  937. It is equivalent to starting up normally and then getting to the newsgroup
  938. with a g command.
  939. .TP 5
  940. .B \-s
  941. with no argument suppresses the initial listing of newsgroups with unread
  942. news, whether
  943. .B \-c
  944. is specified or not.
  945. Thus
  946. .B \-c
  947. and
  948. .B \-s
  949. can be used together to test \*(L"silently\*(R" the status of news from
  950. within your
  951. .I .login
  952. file.
  953. If
  954. .B \-s
  955. is followed by a number, the initial listing is suppressed after that many
  956. lines have been listed.
  957. Presuming that you have your
  958. .I .newsrc
  959. sorted into order of interest,
  960. .B \-s5
  961. will tell you the 5 most interesting newsgroups that have unread news.
  962. This is also a nice feature to use in your
  963. .I .login
  964. file, since it not only tells you whether there is unread news, but also how
  965. important the unread news is, without having to wade through the entire
  966. list of unread newsgroups.
  967. If no 
  968. .B \-s
  969. switch is given 
  970. .B \-s5
  971. is assumed, so just putting \*(L"rn \-c\*(R"
  972. into your
  973. \&.login file is fine.
  974. .TP 5
  975. .B \-S<number>
  976. causes
  977. .I rn
  978. to enter subject search mode (^N) automatically whenever a newsgroup is
  979. started up with <number> unread articles or more.
  980. Additionally, it causes any \*(L'n\*(R' typed while in subject search mode
  981. to be interpreted as \*(L'^N\*(R' instead.
  982. (To get back out of subject search mode, the best command is probably
  983. \&\*(L'^\*(R'.)
  984. If <number> is omitted, 3 is assumed.
  985. .TP 5
  986. .B \-t
  987. puts
  988. .I rn
  989. into terse mode.
  990. This is more cryptic but useful for low baud rates.
  991. (Note that your system administrator may have compiled
  992. .I rn
  993. with either verbose or terse messages only to save memory.)
  994. You may wish to use the baud-rate switch modifier below to enable terse mode
  995. only at lower baud rates.
  996. .TP 5
  997. .B \-T
  998. allows you to type ahead of rn.
  999. Ordinarily rn will eat typeahead to prevent your autorepeating space bar from
  1000. doing a very frustrating thing when you accidentally hold it down.
  1001. If you don't have a repeating space bar, or you are working at low baud
  1002. rate, you can set this switch to prevent this behavior.
  1003. You may wish to use the baud-rate switch modifier below to disable typeahead
  1004. only at lower baud rates.
  1005. .TP 5
  1006. .B \-v
  1007. sets verification mode for commands.
  1008. When set, the command being executed is displayed to give some feedback that
  1009. the key has actually been typed.
  1010. Useful when the system is heavily loaded and you give a command that takes
  1011. a while to start up.
  1012. .TP 5
  1013. .B \-/
  1014. sets SAVEDIR to \*(L"%p/%c\*(R" and SAVENAME to \*(L"%a\*(R", which means
  1015. that by default articles are saved in a subdirectory of your private news
  1016. directory corresponding to the name of the the current newsgroup, with the
  1017. filename being the article number.
  1018. .B +/
  1019. sets SAVEDIR to \*(L"%p\*(R" and SAVENAME to \*(L"%^C\*(R", which by
  1020. default saves articles directly to your private news directory, with the
  1021. filename being the name of the current newsgroup, first letter capitalized.
  1022. (Either
  1023. .B +/
  1024. or
  1025. .B \-/
  1026. may be default on your system, depending on the feelings of your news
  1027. administrator when he, she or it installed
  1028. .IR rn .)
  1029. You may, of course, explicitly set SAVEDIR and SAVENAME to other values\*(--see
  1030. discussion in the environment section.
  1031. .PP
  1032. Any switch may be selectively applied according to the current baud-rate.
  1033. Simply prefix the switch with +speed to apply the switch at that speed or
  1034. greater, and \%\-speed to apply the switch at that speed or less.
  1035. Examples: \%\-1200\-hposted suppresses the Posted line at 1200 baud or less;
  1036. \%+9600\-m enables marking at 9600 baud or more.
  1037. You can apply the modifier recursively to itself also: \%+300\-1200\-t sets
  1038. terse mode from 300 to 1200 baud.
  1039. .PP
  1040. Similarly, switches may be selected based on terminal type:
  1041. .Sp
  1042.     \-=vt100+T        set +T on vt100
  1043. .br
  1044.     \-=tvi920\-ETERM=mytvi    get a special termcap entry
  1045. .br
  1046.     \-=tvi920\-ERNMACRO=%./.rnmac.tvi
  1047. .br
  1048.                 set up special keymappings
  1049. .br
  1050.     +=paper\-v        set verify mode if not hardcopy
  1051. .PP
  1052. Some switch arguments, such as environment variable values, may require
  1053. spaces in them.
  1054. Such spaces should be quoted via ", ', or \e in the conventional fashion,
  1055. even when passed via RNINIT or the & command.
  1056. .Sh "Regular Expressions"
  1057. The patterns used in article searching are regular expressions such as
  1058. those used by
  1059. .IR ed (1).
  1060. In addition, \ew matches an alphanumeric character and \eW a nonalphanumeric.
  1061. Word boundaries may be matched by \eb, and non-boundaries by \eB.
  1062. The bracketing construct \e(\ ...\ \e) may also be used, and \edigit matches
  1063. the digit'th substring, where digit can range from 1 to 9.
  1064. \e0 matches whatever the last bracket match matched.
  1065. Up to 10 alternatives may given in a pattern, separated by \e|, with the
  1066. caveat that \e(\ ...\ \e|\ ...\ \e) is illegal.
  1067. .Sh "Interpretation and Interpolation"
  1068. Many of the strings that
  1069. .I rn
  1070. handles are subject to interpretations of several types.
  1071. Under filename expansion, an initial \*(L"~/\*(R" is translated to the name
  1072. of your home directory, and \*(L"~name\*(R" is translated to the login
  1073. directory for the user specified.
  1074. Filename expansion will also expand an initial environment variable, and
  1075. also does the backslash, uparrow and percent expansion mentioned below.
  1076. .PP
  1077. All interpreted strings go through backslash, uparrow and percent
  1078. interpretation.
  1079. The backslash escapes are the normal ones (such as \en, \et, \ennn, etc.).
  1080. The uparrow escapes indicate control codes in the normal fashion.
  1081. Backslashes or uparrows to be passed through should be escaped with backslash.
  1082. The special percent escapes are similar to printf percent escapes.
  1083. These cause the substitution of various run-time values into the string.
  1084. The following are currently recognized:
  1085. .Ip %a 8
  1086. Current article number.
  1087. .Ip %A 8
  1088. Full name of current article (%P/%c/%a).
  1089. (On a Eunice system with the LINKART option, %P/%c/%a returns the name of
  1090. the article in the current newsgroup, while %A returns the real name of
  1091. the article, which may be different if the current article was posted to
  1092. multiple newsgroups.)
  1093. .Ip %b 8
  1094. Destination of last save command, often a mailbox.
  1095. .Ip %B 8
  1096. The byte offset to the beginning of the part of the article to be saved,
  1097. set by the save command.
  1098. The \*(L's\*(R' and \*(L'S\*(R' commands set it to 0, and the \*(L'w\*(R'
  1099. and \*(L'W\*(R' commands set it to the byte offset of the body of the article.
  1100. .Ip %c 8
  1101. Current newsgroup, directory form.
  1102. .Ip %C 8
  1103. Current newsgroup, dot form.
  1104. .Ip %d 8
  1105. Full name of newsgroup directory (%P/%c).
  1106. .Ip %D 8
  1107. \*(L"Distribution:\*(R" line from the current article.
  1108. .Ip %f 8
  1109. \*(L"From:\*(R" line from the current article, or the \*(L"Reply-To:\*(R"
  1110. line if there is one.
  1111. This differs from %t in that comments (such as the full name) are not
  1112. stripped out with %f.
  1113. .Ip %F 8
  1114. \*(L"Newsgroups:\*(R" line for a new article, constructed from
  1115. \*(L"Newsgroups:\*(R" and \*(L"Followup-To:\*(R" lines of current article.
  1116. .Ip %h 8
  1117. Name of the header file to pass to the mail or news poster,
  1118. containing all the information that the poster program needs in the
  1119. form of a message header.
  1120. It may also contain a copy of the current article.
  1121. The format of the header file is controlled by the MAILHEADER and NEWSHEADER
  1122. environment variables.
  1123. .Ip %H 8
  1124. Host name (your machine's name).
  1125. .Ip %i 8
  1126. \*(L"Message-I.D.:\*(R" line from the current article, with <> guaranteed.
  1127. .Ip %I 8
  1128. The reference indication mark (see the
  1129. .B \-F
  1130. switch.)
  1131. .Ip %l 8
  1132. The news administrator's login name, if any.
  1133. .Ip %L 8
  1134. Login name (yours).
  1135. .Ip %m 8
  1136. The current mode of rn, for use in conditional macros.
  1137. .Sp
  1138. .nf
  1139.     i    Initializing.
  1140.     n    Newsgroup selection level.
  1141.     a    Article selection level.
  1142.     p    Pager level.
  1143.     m    Miscellaneous questions.
  1144. .fi
  1145. .Ip %M 8
  1146. The number of articles marked to return via the \*(L'M\*(R' command.
  1147. If the same article is Marked multiple times, \*(L"%M\*(R" counts it
  1148. multiple times in the current implementation.
  1149. .Ip %n 8
  1150. \*(L"Newsgroups:\*(R" line from the current article.
  1151. .Ip %N 8
  1152. Full name (yours).
  1153. .Ip %o 8
  1154. Organization (yours).
  1155. .Ip %O 8
  1156. Original working directory (where you ran rn from).
  1157. .Ip %p 8
  1158. Your private news directory, normally ~/News.
  1159. .Ip %P 8
  1160. Public news spool directory, normally /usr/spool/news.
  1161. .Ip %r 8
  1162. Last reference on references line of current article (parent article id).
  1163. .Ip %R 8
  1164. References list for a new article, constructed from the references and article
  1165. ID of the current article.
  1166. .Ip %s 8
  1167. Subject, with all Re's and (nf)'s stripped off.
  1168. .Ip %S 8
  1169. Subject, with one \*(L"Re:\*(R" stripped off.
  1170. .Ip %t 8
  1171. \*(L"To:\*(R" line derived from the \*(L"From:\*(R" and \*(L"Reply-To:\*(R"
  1172. lines of the current article.
  1173. This always returns an Internet format address.
  1174. .Ip %T 8
  1175. \*(L"To:\*(R" line derived from the \*(L"Path:\*(R" line of the
  1176. current article to produce a uucp path.
  1177. .Ip %u 8
  1178. The number of unread articles in the current newsgroup.
  1179. .Ip %U 8
  1180. The number of unread articles in the current newsgroup, not counting the
  1181. current article.
  1182. .Ip %x 8
  1183. The news library directory.
  1184. .Ip %X 8
  1185. The rn library directory.
  1186. .Ip %z 8
  1187. The length of the current article in bytes.
  1188. .Ip %~ 8
  1189. Your home directory.
  1190. .Ip %. 8
  1191. The directory containing your dot files, which is your home directory unless
  1192. the environment variable DOTDIR is defined when rn is invoked.
  1193. .Ip %$ 8
  1194. Current process number.
  1195. .Ip %/ 8
  1196. Last search string.
  1197. .Ip %% 8
  1198. A percent sign.
  1199. .Ip "%{name} or %{name\-default}" 8
  1200. The environment variable \*(L"name\*(R".
  1201. .Ip %[name] 8
  1202. The value of header line \*(L"Name:\*(R" from the current article.
  1203. The \*(L"Name:\ \*(R" is not included.
  1204. For example \*(L"%D\*(R" and \*(L"%[distribution]\*(R" are equivalent.
  1205. The name must be spelled out in full.
  1206. .Ip %`command` 8
  1207. Inserts the output of the command, with any embedded newlines translated
  1208. to space.
  1209. .Ip %""prompt"" 8
  1210. Prints prompt on the terminal, then inputs one string, and inserts it.
  1211. .Ip "%(test_text=pattern?then_text:else_text)" 8
  1212. If
  1213. .I test_text
  1214. matches
  1215. .IR pattern ,
  1216. has the value
  1217. .IR then_text ,
  1218. otherwise
  1219. .IR else_text .
  1220. The \*(L":else_text\*(R" is optional, and if absent, interpolates the null string.
  1221. The = may be replaced with != to negate the test.
  1222. To quote any of the metacharacters
  1223. (\*(L'=\*(R', \*(L'?\*(R', \*(L':\*(R', or \*(L')\*(R'),
  1224. precede with a backslash.
  1225. .Ip %digit 8
  1226. The digits 1 through 9 interpolate the string matched by the nth bracket
  1227. in the last pattern match that had brackets.
  1228. If the last pattern had alternatives, you may not know the number of the
  1229. bracket you want\*(--%0 will give you the last bracket matched.
  1230. .PP
  1231. Modifiers: to capitalize the first letter, insert \*(L'^\*(R':
  1232. \*(L"%^C\*(R" produces something like \*(L"Net.jokes\*(R".
  1233. Inserting \*(L'_\*(R' causes the first letter following the last
  1234. \&\*(L'/\*(R' to be capitalized: \*(L"%_c\*(R" produces \*(L"net/Jokes\*(R".
  1235. .SH ENVIRONMENT
  1236. The following environment variables are paid attention to by
  1237. .IR rn .
  1238. In general the default values assumed for these variables by
  1239. .I rn
  1240. are reasonable, so if you are using
  1241. .I rn
  1242. for the first time, you can safely ignore this section.
  1243. Note that the defaults below may not correspond precisely to the defaults
  1244. on your system.
  1245. To find the actual defaults you would need to look in config.h and common.h
  1246. in the rn source directory, and the file INIT in the rn library.
  1247. .PP
  1248. Those variables marked (%) are subject to % interpolation, and those marked
  1249. (~) are subject to both % interpolation and ~ interpretation.
  1250. .Ip "ATTRIBUTION (%)" 8
  1251. Gives the format of the attribution line in front of the quoted article
  1252. included by an F command.
  1253. .Sp
  1254. Default: In article %i %f writes:
  1255. .Ip "CANCEL (~)" 8
  1256. The shell command used to cancel an article.
  1257. .Sp
  1258. Default: inews \-h < %h
  1259. .Ip "CANCELHEADER (%)" 8 13v
  1260. The format of the file to pass to the CANCEL command in order to cancel
  1261. an article.
  1262. .Sp
  1263. Default:
  1264. .br
  1265. Newsgroups: %n
  1266. .br
  1267. Subject: cmsg cancel %i
  1268. .br
  1269. References: %R
  1270. .br
  1271. Reply-To: %L@%H.UUCP (%N)
  1272. .br
  1273. Distribution: %D
  1274. .br
  1275. Organization: %o
  1276. .sp 1
  1277. %i cancelled from rn.
  1278. .Ip DOTDIR 8
  1279. Where to find your dot files, if they aren't in your home directory.
  1280. Can be interpolated using \*(L"%.\*(R".
  1281. .Sp
  1282. Default: $HOME
  1283. .Ip "EDITOR (~)" 8
  1284. The name of your editor, if VISUAL is undefined.
  1285. .Sp
  1286. Default: whatever your news administrator compiled in, usually vi.
  1287. .Ip "FIRSTLINE (%)" 8
  1288. Controls the format of the line displayed at the top of an article.
  1289. Warning: this may go away.
  1290. .Sp
  1291. Default: Article %a %(%U%M!=^00$?(%U more%(%M!=^0$? + %M Marked to return)\e) )in %C:, more or less.
  1292. .Ip HOME 8
  1293. Your home directory.
  1294. Affects ~ interpretation, and the location of your
  1295. dot files if DOTDIR is not defined.
  1296. .Sp
  1297. Default: $LOGDIR
  1298. .Ip "KILLGLOBAL (~)" 8
  1299. Where to find the KILL file to apply to every newsgroup.
  1300. See the \*(L'^K\*(R' command at the newsgroup selection level.
  1301. .Sp
  1302. Default: %p/KILL
  1303. .Ip "KILLLOCAL (~)" 8
  1304. Where to find the KILL file for the current newsgroup.
  1305. See the commands \*(L'K\*(R' and \*(L'^K\*(R' at the article selection level,
  1306. and the search modifier \*(L'K\*(R'.
  1307. .Sp
  1308. Default: %p/%c/KILL
  1309. .Ip LOGDIR 8
  1310. Your home directory if HOME is undefined.
  1311. Affects ~ interpretation, and the location of your
  1312. dot files if DOTDIR is not defined.
  1313. .Sp
  1314. Default: none.
  1315. .Sp
  1316. Explanation: you must have either $HOME or $LOGDIR.
  1317. .Ip LOGNAME 8
  1318. Your login name, if USER is undefined.
  1319. May be interpolated using \*(L"%L\*(R".
  1320. .Sp
  1321. Default: value of getlogin().
  1322. .Ip "MAILFILE (~)" 8
  1323. Where to check for mail.
  1324. .Sp
  1325. Default: /usr/spool/mail/%L
  1326. .Ip "MAILHEADER (%)" 8
  1327. The format of the header file for replies.
  1328. See also MAILPOSTER.
  1329. .Sp
  1330. Default:
  1331. .Sp
  1332. To: %T
  1333. .br
  1334. Subject: Re: %S
  1335. .br
  1336. Newsgroups: %n
  1337. .br
  1338. In-Reply-To: %i
  1339. .br
  1340. %(%[references]!=^$?References\\: %[references]
  1341. .br
  1342. )Organization: %o
  1343. .br
  1344. Cc: 
  1345. .br
  1346. Bcc: \en\en
  1347. .Ip "MAILPOSTER (~)" 8
  1348. The shell command to be used by the reply commands (r and R)
  1349. in order to allow you to enter and deliver the response.
  1350. .I Rn
  1351. will not itself call upon an editor for replies\*(--this
  1352. is a function of the program called by
  1353. .IR rn .
  1354. See also MAILHEADER.
  1355. .Sp
  1356. Default: Rnmail \-h %h
  1357. .Ip "MBOXSAVER (~)" 8
  1358. The shell command to save an article in mailbox format.
  1359. .Sp
  1360. Default: %X/mbox.saver %A %P %c %a %B %C "%b" \e
  1361. .br
  1362. "From: %T %`date`"
  1363. .Sp
  1364. Explanation: the first seven arguments are the same as for NORMSAVER.
  1365. The eighth argument to the shell script is the new From: line
  1366. for the article, including the posting date,
  1367. derived either directly from the Posted: line, or not-so-directly from
  1368. the Date: line.
  1369. Header munging at its finest.
  1370. .Ip NAME 8
  1371. Your full name.
  1372. May be interpolated using \*(L"%N\*(R".
  1373. .Sp
  1374. Default: name from /etc/passwd, or ~/.fullname.
  1375. .Ip "NEWSHEADER (%)" 8 16v
  1376. The format of the header file for followups.
  1377. See also NEWSPOSTER.
  1378. .Sp
  1379. Default:
  1380. .Sp
  1381. Newsgroups: %F
  1382. .br
  1383. Subject: Re: %S
  1384. .br
  1385. Summary:
  1386. .br
  1387. Expires: 
  1388. .br
  1389. References: %R
  1390. .br
  1391. Sender: 
  1392. .br
  1393. Reply-To: %L@%H.UUCP (%N)
  1394. .br
  1395. Followup-To: 
  1396. .br
  1397. Distribution: %D
  1398. .br
  1399. Organization: %o
  1400. .br
  1401. Keywords: \en\en
  1402. .Ip "NEWSPOSTER (~)" 8
  1403. The shell command to be used by the followup commands (f and F)
  1404. in order to allow you to enter and post a followup news article.
  1405. .I Rn
  1406. will not itself call upon an editor for followups\*(--this
  1407. is a function of the program called by
  1408. .IR rn .
  1409. See also NEWSHEADER.
  1410. .Sp
  1411. Default: Pnews \-h %h
  1412. .Ip "NORMSAVER (~)" 8
  1413. The shell command to save an article in the normal (non-mailbox) format.
  1414. .Sp
  1415. Default: %X/norm.saver %A %P %c %a %B %C "%b"
  1416. .Ip ORGANIZATION 8
  1417. Either the name of your organization, or the name of a file containing the
  1418. name of your organization.
  1419. May be interpolated using \*(L"%o\*(R".
  1420. .Sp
  1421. Default: whatever your news administrator compiled in.
  1422. .Ip "PIPESAVER (%)" 8
  1423. The shell command to execute in order to accomplish a save to a pipe
  1424. (\*(L"s\ |\ command\*(R" or \*(L"w\ |\ command\*(R").
  1425. The command typed by the user is substituted in as %b.
  1426. .Sp
  1427. Default: %(%B=^0$?<%A:tail +%Bc %A |) %b
  1428. .Sp
  1429. Explanation: if %B is 0, the command is \*(L"<%A %b\*(R", otherwise
  1430. the command is \*(L"tail +%Bc %A | %b\*(R".
  1431. .Ip RNINIT 8
  1432. Default values for switches may be passed to
  1433. .I rn
  1434. by placing them in RNINIT.
  1435. Any switch that is set in RNINIT may be overruled 
  1436. on the command line, or via the \*(L'&\*(R' command from within
  1437. .IR rn .
  1438. Binary-valued switches that are set with \*(L"\-switch\*(R" may be unset
  1439. using \*(L"+switch\*(R".
  1440. .Sp
  1441. If RNINIT begins with a \*(L'/\*(R' it is assumed to be the name of a file
  1442. containing switches.
  1443. If you want to set many environment variables but don't want to keep
  1444. them all in your environment, or if the use of any of these variables
  1445. conflicts with other programs, you can use this feature along with the
  1446. .B \-E
  1447. switch to set the environment variables upon startup.
  1448. .Sp
  1449. Default: \*(L" \*(R".
  1450. .Ip "RNMACRO (~)" 8
  1451. The name of the file containing macros and key mappings.
  1452. See the MACROS section.
  1453. .Sp
  1454. Default: %./.rnmac
  1455. .Ip "SAVEDIR (~)" 8
  1456. The name of the directory to save to, if the save command does not specify
  1457. a directory name.
  1458. .Sp
  1459. Default:
  1460. .br
  1461.    If
  1462. .B \-/
  1463. is set: %p/%c
  1464. .br
  1465.    If
  1466. .B +/
  1467. is set: %p
  1468. .Ip "SAVENAME (%)" 8
  1469. The name of the file to save to, if the save command contains only a
  1470. directory name.
  1471. .Sp
  1472. Default:
  1473. .br
  1474.    If
  1475. .B \-/
  1476. is set: %a
  1477. .br
  1478.    If
  1479. .B +/
  1480. is set: %^C
  1481. .Ip SHELL 8
  1482. The name of your preferred shell.
  1483. It will be used by the \*(L'!\*(R', \*(L'S\*(R' and \*(L'W\*(R' commands.
  1484. .Sp
  1485. Default: whatever your news administrator compiled in.
  1486. .Ip "SUBJLINE (%)" 8
  1487. Controls the format of the lines displayed by the \*(L'=\*(R' command at
  1488. the article selection level.
  1489. .Sp
  1490. Default: %s
  1491. .Ip TERM 8
  1492. Determines which termcap entry to use, unless TERMCAP contains the entry.
  1493. .Ip TERMCAP 8
  1494. Holds either the name of your termcap file, or a termcap entry.
  1495. .Sp
  1496. Default: /etc/termcap, normally.
  1497. .Ip USER 8
  1498. Your login name.
  1499. May be interpolated using \*(L"%L\*(R".
  1500. .Sp
  1501. Default: $LOGNAME
  1502. .Ip "VISUAL (~)" 8
  1503. The name of your editor.
  1504. .Sp
  1505. Default: $EDITOR
  1506. .Ip "YOUSAID (%)" 8
  1507. Gives the format of the attribution line in front of the quoted article
  1508. included by an R command.
  1509. .Sp
  1510. Default: In article %i you write:
  1511. .SH MACROS
  1512. When
  1513. .I rn
  1514. starts up, it looks for a file containing macro definitions (see environment
  1515. variable RNMACRO).
  1516. Any sequence of commands may be bound to any sequence of keys, so you
  1517. could remap your entire keyboard if you desire.
  1518. Blank lines or lines beginning with # in the macro file are considered
  1519. comments; otherwise
  1520. .I rn
  1521. looks for two fields separated by white space.
  1522. The first field gives the sequence of keystrokes that trigger the macro,
  1523. and the second field gives the sequence of commands to execute.
  1524. Both fields are subject to % interpolation, which will also translate
  1525. backslash and uparrow sequences.
  1526. (The keystroke field is interpreted at startup time, but the command field
  1527. is interpreted at macro execution time so that you may refer to % values
  1528. in a macro.)
  1529. For example, if you want to reverse the roles of carriage return and
  1530. space in rn
  1531. .Sp
  1532. ^J    \e040
  1533. .br
  1534. ^M    \e040
  1535. .br
  1536. \e040    ^J
  1537. .Sp
  1538. will do just that.
  1539. By default, all characters in the command field are interpreted as the
  1540. canonical
  1541. .I rn
  1542. characters, i.e. no macro expansion is done.
  1543. Otherwise the above pair of macros would cause an infinite loop.
  1544. To force macro expansion in the command field, enclose the
  1545. macro call with ^( ... ^) thusly:
  1546. .Sp
  1547. @s    |mysavescript
  1548. .br
  1549. @w    w^(@s^)
  1550. .Sp
  1551. You can use the %() conditional construct to construct macros that work
  1552. differently under different circumstances.
  1553. In particular, the current mode (%m) of
  1554. .I rn
  1555. could be used to make a command that only works at a particular level.
  1556. For example,
  1557. .Sp
  1558. ^[[O    %(%m=p?\e040)
  1559. .Sp
  1560. will only allow the macro to work at the pager level.
  1561. .Sp
  1562. %(%{TERM}=vt100?^[[O)    /^J
  1563. .Sp
  1564. will do the binding only if the terminal type is vt100,
  1565. though if you have many of these it would be better to have separate
  1566. files for each terminal.
  1567. .Sp
  1568. If you want to bind a macro to a function key that puts a common garbage character
  1569. after the sequence (such as the carriage return on the end of Televideo 920
  1570. function sequences), DO NOT put the carriage return
  1571. into all the sequences or you will waste a CONSIDERABLE amount of internal
  1572. storage.
  1573. Instead of \*(L"^AF^M\*(R", put \*(L"^AF+1\*(R", which indicates to
  1574. .I rn
  1575. that it should gobble up one character after the F.
  1576. .SH AUTHOR
  1577. Larry Wall <lwall@sdcrdcf.UUCP>
  1578. .br
  1579. Regular expression routines are borrowed from emacs, by James Gosling.
  1580. .SH FILES
  1581. .Ip "%./.newsrc" 1.25i
  1582. status of your news reading
  1583. .Ip "%./.oldnewsrc" 1.25i
  1584. backup copy of your
  1585. .I .newsrc
  1586. from start of session
  1587. .Ip "%./.rnlock" 1.25i
  1588. lock file so you don't screw up your
  1589. .I .newsrc
  1590. .Ip "%./.rnlast" 1.25i
  1591. info from last run of rn
  1592. .Ip "%./.rnsoft" 1.25i
  1593. soft pointers into /usr/lib/active to speed startup, synchronous with
  1594. .I .newsrc
  1595. .Ip "%./.rnhead" 1.25i
  1596. temporary header file to pass to a mailer or news poster
  1597. .Ip "%./.rnmac" 1.25i
  1598. macro and keymap definitions
  1599. .Ip "%p" 1.25i
  1600. your news save directory, usually ~/News
  1601. .Ip "%x/active" 1.25i
  1602. the list of active newsgroups, usually /usr/lib/news/active
  1603. .Ip "%P" 1.25i
  1604. the public news spool directory, usually /usr/spool/news
  1605. .Ip "%X/INIT" 1.25i
  1606. system-wide default switches
  1607. .SH SEE ALSO
  1608. newsrc(5), more(1), readnews(1), Pnews(1), Rnmail(1)
  1609. .SH DIAGNOSTICS
  1610. Generally self-documenting, as they say.
  1611. .SH BUGS
  1612. The
  1613. .B \-h
  1614. switch can only hide header lines that
  1615. .I rn
  1616. knows about.
  1617. .PP
  1618. The \*(L'\-\*(R' command doesn't cross newsgroup boundaries, and only undoes
  1619. the last article selection.
  1620. .PP
  1621. If you edit your
  1622. .I .newsrc
  1623. while
  1624. .I rn
  1625. is running,
  1626. .I rn
  1627. will happily wipe out your changes when it decides to
  1628. write out the
  1629. .I .newsrc
  1630. file.
  1631. .PP
  1632. .I Rn
  1633. doesn't do certain things (like ordering articles on posting date) that
  1634. the author feels should be handled by inews.
  1635. .PP
  1636. Marking of duplicate articles as read in cross-referenced newsgroups will
  1637. not work unless the Xref patch is installed in inews.
  1638. .PP
  1639. If you get carried away with % or escape substitutions, you can overflow
  1640. buffers.
  1641. .PP
  1642. There should be no fixed limit on the number of newsgroups.
  1643. .PP
  1644. Some of the more esoteric features may be missing on machines with limited
  1645. address space.
  1646. !STUFFY!FUNK!
  1647. echo Extracting init.c
  1648. cat >init.c <<'!STUFFY!FUNK!'
  1649. /* $Header: init.c,v 4.3 85/05/01 16:16:13 lwall Exp $
  1650.  *
  1651.  * $Log:    init.c,v $
  1652.  * Revision 4.3  85/05/01  16:16:13  lwall
  1653.  * Baseline for release with 4.3bsd.
  1654.  * 
  1655.  */
  1656.  
  1657. #include "EXTERN.h"
  1658. #include "common.h"
  1659. #include "util.h"
  1660. #include "final.h"
  1661. #include "term.h"
  1662. #include "last.h"
  1663. #include "rn.h"
  1664. #include "rcstuff.h"
  1665. #include "ngdata.h"
  1666. #include "only.h"
  1667. #include "intrp.h"
  1668. #include "addng.h"
  1669. #include "sw.h"
  1670. #include "art.h"
  1671. #include "artsrch.h"
  1672. #include "artio.h"
  1673. #include "backpage.h"
  1674. #include "bits.h"
  1675. #include "cheat.h"
  1676. #include "head.h"
  1677. #include "help.h"
  1678. #include "kfile.h"
  1679. #include "ngsrch.h"
  1680. #include "ngstuff.h"
  1681. #include "rcln.h"
  1682. #include "respond.h"
  1683. #include "ng.h"
  1684. #include "INTERN.h"
  1685. #include "init.h"
  1686.  
  1687. bool
  1688. initialize(argc,argv)
  1689. int argc;
  1690. char *argv[];
  1691. {
  1692.     char *tcbuf;
  1693.     register bool foundany = FALSE;
  1694.     long time();
  1695. #ifdef NOLINEBUF
  1696.     char std_out_buf[BUFSIZ];
  1697.  
  1698.     setbuf(std_out_buf);
  1699. #endif
  1700.  
  1701.     tcbuf = safemalloc(1024);        /* make temp buffer for termcap and */
  1702.                     /* other initialization stuff */
  1703.     
  1704.     /* init terminal */
  1705.     
  1706.     term_init();            /* must precede sw_init() so that */
  1707.                     /* ospeed is set for baud-rate */
  1708.                     /* switches.  Actually terminal */
  1709.                     /* mode setting is in term_set() */
  1710.  
  1711.     /* we have to know rnlib to look up global switches in %X/INIT */
  1712.  
  1713.     lib = savestr(filexp(LIB));
  1714.     rnlib = savestr(filexp(RNLIB));
  1715.  
  1716.     /* decode switches */
  1717.  
  1718.     sw_init(argc,argv,&tcbuf);          /* must not do % interps! */
  1719.                     /* (but may mung environment) */
  1720.  
  1721.     /* init signals, status flags */
  1722.  
  1723.     final_init();
  1724.     
  1725.     /* start up file expansion and the % interpreter */
  1726.  
  1727.     intrp_init(tcbuf);
  1728.     
  1729.     /* now make sure we have a current working directory */
  1730.  
  1731.     cwd_check();
  1732.     
  1733.     /* now that we know where to save things, cd to news directory */
  1734.  
  1735.     if (chdir(spool)) {
  1736.     printf(nocd,spool) FLUSH;
  1737.     finalize(1);
  1738.     }
  1739.  
  1740.     /* if we aren't just checking, turn off echo */
  1741.  
  1742.     if (!checkflag)
  1743.     term_set(tcbuf);
  1744.  
  1745.     /* get info on last rn run, if any */
  1746.  
  1747.     last_init(tcbuf);
  1748.  
  1749.     free(tcbuf);            /* recover 1024 bytes */
  1750.  
  1751.     /* make sure we are the right version */
  1752.  
  1753.     version_check();
  1754.  
  1755.     /* make sure we are the sole possessors of .newsrc */
  1756.  
  1757.     lock_check();
  1758.  
  1759.     /* check for news news */
  1760.  
  1761.     newsnews_check();
  1762.  
  1763.     /* open active file, etc. */
  1764.  
  1765.     ngdata_init();
  1766.  
  1767.     /* now read in the .newsrc file */
  1768.  
  1769.     foundany = rcstuff_init();
  1770.  
  1771.     /* it looks like we will actually read something, so init everything */
  1772.  
  1773.     addng_init();
  1774.     art_init();
  1775.     artio_init();
  1776.     artsrch_init();
  1777.     backpage_init();
  1778.     bits_init();
  1779.     cheat_init();
  1780. /*  final_init();    already done */
  1781.     head_init();
  1782.     help_init();
  1783. /*  intrp_init();      already done */
  1784.     kfile_init();
  1785. /*  last_init();    already done */
  1786.     ng_init();
  1787. /*  ngdata_init();    already done */
  1788.     ngsrch_init();
  1789.     ngstuff_init();
  1790.     only_init();
  1791.     rcln_init();
  1792. /*  rcstuff_init();    already done */
  1793.     respond_init();
  1794.     rn_init();
  1795.     search_init();
  1796. /*  sw_init();      already done */
  1797. /*  term_init();    already done */
  1798.     util_init();
  1799.  
  1800. #ifdef FINDNEWNG
  1801.     fstat(actfp->_file,&filestat);    /* did active file grow? */
  1802.     if (filestat.st_size != lastactsiz) {
  1803.     long actsiz = filestat.st_size;    /* remember new size */
  1804.     NG_NUM oldnext = nextrcline;    /* remember # lines in newsrc */
  1805. #ifdef FASTNEW
  1806.     bool munged = writesoft || !lastactsiz;
  1807.                     /* bad soft ptrs -> edited active */
  1808. #else
  1809.     bool munged = TRUE;        /* just assume .newsrc munged */
  1810. #endif
  1811.  
  1812. #ifdef VERBOSE
  1813.     IF(verbose)
  1814.         fputs("\nChecking active list for new newsgroups...\n",stdout)
  1815.           FLUSH;
  1816.     ELSE
  1817. #endif
  1818. #ifdef TERSE
  1819.         fputs("\nNew newsgroups:\n",stdout) FLUSH;
  1820. #endif
  1821. #ifdef FASTNEW
  1822.     if (!munged) {            /* maybe just do tail of file? */
  1823.         fseek(actfp,lastactsiz-1,0);
  1824.         fgets(buf,LBUFLEN,actfp);
  1825.         munged = (*buf != '\n');
  1826.         if (!munged)
  1827.         munged = newlist(munged,FALSE);
  1828.     }
  1829. #endif
  1830.     if (munged) {            /* must we scan entire file? */
  1831.         fseek(actfp,0L,0);        /* rewind active file */
  1832.         newlist(munged,FALSE);      /* sure hope they use hashing... */
  1833.     }
  1834.     lastactsiz = actsiz;        /* remember for .rnlast */
  1835.     if (nextrcline != oldnext) {    /* did we add any new groups? */
  1836.         foundany = TRUE;        /* let main() know */
  1837.         starthere = 0;              /* and start ng scan from the top */
  1838.     }
  1839.     }
  1840. #endif
  1841.     time(&lasttime);            /* remember when we inited-- */
  1842.                     /* ends up back in .rnlast */
  1843.     writelast();                       /* in fact, put it there now */
  1844.     
  1845. #ifdef FINDNEWNG
  1846. # ifdef ONLY
  1847.     if (maxngtodo)            /* patterns on command line? */
  1848.     foundany |= scanactive();
  1849. # endif
  1850. #endif
  1851.  
  1852.     return foundany;
  1853. }
  1854.  
  1855. /* make sure there is no rn out there already */
  1856.  
  1857. void
  1858. lock_check()
  1859. {
  1860.     lockname = savestr(filexp(LOCKNAME));
  1861.     if (!checkflag) {
  1862.     tmpfp = fopen(lockname,"r");
  1863.     if (tmpfp != Nullfp) {
  1864.         int processnum;
  1865.  
  1866.         fgets(buf,LBUFLEN,tmpfp);
  1867.         fclose(tmpfp);
  1868.         processnum = atoi(buf);
  1869. #ifdef VERBOSE
  1870.         IF(verbose)
  1871.         printf("You seem to have left an rn running, process %d.\n",
  1872.             processnum) FLUSH;
  1873.         ELSE
  1874. #endif
  1875. #ifdef TERSE
  1876.         printf("Rn left running, #%d.\n", processnum) FLUSH;
  1877. #endif
  1878.         if (kill(processnum, SIGEMT)) {
  1879.                     /* does process not exist? */
  1880.                     /* (rn ignores SIGEMT) */
  1881.         sleep(2);
  1882. #ifdef VERBOSE
  1883.         IF(verbose)
  1884.             fputs("\n\
  1885. That process does not seem to exist anymore.  The count of read articles\n\
  1886. may be incorrect in the last newsgroup accessed by that other (defunct)\n\
  1887. process.\n\n",stdout) FLUSH;
  1888.         ELSE
  1889. #endif
  1890. #ifdef TERSE
  1891.             fputs("\nProcess crashed.\n",stdout) FLUSH;
  1892. #endif
  1893.         if (*lastngname) {
  1894. #ifdef VERBOSE
  1895.             IF(verbose)
  1896.             printf("(The last newsgroup accessed was %s.)\n\n",
  1897.             lastngname) FLUSH;
  1898.             ELSE
  1899. #endif
  1900. #ifdef TERSE
  1901.             printf("(In %s.)\n\n",lastngname) FLUSH;
  1902. #endif
  1903.         }
  1904.         get_anything();
  1905.         putchar('\n') FLUSH;
  1906.         }
  1907.         else {
  1908. #ifdef VERBOSE
  1909.         IF(verbose)
  1910.             fputs("\n\
  1911. You may not have two copies of rn running simultaneously.  Goodbye.\n\
  1912. ",stdout) FLUSH;
  1913.         ELSE
  1914. #endif
  1915. #ifdef TERSE
  1916.             fputs("\nCan't start another.\n",stdout) FLUSH;
  1917. #endif
  1918.         finalize(0);
  1919.         }
  1920.     }
  1921.     tmpfp = fopen(lockname,"w");
  1922.     if (tmpfp == Nullfp) {
  1923.         printf(cantcreate,lockname) FLUSH;
  1924.         sig_catcher(0);
  1925.     }
  1926.     fprintf(tmpfp,"%d\n",getpid());
  1927.     fclose(tmpfp);
  1928.     }
  1929. }
  1930.  
  1931. void
  1932. newsnews_check()
  1933. {
  1934.     char *newsnewsname = filexp(NEWSNEWSNAME);
  1935.  
  1936.     if (!checkflag && (tmpfp = fopen(newsnewsname,"r")) != Nullfp) {
  1937.     fstat(tmpfp->_file,&filestat);
  1938.     if (filestat.st_mtime > lasttime) {
  1939.         while (fgets(buf,sizeof(buf),tmpfp) != Nullch)
  1940.         fputs(buf,stdout) FLUSH;
  1941.         get_anything();
  1942.         putchar('\n') FLUSH;
  1943.     }
  1944.     fclose(tmpfp);
  1945.     }
  1946. }
  1947.  
  1948. void
  1949. version_check()
  1950. {
  1951.     set_ngname("net.announce");
  1952.     if (access(ngdir,0)) {
  1953. #ifdef VERBOSE
  1954.     IF(verbose)
  1955.         fputs("Can't find net.announce.  Wrong news version?\n",stdout)
  1956.           FLUSH;
  1957.     ELSE
  1958. #endif
  1959. #ifdef TERSE
  1960.         fputs("Wrong version?\n",stdout) FLUSH;
  1961. #endif
  1962.     finalize(1);
  1963.     }
  1964. }
  1965. !STUFFY!FUNK!
  1966. echo Extracting ng.h
  1967. cat >ng.h <<'!STUFFY!FUNK!'
  1968. /* $Header: ng.h,v 4.3 85/05/01 11:44:29 lwall Exp $
  1969.  *
  1970.  * $Log:    ng.h,v $
  1971.  * Revision 4.3  85/05/01  11:44:29  lwall
  1972.  * Baseline for release with 4.3bsd.
  1973.  * 
  1974.  */
  1975.  
  1976. EXT ART_NUM art INIT(0);    /* current or prospective article # */
  1977.  
  1978. EXT int checkcount INIT(0);    /* how many articles have we read */
  1979.             /*   in the current newsgroup since */
  1980.             /*   the last checkpoint? */
  1981. EXT int docheckwhen INIT(20);    /* how often to do checkpoint */
  1982.  
  1983. #ifdef MAILCALL
  1984. EXT int mailcount INIT(0);            /* check for mail when 0 mod 10 */
  1985. #endif
  1986. EXT char *mailcall INIT(nullstr);
  1987.  
  1988. EXT bool forcelast INIT(FALSE);            /* ought we show "End of newsgroup"? */
  1989. EXT bool forcegrow INIT(FALSE);        /* do we want to recalculate size */
  1990.                     /* of newsgroup, e.g. after posting? */
  1991.  
  1992. #define NG_ERROR -1
  1993. #define NG_NORM 0
  1994. #define NG_ASK 1
  1995. #define NG_MINUS 2
  1996.  
  1997. void    ng_init();
  1998. int    do_newsgroup();
  1999. int    art_switch();
  2000. #ifdef MAILCALL
  2001.     void    setmail();
  2002. #endif
  2003. void    setdfltcmd();
  2004. !STUFFY!FUNK!
  2005. echo ""
  2006. echo "End of kit 1 (of 9)"
  2007. cat /dev/null >kit1isdone
  2008. config=true
  2009. for iskit in 1 2 3 4 5 6 7 8 9; do
  2010.     if test -f kit${iskit}isdone; then
  2011.     echo "You have run kit ${iskit}."
  2012.     else
  2013.     echo "You still need to run kit ${iskit}."
  2014.     config=false
  2015.     fi
  2016. done
  2017. case $config in
  2018.     true)
  2019.     echo "You have run all your kits.  Please read README and then type Configure."
  2020.     chmod 755 Configure
  2021.     ;;
  2022. esac
  2023. : I do not append .signature, but someone might mail this.
  2024. exit
  2025.  
  2026.