home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume25 / trn / part06 / help.c next >
Encoding:
C/C++ Source or Header  |  1991-12-02  |  16.1 KB  |  509 lines

  1. /* $Id: help.c,v 4.4.2.1 1991/12/01 18:05:42 sob PATCH_2 sob $
  2.  *
  3.  * $Log: help.c,v $
  4.  * Revision 4.4.2.1  1991/12/01  18:05:42  sob
  5.  * Patchlevel 2 changes
  6.  *
  7.  * Revision 4.4  1991/09/09  20:18:23  sob
  8.  * release 4.4
  9.  *
  10.  *
  11.  * 
  12.  */
  13. /* This software is Copyright 1991 by Stan Barber. 
  14.  *
  15.  * Permission is hereby granted to copy, reproduce, redistribute or otherwise
  16.  * use this software as long as: there is no monetary profit gained
  17.  * specifically from the use or reproduction of this software, it is not
  18.  * sold, rented, traded or otherwise marketed, and this copyright notice is
  19.  * included prominently in any copy made. 
  20.  *
  21.  * The author make no claims as to the fitness or correctness of this software
  22.  * for any use whatsoever, and it is provided as is. Any use of this software
  23.  * is at the user's own risk. 
  24.  */
  25.  
  26. #include "EXTERN.h"
  27. #include "common.h"
  28. #include "rn.h"
  29. #include "term.h"
  30. #include "INTERN.h"
  31. #include "help.h"
  32.  
  33. void
  34. help_init()
  35. {
  36.     ;
  37. }
  38.  
  39. int
  40. help_page()
  41. {
  42.     int cmd;
  43.  
  44. #ifdef PAGERHELP
  45.     doshell(sh,filexp(PAGERHELP));
  46. #else
  47.     page_init();
  48.     if ((cmd = print_lines("\
  49. Paging commands:\n\
  50. ",STANDOUT)) ||
  51.     (cmd = print_lines("\n\
  52. SP    Display the next page.\n\
  53. x    Display the next page decrypted (rot13).\n\
  54. d    Display half a page more.\n\
  55. CR    Display one more line.\n\
  56. ^R,v,^X    Restart the current article (v=verbose header, ^X=rot13).\n\
  57. ",NOMARKING)) ||
  58.     (cmd = print_lines("\
  59. b    Back up one page.\n\
  60. ^L,X    Refresh the screen (X=rot13).\n\
  61. ",NOMARKING)) ||
  62. #ifdef USETHREADS
  63.     (cmd = print_lines("\
  64. t    Display the entire article tree and all its subjects.\n\
  65. ",NOMARKING)) ||
  66. #endif
  67.     (cmd = print_lines("\
  68. g pat    Go to (search forward within article for) pattern.\n\
  69. G    Search again for current pattern within article.\n\
  70. ^G    Search for next line beginning with \"Subject:\".\n\
  71. TAB    Search for next line beginning with a different character.\n\
  72. q    Quit the pager, go to end of article.  Leave article read or unread.\n\
  73. j    Junk this article (mark it read).  Goes to end of article.\n\
  74. \n\
  75. ",NOMARKING)) ||
  76.     (cmd = print_lines("\
  77. The following commands skip the rest of the current article, then behave\n\
  78. just as if typed to the 'What next?' prompt at the end of the article:\n\
  79. ",STANDOUT)) ||
  80.     (cmd = print_lines("\n\
  81. n    Scan forward for next unread article.\n\
  82. N    Go to next article.\n\
  83. ^N    Scan forward for next unread article with same title.\n\
  84. p,P,^P    Same as n,N,^N, only going backwards.\n\
  85. -    Go to previously displayed article.\n\
  86. ",NOMARKING)) ||
  87. #ifdef USETHREADS
  88.     (cmd = print_lines("\
  89. <,>    Browse the previous/next selected thread.  If no threads are selected,\n\
  90.     all threads that had unread news upon entry to the group are considered\n\
  91.     selected for browsing.  Entering an empty group browses all threads.\n\
  92. [,],{,} Go to parent/child/root/leaf in thread.\n\
  93. \n\
  94. ",NOMARKING)) ||
  95. #endif
  96.     (cmd = print_lines("\
  97. The following commands also take you to the end of the article.\n\
  98. Type h at end of article for a description of these commands:\n\
  99. ",STANDOUT)) ||
  100. #ifdef USETHREADS
  101.     (cmd = print_lines("\
  102.     # $ & / = ? c C f F k K ^K J , m M number e r R ^R s S u U v w W Y ^ |\n\
  103. \n\
  104. (To return to the middle of the article after one of these commands, type ^L.)\n\
  105. ",NOMARKING)) )
  106. #else
  107.     (cmd = print_lines("\
  108.     # $ & / = ? c C f F k K ^K m M number e r R ^R s S u v w W Y ^ |\n\
  109. \n\
  110. (To return to the middle of the article after one of these commands, type ^L.)\n\
  111. ",NOMARKING)) )
  112. #endif
  113.     return cmd;
  114. #endif
  115.     return 0;
  116. }
  117.  
  118. int
  119. help_art()
  120. {
  121.     int cmd;
  122. #ifdef ARTHELP
  123.     doshell(sh,filexp(ARTHELP));
  124. #else
  125.     page_init();
  126.     if ((cmd = print_lines("\
  127. Article Selection commands:\n\
  128. ",STANDOUT)) ||
  129. #ifdef USETHREADS
  130.     (cmd = print_lines("\n\
  131. n,SP    Find next unread article (follows discussion-tree in threaded groups).\n\
  132. ",NOMARKING)) ||
  133. #else
  134.     (cmd = print_lines("\n\
  135. n,SP    Scan forward for next unread article.\n\
  136. ",NOMARKING)) ||
  137. #endif
  138.     (cmd = print_lines("\
  139. N    Go to next article.\n\
  140. ^N    Scan forward for next unread article with same subject.\n\
  141. p,P,^P    Same as n,N,^N, only going backwards.\n\
  142. -    Go to previously displayed article.\n\
  143. ",NOMARKING)) ||
  144. #ifdef USETHREADS
  145.     (cmd = print_lines("\
  146. <,>    Browse the previous/next selected thread.  If no threads are selected,\n\
  147.     all threads that had unread news upon entry to the group are considered\n\
  148.     selected for browsing.  Entering an empty group browses all threads.\n\
  149. [,]    Go to article's parent/child.\n\
  150. {,}    Go to tree's root/leaf.\n\
  151. t    Display the entire article tree and all its subjects.\n\
  152. ",NOMARKING)) ||
  153. #endif
  154.     (cmd = print_lines("\
  155. number    Go to specified article.\n\
  156. range{,range}:command{:command}\n\
  157.     Apply one or more commands to one or more ranges of articles.\n\
  158.     Ranges are of the form: number | number-number.  You may use . for\n\
  159.     the current article, and $ for the last article.\n\
  160. ",NOMARKING)) ||
  161. #ifdef USETHREADS
  162.     (cmd = print_lines("\
  163.      Valid commands are: e, j, m, M, s, S, t, T, |, +, and -.\n\
  164. :cmd    Perform a command on all the selected articles.\n\
  165. ",NOMARKING)) ||
  166. #else
  167.     (cmd = print_lines("\
  168.      Valid commands are: e, j, m, M, s, S, and |.\n\
  169. ",NOMARKING)) ||
  170. #endif
  171.     (cmd = print_lines("\
  172. /pattern/modifiers\n\
  173.     Scan forward for article containing pattern in the subject line.\n\
  174.     (Use ?pat? to scan backwards; append h to scan headers, a to scan\n\
  175.     entire articles, r to scan read articles, c to make case sensitive.)\n\
  176. ",NOMARKING)) ||
  177.     (cmd = print_lines("\
  178. /pattern/modifiers:command{:command}\n\
  179.     Apply one or more commands to the set of articles matching pattern.\n\
  180.     Use a K modifier to save entire command to the KILL file for this\n\
  181.     newsgroup.  Commands m and M, if first, imply an r modifier.\n\
  182.      Valid commands are the same as for the range command.\n\
  183. ",NOMARKING)) ||
  184.     (cmd = print_lines("\
  185. f,F    Submit a followup article (F = include this article).\n\
  186. r,R    Reply through net mail (R = include this article).\n\
  187. e dir{|command}\n\
  188.     Extract to directory using /bin/sh, uudecode, unship, or command.\n\
  189. s ...    Save to file or pipe via sh.\n\
  190. S ...    Save via preferred shell.\n\
  191. w,W    Like s and S but save without the header.\n\
  192. | ...    Same as s|...\n\
  193. ",NOMARKING)) ||
  194.     (cmd = print_lines("\
  195. C    Cancel this article, if yours.\n\
  196. ^R,v    Restart article (v=verbose).\n\
  197. ^X    Restart article, rot13 mode.\n\
  198. c    Catch up (mark all articles as read).\n\
  199. b    Back up one page.\n\
  200. ^L    Refresh the screen.  You can get back to the pager with this.\n\
  201. X    Refresh screen in rot13 mode.\n\
  202. ",NOMARKING)) ||
  203.     (cmd = print_lines("\
  204. ^    Go to first unread article.  Disables subject search mode.\n\
  205. $    Go to end of newsgroup.  Disables subject search mode.\n\
  206. ",NOMARKING)) ||
  207.     (cmd = print_lines("#       Print last article number.\n\
  208. &    Print current values of command-line switches.\n\
  209. &switch {switch}\n\
  210.     Set or unset more switches.\n\
  211. &&    Print current macro definitions.\n\
  212. &&def    Define a new macro.\n\
  213. j    Junk this article (mark it read).  Stays at end of article.\n\
  214. ",NOMARKING)) ||
  215.     (cmd = print_lines("\
  216. m    Mark article as still unread.\n\
  217. M    Mark article as still unread upon exiting newsgroup or Y command.\n\
  218. Y    Yank back articles marked temporarily read via M.\n\
  219. k    Kill current subject (mark articles as read).\n\
  220. ",NOMARKING)) ||
  221. #ifdef USETHREADS
  222.     (cmd = print_lines("\
  223. ,    Mark current article and its replies as read.\n\
  224. J    Junk entire thread (mark all subjects as read in this thread).\n\
  225. T    Trash current thread (like 'J'), and save command in KILL file.\n\
  226. ",NOMARKING)) ||
  227. #endif
  228.     (cmd = print_lines("\
  229. K    Mark current subject as read, and save command in KILL file.\n\
  230. ^K    Edit local KILL file (the one for this newsgroup).\n\
  231. =    List subjects of unread articles.\n\
  232. ",NOMARKING)) ||
  233. #ifdef USETHREADS
  234.     (cmd = print_lines("\
  235. +    Enter thread selection mode.\n\
  236. U    Unread some news -- prompts for thread, subthread, all, or select.\n\
  237. ",NOMARKING)) ||
  238. #endif
  239.     (cmd = print_lines("\
  240. u    Unsubscribe from this newsgroup.\n\
  241. q    Quit this newsgroup for now.\n\
  242. Q    Quit newsgroup, staying at current newsgroup.\n\
  243. ",NOMARKING)) )
  244.     return cmd;
  245. #endif
  246.     return 0;
  247. }
  248.  
  249. int
  250. help_ng()
  251. {
  252.     int cmd;
  253. #ifdef NGHELP
  254.     doshell(sh,filexp(NGHELP));
  255. #else
  256.     page_init();
  257.     if (cmd = print_lines("\
  258. Newsgroup Selection commands:\n\
  259. ",STANDOUT) )
  260.     return cmd;
  261.     if (ng != nextrcline) {
  262.     if ((cmd = print_lines("\
  263. \n\
  264. y,SP    Do this newsgroup now.\n\
  265. .cmd    Do this newsgroup, executing cmd as first command.\n\
  266. ",NOMARKING)) ||
  267. #ifdef USETHREADS
  268.     (cmd = print_lines("\
  269. +    Enter this newsgroup through the thread selector (like typing .+<CR>).\n\
  270. ",NOMARKING)) ||
  271. #endif
  272.     (cmd = print_lines("\
  273. =    Start this newsgroup, but list subjects before reading articles.\n\
  274. ",NOMARKING)) ||
  275. #ifdef USETHREADS
  276.     (cmd = print_lines("\
  277. U    Enter this newsgroup by way of the \"Set unread?\" prompt.\n\
  278. ",NOMARKING)) ||
  279. #endif
  280.     (cmd = print_lines("\
  281. u    Unsubscribe from this newsgroup.\n\
  282. ",NOMARKING)) )
  283.         return cmd;
  284.     }
  285.     if ((cmd = print_lines("\
  286. c    Catch up (mark this newsgroup all read).\n\
  287. A    Abandon read/unread changes to this newsgroup since you started trn.\n\
  288. \n\
  289. n    Go to the next newsgroup with unread news.\n\
  290. N    Go to the next newsgroup.\n\
  291. p    Go to the previous newsgroup with unread news.\n\
  292. P    Go to the previous newsgroup.\n\
  293. ",NOMARKING)) ||
  294.     (cmd = print_lines("\
  295. -    Go to the previously displayed newsgroup.\n\
  296. 1    Go to the first newsgroup.\n\
  297. ^    Go to the first newsgroup with unread news.\n\
  298. $    Go to the last newsgroup.\n\
  299. ",NOMARKING)) ||
  300.     (cmd = print_lines("\
  301. g name    Go to the named newsgroup.  Subscribe to new newsgroups this way too.\n\
  302. /pat    Search forward for newsgroup matching pattern.\n\
  303. ?pat    Search backward for newsgroup matching pattern.\n\
  304.     (Use * and ? style patterns.  Append r to include read newsgroups.)\n\
  305. ",NOMARKING)) ||
  306.     (cmd = print_lines("\
  307. l pat    List unsubscribed newsgroups containing pattern.\n\
  308. m name    Move named newsgroup elsewhere (no name moves current newsgroup).\n\
  309. o pat    Only display newsgroups matching pattern.  Omit pat to unrestrict.\n\
  310. a pat    Like o, but also scans for unsubscribed newsgroups matching pattern.\n\
  311. L    List current .newsrc.\n\
  312. ",NOMARKING)) ||
  313.     (cmd = print_lines("\
  314. &    Print current command-line switch settings.\n\
  315. &switch {switch}\n\
  316.     Set (or unset) more command-line switches.\n\
  317. &&    Print current macro definitions.\n\
  318. &&def    Define a new macro.\n\
  319. !cmd    Shell escape.\n\
  320. ",NOMARKING)) ||
  321.     (cmd = print_lines("\
  322. q    Quit trn.\n\
  323. x    Quit, restoring .newsrc to its state at startup of trn.\n\
  324. ^K    Edit the global KILL file.  Use commands like /pattern/j to suppress\n\
  325.     pattern in every newsgroup.\n\
  326. v    Print version.\n\
  327. ",NOMARKING)) )
  328.     return cmd;
  329. #endif
  330. #ifdef PUSHBACK
  331.     if (cmd = get_anything())
  332.     return cmd;
  333.     show_macros();
  334. #endif
  335.     return 0;
  336. }
  337.  
  338. #ifdef ESCSUBS
  339. int
  340. help_subs()
  341. {
  342.     int cmd;
  343. #ifdef SUBSHELP
  344.     doshell(sh,filexp(SUBSHELP));
  345. #else
  346.     page_init();
  347.     if ((cmd = print_lines("\
  348. Valid substitutions are:\n\
  349. ",STANDOUT)) ||
  350.     (cmd = print_lines("\
  351. \n\
  352. a    Current article number\n\
  353. A    Full name of current article (%P/%c/%a)\n\
  354. b    Destination of last save command, often a mailbox\n\
  355. B    Bytes to ignore at beginning of last saved article\n\
  356. ",NOMARKING)) ||
  357.     (cmd = print_lines("\
  358. c    Current newsgroup, directory form\n\
  359. C    Current newsgroup, dot form\n\
  360. d    Full name of newsgroup directory (%P/%c)\n\
  361. D    Distribution line from current article\n\
  362. e    The last command executed to extract data from an article\n\
  363. E    The last extraction directory\n\
  364. ",NOMARKING)) ||
  365.     (cmd = print_lines("\
  366. f    Who the current article is from\n\
  367. F    Newsgroups to followup to (from Newsgroups and Followup-To)\n\
  368. h    (This help message)\n\
  369. H    Host name (yours)\n\
  370. i    Message-I.D. line from current article, with <>\n\
  371. I    Reference indicator mark (see -F switch)\n\
  372. ",NOMARKING)) ||
  373.     (cmd = print_lines("\
  374. l    News administrator's login name, if any\n\
  375. L    Login name (yours)\n\
  376. ",NOMARKING)) ||
  377. #ifdef USETHREADS
  378.     (cmd = print_lines("\
  379. m    Current mode, first letter of (init,newsgroup,thread,article,pager,\n\
  380.         unread,Add,Catchup,Delete-bogus,Mailbox,Resubscribe)\n\
  381. ",NOMARKING)) ||
  382. #else
  383.     (cmd = print_lines("\
  384. m    Current mode, first letter of (init, newsgroup, article, pager,\n\
  385.         Add, Catchup, Delete bogus, Mailbox, Resubscribe)\n\
  386. ",NOMARKING)) ||
  387. #endif
  388.     (cmd = print_lines("\
  389. M    Number of article marked with M\n\
  390. n    Newsgroups from current article\n\
  391. N    Full name (yours)\n\
  392. o    Organization (yours)\n\
  393. O    Original working directory (where you ran trn from)\n\
  394. ",NOMARKING)) ||
  395.     (cmd = print_lines("\
  396. p    Your private news directory (from -d)\n\
  397. P    Public news spool directory\n\
  398. r    Last reference (parent article id)\n\
  399. R    References list for followup article\n\
  400. ",NOMARKING)) ||
  401.     (cmd = print_lines("\
  402. s    Subject, with all Re's and (nf)'s stripped off\n\
  403. S    Subject, with one Re stripped off\
  404. t    New To line derived from From and Reply-To (Internet format)\n\
  405. T    New To line derived from Path\n\
  406. u    Number of unread articles\n\
  407. ",NOMARKING)) ||
  408. #ifdef USETHREADS
  409.     (cmd = print_lines("\
  410. U    Number of unread articles not counting the current article (when\n\
  411.     threads are selected, the count only reflects selected articles)\n\
  412. v    The number of extra (unselected) articles, not counting the current\n\
  413.     one if it is unselected\n\
  414. w    Mthreads' tmp directory\n\
  415. W    Where thread files are saved\n\
  416. x    News library directory\n\
  417. X    Trn library directory\n\
  418. z    Length of current article in bytes\n\
  419. Z    Number of selected threads\n\
  420. ",NOMARKING)) ||
  421. #else
  422.     (cmd = print_lines("\
  423. U    Number of unread articles not counting the current article\n\
  424. x    News library directory\n\
  425. X    Trn library directory\n\
  426. z    Length of current article in bytes\n\
  427. ",NOMARKING)) ||
  428. #endif
  429.     (cmd = print_lines("\
  430. ~    Your home directory\n\
  431. .    Directory containing . files\n\
  432. #    A counter in multi-article saves\n\
  433. $    Current process number\n\
  434. /    Last search string\n\
  435. ESC    Run preceding command through % interpretation\n\
  436. ",NOMARKING)) )
  437.     return cmd;
  438. #endif
  439.     return 0;
  440. }
  441. #endif
  442.  
  443. #ifdef USETHREADS
  444. int
  445. help_select()
  446. {
  447.     int cmd;
  448.  
  449.     page_init();
  450.     if ((cmd = print_lines("\
  451. Thread selection commands:\n\
  452. ",STANDOUT)) ||
  453.     (cmd = print_lines("\n\
  454. a-z,0-9    Select/deselect the discussion thread by its letter or number.  By\n\
  455.     default the letters h, k, m, n, p, q and y are omitted.\n\
  456. SP    Perform the default command (usually > or Z).\n\
  457. CR    Start reading.  Selects the current thread if none are selected.\n\
  458. Z,TAB    Start reading.  If no articles are selected, read everything.\n\
  459. y, '.'    Toggle the current thread's selection.\n\
  460. k, ','    Mark the current thread as killed.\n\
  461. ",NOMARKING)) ||
  462.     (cmd = print_lines("\
  463. m, \\    Unmark the current thread.\n\
  464. -    Set a range, as in 2 - 5.  Repeats the last marking action.\n\
  465. @    Toggle all visible thread selections.\n\
  466. n, ]    Move down to the next thread.\n\
  467. p, [    Move up to the previous thread.\n\
  468. <, >    Go to previous/next page.\n\
  469. ^, $    Go to first/last page.\n\
  470. ",NOMARKING)) ||
  471.     (cmd = print_lines("\
  472. X    Mark all unselected articles as read and start reading.\n\
  473. D    Mark unselected articles on the current page as read.  Start\n\
  474.     reading if articles were selected, else go to next page.\n\
  475. J    Junk all selected articles (mark them as read).\n\
  476. ^K    Edit local KILL file (the one for this newsgroup).\n\
  477. :cmd    Perform a command on all the selected articles.\n\
  478. ",NOMARKING)) ||
  479.     (cmd = print_lines("\
  480. /pattern/modifiers\n\
  481.     Scan all articles for a subject containing pattern.\n\
  482.     (Append h to scan headers, a to scan entire articles, c to make case\n\
  483.     sensitive, r to scan read articles (assumed when you are selecting\n\
  484.     read articles to set unread.)\n\
  485. /pattern/modifiers:command{:command}\n\
  486.     Apply one or more commands to the set of articles matching pattern.\n\
  487. ",NOMARKING)) ||
  488.     (cmd = print_lines("\
  489.     Use a K modifier to save entire command to the KILL file for this\n\
  490.     newsgroup.  Commands m and M, if first, imply an r modifier.\n\
  491.      Valid commands are: e, E, j, m, M, s, S, t, T, !, =, ',' and the\n\
  492.     thread selection commands: + and -.\n\
  493. N    Leave this group as-is and go on to the next.\n\
  494. U    Switch between selecting read/unread articles.\n\
  495. L    Switch the current display mode between a terse mode without\n\
  496.     authors and a short and long mode with authors.\n\
  497. ",NOMARKING)) ||
  498.     (cmd = print_lines("\
  499. &    View or set command line switches.\n\
  500. &&    View or set macro definitions.\n\
  501. !cmd    Escape to a subshell.\n\
  502. q    Quit selection mode.\n\
  503. Q    Quit group and return to news group selection prompt for this group.\n\
  504. ",NOMARKING)) )
  505.     return cmd;
  506.     return 0;
  507. }
  508. #endif
  509.