1 /*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
7 * with the License.
8 *
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
13 *
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
19 *
20 * CDDL HEADER END
21 */
22 /* Copyright (c) 1988 AT&T */
23 /* All Rights Reserved */
24
25
26 /*
27 * Copyright (c) 1999 by Sun Microsystems, Inc.
28 * All rights reserved.
29 */
30
31 /*
32 * cscope - interactive C symbol cross-reference
33 *
34 * display help
35 */
36
37 #include "global.h"
38 #include <curses.h> /* LINES */
39
40 #define MAXHELP 50 /* maximum number of help strings */
41
42 void
help(void)43 help(void)
44 {
45 char **ep, *s, **tp, *text[MAXHELP];
46 int line;
47
48 tp = text;
49 if (changing == NO) {
50 if (mouse) {
51 *tp++ = "Point with the mouse and click button 1 to "
52 "move to the desired input field,\n";
53 *tp++ = "type the pattern to search for, and then "
54 "press the RETURN key. For the first 5\n";
55 *tp++ = "and last 2 input fields, the pattern can be "
56 "a regcmp(3C) regular expression.\n";
57 *tp++ = "If the search is successful, you can edit "
58 "the file containing a displayed line\n";
59 *tp++ = "by pointing with the mouse and clicking "
60 "button 1.\n";
61 *tp++ = "\nYou can either use the button 2 menu or "
62 "these command characters:\n\n";
63 } else {
64 *tp++ = "Press the TAB key repeatedly to move to the "
65 "desired input field, type the\n";
66 *tp++ = "pattern to search for, and then press the "
67 "RETURN key. For the first 4 and\n";
68 *tp++ = "last 2 input fields, the pattern can be a "
69 "regcmp(3C) regular expression.\n";
70 *tp++ = "If the search is successful, you can use "
71 "these command characters:\n\n";
72 *tp++ = "1-9\tEdit the file containing the displayed "
73 "line.\n";
74 }
75 *tp++ = "space\tDisplay next lines.\n";
76 *tp++ = "+\tDisplay next lines.\n";
77 *tp++ = "-\tDisplay previous lines.\n";
78 *tp++ = "^E\tEdit all lines.\n";
79 *tp++ = ">\tWrite all lines to a file.\n";
80 *tp++ = ">>\tAppend all lines to a file.\n";
81 *tp++ = "<\tRead lines from a file.\n";
82 *tp++ = "^\tFilter all lines through a shell command.\n";
83 *tp++ = "|\tPipe all lines to a shell command.\n";
84 *tp++ = "\nAt any time you can use these command "
85 "characters:\n\n";
86 if (!mouse) {
87 *tp++ = "^P\tMove to the previous input field.\n";
88 }
89 *tp++ = "^A\tSearch again with the last pattern typed.\n";
90 *tp++ = "^B\tRecall previous input field and search pattern.\n";
91 *tp++ = "^F\tRecall next input field and search pattern.\n";
92 *tp++ = "^C\tToggle ignore/use letter case when searching.\n";
93 *tp++ = "^R\tRebuild the symbol database.\n";
94 *tp++ = "!\tStart an interactive shell (type ^D to return "
95 "to cscope).\n";
96 *tp++ = "^L\tRedraw the screen.\n";
97 *tp++ = "?\tDisplay this list of commands.\n";
98 *tp++ = "^D\tExit cscope.\n";
99 *tp++ = "\nNote: If the first character of the pattern you "
100 "want to search for matches\n";
101 *tp++ = "a command, type a \\ character first.\n";
102 } else {
103 if (mouse) {
104 *tp++ = "Point with the mouse and click button 1 "
105 "to mark or unmark the line to be\n";
106 *tp++ = "changed. You can also use the button 2 "
107 "menu or these command characters:\n\n";
108 } else {
109 *tp++ = "When changing text, you can use these "
110 "command characters:\n\n";
111 *tp++ = "1-9\tMark or unmark the line to be changed.\n";
112 }
113 *tp++ = "*\tMark or unmark all displayed lines to be "
114 "changed.\n";
115 *tp++ = "space\tDisplay next lines.\n";
116 *tp++ = "+\tDisplay next lines.\n";
117 *tp++ = "-\tDisplay previous lines.\n";
118 *tp++ = "a\tMark or unmark all lines to be changed.\n";
119 *tp++ = "^D\tChange the marked lines and exit.\n";
120 *tp++ = "RETURN\tExit without changing the marked lines.\n";
121 *tp++ = "!\tStart an interactive shell (type ^D to return "
122 "to cscope).\n";
123 *tp++ = "^L\tRedraw the screen.\n";
124 *tp++ = "?\tDisplay this list of commands.\n";
125 }
126 /* print help, a screen at a time */
127 ep = tp;
128 line = 0;
129 for (tp = text; tp < ep; ) {
130 if (line < LINES - 1) {
131 for (s = *tp; *s != '\0'; ++s) {
132 if (*s == '\n') {
133 ++line;
134 }
135 }
136 (void) addstr(*tp++);
137 } else {
138 (void) addstr("\n");
139 askforchar();
140 (void) clear();
141 line = 0;
142 }
143 }
144 if (line) {
145 (void) addstr("\n");
146 askforchar();
147 }
148 }
149