home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 35 Internet / 35-Internet.zip / trn_12.zip / src / help.c < prev    next >
C/C++ Source or Header  |  1993-12-04  |  17KB  |  515 lines

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