|
From: Petr S. <pe...@us...> - 2001-02-09 21:06:52
|
Update of /cvsroot/cscope/cscope/src
In directory usw-pr-cvs1:/tmp/cvs-serv4507/src
Modified Files:
edit.c global.h main.c
Log Message:
Introduced CSCOPE_EDITOR, CSCOPE_LINEFLAG and CSCOPE_LINEFLAG_AFTER_FILE.
CSCOPE_EDITOR is to be used when the default EDITOR value is incompatible
when called from cscope. CSCOPE_LINEFLAG allows options to be provided
for the editor and CSCOPE_LINEFLAG_AFTER_FILE allows options for the editor
if they need to be set after the name of the file to be edited.
Index: edit.c
===================================================================
RCS file: /cvsroot/cscope/cscope/src/edit.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** edit.c 2000/05/31 16:54:10 1.3
--- edit.c 2001/02/09 21:07:17 1.4
***************
*** 102,106 ****
{
char msg[MSGLEN + 1]; /* message */
! char plusnum[NUMLEN + 2]; /* line number option */
char *s;
--- 102,106 ----
{
char msg[MSGLEN + 1]; /* message */
! char plusnum[NUMLEN + 20]; /* line number option: allow space for wordy line# flag */
char *s;
***************
*** 108,113 ****
(void) sprintf(msg, "%s +%s %s", basename(editor), linenum, file);
postmsg(msg);
! (void) sprintf(plusnum, "+%s", linenum);
!
/* if this is the more or page commands */
if (strcmp(s = basename(editor), "more") == 0 || strcmp(s, "page") == 0) {
--- 108,112 ----
(void) sprintf(msg, "%s +%s %s", basename(editor), linenum, file);
postmsg(msg);
! (void) sprintf(plusnum, lineflag, linenum);
/* if this is the more or page commands */
if (strcmp(s = basename(editor), "more") == 0 || strcmp(s, "page") == 0) {
***************
*** 116,119 ****
--- 115,121 ----
length */
(void) execute(editor, editor, plusnum, file, "/dev/null", NULL);
+ }
+ else if (lineflagafterfile) {
+ (void) execute(editor, editor, file, plusnum, NULL);
}
else {
Index: global.h
===================================================================
RCS file: /cvsroot/cscope/cscope/src/global.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -r1.11 -r1.12
*** global.h 2000/05/19 04:46:32 1.11
--- global.h 2001/02/09 21:07:17 1.12
***************
*** 94,98 ****
/* main.c global data */
! extern char *editor, *home, *shell; /* environment variables */
extern char *argv0; /* command name */
extern BOOL compress; /* compress the characters in the crossref */
--- 94,99 ----
/* main.c global data */
! extern char *editor, *home, *shell, *lineflag; /* environment variables */
! extern BOOL lineflagafterfile;
extern char *argv0; /* command name */
extern BOOL compress; /* compress the characters in the crossref */
Index: main.c
===================================================================
RCS file: /cvsroot/cscope/cscope/src/main.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -r1.15 -r1.16
*** main.c 2000/10/27 11:35:01 1.15
--- main.c 2001/02/09 21:07:17 1.16
***************
*** 52,55 ****
--- 52,56 ----
#define EDITOR "vi"
#define SHELL "sh"
+ #define LINEFLAG "+%s" /* default: used by vi and emacs */
#define TMPDIR "/tmp"
#ifndef DFLT_INCDIR
***************
*** 67,71 ****
char dicode2[256]; /* digraph second character code */
! char *editor, *home, *shell; /* environment variables */
char *argv0; /* command name */
BOOL compress = YES; /* compress the characters in the crossref */
--- 68,73 ----
char dicode2[256]; /* digraph second character code */
! char *editor, *home, *shell, *lineflag; /* environment variables */
! BOOL lineflagafterfile;
char *argv0; /* command name */
BOOL compress = YES; /* compress the characters in the crossref */
***************
*** 307,313 ****
/* read the environment */
editor = mygetenv("EDITOR", EDITOR);
! editor = mygetenv("VIEWER", editor); /* use viewer if set */
home = getenv("HOME");
shell = mygetenv("SHELL", SHELL);
tmpdir = mygetenv("TMPDIR", TMPDIR);
--- 309,318 ----
/* read the environment */
editor = mygetenv("EDITOR", EDITOR);
! editor = mygetenv("VIEWER", editor); /* use viewer if set */
! editor = mygetenv("CSCOPE_EDITOR", editor); /* has last word */
home = getenv("HOME");
shell = mygetenv("SHELL", SHELL);
+ lineflag = mygetenv("CSCOPE_LINEFLAG", LINEFLAG);
+ lineflagafterfile = getenv("CSCOPE_LINEFLAG_AFTER_FILE")?1:0;
tmpdir = mygetenv("TMPDIR", TMPDIR);
|