View | Details | Raw Unified
Collapse All | Expand All

(-) ./cscope-15.5/src/global.h (-1 / +1 lines)
 Lines 241-247    Link Here 
extern	long	totalterms;	/* total inverted index terms */
extern	long	totalterms;	/* total inverted index terms */
extern	BOOL	trun_syms;	/* truncate symbols to 8 characters */
extern	BOOL	trun_syms;	/* truncate symbols to 8 characters */
extern	char	tempstring[8192]; /* global dummy string buffer */
extern	char	tempstring[8192]; /* global dummy string buffer */
extern	char	*tmpdir;	/* temporary directory */
extern	char	tmpdir[2048];	/* temporary directory */
/* command.c global data */
/* command.c global data */
extern	BOOL	caseless;	/* ignore letter case when searching */
extern	BOOL	caseless;	/* ignore letter case when searching */
(-) ./cscope-15.5/src/main.c (-4 / +21 lines)
 Lines 105-111    Link Here 
BOOL	trun_syms;		/* truncate symbols to 8 characters */
BOOL	trun_syms;		/* truncate symbols to 8 characters */
char	tempstring[8192];	/* use this as a buffer, instead of 'yytext', 
char	tempstring[8192];	/* use this as a buffer, instead of 'yytext', 
				 * which had better be left alone */
				 * which had better be left alone */
char	*tmpdir;		/* temporary directory */
char	tmpdir[2048];		/* temporary directory */
static	BOOL	onesearch;		/* one search only in line mode */
static	BOOL	onesearch;		/* one search only in line mode */
static	char	*reflines;		/* symbol reference lines file */
static	char	*reflines;		/* symbol reference lines file */
 Lines 312-319    Link Here 
	shell = mygetenv("SHELL", SHELL);
	shell = mygetenv("SHELL", SHELL);
	lineflag = mygetenv("CSCOPE_LINEFLAG", LINEFLAG);
	lineflag = mygetenv("CSCOPE_LINEFLAG", LINEFLAG);
	lineflagafterfile = getenv("CSCOPE_LINEFLAG_AFTER_FILE")?1:0;
	lineflagafterfile = getenv("CSCOPE_LINEFLAG_AFTER_FILE")?1:0;
	tmpdir = mygetenv("TMPDIR", TMPDIR);
	char template[] = "cscope.XXXXXX";
	snprintf(tmpdir, sizeof(tmpdir), "%s/%s", mygetenv("TMPDIR", TMPDIR), template);
	tmpdir[sizeof(tmpdir)-1] = '\0';
	char *ret;
	ret = mkdtemp(tmpdir);
	if (ret == NULL)s
	{
		fprintf (stderr, "cscope: Temporary directory %s cannot be created.\n", tmpdir);
		myexit(1);
	}
	
	/* XXX remove if/when clearerr() in dir.c does the right thing. */
	/* XXX remove if/when clearerr() in dir.c does the right thing. */
	if (namefile && strcmp(namefile, "-") == 0 && !buildonly)
	if (namefile && strcmp(namefile, "-") == 0 && !buildonly)
	{
	{
 Lines 331-338    Link Here 
	/* create the temporary file names */
	/* create the temporary file names */
	pid = getpid();
	pid = getpid();
	(void) sprintf(temp1, "%s/cscope%d.1", tmpdir, pid);
	(void) snprintf(temp1, sizeof(temp1), "%s/cscope%d.1", tmpdir, pid);
	(void) sprintf(temp2, "%s/cscope%d.2", tmpdir, pid);
	temp1[sizeof(temp1)-1] = '\0';
	(void) snprintf(temp2, sizeof(temp1), "%s/cscope%d.2", tmpdir, pid);
	temp2[sizeof(temp2)-1] = '\0';
	/* if running in the foreground */
	/* if running in the foreground */
	if (signal(SIGINT, SIG_IGN) != SIG_IGN) {
	if (signal(SIGINT, SIG_IGN) != SIG_IGN) {
 Lines 825-830    Link Here 
void
void
myexit(int sig)
myexit(int sig)
{
{
	int retval;
	/* HBB 20010313; close file before unlinking it. Unix may not care
	/* HBB 20010313; close file before unlinking it. Unix may not care
	 * about that, but DOS absolutely needs it */
	 * about that, but DOS absolutely needs it */
	if (refsfound != NULL)
	if (refsfound != NULL)
 Lines 834-839    Link Here 
	if (temp1[0] != '\0') {
	if (temp1[0] != '\0') {
		(void) unlink(temp1);
		(void) unlink(temp1);
		(void) unlink(temp2);
		(void) unlink(temp2);
		if (retval = rmdir(tmpdir) != 0)
		{
			fprintf(stderr, "error deleting %s\n", tmpdir);
		}
	}
	}
	/* restore the terminal to its original mode */
	/* restore the terminal to its original mode */
	if (incurses == YES) {
	if (incurses == YES) {