BSD 4_3 development
[unix-history] / usr / contrib / rn / help.c
CommitLineData
1cd0e254
C
1/* $Header: help.c,v 4.3.1.2 85/09/10 11:05:39 lwall Exp $
2 *
3 * $Log: help.c,v $
4 * Revision 4.3.1.2 85/09/10 11:05:39 lwall
5 * Improved %m in in_char().
6 *
7 * Revision 4.3.1.1 85/05/10 11:33:10 lwall
8 * Branch for patches.
9 *
10 * Revision 4.3 85/05/01 11:38:59 lwall
11 * Baseline for release with 4.3bsd.
12 *
13 */
14
15#include "EXTERN.h"
16#include "common.h"
17#include "rn.h"
18#include "term.h"
19#include "INTERN.h"
20#include "help.h"
21
22void
23help_init()
24{
25 ;
26}
27
28int
29help_page()
30{
31 int cmd;
32
33#ifdef PAGERHELP
34 doshell(sh,filexp(PAGERHELP));
35#else
36 page_init();
37 if ((cmd = print_lines("\
38Paging commands:\n\
39",STANDOUT)) ||
40 (cmd = print_lines("\n\
41SP Display the next page.\n\
42x Display the next page decrypted (rot13).\n\
43d Display half a page more.\n\
44CR Display one more line.\n\
45^R,v,^X Restart the current article (v=verbose header, ^X=rot13).\n\
46",NOMARKING)) ||
47 (cmd = print_lines("\
48^B Back up one page.\n\
49^L,X Refresh the screen (X=rot13).\n\
50g pat Go to (search forward within article for) pattern.\n\
51G Search again for current pattern within article.\n\
52^G Search for next line beginning with \"Subject:\".\n\
53TAB Search for next line beginning with a different character.\n\
54q Quit the pager, go to end of article. Leave article read or unread.\n\
55j Junk this article (mark it read). Goes to end of article.\n\
56\n\
57",NOMARKING)) ||
58 (cmd = print_lines("\
59The following commands skip the rest of the current article, then behave\n\
60just as if typed to the 'What next?' prompt at the end of the article:\n\
61",STANDOUT)) ||
62 (cmd = print_lines("\n\
63n Scan forward for next unread article.\n\
64N Go to next article.\n\
65^N Scan forward for next unread article with same title.\n\
66p,P,^P Same as n,N,^N, only going backwards.\n\
67- Go to previously displayed article.\n\
68\n\
69",NOMARKING)) ||
70 (cmd = print_lines("\
71The following commands also take you to the end of the article.\n\
72Type h at end of article for a description of these commands:\n\
73",STANDOUT)) ||
74 (cmd = print_lines("\
75 # $ & / = ? c C f F k K ^K m M number r R ^R s S u v w W Y ^ |\n\
76\n\
77(To return to the middle of the article after one of these commands, type ^L.)\n\
78",NOMARKING)) )
79 return cmd;
80#endif
81 return 0;
82}
83
84int
85help_art()
86{
87 int cmd;
88#ifdef ARTHELP
89 doshell(sh,filexp(ARTHELP));
90#else
91 page_init();
92 if ((cmd = print_lines("\
93Article Selection commands:\n\
94",STANDOUT)) ||
95 (cmd = print_lines("\n\
96n,SP Scan forward for next unread article.\n\
97N Go to next article.\n\
98^N Scan forward for next unread article with same subject.\n\
99p,P,^P Same as n,N,^N, only going backwards.\n\
100- Go to previously displayed article.\n\
101",NOMARKING)) ||
102 (cmd = print_lines("\
103number Go to specified article.\n\
104range{,range} command{:command}\n\
105 Apply one or more commands to one or more ranges of articles.\n\
106 Ranges are of the form: number | number-number. You may use . for\n\
107 the current article, and $ for the last article.\n\
108 Valid commands are: j, m, M, s, S, and !.\n\
109",NOMARKING)) ||
110 (cmd = print_lines("\
111/pattern/modifiers\n\
112 Scan forward for article containing pattern in the subject line.\n\
113 (Use ?pat? to scan backwards; append h to scan headers, a to scan\n\
114 entire articles, r to scan read articles, c to make case sensitive.\n\
115/pattern/modifiers:command{:command}\n\
116 Apply one or more commands to the set of articles matching pattern.\n\
117 Use a K modifier to save entire command to the KILL file for this\n\
118 newsgroup. Commands m and M, if first, imply an r modifier.\n\
119 Valid commands are: j, m, M, s, S, and !.\n\
120",NOMARKING)) ||
121 (cmd = print_lines("\
122f,F Submit a followup article (F = include this article).\n\
123r,R Reply through net mail (R = include this article).\n\
124s ... Save to file or pipe via sh.\n\
125S ... Save via preferred shell.\n\
126w,W Like s and S but save without the header.\n\
127| ... Same as s|...\n\
128C Cancel this article, if yours.\n\
129",NOMARKING)) ||
130 (cmd = print_lines("\
131^R,v Restart article (v=verbose).\n\
132^X Restart article, rot13 mode.\n\
133c Catch up (mark all articles as read).\n\
134^B Back up one page.\n\
135^L Refresh the screen. You can get back to the pager with this.\n\
136X Refresh screen in rot13 mode.\n\
137",NOMARKING)) ||
138 (cmd = print_lines("\
139^ Go to first unread article. Disables subject search mode.\n\
140$ Go to end of newsgroup. Disables subject search mode.\n\
141",NOMARKING)) ||
142 (cmd = print_lines("# Print last article number.\n\
143& Print current values of command-line switches.\n\
144&switch {switch}\n\
145 Set or unset more switches.\n\
146&& Print current macro definitions.\n\
147&&def Define a new macro.\n\
148j Junk this article (mark it read). Stays at end of article.\n\
149m Mark article as still unread.\n\
150M Mark article as still unread upon exiting newsgroup or Y command.\n\
151",NOMARKING)) ||
152 (cmd = print_lines("\
153Y Yank back articles marked temporarily read via M.\n\
154k Mark current SUBJECT as read.\n\
155K Mark current SUBJECT as read, and save command in KILL file.\n\
156= List subjects of unread articles.\n\
157u Unsubscribe to this newsgroup.\n\
158^K Edit local KILL file (the one for this newsgroup).\n\
159q Quit this newsgroup for now.\n\
160Q Quit newsgroup, staying at current newsgroup.\n\
161",NOMARKING)) )
162 return cmd;
163#endif
164 return 0;
165}
166
167int
168help_ng()
169{
170 int cmd;
171#ifdef NGHELP
172 doshell(sh,filexp(NGHELP));
173#else
174 page_init();
175 if (cmd = print_lines("\
176Newsgroup Selection commands:\n\
177",STANDOUT) )
178 return cmd;
179 if (ng != nextrcline) {
180 if (cmd = print_lines("\
181\n\
182y,SP Do this newsgroup now.\n\
183.cmd Do this newsgroup, executing cmd as first command.\n\
184= Equivalent to .=<carriage return>.\n\
185u Unsubscribe from this newsgroup.\n\
186c Catch up (mark this newsgroup all read).\n\
187",NOMARKING) )
188 return cmd;
189 }
190 if ((cmd = print_lines("\
191\n\
192n Go to the next newsgroup with unread news.\n\
193N Go to the next newsgroup.\n\
194p Go to the previous newsgroup with unread news.\n\
195P Go to the previous newsgroup.\n\
196",NOMARKING)) ||
197 (cmd = print_lines("\
198- Go to the previously displayed newsgroup.\n\
1991 Go to the first newsgroup.\n\
200^ Go to the first newsgroup with unread news.\n\
201$ Go to the last newsgroup.\n\
202",NOMARKING)) ||
203 (cmd = print_lines("\
204g name Go to the named newsgroup. Subscribe to new newsgroups this way too.\n\
205/pat Search forward for newsgroup matching pattern.\n\
206?pat Search backward for newsgroup matching pattern.\n\
207 (Use * and ? style patterns. Append r to include read newsgroups.)\n\
208",NOMARKING)) ||
209 (cmd = print_lines("\
210l pat List unsubscribed newsgroups containing pattern.\n\
211m name Move named newsgroup elsewhere (no name moves current newsgroup).\n\
212o pat Only display newsgroups matching pattern. Omit pat to unrestrict.\n\
213a pat Like o, but also scans for unsubscribed newsgroups matching pattern.\n\
214L List current .newsrc.\n\
215",NOMARKING)) ||
216 (cmd = print_lines("\
217& Print current command-line switch settings.\n\
218&switch {switch}\n\
219 Set (or unset) more command-line switches.\n\
220&& Print current macro definitions.\n\
221&&def Define a new macro.\n\
222!cmd Shell escape.\n\
223",NOMARKING)) ||
224 (cmd = print_lines("\
225q Quit rn.\n\
226^K Edit the global KILL file. Use commands like /pattern/j to suppress\n\
227 pattern in every newsgroup.\n\
228v Print version.\n\
229",NOMARKING)) )
230 return cmd;
231#endif
232#ifdef PUSHBACK
233 if (cmd = get_anything())
234 return cmd;
235 show_macros();
236#endif
237 return 0;
238}
239
240#ifdef ESCSUBS
241int
242help_subs()
243{
244 int cmd;
245#ifdef SUBSHELP
246 doshell(sh,filexp(SUBSHELP));
247#else
248 page_init();
249 if ((cmd = print_lines("\
250Valid substitutions are:\n\
251",STANDOUT)) ||
252 (cmd = print_lines("\
253\n\
254a Current article number\n\
255A Full name of current article (%P/%c/%a)\n\
256b Destination of last save command, often a mailbox\n\
257B Bytes to ignore at beginning of last saved article\n\
258",NOMARKING)) ||
259 (cmd = print_lines("\
260c Current newsgroup, directory form\n\
261C Current newsgroup, dot form\n\
262d Full name of newsgroup directory (%P/%c)\n\
263D Distribution line from current article\
264",NOMARKING)) ||
265 (cmd = print_lines("\
266f Who the current article is from\n\
267F Newsgroups to followup to (from Newsgroups and Followup-To)\n\
268h (This help message)\n\
269H Host name (yours)\n\
270i Message-I.D. line from current article, with <>\n\
271I Reference indicator mark (see -F switch)\n\
272",NOMARKING)) ||
273 (cmd = print_lines("\
274l News administrator's login name, if any\n\
275L Login name (yours)\n\
276m Current mode, first letter of (init, newsgroup, article, pager,\n\
277 Add, Catchup, Delete bogus, Mailbox, Resubscribe)\n\
278M Number of article marked with M\n\
279n Newsgroups from current article\n\
280N Full name (yours)\n\
281",NOMARKING)) ||
282 (cmd = print_lines("\
283o Organization (yours)\n\
284O Original working directory (where you ran rn from)\n\
285p Your private news directory (from -d)\n\
286P Public news spool directory\n\
287",NOMARKING)) ||
288 (cmd = print_lines("\
289r Last reference (parent article id)\n\
290R References list for followup article\n\
291s Subject, with all Re's and (nf)'s stripped off\n\
292S Subject, with one Re stripped off\
293",NOMARKING)) ||
294 (cmd = print_lines("\
295t New To line derived from From and Reply-To (Internet format)\n\
296T New To line derived from Path\n\
297u Number of unread articles\n\
298U Number of unread articles not counting current article\n\
299x News library directory\n\
300X Rn library directory\n\
301z Length of current article in bytes\n\
302",NOMARKING)) ||
303 (cmd = print_lines("\
304~ Your home directory\n\
305. Directory containing . files\n\
306$ Current process number\n\
307/ Last search string\n\
308ESC Run preceding command through % interpretation\n\
309",NOMARKING)) )
310 return cmd;
311#endif
312 return 0;
313}
314#endif
315