home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume19 / nn / part10 < prev    next >
Encoding:
Internet Message Format  |  1989-06-22  |  49.6 KB

  1. Subject:  v19i071:  NN, a Usenet news reader, Part10/15
  2. Newsgroups: comp.sources.unix
  3. Sender: sources
  4. Approved: rsalz@uunet.UU.NET
  5.  
  6. Submitted-by: storm@texas.dk (Kim F. Storm)
  7. Posting-number: Volume 19, Issue 71
  8. Archive-name: nn/part10
  9.  
  10. #!/bin/sh
  11. # this is part 10 of a multipart archive
  12. # do not concatenate these parts, unpack them in order with /bin/sh
  13. # file nn.1 continued
  14. #
  15. CurArch=10
  16. if test ! -r s2_seq_.tmp
  17. then echo "Please unpack part 1 first!"
  18.      exit 1; fi
  19. ( read Scheck
  20.   if test "$Scheck" != $CurArch
  21.   then echo "Please unpack part $Scheck next!"
  22.        exit 1;
  23.   else exit 0; fi
  24. ) < s2_seq_.tmp || exit 1
  25. echo "x - Continuing file nn.1"
  26. sed 's/^X//' << 'NO_NEWS_IS_GOOD_NEWS' >> nn.1
  27. Xa total of 32 different macros.
  28. X.LP
  29. XTo define macro number \fIM\fP, the following construction is used
  30. X(the line breaks are mandatory):
  31. X.nf
  32. X    \fBdefine\fP \fIM\fP
  33. X        \fIbody\fP
  34. X    \fBend\fP
  35. X.fi
  36. X.LP
  37. XThe \fIbody\fP consists of a sequence of \fItokens\fP separated by
  38. Xwhite space (blanks or newlines).  However, certain \fItokens\fP 
  39. Xcontinue to the end of the current line.  
  40. X.LP
  41. XThe following \fItokens\fP may occur in the macro \fIbody\fP:
  42. X.TP
  43. X.I Comments
  44. XEmpty lines and text following a # character (preceded by white space)
  45. Xis ignored.
  46. X.TP
  47. X.I Command Names
  48. XAny command name listed in the key mapping section can be included in
  49. Xa macro causing that command to be invoked when the macro is executed.
  50. X.TP
  51. X.I Extended Commands
  52. XAll the extended commands which can be executed through the 
  53. X.B command
  54. Xcommand (normally bound to the : key) can also be executed in a macro.
  55. XAn extended command starts with a colon (:) and continues to the
  56. Xend of the current line.  Example:
  57. X.br
  58. X    :show groups total
  59. X.TP
  60. X.I Key Strokes
  61. XA key stroke (which is normally mapped into a command depending on the
  62. Xcurrent mode) is specified as a key name enclosed in single quotes.
  63. XExamples (A-key, left arrow key, RETURN key):
  64. X.br
  65. X    'A'  'left'  '^M'
  66. X.TP
  67. X.I Strings
  68. XInput to commands prompting for a string, e.g. a file name, can be
  69. Xspecified in a macro as a double quoted string.  Example (save without
  70. Xprompting for a file name):
  71. X.br
  72. X    \fBsave-short\fP "+$G"
  73. X.TP
  74. X.I Conditionals
  75. XConditionals may occur anywhere in a macro; a conditional is evaluated
  76. Xwhen the macro is executed, and if the condition is false \fIthe rest
  77. Xof the current line is ignored\fP.  The following conditionals are available:
  78. X.nf
  79. X    \fB?menu\fP    True in menu mode
  80. X    \fB?show\fP    True in reading mode
  81. X    \fB?folder\fP    True when looking at a folder
  82. X    \fB?group\fP    True when looking at a news group
  83. X    \fB?yes\fP    Query user, true if answer is yes
  84. X    \fB?no\fP    Query user, true if answer is no
  85. X.fi
  86. XExample (stop macro execution if user rejects to continue):
  87. X.br
  88. X    \fBprompt\fP "continue? " \fB?no break\fP
  89. X.sp 0.5v
  90. XIn addition to these conditionals, it is possible to test the current
  91. Xvalue of boolean and integer variables using the following form:
  92. X.br
  93. X    \fB?\fP\fIvariable\fP\fB=\fP\fIvalue\fP
  94. X.br
  95. XThis conditional will be true (1) if the variable is an integer variable
  96. Xwhose current value is the one specified, or (2) if the variable is a
  97. Xboolean variable which is either \fBon\fP or \fBoff\fP.  Examples:
  98. X.nf
  99. X    ?layout=3 :set layout 1
  100. X    ?monitor=on  break
  101. X    ?sort=off :sort age
  102. X.fi
  103. X.TP
  104. X.B break
  105. XTerminate macro execution completely.  This includes nested macros.
  106. XExample (stop if looking at a folder):
  107. X.br
  108. X    \fB?folder\fP \fBbreak\fP
  109. X.TP
  110. X.B return
  111. XTerminate execution of current macro.  If the current macro is called
  112. Xfrom another macro, execution of that macro continues immediately.
  113. X.TP
  114. X.B input
  115. XQuery the user for a key stroke or a string, for example a file name.
  116. XExample (prompt the user for a file name in the usual way):
  117. X.br
  118. X    \fBsave-short\fP \fBinput\fP
  119. X.TP
  120. X.B yes
  121. XConfirm unconditionally \fIif\fP a command requires confirmation.  It
  122. Xis ignored if the command does not require confirmation.  Example
  123. X(confirm creation of new files):
  124. X.br
  125. X    \fBsave-short\fP "+$G" \fByes\fP
  126. X.TP
  127. X.B no
  128. XTerminate execution of current macro \fIif\fP a command requires
  129. Xconfirmation; otherwise ignore it.  If neither \fByes\fP nor \fBno\fP
  130. Xis specified when a command requires confirmation, the user must
  131. Xanswer the question as usual \- if the user confirms the action
  132. Xexecution continues normally; otherwise the execution of the current
  133. Xmacro is terminated.  Example (do not create new files):
  134. X.br
  135. X    \fBsave-short\fP "+$L/misc" \fBno\fP
  136. X.TP
  137. X\fBprompt\fP \fIstring\fP
  138. XPrint the \fIstring\fP in the prompt line (highlighted).  The string
  139. Xmust be enclosed in double quotes.  Example:
  140. X.br
  141. X    \fBprompt\fP "Enter recipient name"
  142. X.TP
  143. X\fBecho\fP \fIstring\fP
  144. XDisplay the \fIstring\fP in the prompt line for a short period.  Example:
  145. X.br
  146. X    ?show \fBecho\fP "Cannot be used in reading mode" break
  147. X.TP
  148. X\fBmacro\fP \fIM\fP
  149. XInvoke macro number \fIM\fP.  The maximum macro nesting level is five
  150. X(also catches macro loops).
  151. X.LP
  152. XI use the following macro to quickly save all the selected files in a
  153. Xfile whose name is entered as usual.  It also works in reading mode
  154. X(saving just the current article).
  155. X.nf
  156. X    \fBdefine\fP 1
  157. X        :unset save-report
  158. X        save-short input yes
  159. X        ?menu '+'
  160. X        :set save-report
  161. X    \fBend\fP
  162. X.fi
  163. X.SH THE INIT FILES
  164. XThe
  165. X.I init
  166. Xfiles are used to customize \fInn\fP's behaviour to your personal taste.
  167. X\fINn\fP uses two init files \- a system-wide init file located in the
  168. Xlibrary directory, and a private init file located in the user's
  169. X\&\fI.nn\fP directory.  The private init file is read after the global
  170. Xinit file to allow the user to change the default setup.
  171. X.LP
  172. XThe init file may contain the following types of commands (and data):
  173. X.TP
  174. X.B Comments
  175. XEmpty lines and lines with a # character as the first non-blank
  176. Xcharacter are ignored.
  177. X.TP
  178. X.B Variable settings
  179. XYou can 
  180. X.B set
  181. X(or 
  182. X.BR unset )
  183. Xall the variables described earlier to change
  184. Xnn's behaviour permanently.  The 
  185. X.B set
  186. Xand
  187. X.B unset
  188. Xcommands you can use in the init file have exactly the same format as
  189. Xthe 
  190. X.B :set
  191. Xand
  192. X.B :unset
  193. Xcommands described earlier (except that the : prefix is omitted.)
  194. X.TP
  195. X.B Key mappings
  196. XYou can use all the versions of the
  197. X.B map
  198. Xcommand in the init file.
  199. X.TP
  200. X.B Macro Definitions
  201. XYou can define sequences of commands and key strokes using the
  202. X\fBdefine\fP...\fBend\fP construction,
  203. Xwhich can then be
  204. Xbound to single keys with the
  205. X.B map
  206. Xcommand.
  207. X.TP
  208. X.B Load terminal specific files
  209. XYou can load a terminal specific file using the
  210. X.sp 0.5v
  211. X    \fBload\fP \fIfile\fP
  212. X.sp 0.5v
  213. XThe character
  214. X.B @
  215. Xin the 
  216. X.I file
  217. Xwill be replaced by the terminal type defined in the TERM environment
  218. Xvariable.  \fInn\fP silently ingores the
  219. X.B load
  220. Xcommand if the file does not exist (so you don't have to have a
  221. Xspecific init file for terminals which does not require remapping).
  222. XIf the file is not specified by an absolute pathname, it must reside
  223. Xin your ~/.nn directory.  Examples:
  224. X.nf
  225. X    # load local customizations
  226. X    load /usr/lib/nninit
  227. X    # load personal terminal specific customizations
  228. X    load init.@
  229. X.fi
  230. X.TP
  231. X.B Change working directory of nn
  232. XYou can use the
  233. X.B cd
  234. Xcommand to change the working directory whenever you enter \fInn\fP.
  235. XExample:
  236. X.nf
  237. X    # Use folder directory as working directory inside \fInn\fP
  238. X    cd ~/News
  239. X.fi
  240. X.TP
  241. X.B The news group presentation sequence
  242. XThe 
  243. X.I last
  244. Xpart of the init file may specify the sequence in which you want the
  245. Xnews groups to be presented.  This part starts with the command
  246. X.B sequence
  247. Xand continues to the end of the init file.
  248. X.LP
  249. XBoth init files may contain a presentation sequence.  In this case,
  250. Xthe global sequence is \fIappended\fP to the private sequence.
  251. X.SH GROUP PRESENTATION SEQUENCE
  252. XNews groups are normally presented in the sequence defined in the
  253. Xsystem-wide 
  254. X.B init
  255. Xfile in \fInn\fP's library directory.
  256. X.LP
  257. XYou can personalize the presentation sequence
  258. Xby specifying an alternative sequence in the private
  259. X.I init
  260. Xfile.
  261. XThe sequence in the private init file is used
  262. X.I before
  263. Xthe global presentation sequence, and need only
  264. Xdescribe the deviations from the default presentation sequence.
  265. X.LP
  266. XThe presentation sequence must start with the word
  267. X.br
  268. X    \fBsequence\fP
  269. X.br
  270. Xfollowed by a list of the news group names in the order you want them
  271. Xto be presented.  
  272. XThe group names must be separated by white space.
  273. XThe sequence list must be the \fIlast\fP part of the
  274. Xinit file (the parsing of commands from the init file stops when the
  275. Xword \fBsequence\fP is encountered).
  276. X.LP
  277. XYou may use a full group name like "comp.unix.questions", or just the
  278. Xname of a main group or subgroup, e.g. "comp" or "comp.unix".
  279. XHowever, if "comp" precedes "comp.unix.questions" in the list, this
  280. Xsubgroup will be placed in the normal alphabetic sequence during the
  281. Xcollection of all the "comp" groups.
  282. X.LP
  283. XGroups which are not explicitly mentioned in any of the sequence files
  284. Xwill be placed after the mentioned groups, unless `!!' is used and it
  285. Xhas not been disabled (as described below).
  286. X.LP
  287. XEach group name may be followed by a file or folder name (must start
  288. Xwith either of / . ~ or +) which will specify the default save file
  289. Xfor that group (and its subgroups).  A single "+" following the group
  290. Xname is an abbreviation for the last save file name used.
  291. X.LP
  292. XWhen an article is saved, the default save name will be used as the
  293. Xinitial contents of the file name prompt for further editing.  It
  294. Xtherefore does not need to be be a complete file name (unless you use
  295. Xthe quick save mode).
  296. X.LP
  297. XThe following meta notation can be used in a sequence file:
  298. X.TP
  299. Xgroup.name
  300. XAppend the group (and its subgroups) to the presentation sequence list.
  301. X.TP
  302. X\&! group.name
  303. XCompletely ignore the group (and its subgroups)
  304. Xunless they are already in the presentation sequence (i.e. has been
  305. Xexplicitly mentioned earlier in the sequence).
  306. X.TP
  307. X\&!!
  308. XStop building the presentation sequence.  This eliminates all groups
  309. Xthat are not already in the presentation sequence.
  310. X.TP
  311. X\fBNEW\fP
  312. XThis is a pseudo group name which matches all new groups; you could place
  313. Xthis symbol early in your presentation sequence to see new groups `out
  314. Xof sequence' (to attract your attention to them).
  315. X.TP
  316. X\&< group.name
  317. XPlace the group (and its subgroups) at the beginning of the
  318. Xpresentation sequence.
  319. X.TP
  320. X\&> group.name
  321. XPlace the group (and its subgroups) after all other groups that are
  322. Xand will be entered into the presentation sequence.
  323. X.TP
  324. X\&@
  325. XDisable the `!!' command.  This can be included in the personal
  326. Xpresentation sequence if the global 
  327. X.B sequence
  328. Xfile contains a !! entry (see example 1 below).
  329. X.LP
  330. X.sp 0.5v
  331. X.B Example 1:
  332. XIn a company where ordinary users only should read the local
  333. Xnews groups, and ignore the rest (including new news groups which are
  334. Xotherwise always subscribed to initially), can use the following
  335. Xglobal presentation sequence:
  336. X.sp 0.5v
  337. X.nf
  338. X    general
  339. X    follow
  340. X    !local.test
  341. X    local
  342. X    !!
  343. X.fi
  344. X.sp 0.5v
  345. XThe "expert" users in the company must put the 
  346. X.B @
  347. Xcommand somewhere
  348. Xin their private sequence to avoid losing news groups which they have
  349. Xnot explicitly mentioned in their init file.
  350. X.sp
  351. X.B Example 2:
  352. XThis is the global sequence for systems with
  353. Xheavy news addicts who setup their own sequences anyway.
  354. X.nf
  355. X.sp 0.5v
  356. X    # all must read the general news first
  357. X    < general
  358. X.sp 0.5v
  359. X    # test is test, and junk is junk, 
  360. X    # so it is placed at the very end
  361. X    > test 
  362. X    > .test    
  363. X    > junk
  364. X.sp 0.5v
  365. X    # this is the standard sequence which everybody may
  366. X    # change to their own liking
  367. X    local    # our local groups
  368. X    dk    # the Danish groups
  369. X    eunet.general # to present it before eunet.followup
  370. X    eunet    # the other European groups 
  371. X    comp    # the serious groups
  372. X    news    # news on news
  373. X    sci    # other serious groups
  374. X    rec    # not really that important (don't quote me)
  375. X    misc    # well, it must be somewhere
  376. X.sp 0.5v
  377. X    # the groups that are not listed above goes here
  378. X.sp 0.5v
  379. X.fi
  380. XNotice the use of comments in the sequence where they are allowed at
  381. Xthe end of non-empty lines as well.
  382. X.sp
  383. X.B Example 3:
  384. XMy own presentation sequence (in the init file) simply
  385. Xlists my favourite groups and the corresponding default save files:
  386. X.nf
  387. X.sp 0.5v
  388. X   \fBsequence\fP
  389. X    rec.music.synth +synth/
  390. X    comp.emacs +emacs/misc
  391. X    gnu.emacs +
  392. X    NEW  # show new groups here
  393. X    comp.risks +risks
  394. X    news.admin
  395. X    eunet.sources +src/unix/
  396. X    comp.sources +src/$L/
  397. X    comp.sys.ti +ti/$L
  398. X.sp 0.5v
  399. X.fi
  400. XThe presentation sequence is not used when \fInn\fP is called with one or
  401. Xmore news group names on the command line; it is thus possible to read
  402. Xignored groups (on explicit request) wihtout changing the init file.
  403. X(Of course, you can also use the
  404. X.B G
  405. Xcommand to read ignored groups).
  406. X.SH THE NN RECORD FILE
  407. XThe directory ~/.nn contains all the files that are related to
  408. X\fInn\fP.  Besides the init file, most of these files are maintained
  409. Xautomatically by \fInn\fP, and the most 
  410. Ximportant is the
  411. X.B rc
  412. Xfile which contains a record of which articles have been read in which
  413. Xgroups, and which groups have been unsubscribed to.  (This is the
  414. Xequivalent of the .newsrc file used by other news reader programs; the
  415. X\&.newsrc file is not supported in the present release of \fInn\fP.)
  416. X.LP
  417. XNormally, you will not need to change this file, because you can use
  418. Xthe \fBU\fP command to unsubscribe and resubscribe to news groups, and
  419. Xthe
  420. X.IR nngoback (1)
  421. Xprogram is available to `turn back' the rc file one or more days.
  422. X.LP
  423. XEach line in the rc file has the following format:
  424. X.br
  425. X.sp 0.5v
  426. X    + 000000 news.group.name
  427. X.sp 0.5v
  428. X.br
  429. XThe "+" indicates that you subscribe to the news group.  A "!" instead
  430. Xof the "+" indicates that you have unsubscribed to the group.  The
  431. Xsix digits are the number of the last article you have read in the
  432. Xgroup, and the rest of the line is the name of the news group.
  433. X.LP
  434. XThe order of the lines in the rc file is not important, and
  435. Xentries for new newsgroups are automatically appended to the file
  436. X(with subscription, unless you immediately unsubscribe to them).
  437. X.SH ENVIRONMENT
  438. XThe following environment variables are used by \fInn\fP:
  439. X.LP
  440. X.BR EDITOR .
  441. XThe editor invoked when editing replies, follow-ups, and composing
  442. Xmail.  \fInn\fP knows about the following editors:
  443. X.BR vi (1),
  444. X.BR ded (1),
  445. X.B GNU
  446. X.BR emacs (1),
  447. Xand
  448. X.B Micro
  449. X.BR emacs (1),
  450. Xand will try to position the cursor on the first line following the
  451. Xheader, i.e. after the blank line which must not be deleted!  If an
  452. Xarticle has been included, the cursor is placed on the first line of
  453. Xthe included text (to allow you to delete sections easily).
  454. X.LP
  455. X.BR SHELL .
  456. XThis is the shell which is spawned if the system cannot suspend
  457. X\fInn\fP, and it will be used to execute the shell escapes.
  458. X.LP
  459. X.BR TERM .
  460. XThe terminal type.
  461. X.SH AUTHOR
  462. XKim F. Storm, Texas Instruments A/S, Denmark
  463. X.br
  464. XE-mail: storm@texas.dk  (but see the addresses below)
  465. X.LP
  466. XThe NNTP support was designed and implemented by
  467. XRen\o'\(aae' Seindal, Institute of Datalogy, University of Copenhagen, Denmark,
  468. Xwho also ported \fInn\fP to BSD 4.3 and SunOS 4.0.
  469. X.SH FILES
  470. X.DT
  471. X.nr tW \w'~/.nn/KILL.COMP'
  472. X.nr tX \w'/usr/lib/terminfo/*'
  473. X.if \n(tWu>\n(tXu .nr tX \n(tWu
  474. X.ta \n(tWu+3m
  475. X~/.nn/rc    The record of read articles.
  476. X.br
  477. X~/.nn/rc.bak    Copy of rc file saved on entry to \fInn\fP.
  478. X.br
  479. X~/.nn/init    Personal configuration and presentation sequence.
  480. X.br
  481. X~/.nn/kill    The automatic kills and selections.
  482. X.br
  483. X~/.nn/KILL.COMP    The compiled kill file.
  484. X.br
  485. X$lib/init    System-wide setup and presentation sequence.
  486. X.br
  487. X$lib/aux    The response edit and send script.
  488. X.br
  489. X$lib/routes    Mapping rules for mail addresses (on non-domain systems).
  490. X.br
  491. X$db/*    The news data base.
  492. X.br
  493. X/etc/termcap    Terminal data base [BSD].
  494. X.br
  495. X/usr/lib/terminfo/*    Terminal data base [SysV].
  496. X.br
  497. X/usr/lib/nntp-server    Name of remote nntp server.
  498. X.sp 0.5v
  499. X.DT
  500. XThe name $lib and $db are the directories used for the auxiliary files
  501. Xand the news data base respectively.  Their name and location is
  502. Xdefined at compile time.  Common choices are /usr/local/lib/nn or
  503. X/usr/lib/news/nn for $lib and /usr/spool/nn or /usr/spool/news/.nn for
  504. X$db.
  505. X.SH SEE ALSO
  506. XOther netnews documentation.
  507. X.br
  508. Xnncheck(1), nngoback(1), nngrep(1), nntidy(1)
  509. X.br
  510. Xnnadmin(1M), nnquery(1M), nnusage(1M), nnmaster(8)
  511. X.SH MAILING LISTS
  512. XBugs and fixes, suggestions, ideas, critique, etc. can be sent to
  513. Xthe following address:
  514. X.br
  515. X    nn-bugs@dkuug.dk
  516. X.LP
  517. XWe have created a moderated mailing list for news about \fInn\fP.  The
  518. Xmoderator is Ren\o'\(aae' Seindal, seindal@diku.dk.  Send
  519. Xyour contributions to the address:
  520. X.br
  521. X    nn-info@dkuug.dk
  522. X.LP
  523. XYou are welcome to join the nn-info mailing list, just send your
  524. Xname and E-mail address to the following address:
  525. X.br
  526. X    nn-info-request@dkuug.dk
  527. X.LP
  528. XIf these addresses fail, you may want to know that dkuug.dk is the
  529. Xdanish EUnet backbone, so if you can reach uunet or mcvax, you can
  530. Xalso reach us (e.g. using ...!uunet!dkuug.dk!nn-info).
  531. NO_NEWS_IS_GOOD_NEWS
  532. echo "File nn.1 is complete"
  533. chmod 0644 nn.1 || echo "restore of nn.1 fails"
  534. set `wc -c nn.1`;Sum=$1
  535. if test "$Sum" != "93389"
  536. then echo original size 93389, current size $Sum;fi
  537. echo "x - extracting nn.c (Text)"
  538. sed 's/^X//' << 'NO_NEWS_IS_GOOD_NEWS' > nn.c &&
  539. X/*
  540. X *    The User Interface main program
  541. X */
  542. X
  543. X#include "config.h"
  544. X#include "menu.h"
  545. X#include "term.h"
  546. X#include "keymap.h"
  547. X#include "options.h"
  548. X
  549. Xstatic int
  550. X    dont_read_init_file = 0,
  551. X    prompt_for_group = 0;
  552. X
  553. Xstatic char
  554. X    *match_subject = NULL;
  555. X
  556. Xexport int
  557. X    article_limit = -1,
  558. X    also_read_articles = 0,
  559. X    do_kill_handling = 1,
  560. X    group_name_args = 0,
  561. X    merged_menu = 0,
  562. X    silent = 0,
  563. X    Debug = 0;
  564. X
  565. Ximport int 
  566. X    keep_rc_backup, no_update,                     /* rc.c */
  567. X    preview_window, fmt_linenum, fmt_rptsubj,            /* menu.c */
  568. X    show_article_date, first_page_lines,            /* more.c */
  569. X    dont_split_digests, dont_sort_articles,            /* group.c */
  570. X    dont_sort_folders,                        /* folder.c */
  571. X    show_current_time, conf_dont_sleep;                /* term.c */
  572. X
  573. XOption_Description(nn_options) {
  574. X    'a', Int_Option(article_limit),
  575. X    'B', Bool_Option(keep_rc_backup),
  576. X    'd', Bool_Option(dont_split_digests),
  577. X    'f', Bool_Option(dont_sort_folders),
  578. X    'g', Bool_Option(prompt_for_group),
  579. X    'I', Bool_Option(dont_read_init_file),
  580. X    'k', Bool_Option(do_kill_handling),
  581. X    'l', Int_Option(first_page_lines),
  582. X    'L', Int_Option_Optional(fmt_linenum, 3),
  583. X    'm', Bool_Option(merged_menu),
  584. X    'N', Bool_Option(no_update),
  585. X    'q', Bool_Option(dont_sort_articles),
  586. X    'Q', Bool_Option(silent),
  587. X    's', String_Option(match_subject),
  588. X    'S', Bool_Option(fmt_rptsubj),
  589. X    'T', Bool_Option(show_current_time),
  590. X    'w', Int_Option_Optional(preview_window, 5),
  591. X    'W', Bool_Option(conf_dont_sleep),
  592. X    'x', Int_Option_Optional(also_read_articles, -1),
  593. X    'Z', Int_Option(Debug),
  594. X    '\0',
  595. X};
  596. X
  597. X
  598. Xstatic int
  599. X    report_number_of_articles = 0,
  600. X    report_group_names = 0;
  601. Xstatic char
  602. X    *check_message_format = NULL;
  603. X
  604. XOption_Description(check_options) {
  605. X    'Q', Bool_Option(silent),
  606. X    'r', Bool_Option(report_number_of_articles),
  607. X    'f', String_Option(check_message_format),
  608. X    't', Bool_Option(report_group_names),
  609. X    '\0',
  610. X};
  611. X
  612. X
  613. X/* program name == argv[0] without path */
  614. X
  615. Xchar *pname;
  616. X
  617. X
  618. Xmain(argc, argv)
  619. Xint argc;
  620. Xchar *argv[];
  621. X{
  622. X    extern long unread_articles;
  623. X    extern char *program_name();
  624. X    int emacs_slave_mode = 0, check_news = 0, enter_admin_mode = 0;
  625. X
  626. X    pname = program_name(argv);
  627. X    if (strcmp(pname, "nnadmin") == 0)
  628. X    enter_admin_mode = 1;
  629. X    else
  630. X    if (strcmp(pname, "nnemacs") == 0)
  631. X    emacs_slave_mode = 1;
  632. X    else
  633. X    if (strcmp(pname, "nncheck") == 0) {
  634. X    keep_rc_backup = 0;    
  635. X    check_news = 1;
  636. X    }
  637. X    
  638. X    if (!check_news && !emacs_slave_mode && (!enter_admin_mode || argc == 1))
  639. X    if (!isatty(0)) {
  640. X        fprintf(stderr, "Input is not a tty\n");
  641. X        nn_exit(1);
  642. X    }
  643. X    
  644. X    init_global(0);
  645. X    init_key_map();
  646. X    init_execute();
  647. X    init_macro();
  648. X    
  649. X#ifdef NNTP
  650. X    nntp_check();
  651. X#endif
  652. X    if (enter_admin_mode) {
  653. X    if (argc == 1) {
  654. X        init_term();
  655. X        visit_init_file();
  656. X    }
  657. X    open_master(OPEN_READ);
  658. X    visit_active_file();
  659. X    admin_mode(argv[1]);
  660. X    nn_exit(0);
  661. X    }
  662. X
  663. X    if (check_news)
  664. X    parse_options(argc, argv, (char *)NULL, check_options, "");    
  665. X    else
  666. X    if (!emacs_slave_mode) {
  667. X    init_term();
  668. X
  669. X    if (argc < 2 || strncmp(argv[1], "-I", 2))
  670. X        visit_init_file();
  671. X
  672. X    group_name_args =
  673. X        parse_options(argc, argv, (char *)NULL,
  674. X              nn_options, " [group | [+]folder]...");
  675. X
  676. X    if (!silent)
  677. X        print_version("Release %R.%V.%P #%U,  Kim F. Storm, 1989\n\n");
  678. X    }
  679. X
  680. X    open_master(OPEN_READ);
  681. X    
  682. X    if (also_read_articles) {
  683. X    if (article_limit < 0) 
  684. X        article_limit = also_read_articles;
  685. X    do_kill_handling = 0;
  686. X    no_update++;
  687. X    }
  688. X    
  689. X    if (match_subject) {
  690. X    if (*match_subject != '/') init_quick_match(match_subject);
  691. X    no_update++;
  692. X    do_kill_handling = 0;
  693. X    }
  694. X
  695. X    if (merged_menu) {
  696. X    no_update++;
  697. X    }
  698. X    
  699. X    if (!no_update && group_name_args > 0)
  700. X    no_update = only_folder_args(argv + 1);
  701. X    
  702. X    visit_rc_file();
  703. X
  704. X    count_unread_articles(report_group_names);
  705. X
  706. X    if (emacs_slave_mode)
  707. X    prt_unread("%U %G\n");
  708. X    
  709. X    if (check_news) {
  710. X    if (check_message_format) {
  711. X        if (unread_articles || !silent)
  712. X        prt_unread(check_message_format);
  713. X    } else    
  714. X    if (report_number_of_articles) {
  715. X        prt_unread("%U");
  716. X        nn_exit(0);
  717. X    } else
  718. X    if (!silent) {
  719. X        if (unread_articles || report_number_of_articles)
  720. X        prt_unread("There %i %u in %g\n");
  721. X        else 
  722. X        prt_unread((char *)NULL);
  723. X    }
  724. X
  725. X    nn_exit( unread_articles ? 0 : 99 );
  726. X    }
  727. X    
  728. X    if (unread_articles == 0 &&
  729. X    group_name_args == 0 &&
  730. X    !also_read_articles &&
  731. X    !prompt_for_group) {
  732. X    if (!silent) prt_unread((char *)NULL);
  733. X    nn_exit(0);
  734. X    }
  735. X
  736. X    if (do_kill_handling)
  737. X    do_kill_handling = init_kill();
  738. X    
  739. X    if (group_name_args > 0)
  740. X    named_group_sequence(argv + 1);
  741. X    else
  742. X    normal_group_sequence();
  743. X
  744. X    if (emacs_slave_mode) {
  745. X    emacs_mode();
  746. X    goto out;
  747. X    }
  748. X
  749. X    if (prompt_for_group) {
  750. X    raw();
  751. X    current_group = NULL;
  752. X    prompt_line = Lines - 1;
  753. X    goto_group(K_GOTO_GROUP, (article_header *)NULL);
  754. X    no_raw();
  755. X    clrdisp();
  756. X    goto out;
  757. X    }
  758. X    if (!no_update && article_limit == 0) {
  759. X    char answer[50];
  760. X
  761. X    prt_unread("\nCatch-up on %u ? (all) (i)nteractive ");
  762. X    fl;
  763. X    if (gets(answer)) {
  764. X        if (strncmp(answer, "all", 3) == 0) {
  765. X        printf("\nUPDATING rc FILE....");
  766. X        fl;
  767. X        read_news(-1);
  768. X        printf("DONE\n");
  769. X        goto out;
  770. X        }
  771. X        if (*answer == 'i') {
  772. X        read_news(1);
  773. X        goto out;
  774. X        }
  775. X    }
  776. X    printf("\nNO UPDATE\n");
  777. X    goto out;
  778. X    }
  779. X
  780. X    if (merged_menu) {
  781. X    merge_and_read(match_subject, do_kill_handling);
  782. X    clrdisp();
  783. X    } else
  784. X    if (read_news(0)) {
  785. X    clrdisp();
  786. X    } else {
  787. X    gotoxy(0,Lines-1);
  788. X    if (group_name_args == 0)
  789. X        printf("No News\n");
  790. X    else
  791. X        printf("\r\n");
  792. X    }
  793. X    
  794. X#ifdef STATISTICS    
  795. X    log_usage();
  796. X#endif    
  797. X
  798. X    if (!also_read_articles && unread_articles > 0 && !silent && group_name_args == 0)
  799. X    prt_unread("There %i still %u in %g\n\n\r");
  800. X        
  801. X out:
  802. X    
  803. X    nn_exit(0);
  804. X    /*NOTREACHED*/
  805. X}
  806. X
  807. X/* 
  808. X * nn_exit() --- called whenever a program exits.
  809. X */
  810. Xnn_exit(n)
  811. X{
  812. X    static int loop = 0;
  813. X    
  814. X    if (loop) exit(n);
  815. X    loop++;
  816. X    
  817. X#ifdef NNTP
  818. X    nntp_cleanup();
  819. X#endif /* NNTP */
  820. X    close_master();
  821. X    close_rc();
  822. X    
  823. X    exit(n);
  824. X}
  825. X
  826. Xexport group_header *jump_to_group = NULL;
  827. X
  828. Xstatic read_news(mode)
  829. X{
  830. X    register group_header *cur, *prev, *tmp;
  831. X    int menu_cmd;
  832. X    int must_clear = 0, did_jump = 0;
  833. X    extern int menu();
  834. X
  835. X    prev = group_sequence;
  836. X
  837. X    cur = group_sequence;
  838. X    
  839. X    while (cur != NULL || did_jump) {
  840. X    if (s_hangup) break;
  841. X    
  842. X    if (cur == NULL) {
  843. X        did_jump = 0;
  844. X        cur = group_sequence;
  845. X        continue;
  846. X    }
  847. X    
  848. X    if (!also_read_articles)
  849. X        if (cur->last_article >= cur->last_l_article) {
  850. X        cur = cur->next_group;
  851. X        continue;
  852. X        }
  853. X    
  854. X    if (mode) {
  855. X        if (mode > 0) {
  856. X        char answer[50];
  857. X        printf("Update %s (%ld)? ", 
  858. X               cur->group_name,
  859. X               (long)(cur->last_l_article - cur->last_article));
  860. X        fl;
  861. X        if (gets(answer) == NULL || s_keyboard) {
  862. X            putchar(NL);
  863. X            printf("Update rest? ");
  864. X            fl;
  865. X            if (gets(answer) == NULL || *answer != 'y')
  866. X            return 0;
  867. X            mode = -1;
  868. X            *answer = 'y';
  869. X        }
  870. X        if (*answer == '?') {
  871. X            printf("Enter (y)es to update current group\n");
  872. X            continue; /* redo current group */
  873. X        }
  874. X        if (*answer != 'y') {
  875. X            cur = cur->next_group;
  876. X            continue;
  877. X        }
  878. X        }
  879. X        update_rc(cur);
  880. X        continue;
  881. X    }
  882. X    
  883. X    free_memory();
  884. X    
  885. X    if (cur->group_flag & G_FOLDER) {
  886. X        menu_cmd = folder_menu(cur->group_name);
  887. X        if (menu_cmd == ME_NO_REDRAW) {
  888. X        menu_cmd = ME_NO_ARTICLES;
  889. X        cur->last_l_article = 0;
  890. X        }
  891. X    } else
  892. X        menu_cmd = group_menu(cur, -1, 
  893. X                  match_subject, do_kill_handling, menu);
  894. X
  895. X    if (menu_cmd != ME_NO_ARTICLES)
  896. X        must_clear++;
  897. X    
  898. X    switch (menu_cmd) {
  899. X        
  900. X     case ME_PREV:
  901. X        tmp = cur;
  902. X        cur = prev;
  903. X        prev = tmp;
  904. X        cur->last_article = cur->first_article;
  905. X        continue;
  906. X        
  907. X     case ME_READ:
  908. X        cur->last_article = cur->last_l_article;
  909. X        /* fall thru */
  910. X        
  911. X     case ME_NEXT:
  912. X        prev = cur;
  913. X        /* fall thru */
  914. X        
  915. X     case ME_NO_ARTICLES:
  916. X        cur = cur->next_group;
  917. X        continue;
  918. X        
  919. X     case ME_QUIT:
  920. X        if (jump_to_group) {
  921. X        prev = cur;
  922. X        cur = jump_to_group;
  923. X        jump_to_group = NULL;
  924. X        did_jump = 1;
  925. X        continue;
  926. X        }
  927. X        
  928. X        return must_clear;
  929. X    }    
  930. X    }
  931. X    return must_clear;
  932. X}
  933. X
  934. X
  935. X
  936. Xexport char *mail_box = NULL;
  937. X
  938. Xunread_mail(t)
  939. Xtime_t t;
  940. X{
  941. X    struct stat st;
  942. X    static time_t next = 0;
  943. X    static int any = 0;
  944. X    
  945. X    if (next > t) return any;
  946. X    
  947. X    next = t + 60;
  948. X    any = 0;
  949. X    
  950. X    if (mail_box == NULL ||
  951. X    stat(mail_box, &st) != 0 ||
  952. X    st.st_size == 0 || 
  953. X    st.st_mtime < st.st_atime) return 0;
  954. X    
  955. X    any = 1;
  956. X    
  957. X    return 1;
  958. X}
  959. X
  960. X#ifdef STATISTICS
  961. Xstatic time_t usage_time = 0;
  962. X
  963. Xtick_usage(end_t, start_t)
  964. Xtime_t *end_t, *start_t;
  965. X{
  966. X    time_t temp_t;
  967. X    static time_t last_t = 0;
  968. X    
  969. X    if (end_t == NULL) end_t = &temp_t;
  970. X    
  971. X    time(end_t);
  972. X    
  973. X    if (start_t == 0) {
  974. X    /* 
  975. X     * We ignore delays > 2 minutes because the user has probably
  976. X     * just left the terminal inside nn and done something else
  977. X     */
  978. X    if ((last_t + 120) > *end_t) 
  979. X        usage_time += *end_t - last_t;
  980. X    } else 
  981. X    usage_time += (*end_t - *start_t)/60;
  982. X    
  983. X    last_t = *end_t;
  984. X}
  985. X
  986. Xlog_usage()
  987. X{
  988. X    usage_time /= 60;
  989. X
  990. X    if (usage_time < STATISTICS) return; /* don't log short sessions */
  991. X    
  992. X    log_entry('U', "USAGE %d.%02d", usage_time/60, usage_time%60);
  993. X}
  994. X#endif
  995. X
  996. X#ifdef MALLOC_TEST
  997. Xstatic int in_calloc = 0;
  998. X
  999. Xchar *malloc(n)
  1000. Xunsigned int n;
  1001. X{
  1002. X    char *p, *sbrk();
  1003. X    
  1004. X    if (p = sbrk(n + 3))
  1005. X    while ( ((int)p) & 3) p++;
  1006. X    
  1007. X    if (!in_calloc)
  1008. X    printf("MALLOC(%u) => %lx\n", n, (long)p);
  1009. X    
  1010. X    return p;
  1011. X}
  1012. X
  1013. Xchar *calloc(n, s)
  1014. Xunsigned n, s;
  1015. X{
  1016. X    char *p;
  1017. X    
  1018. X    in_calloc = 1;
  1019. X    p = malloc(n*s);
  1020. X    in_calloc = 0;
  1021. X    
  1022. X    printf("CALLOC(%u,%u) => %lx\n", n, s, (long)p);
  1023. X
  1024. X    return p;
  1025. X}
  1026. X
  1027. Xfree(p)
  1028. Xchar *p;
  1029. X{
  1030. X    printf("FREE(%lx)\n", p);
  1031. X}
  1032. X
  1033. Xchar *realloc()
  1034. X{
  1035. X    printf("REALLOC\n");
  1036. X}
  1037. X
  1038. X#endif /* MALLOC_TEST */
  1039. X
  1040. X/* this will go into emacs_mode.c when it is completed someday */
  1041. X
  1042. Xemacs_mode()
  1043. X{
  1044. X    printf("EMACS MODE IS NOT SUPPORTED YET.\n");
  1045. X}
  1046. NO_NEWS_IS_GOOD_NEWS
  1047. chmod 0644 nn.c || echo "restore of nn.c fails"
  1048. set `wc -c nn.c`;Sum=$1
  1049. if test "$Sum" != "9858"
  1050. then echo original size 9858, current size $Sum;fi
  1051. echo "x - extracting nnadmin.1m (Text)"
  1052. sed 's/^X//' << 'NO_NEWS_IS_GOOD_NEWS' > nnadmin.1m &&
  1053. X.TH NNADMIN 1M "Release 6.3"
  1054. X.\" (c) Copyright 1988, Kim F. Storm
  1055. X.UC 4
  1056. X.SH NAME
  1057. Xnnadmin \- nn database administration
  1058. X.SH SYNOPSIS
  1059. X.B nnadmin
  1060. X[ 
  1061. X.I commands
  1062. X]
  1063. X.SH DESCRIPTION
  1064. X.I nnadmin
  1065. Xis a control program for the \fInnmaster\fP(1M) daemon which is
  1066. Xresponsible for building and maintaining the database used by the
  1067. X\fInn\fP(1) news reader.
  1068. X.LP
  1069. X\fInnadmin\fP allows you to display extracts from the log file,
  1070. Xdisplay the "raw" contents of the database, make consistency checks on
  1071. Xthe database, instruct the running \fInnmaster\fP to expire one or
  1072. Xmore groups, alter the options of the running \fInnmaster\fP, and much
  1073. Xmore.
  1074. X.LP
  1075. X\fInnadmin\fP runs in two modes: interactive and non-interactive.
  1076. X.LP
  1077. XIn interactive mode, simple one line menus are used to show the
  1078. Xavailable operations which are then selected by typing the letter
  1079. Xassociated with the command (normally the first letter in the command
  1080. Xname).
  1081. X.LP
  1082. XIn non-interactive mode, the
  1083. X.I commands
  1084. Xargument will be used as a series of key-strokes which are interpreted
  1085. Xexactly as if they were typed in from the keyboard in interactive
  1086. Xmode.  For example, to stop the \fInnmaster\fP, the following
  1087. Xinvokation of nnadmin can be used:
  1088. X.br
  1089. X    \fInnadmin\fP MK
  1090. X.br
  1091. Xwhich will select the (M)aster submenu from the main menu, and then
  1092. Xthe (K)ill entry from the submenu.
  1093. X.LP
  1094. XIn non-interactive mode, the menus are not displayed and the commands
  1095. Xare not echoed!  \fInnadmin\fP will exit when there are no more
  1096. Xkey-strokes to be read from the 
  1097. X.I commands
  1098. Xargument.  It is not possible to specify a group name in the 
  1099. X.I commands
  1100. Xargument, so the functionalities of \fInnadmin\fP that relates to
  1101. Xspecific groups are only available in interactive mode.
  1102. X.LP
  1103. XYou can also invoke an interactive \fInnadmin\fP using the 
  1104. X.B :admin
  1105. Xcommand in \fInn\fP.  The only operation which is not available is the
  1106. XValidation command, because it whould disturb the normal operation of
  1107. X\fInn\fP.
  1108. X.SH MAIN MENU
  1109. XFrom the main menu (identified by the 
  1110. X.B ADMIN
  1111. Xprompt) you can select the following operations:
  1112. X.TP
  1113. X.B C)onf
  1114. X.br
  1115. XShow current configuration parameters such as directories, files,
  1116. Xprograms, network usage, etc.
  1117. X.TP
  1118. X.B E)xpire
  1119. X.br
  1120. XSend a request to the \fInnmaster\fP daemon to run expire on all
  1121. Xgroups in the database.  This is equal to the Init operation when
  1122. Xthe \fInnmaster\fP is started with the \-E option.
  1123. X.TP
  1124. X.B G)roups
  1125. X.br
  1126. XEnter the GROUP submenu.
  1127. X.TP
  1128. X.B I)nit
  1129. X.br
  1130. XSend a request to the \fInnmaster\fP daemon to recollect all
  1131. Xgroups in the database.  
  1132. X.TP
  1133. X.B L)ogs
  1134. X.br
  1135. XEnter the LOG submenu.
  1136. X.TP
  1137. X.B M)aster
  1138. X.br
  1139. XEnter the MASTER submenu.
  1140. X.TP
  1141. X.B Q)uit
  1142. X.br
  1143. XQuit \fInnadmin\fP.
  1144. X.TP
  1145. X.B S)tat
  1146. X.br
  1147. XPrint general statistics about the database.  See the section on
  1148. XDatabase Statistics below.
  1149. X.TP
  1150. X.B U)pdate
  1151. X.br
  1152. XUpdate the incore copy of the database master index.
  1153. X.TP
  1154. X.B V)alidate
  1155. X.br
  1156. XMake a thorough consistency check on the database.  If inconsistencies
  1157. Xare found in a group, you will be asked whether a request should be
  1158. Xsent to the \fInnmaster\fP daemon to recollect the group (in
  1159. Xnon-interactive mode, requests will be sent automatically for all
  1160. Xcorrupted groups).
  1161. X.TP
  1162. X.B W)akeup
  1163. X.br
  1164. XSend a wakeup signal to the \fInnmaster\fP daemon to have it receive
  1165. Xmessages sent to it, perform the required actions, and then collect
  1166. Xarticles as necessary.
  1167. X.TP
  1168. X.B Z (silent validation)
  1169. X.br
  1170. XThis operation is identical to the Validate operation, expect that no
  1171. Xoutput is produced during the consistency check; this operation is
  1172. Xused by the \fInnmaster\fP to execute the \-C option.
  1173. X.SH THE MASTER MENU
  1174. XThe master menu (identified by the
  1175. X.B MASTER
  1176. Xprompt) provides access to overall database information, and to send
  1177. Xcontrol messages to the \fInnmaster\fP daemon.
  1178. X.TP
  1179. X.B A)ll
  1180. X.br
  1181. XPrint the master index entry for all groups in the database.
  1182. X.TP
  1183. X.B E)mpty
  1184. X.br
  1185. XPrint the master index entry for the empty groups in the database.
  1186. X.TP
  1187. X.B F)iles
  1188. X.br
  1189. XPrint a listing (using 
  1190. X.IR ls (1))
  1191. Xof all the data and index files in the database.
  1192. X.TP
  1193. X.B G)roup
  1194. X.br
  1195. XPrint the master index entry for a single group identified by its
  1196. Xinternal group number.
  1197. X.TP
  1198. X.B K)ill 
  1199. X.br
  1200. XStop the \fInnmaster\fP when it has finished its current task.
  1201. X.TP
  1202. X.B N)on-empty
  1203. X.br
  1204. XPrint the master index entry for the non-empty groups in the database.
  1205. X.TP
  1206. X.B O)ptions
  1207. X.br
  1208. XChange the runtime options of the running \fInnmaster\fP daemon.
  1209. XCurrently, only the value of the \-r and \-e options can be modified.
  1210. X.TP
  1211. X.B S)tat
  1212. X.br
  1213. XPrint general statistics about the database.  See the section on
  1214. XDatabase Statistics below.
  1215. X.TP
  1216. X.B T)race
  1217. X.br
  1218. XTurn the trace option \-t on or off in the running \fInnmaster\fP.
  1219. X.SH THE LOG MENU
  1220. XThe log menu (identified by the
  1221. X.B LOG
  1222. Xprompt) enables you the extract specific entries from the log file,
  1223. Xand to truncate the log file.
  1224. X.LP
  1225. XThe entries in the log file share the following format:
  1226. X.sp 0.5v
  1227. X    <class>: <date> <time> (<user>): <message>
  1228. X.sp 0.5v
  1229. Xwhere <class> identifies the message class, the <date> and <time>
  1230. Xspecify when the entry was made, the <user> specifies who created the
  1231. Xentry (the letter "M" denote the \fInnmaster\fP), and the <message> is
  1232. Xthe text of the entry.
  1233. X.LP
  1234. XTo extract the log file entries of a specific class, simply enter the
  1235. Xletter identifying the class:
  1236. X.TP
  1237. X.B A - admin to master communication
  1238. X.br
  1239. XThis class of messages are related to the sending of messages from an
  1240. X\fInnadmin\fP program to the \fInnmaster\fP daemon.
  1241. X.TP
  1242. X.B C - collection statistics
  1243. X.br
  1244. XStatistics about collection of new articles.  The message has the format:
  1245. X.br
  1246. X    Collect: \fInnn\fP art, \fIppp\fP gr, \fIttt\fP s
  1247. X.br
  1248. Xmeaning that 
  1249. X.I nnn
  1250. Xarticles in
  1251. X.I ppp
  1252. Xgroups were collected in
  1253. X.I ttt
  1254. Xseconds (real time).
  1255. X.TP
  1256. X.B E - fatal errors
  1257. X.br
  1258. XFatal errors encountered during operation.  These errors require
  1259. Xmanual intervention to be fixed (some of the fatal errors occur if
  1260. Xthing that "cannot happen" happens anyway, and may indicate a bug
  1261. Xin the software).
  1262. X.TP
  1263. X.B M - nnmaster messages.
  1264. X.br
  1265. XMaster start/stop messages.
  1266. X.TP
  1267. X.B N - NNTP related messages
  1268. X.br
  1269. XVarious messages related to the NNTP part of the nnmaster, mostly
  1270. Xabout lost connections and failed attempts to connect to the NNTP
  1271. Xserver.  These messages should only appear if you use NNTP, and your
  1272. XNNTP server is down for some reason. 
  1273. X.TP
  1274. X.B R - reports
  1275. X.br
  1276. XNon-fatal error which enables the \fInnmaster\fP to continue
  1277. Xoperation, but may prevent a user to run \fInn\fP (file access
  1278. Xproblems).  Reported problems should be checked.  The most common
  1279. Xreport message will probably be 
  1280. X.br
  1281. X    some.group: no directory
  1282. X.br
  1283. Xwhich indicates that the spool directory for that group has
  1284. Xdisappeared (most likely because it has been rmgroup'ed).
  1285. X.TP
  1286. X.B T - trace output
  1287. X.br
  1288. XMessages produced as a result of using the \-t option on the
  1289. X\fInnmaster\fP.  This is primarily for debugging purposes.
  1290. X.TP
  1291. X.B U - usage statistics
  1292. X.br
  1293. XIf \fInn\fP is compiled with the STATISTICS option enabled, an entry
  1294. Xwill be made in the log file every time a user has spent more than
  1295. Xfive minutes on news reading.  The message will have the following format:
  1296. X.br
  1297. X    USAGE \fIhours.minutes\fP
  1298. X.br
  1299. XSince it is possible to
  1300. Xsuspend
  1301. X\fInn\fP, or leave the terminal while \fInn\fP is active, \fInn\fP
  1302. Xtries to be intelligent when it calculates the usage time so it will
  1303. Xreflect the actual time spent on news reading.  The usage statistics
  1304. Xcan be summarized using the \fInnusage\fP(1M) program.
  1305. X.TP
  1306. X.B V - validation errors
  1307. X.br
  1308. XWhen inconsistencies are detected in the database during validation,
  1309. Xan entry for each corrupted group will be entered in the log file.
  1310. X.TP
  1311. X.B X - expire statistics
  1312. X.br
  1313. XMessages similar to the Collect statistics reporting the result of
  1314. Xrunning expire on the database.
  1315. X.LP
  1316. XTo extract a specific entry class, 
  1317. X.IR grep (1)
  1318. Xis used, so it may take a while on a large log file.
  1319. X.LP
  1320. XThere are also a few special operations on the log file:
  1321. X.TP
  1322. X.B G)roup
  1323. X.br
  1324. XExtract the entries which refers to a specified group.
  1325. X.TP
  1326. X.B (1-9) tail
  1327. X.br
  1328. XInvoke
  1329. X.IR tail (1)
  1330. Xto extract the last 10-90 entries in the log file.
  1331. X.TP
  1332. X.B (.) all
  1333. X.br
  1334. XDisplay the complete log file.
  1335. X.TP
  1336. X.B (@) clean
  1337. X.br
  1338. XMove the Log file to Log.old, and create a new empty Log file.  If you
  1339. Xwant to clean out the old log file as well, simply repeat the clean
  1340. Xoperation (this will result in an empty Log.old file.)
  1341. X.SH THE GROUP MENU
  1342. XWhen you enter the group menu (identified by the
  1343. X.B GROUP
  1344. Xprompt), \fInnadmin\fP will prompt you for the name of a news group,
  1345. Xwhich you can enter with the usual completion feature described in the
  1346. X\fInn\fP(1) manual.  You can then perform the following operations on
  1347. Xthe specified group:
  1348. X.TP
  1349. X.B C)lear_flag
  1350. X.br
  1351. XClear a group specific flag.  See the section on group flags below.
  1352. X.TP
  1353. X.B D)ata
  1354. X.br
  1355. XDump the contents of the data file containing the extracted article
  1356. Xheaders for the group.
  1357. X.TP
  1358. X.B E)xpire
  1359. X.br
  1360. XRequest the \fInnmaster\fP to run expire on the group.
  1361. X.TP
  1362. X.B F)iles
  1363. X.br
  1364. XList the files (using
  1365. X.IR ls (1))
  1366. Xcontaining the index and data for the group.
  1367. X.TP
  1368. X.B G)roup
  1369. X.br
  1370. XSwitch to another group.
  1371. X.TP
  1372. X.B H)eader
  1373. X.br
  1374. XDump the master index entry for the group.
  1375. X.TP
  1376. X.B R)ecollect
  1377. X.br
  1378. XRequest the \fInnmaster\fP to recollect all articles in the group.
  1379. X.TP
  1380. X.B S)et_flag
  1381. X.br
  1382. XSet a group specific flag.  See the section on group flags below.
  1383. X.SH INDIVIDUAL GROUP FLAGS
  1384. XYou can set and clear the following flags for individual groups to
  1385. Xcontrol the future behaviour of \fInnmaster\fP on that group.
  1386. X.TP
  1387. X.B A)lways_digest
  1388. X.br
  1389. XNormally, \fInnmaster\fP will only attempt to split digests into
  1390. Xindividual articles if it can easily recognize an article as a digest.
  1391. XThis requires that the word "digest" appears somewhere in the subject
  1392. Xline, and that one of the first few lines in the body of the article
  1393. Xloosely matches the subject.  A few news groups frequently receives
  1394. Xdigests which break one or both of these requirements.  To have
  1395. X\fInnmaster\fP split these digests into individual articles anyway,
  1396. Xyou can turn on the "always digest" flag on these news groups.
  1397. XThis will instruct \fInnmaster\fP to treat 
  1398. X.I all
  1399. Xarticles in the group as digests (naturally, articles which are then
  1400. Xfound not to contain other articles are still treated as normal articles.)
  1401. X.TP
  1402. X.B C)ontrol
  1403. X.br
  1404. XThis is a special flag for the control group.  It indicates that the
  1405. X"Newsgroups:" field in the article header cannot be trusted (it does
  1406. Xnot specify the groups to which the article has been posted.)
  1407. X.TP
  1408. X.B D)irectory missing
  1409. X.br
  1410. XThis flag indicates that the spool directory for the news group cannot
  1411. Xbe found (the group has probably been removed with 
  1412. X.IR rmgroup (1M)).
  1413. XIt is set automatically be the \fInnmaster\fP if it cannot
  1414. Xaccess the directory.  When the flag is set, \fInnmaster\fP completely
  1415. Xignores the group, so it can be used to disable news collection in
  1416. Xspecific groups.  If you recreate the group or the directory
  1417. Xmanually, you must also clear this flag to have the \fInnmaster\fP
  1418. Xrecognize the group again.
  1419. X.TP
  1420. X.B M)oderated
  1421. X.br
  1422. XIndicates that the group is moderated.  This flag is normally
  1423. Xinitialized automatically from the active file, and it should not be
  1424. Xchanged lightly.
  1425. X.TP
  1426. X.B N)ever_digest
  1427. X.br
  1428. XThis is the opposite of the "always digest" flag; when set, the
  1429. X\fInnmaster\fP will never attempt to split any articles in that group
  1430. Xinto subarticles.
  1431. X.LP
  1432. XNotice that these flags will be reset to their default value if you
  1433. Xreinitialize the database using \fInnmaster\fP \-I.
  1434. X.SH DATABASE STATISTICS DISPLAY
  1435. XWhen you select the (S)tat operation in the main or master menus, you
  1436. Xwill get some general statistics about the database:
  1437. X.TP
  1438. Xlast_scan
  1439. X.br
  1440. XThe time stamp on the active file the last time the \fInnmaster\fP
  1441. Xread it.
  1442. X.TP
  1443. Xno of groups
  1444. X.br
  1445. XThe total number of groups in the database.
  1446. X.TP
  1447. Xnext write
  1448. X.br
  1449. XThe size of the GROUPS file containing the group names
  1450. X(used for consistency checking).
  1451. X.TP
  1452. XArticles
  1453. X.br
  1454. XThe total number of articles in all groups.  This is not an
  1455. Xexact number, because it will count split digests as a single article
  1456. X(making the number too small), and it may count some articles that
  1457. Xhave been expired (making the number too large).
  1458. X.TP
  1459. XDisk blocks
  1460. X.br
  1461. XThe total number of (512 byte) disk blocks occupied by the database.
  1462. X.SH MASTER INDEX ENTRIES
  1463. XThe master index entries displayed when you select the (H)eader
  1464. Xoperation in the master and group menus contain the following information:
  1465. X.TP
  1466. X\fIgroup_name  group_number\fP
  1467. X.br
  1468. XThe first line of the display will show the name of the group and the
  1469. Xinternal group number which is used to identify the group in the database.
  1470. X.TP
  1471. Xfirst/last art
  1472. X.br
  1473. XThis is the numbers of the first and last article that are currently
  1474. Xstored in the database.
  1475. X.TP
  1476. Xactive info
  1477. X.br
  1478. XThis is the numbers of the first and last article in the news system
  1479. Xas read from the active file.  They will normally match the numbers
  1480. Xabove, but they may differ while the \fInnmaster\fP is working on the
  1481. Xgroup (or it has not yet collected all the articles in the group).
  1482. XNotice: these numbers will be zero when administration mode is
  1483. Xselected from nn.
  1484. X.TP
  1485. XOffsets: index->..., data->...  
  1486. X.br
  1487. XThese values show the starting position for the next write operation
  1488. Xon the index and data files.  They are primarily used for consistency
  1489. Xchecking and recovery after a system crash, but after an "expire by
  1490. Xrewrite" operation which is performed "in-situ", the data and index
  1491. Xfiles may physically be longer than the actual data stored in them.
  1492. X.TP
  1493. XFlags:
  1494. X.br
  1495. XThis shows the current flags set for this group.  If no flags are set,
  1496. Xthe field is omitted from the display.  One extra flag which was not
  1497. Xexplained above is the BLOCKED flag; it is a temporary locking flag
  1498. Xset on a group by the \fInnmaster\fP while it is updating the database
  1499. Xfiles for that group to prevent \fInn\fP clients to access that group.
  1500. X.SH RAW DATABASE DISPLAY
  1501. XWhen you select the (D)ata operation on the group menu, you will get a
  1502. Xcombined display of the raw data and index files for that group.  The
  1503. Xindex file contains a single 32 bit value for each existing article
  1504. Xnumber.  This value is an offset into the data file pointing to the
  1505. Xheader for the corresponding article.
  1506. X.LP
  1507. XWhen \fInn\fP want to access the article from number N to the last
  1508. Xarticle, it looks up the offset for article number N in the index
  1509. Xfile, and uses this as the starting point for reading article header
  1510. Xinformation in the data file.  It then simply reads to the end of the
  1511. Xdata file in which the article headers for articles number N+1, N+2,
  1512. Xand so on follows immediately after the header for article number N.
  1513. X.LP
  1514. XThe article header information is presented in a very terse form; each
  1515. Xof the output lines are described below for reference purposes:
  1516. X.TP
  1517. Xoffset = \fIxxxx\fP    , article # = \fInnnnn\fP
  1518. X.br
  1519. XThis shows the offset into the data file and the article number.  The
  1520. Xoffset will be checked against the offset in the index file.
  1521. X.TP
  1522. Xxpost(\fIcount\fP):  \fInnn\fP, \fInnn\fP, \fInnn\fP, ...
  1523. X.br
  1524. XCross-postings to other groups are encoded as a list of internal group
  1525. Xnumbers; only the news groups 
  1526. X.I preceding
  1527. Xthe current news group on the Newsgroups: line are included.
  1528. X(\fInn\fP will present an article posted to several news groups in the
  1529. Xfirst group found on the Newsgroups: line to which the user subscribes.)
  1530. X.TP
  1531. X[ digest header | digest article | normal article ]
  1532. X.br
  1533. XThis information tell whether the data file entry is the header of a
  1534. Xcomplete digest (immediately followed by the split articles), an
  1535. Xarticle inside a split digest, or a normal article.
  1536. X.TP
  1537. Xts=\fInn\fP  hp=\fInn\fP  fp=\fInn\fP  lp=\fInn\fP  rep=\fInn\fP  lines=\fInn\fP
  1538. X.br
  1539. XThese values are used by \fInn\fP to sort, present, and access an
  1540. Xarticle:
  1541. X.br
  1542. X.B ts
  1543. Xis the 
  1544. X.I time stamp
  1545. Xon the article; it is a simple encoding of the posting date and time
  1546. Xfound in the Date: field.
  1547. X.br
  1548. X.BR hp ,
  1549. X.BR fp ,
  1550. Xand
  1551. X.B lp
  1552. Xare offsets into the file containing the article text: the \fIheader
  1553. Xposition\fP, \fIfirst text position\fP, and \fIlast text position\fP.
  1554. XThe first will be zero for normal articles, but not for articles in a
  1555. Xsplit digest.  The last will be equal to the length of the file for
  1556. Xnormal articles, but not inside digests.
  1557. X.br
  1558. X.B rep
  1559. Xis the "follow-up level" of this article; it is the number of "Re:"
  1560. Xprefixes which have been removed from the subject line.
  1561. X.TP
  1562. XSender(\fIlength\fP): \fIname\fP
  1563. X.br
  1564. XThe name of the sender in "ready to print" format, i.e. reduced to 16
  1565. Xcharacters as explained in the \fInn\fP manual.
  1566. X.TP
  1567. XSubj(\fIlength\fP): \fIsubject\fP
  1568. X.br
  1569. XThis is the full subject line from the article header (except for Re:
  1570. Xprefixes in various formats).
  1571. X.fi
  1572. X.SH FILES
  1573. XThe $db, $lib, and $news used below are synonyms for the DB_DIRECTORY,
  1574. XLIB_DIRECTORY, and the news system's lib directories respectively.
  1575. X.br
  1576. X.DT
  1577. X.ta \w'$db/DATA/\fInnn\fP.dx'u+3m
  1578. X$db/MASTER    Database master index
  1579. X.br
  1580. X$db/GROUPS    News group names in MASTER file order
  1581. X.br
  1582. X$db/DATA/\fInnn\fP.x    Index file for group number \fInnn\fP
  1583. X.br
  1584. X$db/DATA/\fInnn\fP.d    Data file for group number \fInnn\fP
  1585. X.br
  1586. X$lib/GATE    Message channel from \fInnadmin\fP to \fInnmaster\fP
  1587. X.br
  1588. X$lib/MPID    The process id of the \fInnmaster\fP daemon.
  1589. X.br
  1590. X$lib/Log    The log file (truncate it regularly!)
  1591. X.DT
  1592. X.LP
  1593. XThe MASTER file contains a record for each news group, occurring in
  1594. Xthe same sequence as the group names in the GROUPS file.  The sequence
  1595. Xalso defines the group numbers used to identify the files in the
  1596. Xdatabase and in a few other places.
  1597. X.LP
  1598. XThe GATE file will be created by \fInnadmin\fP when needed, and
  1599. Xremoved by \fInnmaster\fP when it has read it.  Therefore, to send a
  1600. Xmessage to the \fInnmaster\fP requires that you are allowed to write
  1601. Xin the $lib directory.
  1602. X.SH SEE ALSO
  1603. Xnn(1), nncheck(1), nngrep(1), nntidy(1)
  1604. X.br
  1605. Xnnquery(1M), nnusage(1M), nnmaster(8)
  1606. X.SH WARNINGS
  1607. XThe GATE file is created with the owner and modes of the user that
  1608. Xruns \fInnadmin\fP which may cause problems if the owner of the
  1609. X\fInnmaster\fP process (normally "news") is not allowed to read the
  1610. Xcreated GATE file (a "umask" of 022 is ok.)  Unless you allow ordinary
  1611. Xusers to create files in the LIB directory where the GATE file
  1612. Xresides, only the owner of the directory (normally "news") and "root"
  1613. Xcan use \fInnadmin\fP to send messages to the \fInnmaster\fP.
  1614. XHowever, to send a wakeup signal to the master, anybody can run
  1615. X.br
  1616. X    \fInnmaster\fP -w
  1617. X.SH BUGS
  1618. XThe user interface is completely out of line with the rest of the
  1619. X\fInn\fP family, and the way to run \fInnadmin\fP in the
  1620. Xnon-interactive mode is a bit bizarre.  This is not likely to change,
  1621. Xbecause I believe there are more important things to do!
  1622. X.SH AUTHOR
  1623. XKim F. Storm, Texas Instruments A/S, Denmark
  1624. X.br
  1625. XE-mail: storm@texas.dk
  1626. NO_NEWS_IS_GOOD_NEWS
  1627. chmod 0644 nnadmin.1m || echo "restore of nnadmin.1m fails"
  1628. set `wc -c nnadmin.1m`;Sum=$1
  1629. if test "$Sum" != "18517"
  1630. then echo original size 18517, current size $Sum;fi
  1631. echo "x - extracting nncheck.1 (Text)"
  1632. sed 's/^X//' << 'NO_NEWS_IS_GOOD_NEWS' > nncheck.1 &&
  1633. X.TH NNCHECK 1 "Release 6.3"
  1634. X.UC 4
  1635. X.SH NAME
  1636. Xnncheck \- check for unread articles
  1637. X.SH SYNOPSIS
  1638. X.B nncheck
  1639. X[ -Q -r -t ]  [ -f format ]
  1640. X.SH DESCRIPTION
  1641. X.I nncheck
  1642. Xwill report if there are some articles on the system which you have not read.
  1643. X.LP
  1644. XWithout options, \fInncheck\fP will simply print a message reporting
  1645. Xthe number of unread articles with the following format:
  1646. X.br
  1647. X    There are 327 unread articles in 25 groups
  1648. X.br
  1649. Xand when there are no unread articles, the following message will be
  1650. Xprinted:
  1651. X.br
  1652. X    No News (is good news)
  1653. X.LP
  1654. X\fInncheck\fP will exit with a value of 0 if there are unread
  1655. Xarticles, and 99 if there is no news (see the exception for the \-r
  1656. Xoption.)
  1657. X.LP
  1658. XIt is important to notice that even though unread articles have been
  1659. Xreported by \fInncheck\fP, the actual number of unread articles may be
  1660. Xmuch lower (or even zero) when \fInn\fP is invoked to read
  1661. Xthe articles.  This is because the calculation of the number of unread
  1662. Xarticles is only based on recorded article number intervals.  Invoking
  1663. X\fInn\fP to read the articles may reveal that the articles have
  1664. Xpreviously been read in another news group, have been expired, or are
  1665. X.I killed
  1666. Xusing the 
  1667. X.I auto-kill
  1668. Xfacility.
  1669. X.LP
  1670. XThe following options are used to modify the amount and format of the
  1671. Xoutput from \fInncheck\fP:
  1672. X.TP
  1673. X.B \-Q
  1674. XQuiet operation.  No output is produced, only the exit status indicate
  1675. Xwhether there is unread news.
  1676. X.TP
  1677. X.B \-t
  1678. XPrint the name of each group with unread articles, and how many unread
  1679. Xarticles there are (not counting split digests!).
  1680. X.TP
  1681. X.B \-r
  1682. XOutput a single integer value specifying the number of unread
  1683. Xarticles, and exit with a 0 status (somebody told me this would be
  1684. Xuseful).
  1685. X.TP
  1686. X\&\-\fBf\fP \fIformat\fP
  1687. XOutput the number of unread articles using the specified format.  The
  1688. Xformat is a text that may contain the following %-escapes:
  1689. X.sp 0.5v
  1690. X.DT
  1691. X.ta 1i 2i
  1692. X.nf
  1693. X    \fB%-code\fP    \fBresulting output\fP
  1694. X.sp 0.5v
  1695. X    %u    "\fIuuu\fP unread articles"
  1696. X    %g    "\fIggg\fP groups"
  1697. X    %i    "is" if 1 unread article, else "are"
  1698. X    %U    "\fIuuu\fP"
  1699. X    %G    "\fIggg\fP"
  1700. X.fi
  1701. X.DT
  1702. X.sp 0.5v
  1703. Xwhere 
  1704. X.I uuu
  1705. Xis the number of unread articles, and
  1706. X.I ggg
  1707. Xis the number of groups with unread articles.
  1708. X.sp 0.5v
  1709. XFor example, the default output format is
  1710. X.br
  1711. X    "There %i %u in %g"
  1712. X.br
  1713. Xwhich I prefer to the following less perfect format:
  1714. X.br
  1715. X    "There are %U unread article(s) in %G group(s)"
  1716. X.LP
  1717. X.SH FILES
  1718. X.DT
  1719. X.ta \w'$db/MASTER'u+6m
  1720. X~/.nn/rc    The record of read articles
  1721. X.br
  1722. X$db/MASTER    The database master index
  1723. X.DT
  1724. X.SH SEE ALSO
  1725. Xnn(1), nngoback(1), nngrep(1), nntidy(1)
  1726. X.br
  1727. Xnnadmin(1M), nnquery(1M), nnusage(1M), nnmaster(1M)
  1728. X.SH AUTHOR
  1729. XKim F. Storm, Texas Instruments A/S, Denmark
  1730. X.br
  1731. XE-mail: storm@texas.dk
  1732. NO_NEWS_IS_GOOD_NEWS
  1733. chmod 0644 nncheck.1 || echo "restore of nncheck.1 fails"
  1734. set `wc -c nncheck.1`;Sum=$1
  1735. if test "$Sum" != "2668"
  1736. then echo original size 2668, current size $Sum;fi
  1737. echo "x - extracting nngoback.1 (Text)"
  1738. sed 's/^X//' << 'NO_NEWS_IS_GOOD_NEWS' > nngoback.1 &&
  1739. X.TH NNGOBACK 1 "Release 6.3"
  1740. X.UC 4
  1741. X.SH NAME
  1742. Xnngoback \- make news articles unread on a day-by-day basis.
  1743. NO_NEWS_IS_GOOD_NEWS
  1744. echo "End of part 10"
  1745. echo "File nngoback.1 is continued in part 11"
  1746. echo "11" > s2_seq_.tmp
  1747. exit 0
  1748. ---
  1749. Kim F. Storm        storm@texas.dk        Tel +45 429 174 00
  1750. Texas Instruments, Marielundvej 46E, DK-2730 Herlev, Denmark
  1751.       No news is good news, but nn is better!
  1752.  
  1753.