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