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