/* */
This source file includes following definitions.
- help
1 /*===========================================================================
2 Copyright (c) 1998-2000, The Santa Cruz Operation
3 All rights reserved.
4
5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions are met:
7
8 *Redistributions of source code must retain the above copyright notice,
9 this list of conditions and the following disclaimer.
10
11 *Redistributions in binary form must reproduce the above copyright notice,
12 this list of conditions and the following disclaimer in the documentation
13 and/or other materials provided with the distribution.
14
15 *Neither name of The Santa Cruz Operation nor the names of its contributors
16 may be used to endorse or promote products derived from this software
17 without specific prior written permission.
18
19 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
20 IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
21 THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
23 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 INTERRUPTION)
27 HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
30 DAMAGE.
31 =========================================================================*/
32
33 /** @file
34 * display help
35 *
36 * cscope - interactive C symbol cross-reference
37 *
38 */
39
40 #include "global-cscope.h"
41 #if defined(USE_NCURSES) && !defined(RENAMED_NCURSES)
42 #include <ncurses.h>
43 #else
44 #include <curses.h>
45 #endif
46 /**
47 max num of lines of help screen -
48 this number needs to be increased if more than n help items are needed
49 */
50 #define MAXHELP 50 /* maximum number of help strings */
51
52 static char const rcsid[] = "$Id: help.c,v 1.3 2012/10/13 07:02:06 shigio Exp $";
53
54 void
55 help(void)
56 {
57 char **ep, *s, **tp, *text[MAXHELP];
58 int ln;
59
60 tp = text;
61 if (changing == NO) {
62 if (mouse) {
63 *tp++ = "Point with the mouse and click button 1 to move to the desired input field,\n";
64 *tp++ = "type the pattern to search for, and then press the RETURN key. For the first 4\n";
65 *tp++ = "and last 2 input fields, the pattern can be a regcomp(3) regular expression.\n";
66 *tp++ = "If the search is successful, you can edit the file containing a displayed line\n";
67 *tp++ = "by pointing with the mouse and clicking button 1.\n";
68 *tp++ = "\nYou can either use the button 2 menu or these single-character commands:\n\n";
69 } else {
70 *tp++ = "Press the RETURN key repeatedly to move to the desired input field, type the\n";
71 *tp++ = "pattern to search for, and then press the RETURN key. For the first 4 and\n";
72 *tp++ = "last 2 input fields, the pattern can be a regcomp(3) regular expression.\n";
73 *tp++ = "If the search is successful, you can use these single-character commands:\n\n";
74 *tp++ = "0-9a-zA-Z\tEdit the file containing the displayed line.\n";
75 }
76 *tp++ = "space bar\tDisplay next set of matching lines.\n";
77 *tp++ = "+\t\tDisplay next set of matching lines.\n";
78 *tp++ = "^V\t\tDisplay next set of matching lines.\n";
79 *tp++ = "-\t\tDisplay previous set of matching lines.\n";
80 *tp++ = "^E\t\tEdit all lines.\n";
81 *tp++ = ">\t\tWrite the list of lines being displayed to a file.\n";
82 *tp++ = ">>\t\tAppend the list of lines being displayed to a file.\n";
83 *tp++ = "<\t\tRead lines from a file.\n";
84 *tp++ = "^\t\tFilter all lines through a shell command.\n";
85 *tp++ = "|\t\tPipe all lines to a shell command.\n";
86 *tp++ = "^G\t\tRead lines from the result of the execution of global(1).\n";
87 if (!mouse) {
88 *tp++ = "\nAt any time you can use these single-character commands:\n\n";
89 *tp++ = "TAB\t\tSwap positions between input and output areas.\n";
90 *tp++ = "RETURN\t\tMove to the next input field.\n";
91 *tp++ = "^N\t\tMove to the next input field.\n";
92 *tp++ = "^P\t\tMove to the previous input field.\n";
93 }
94 *tp++ = "^Y / ^A\t\tSearch with the last pattern typed.\n";
95 *tp++ = "^B\t\tRecall previous input field and search pattern.\n";
96 *tp++ = "^F\t\tRecall next input field and search pattern.\n";
97 if(caseless)
98 *tp++ = "^C\t\tToggle ignore/use letter case when searching (IGNORE).\n";
99 else
100 *tp++ = "^C\t\tToggle ignore/use letter case when searching (USE).\n";
101 *tp++ = "^R\t\tRebuild the cross-reference.\n";
102 *tp++ = "!\t\tStart an interactive shell (type ^D to return to cscope).\n";
103 *tp++ = "^L\t\tRedraw the screen.\n";
104 *tp++ = "?\t\tDisplay this list of commands.\n";
105 *tp++ = "^D\t\tExit cscope.\n";
106 *tp++ = "\nNote: If the first character of the pattern you want to search for matches\n";
107 *tp++ = "a command, type a \\ character first.\n";
108 *tp++ = "Note: Some ctrl keys may be occupied by your terminal configuration.\n";
109 } else {
110 if (mouse) {
111 *tp++ = "Point with the mouse and click button 1 to mark or unmark the line to be\n";
112 *tp++ = "changed. You can also use the button 2 menu or these single-character\n";
113 *tp++ = "commands:\n\n";
114 }
115 else {
116 *tp++ = "When changing text, you can use these single-character commands:\n\n";
117 *tp++ = "0-9a-zA-Z\tMark or unmark the line to be changed.\n";
118 }
119 *tp++ = "*\t\tMark or unmark all displayed lines to be changed.\n";
120 *tp++ = "space bar\tDisplay next set of lines.\n";
121 *tp++ = "+\t\tDisplay next set of lines.\n";
122 *tp++ = "-\t\tDisplay previous set of lines.\n";
123 *tp++ = "^A\t\tMark or unmark all lines to be changed.\n";
124 *tp++ = "^D\t\tChange the marked lines and exit.\n";
125 *tp++ = "ESC\t\tExit without changing the marked lines.\n";
126 *tp++ = "!\t\tStart an interactive shell (type ^D to return to cscope).\n";
127 *tp++ = "^L\t\tRedraw the screen.\n";
128 *tp++ = "?\t\tDisplay this list of commands.\n";
129 }
130 /* print help, a screen at a time */
131 ep = tp;
132 ln = 0;
133 for (tp = text; tp < ep; ) {
134 if (ln < LINES - 1) {
135 for (s = *tp; *s != '\0'; ++s) {
136 if (*s == '\n') {
137 ++ln;
138 }
139 }
140 (void) addstr(*tp++);
141 }
142 else {
143 (void) addstr("\n");
144 askforchar();
145 (void) clear();
146 ln = 0;
147 }
148 }
149 if (ln) {
150 (void) addstr("\n");
151 askforchar();
152 }
153 }
/* */