FreeBSD/contrib/nvi/ex/ex_cscope.c
/*
 * start_cscopes --
 *	Initialize the cscope package.
 */
start_cscopes
Initialize the cscope package.
start_cscopes Initialize the cscope package .
static int
start_cscopes(SCR *sp, EXCMD *cmdp)
{
	size_t blen, len;
	char *bp, *cscopes, *p, *t;
	CHAR_T *wp;
	size_t wlen;
	if ((cscopes = getenv("CSCOPE_DIRS")) == NULL)
		return (0);
	len = strlen(cscopes);
	GET_SPACE_RETC(sp, bp, blen, len);
	memcpy(bp, cscopes, len + 1);
	for (cscopes = t = bp; (p = strsep(&t, "\t :")) != NULL;)
		if (*p != '\0') {
			CHAR2INT(sp, p, strlen(p) + 1, wp, wlen);
			(void)cscope_add(sp, cmdp, wp);
		}
	FREE_SPACE(sp, bp, blen);
	return (0);
}
static int start_cscopes ( SCR * sp , EXCMD * cmdp ) { size_t blen , len ; char * bp , * cscopes , * p , * t ; CHAR_T * wp ; size_t wlen ; if ( ( cscopes = getenv ( " " ) ) == NULL ) return ( 0 ) ; len = strlen ( cscopes ) ; GET_SPACE_RETC ( sp , bp , blen , len ) ; memcpy ( bp , cscopes , len + 1 ) ; for ( cscopes = t = bp ; ( p = strsep ( & t , " \t " ) ) != NULL ; ) if ( * p != ' \0 ' ) { CHAR2INT ( sp , p , strlen ( p ) + 1 , wp , wlen ) ; ( void ) cscope_add ( sp , cmdp , wp ) ; } FREE_SPACE ( sp , bp , blen ) ; return ( 0 ) ; }
start_cscopes
      Initialize the cscope package.
start_cscopes Initialize the cscope package .
/*
	 * EXTENSION #1:
	 *
	 * If the CSCOPE_DIRS environment variable is set, we treat it as a
	 * list of cscope directories that we're using, similar to the tags
	 * edit option.
	 *
	 * XXX
	 * This should probably be an edit option, although that implies that
	 * we start/stop cscope processes periodically, instead of once when
	 * the editor starts.
	 */