Example #1
0
static Errorclass
troff(void)
{
	/*
	 * troff source error message, from eqn, bib, tbl...
	 * Just like pcc ccom, except uses `'
	 */
	if (cur_wordc < 4)
		return (C_UNKNOWN);

	if (firstchar(cur_wordv[1]) == '`'
	    && lastchar(cur_wordv[1]) == ','
	    && next_lastchar(cur_wordv[1]) == '\''
	    && strcmp(cur_wordv[2], "line") == 0
	    && isdigit((unsigned char)firstchar(cur_wordv[3]))
	    && lastchar(cur_wordv[3]) == ':') {
		clob_last(cur_wordv[1], '\0');	/* drop last , */
		clob_last(cur_wordv[1], '\0');	/* drop last " */
		cur_wordv[1]++;			/* drop first " */
		clob_last(cur_wordv[3], '\0');	/* drop : on line number */
		cur_wordv[2] = cur_wordv[1];	/* overwrite "line" */
		cur_wordv++;			/*compensate*/
		currentfilename = cur_wordv[1];
		language = INTROFF;
		return (C_TRUE);
	}
	return (C_UNKNOWN);
}
Example #2
0
static Errorclass
pccccom(void)
{
	/*
	 * Now attempt a ccom error message match:
	 * Examples:
	 *	"morsesend.c", line 237: operands of & have incompatible types
	 *	"test.c", line 7: warning: old-fashioned initialization: use =
	 *	"subdir.d/foo2.h", line 1: illegal initialization
	 */
	if (cur_wordc < 4)
		return (C_UNKNOWN);
	if (firstchar(cur_wordv[1]) == '"'
	    && lastchar(cur_wordv[1]) == ','
	    && next_lastchar(cur_wordv[1]) == '"'
	    && strcmp(cur_wordv[2], "line") == 0
	    && isdigit((unsigned char)firstchar(cur_wordv[3]))
	    && lastchar(cur_wordv[3]) == ':') {
		clob_last(cur_wordv[1], '\0');	/* drop last , */
		clob_last(cur_wordv[1], '\0');	/* drop last " */
		cur_wordv[1]++;			/* drop first " */
		clob_last(cur_wordv[3], '\0');	/* drop : on line number */
		cur_wordv[2] = cur_wordv[1];	/* overwrite "line" */
		cur_wordv++;		/*compensate*/
		cur_wordc--;
		currentfilename = cur_wordv[1];
		language = INCC;
		return (C_TRUE);
	}
	return (C_UNKNOWN);
}	/* end of ccom */
Example #3
0
Errorclass
troff(void)
{
	/*
	 *	troff source error message, from eqn, bib, tbl...
	 *	Just like pcc ccom, except uses `'
	 */
	if ((firstchar(wordv[1]) == '`') &&
	    (lastchar(wordv[1]) == ',') &&
	    (next_lastchar(wordv[1]) == '\'') &&
	    (strcmp(wordv[2], "line") == 0) &&
	    (isdigit(firstchar(wordv[3]))) &&
	    (lastchar(wordv[3]) == ':')) {
		clob_last(wordv[1], '\0');	/* drop last , */
		clob_last(wordv[1], '\0');	/* drop last " */
		wordv[1]++;			/* drop first " */
		clob_last(wordv[3], '\0');	/* drop : on line number */
		wordv[2] = wordv[1];	/* overwrite "line" */
		wordv++;		/* compensate */
		currentfilename = wordv[1];
		language = INTROFF;
		return (C_TRUE);
	}
	return (C_UNKNOWN);
}
Example #4
0
static Errorclass
mod2(void)
{
	/*
	 * for decwrl modula2 compiler (powell)
	 */
	if (cur_wordc < 5)
		return (C_UNKNOWN);
	if ((strcmp(cur_wordv[1], "!!!") == 0		/* early version */
	     || strcmp(cur_wordv[1], "File") == 0)	/* later version */
	    && lastchar(cur_wordv[2]) == ','		/* file name */
	    && strcmp(cur_wordv[3], "line") == 0
	    && isdigit((unsigned char)firstchar(cur_wordv[4]))	/* line number */
	    && lastchar(cur_wordv[4]) == ':'	/* line number */
	) {
		clob_last(cur_wordv[2], '\0');	/* drop last , on file name */
		clob_last(cur_wordv[4], '\0');	/* drop last : on line number */
		cur_wordv[3] = cur_wordv[2];	/* file name on top of "line" */
		cur_wordv += 2;
		cur_wordc -= 2;
		currentfilename = cur_wordv[1];
		language = INMOD2;
		return (C_TRUE);
	}
	return (C_UNKNOWN);
}
Example #5
0
Errorclass
sunf77(void)
{
	/*
	 * Finally attempt a Sun f77 error message match:
	 * Examples:
	 *	"bar.f", line 237: Error: no label on format statement
	 *	"test.f", line 7: ANSI extension: Hollerith constant
	 *	"dir/foo.h", line 1: Warning: missing END statement
	 */
	if ((firstchar(wordv[1]) == '"') &&
	    (lastchar(wordv[1]) == ',') &&
	    (next_lastchar(wordv[1]) == '"') &&
	    (strcmp(wordv[2], "line") == 0) &&
	    (isdigit(firstchar(wordv[3]))) &&
	    (lastchar(wordv[3]) == ':') &&
		((strcmp(wordv[4], "Error:") == 0) ||
		    (strcmp(wordv[4], "Warning:") == 0) ||
		    ((strcmp(wordv[4], "ANSI") == 0) &&
		    (strcmp(wordv[5], "extension:") == 0)))) {
		clob_last(wordv[1], '\0');	/* drop last , */
		clob_last(wordv[1], '\0');	/* drop last " */
		wordv[1]++;			/* drop first " */
		clob_last(wordv[3], '\0');	/* drop : on line number */
		wordv[2] = wordv[1];	/* overwrite "line" */
		wordv++;		/* compensate */
		wordc--;
		currentfilename = wordv[1];
		language = INSUNF77;
		return (C_TRUE);
	}
	return (C_UNKNOWN);
}	/* end of Sun f77 */
Example #6
0
Errorclass
ri(void)
{
/*
 *	Match an error message produced by ri; here is the
 *	procedure yanked from the distributed version of ri
 *	April 24, 1980.
 *
 *	serror(str, x1, x2, x3)
 *		char str[];
 *		char *x1, *x2, *x3;
 *	{
 *		extern int yylineno;
 *
 *		putc('"', stdout);
 *		fputs(srcfile, stdout);
 *		putc('"', stdout);
 *		fprintf(stdout, " %d: ", yylineno);
 *		fprintf(stdout, str, x1, x2, x3);
 *		fprintf(stdout, "\n");
 *		synerrs++;
 *	}
 */
	if ((firstchar(wordv[1]) == '"') &&
	    (lastchar(wordv[1]) == '"') &&
	    (lastchar(wordv[2]) == ':') &&
	    (isdigit(firstchar(wordv[2])))) {
		clob_last(wordv[1], '\0');	/* drop the last " */
		wordv[1]++;	/* skip over the first " */
		clob_last(wordv[2], '\0');
		language = INRI;
		return (C_TRUE);
	}
	return (C_UNKNOWN);
}
Example #7
0
static Errorclass
richieccom(void)
{
	char *cp;
	char **nwordv;
	char *file;

	if (cur_wordc < 2)
		return (C_UNKNOWN);

	if (lastchar(cur_wordv[1]) == ':') {
		cp = cur_wordv[1] + strlen(cur_wordv[1]) - 1;
		while (isdigit((unsigned char)*--cp))
			continue;
		if (*cp == ':') {
			clob_last(cur_wordv[1], '\0');	/* last : */
			*cp = '\0';			/* first : */
			file = cur_wordv[1];
			nwordv = wordvsplice(1, cur_wordc, cur_wordv+1);
			nwordv[0] = file;
			nwordv[1] = cp + 1;
			cur_wordc += 1;
			cur_wordv = nwordv - 1;
			language = INCC;
			currentfilename = cur_wordv[1];
			return (C_TRUE);
		}
	}
	return (C_UNKNOWN);
}
Example #8
0
static Errorclass
lint0(void)
{
	char **nwordv;
	char *line, *file;

	/*
	 * Attempt a match for the new lint style normal compiler
	 * error messages, of the form
	 *
	 *	printf("%s(%d): %s\n", filename, linenumber, message);
	 */
	if (cur_wordc < 2)
		return (C_UNKNOWN);

	if (lastchar(cur_wordv[1]) == ':'
	    && next_lastchar(cur_wordv[1]) == ')') {
		clob_last(cur_wordv[1], '\0'); /* colon */
		if (persperdexplode(cur_wordv[1], &line, &file)) {
			nwordv = wordvsplice(1, cur_wordc, cur_wordv+1);
			nwordv[0] = file;	/* file name */
			nwordv[1] = line;	/* line number */
			cur_wordc += 1;
			cur_wordv = nwordv - 1;
			language = INLINT;
			return (C_TRUE);
		}
		cur_wordv[1][strlen(cur_wordv[1])] = ':';
	}
	return (C_UNKNOWN);
}
Example #9
0
long DLLCALL getdirsize(const char* path, BOOL include_subdirs, BOOL subdir_only)
{
	char		match[MAX_PATH+1];
	glob_t		g;
	unsigned	gi;
	long		count=0;

	if(!isdir(path))
		return -1;

	SAFECOPY(match,path);
	backslash(match);
	strcat(match,ALLFILES);
	glob(match,GLOB_MARK,NULL,&g);
	if(include_subdirs && !subdir_only)
		count=g.gl_pathc;
	else
		for(gi=0;gi<g.gl_pathc;gi++) {
			if(*lastchar(g.gl_pathv[gi])=='/') {
				if(!include_subdirs)
					continue;
			} else
				if(subdir_only)
					continue;
			count++;
		}
	globfree(&g);
	return(count);
}
Example #10
0
char* DLLCALL prep_dir(const char* base, char* path, size_t buflen)
{
#ifdef __unix__
	char	*p;
#endif
	char	str[MAX_PATH+1];
	char	abspath[MAX_PATH+1];
	char	ch;

	if(!path[0])
		return(path);
	if(path[0]!='\\' && path[0]!='/' && path[1]!=':') {	/* Relative directory */
		ch=*lastchar(base);
		if(ch=='\\' || ch=='/')
			sprintf(str,"%s%s",base,path);
		else
			sprintf(str,"%s%c%s",base,PATH_DELIM,path);
	} else
		strcpy(str,path);

#ifdef __unix__				/* Change backslashes to forward slashes on Unix */
	for(p=str;*p;p++)
		if(*p=='\\') 
			*p='/';
#endif

	backslashcolon(str);
	strcat(str,".");                /* Change C: to C:. and C:\SBBS\ to C:\SBBS\. */
	FULLPATH(abspath,str,buflen);	/* Change C:\SBBS\NODE1\..\EXEC to C:\SBBS\EXEC */
	backslash(abspath);

	sprintf(path,"%.*s",(int)(buflen-1),abspath);
	return(path);
}
Example #11
0
/*
 *	Do the error message from the Richie C Compiler for the PDP11,
 *	which has this source:
 *
 *	if (filename[0])
 *		fprintf(stderr, "%s:", filename);
 *	fprintf(stderr, "%d: ", line);
 *
 *	This also handles errors with column numbers, as in
 *
 *	foo.c:534:12: missing ';'
 *
 */
Errorclass
richieccom(void)
{
	char	*cp;
	char	**nwordv;
	char	*file;
	char	*colon;

	if (lastchar(wordv[1]) == ':') {
		cp = colon = wordv[1] + strlen(wordv[1]) - 1;
		while (isdigit(*--cp))
			continue;
		// If there are two numbers, we want the first
		if (*cp == ':' && isdigit(cp[-1])) {
			colon = cp;
			while (isdigit(*--cp))
				continue;
		}
		if (*cp == ':') {
		        *colon = '\0';			/* last : */
			*cp = '\0';			/* first : */
			file = wordv[1];
			nwordv = wordvsplice(1, wordc, wordv+1);
			nwordv[0] = file;
			nwordv[1] = cp + 1;
			wordc += 1;
			wordv = nwordv - 1;
			language = INCC;
			currentfilename = wordv[1];
			return (C_TRUE);
		}
	}
	return (C_UNKNOWN);
}
Example #12
0
static Errorclass
lint2(void)
{
	char *file;
	char *line;
	char **nwordv;

	/*
	 * Look for type 2 lint errors
	 *
	 *	%.7s used( %s(%d) ), but not defined
	 *	%.7s defined( %s(%d) ), but never used
	 *	%.7s declared( %s(%d) ), but never used or defined
	 *
	 *	bufp defined( "./metric.h"(10) ), but never used
	 */
	if (cur_wordc < 5)
		return (C_UNKNOWN);

	if (lastchar(cur_wordv[2]) == '(' /* ')' */
	    && strcmp(cur_wordv[4], "),") == 0) {
		language = INLINT;
		if (persperdexplode(cur_wordv[3], &line, &file)) {
			nwordv = wordvsplice(2, cur_wordc, cur_wordv+1);
			nwordv[0] = file;
			nwordv[1] = line;
			cur_wordc = cur_wordc + 2;
			cur_wordv = nwordv - 1;	/* 1 based */
			return (C_TRUE);
		}
	}
	return (C_UNKNOWN);
} /* end of lint 2*/
Example #13
0
Errorclass
f77(void)
{
	char	**nwordv;
	/*
	 *	look for f77 errors:
	 *	Error messages from /usr/src/cmd/f77/error.c, with
	 *	these printf formats:
	 *
	 *		Compiler error line %d of %s: %s
	 *		Error on line %d of %s: %s
	 *		Warning on line %d of %s: %s
	 *		Error.  No assembly.
	 */
	if (wordc == 3 && wordvcmp(wordv+1, 3, F77_no_ass) == 0) {
		wordc = 0;
		return (C_SYNC);
	}
	if (wordc < 6)
		return (C_UNKNOWN);
	if ((lastchar(wordv[6]) == ':') &&
	    ((wordvcmp(wordv+1, 3, F77_fatal) == 0) ||
		(wordvcmp(wordv+1, 3, F77_error) == 0) ||
		(wordvcmp(wordv+1, 3, F77_warning) == 0))) {
		language = INF77;
		nwordv = wordvsplice(2, wordc, wordv+1);
		nwordv[0] = wordv[6];
		clob_last(nwordv[0], '\0');
		nwordv[1] = wordv[4];
		wordc += 2;
		wordv = nwordv - 1;	/* 1 based */
		return (C_TRUE);
	}
	return (C_UNKNOWN);
} /* end of f77 */
Example #14
0
void mereducemenucodes (bigstring bs, boolean *flenabled, boolean *flchecked) {

	/*
	4.1b8 dmb: common code for mebuildmenu, memenuitemchanged, and mecheckformulas
	
	handles item disabling with '(', and checkmark with '!'
	
	7.0b23 PBS: no longer static -- used in oppopup.c for right-click menus.
	*/
	
	*flenabled = (stringlength (bs) > 1) || (getstringcharacter (bs, 0) != '-');
		// !equalstrings (bs, (ptrstring) "\p-"); /*all dotted lines are disabled*/
	
	if (getstringcharacter (bs, 0) == '(' && lastchar (bs) != ')') { /*4.1b6 dmb*/
	
		deletestring (bs, 1, 1);
		
		*flenabled = false;
		}
	
	*flchecked = false;
	
	if ((stringlength (bs) > 1) && (getstringcharacter (bs, 0) == '!')) { /*4.1b8 dmb*/
	
		deletestring (bs, 1, 1);
		
		*flchecked = true;
		}
	} /*mereducemenucodes*/
Example #15
0
BOOL DLLCALL isdir(const char *filename)
{
	char	path[MAX_PATH+1];
	char*	p;
	struct stat st;

	SAFECOPY(path,filename);

	p=lastchar(path);
	if(p!=path && IS_PATH_DELIM(*p)) {	/* chop off trailing slash */
#if !defined(__unix__)
		if(*(p-1)!=':')		/* Don't change C:\ to C: */
#endif
			*p=0;
	}

#if defined(__BORLANDC__) && !defined(__unix__)	/* stat() doesn't work right */
	if(stat(path, &st)!=0 || strchr(path,'*')!=NULL || strchr(path,'?')!=NULL)
#else
	if(stat(path, &st)!=0)
#endif
		return(FALSE);

	return(S_ISDIR(st.st_mode) ? TRUE : FALSE);
}
Example #16
0
int
lastnonwhite(int f GCC_UNUSED, int n GCC_UNUSED)
{
    DOT.o = lastchar(DOT.l);
    if (DOT.o < w_left_margin(curwp))
	DOT.o = w_left_margin(curwp);
    return TRUE;
}
Example #17
0
BOOL DLLCALL fexist(const char *filespec)
{
#if defined(_WIN32)

	long	handle;
	struct _finddata_t f;
	BOOL	found;

	if(!strchr(filespec,'*') && !strchr(filespec,'?'))
		return(fnameexist(filespec));

	if((handle=_findfirst((char*)filespec,&f))==-1)
		return(FALSE);
	found=TRUE;
	while(f.attrib&_A_SUBDIR)
		if(_findnext(handle,&f)!=0) {
			found=FALSE;
			break;
		}

 	_findclose(handle);

	return(found);

#else /* Unix or OS/2 */

	/* portion by cmartin */

	glob_t g;
    int c;

	if(!strchr(filespec,'*') && !strchr(filespec,'?'))
		return(fnameexist(filespec));

    /* start the search */
    glob(filespec, GLOB_MARK | GLOB_NOSORT, NULL, &g);

    if (!g.gl_pathc) {
	    /* no results */
    	globfree(&g);
    	return FALSE;
    }

    /* make sure it's not a directory */
	c = g.gl_pathc;
    while (c--) {
    	if (*lastchar(g.gl_pathv[c]) != '/') {
        	globfree(&g);
            return TRUE;
        }
    }

    globfree(&g);
    return FALSE;

#endif
}
Example #18
0
bool CSPList::Load (const string &filepath) {
	FILE *tempfile;
	string line;
	bool valid;
	bool fwdflag;

	bool backflag = false;
	tempfile = fopen (filepath.c_str(), "r");
	if (tempfile == 0) {
		Message ("CSPList::Load - unable to open","");
		return false;
	} else {
	    while (fgets (cbuffer, 4000, tempfile)) {
			line = cbuffer;
			STrimN (line);

			// delete new line char if in string
			int npos = line.rfind ('\n');
			if (npos >= 0) SDeleteN (line, npos, 1);

			valid = true;
			if (line.size() < 1) valid = false;	// empty line
			if (line[0] == '#') valid = false;	// comment line
			
			if (valid) {
				if (fcount < fmax) {
					if (fnewlineflag == 0) {
						if (cbuffer[0] == '*' || fcount < 1) Add (line);
						else Append (line, fcount-1);
					} else if (fnewlineflag == 1) {
						if (lastchar (line) == '\\') {
							SDeleteN (line, line.length()-1, 1);
							fwdflag = true;
						} else {
							fwdflag = false;
						}

						if (backflag == false) Add (line);
						else Append (line, fcount-1);

						backflag = fwdflag;
					}
				} else {
					Message ("CSPList::Load - not enough lines","");
					return false;
				}
			}
    	}
		fclose (tempfile); 
		return true;
	}
}
Example #19
0
Errorclass
cpp(void)
{
	/*
	 *	Now attempt a cpp error message match
	 *	Examples:
	 *		./morse.h: 23: undefined control
	 *		morsesend.c: 229: MAGNIBBL: argument mismatch
	 *		morsesend.c: 237: MAGNIBBL: argument mismatch
	 *		test1.c: 6: undefined control
	 */
	if ((language != INLD) &&	/* loader errors have almost same fmt */
	    (lastchar(wordv[1]) == ':') &&
	    (isdigit(firstchar(wordv[2]))) &&
	    (lastchar(wordv[2]) == ':')) {
		language = INCPP;
		clob_last(wordv[1], '\0');
		clob_last(wordv[2], '\0');
		return (C_TRUE);
	}
	return (C_UNKNOWN);
}	/*end of cpp*/
Example #20
0
static Errorclass
onelong(void)
{
	char **nwordv;

	if (cur_wordc == 1 && language != INLD) {
		/*
		 * We have either:
		 *	a) file name from cc
		 *	b) Assembler telling world that it is complaining
		 *	c) Noise from make ("Stop.")
		 *	c) Random noise
		 */
		cur_wordc = 0;
		if (strcmp(cur_wordv[1], "Stop.") == 0) {
			language = INMAKE;
			return (C_SYNC);
		}
		if (strcmp(cur_wordv[1], "Assembler:") == 0) {
			/* assembler always alerts us to what happened*/
			language = INAS;
			return (C_SYNC);
		} else
		if (strcmp(cur_wordv[1], "Undefined:") == 0) {
			/* loader complains about unknown symbols*/
			language = INLD;
			return (C_SYNC);
		}
		if (lastchar(cur_wordv[1]) == ':') {
			/* cc tells us what file we are in */
			currentfilename = cur_wordv[1];
			(void)substitute(currentfilename, ':', '\0');
			language = INCC;
			return (C_SYNC);
		}
	} else
	if (cur_wordc == 1 && language == INLD) {
		nwordv = Calloc(4, sizeof(char *));
		nwordv[0] = Strdup("ld:");	/* XXX leaked */
		nwordv[1] = cur_wordv[1];
		nwordv[2] = Strdup("is");	/* XXX leaked */
		nwordv[3] = Strdup("undefined.");/* XXX leaked */
		cur_wordc = 4;
		cur_wordv = nwordv - 1;
		return (C_NONSPEC);
	} else
	if (cur_wordc == 1) {
		return (C_SYNC);
	}
	return (C_UNKNOWN);
}	/* end of one long */
Example #21
0
Errorclass
mod2(void)
{
	/*
	 *	for decwrl modula2 compiler (powell)
	 */
	if (((strcmp(wordv[1], "!!!") == 0) ||		/* early version */
	    (strcmp(wordv[1], "File") == 0)) &&		/* later version */
		(lastchar(wordv[2]) == ',') &&		/* file name */
		(strcmp(wordv[3], "line") == 0) &&
		(isdigit(firstchar(wordv[4]))) &&	/* line number */
		(lastchar(wordv[4]) == ':')) {	/* line number */
		clob_last(wordv[2], '\0');	/* drop last , on file name */
		clob_last(wordv[4], '\0');	/* drop last : on line number */
		wordv[3] = wordv[2];		/* file name on top of "line" */
		wordv += 2;
		wordc -= 2;
		currentfilename = wordv[1];
		language = INMOD2;
		return (C_TRUE);
	}
	return (C_UNKNOWN);
}
Example #22
0
static FILE *ztempfile (char *templ)
{
    char *p = strrchr(templ, G_DIR_SEPARATOR);
    FILE *fp = NULL;

    if (p != NULL) {
	*p = '\0';
#ifdef G_OS_WIN32
	if (lastchar(templ) != '\\') {
	    strncat(templ, "\\", 1);
	}
#else
	if (lastchar(templ) != '/') {
	    strncat(templ, "/", 1);
	}
#endif
    } 

    strncat(templ, "ziXXXXXX", 8);
    fp = gretl_mktemp(templ, "wb");

    return fp;
}
Example #23
0
File: ex_1-18.c Project: gsher/edu
/* A program to delete trailing blanks, tabs, blank lines */
main()
{
	int i, len, last;
	char line[MAXLINE];

	while ((len = readline(line, MAXLINE)) > 0){
		last = lastchar(line);
		if(last != 0){
			if(line[len-1] == '\n')
				line[++last] = '\n';
			line[++last] = '\0';
			printf("%s", line);
		}
	}
	return 0;
}
Example #24
0
/*
 * Go to the beginning of the current paragraph.
 */
int
gotobop(int f, int n)
{
    MARK odot;
    int was_on_empty;
    int fc;

    n = need_a_count(f, n, 1);

    was_on_empty = is_empty_line(DOT);
    odot = DOT;

    fc = firstchar(DOT.l);
    if (doingopcmd &&
	((fc >= 0 && DOT.o <= fc) || fc < 0) &&
	!is_first_line(DOT, curbp)) {
	backchar(TRUE, DOT.o + 1);
	pre_op_dot = DOT;
    }
    while (n) {
	if (findpat(TRUE, 1, b_val_rexp(curbp, VAL_PARAGRAPHS)->reg,
		    REVERSE) != TRUE) {
	    (void) gotobob(f, n);
	} else if (is_empty_line(DOT)) {
	    /* special case -- if we found an empty line,
	       and it's adjacent to where we started,
	       skip all adjacent empty lines, and try again */
	    if ((was_on_empty && lforw(DOT.l) == odot.l) ||
		(n > 0 && llength(lforw(DOT.l)) == 0)) {
		/* then we haven't really found what we
		   wanted.  keep going */
		skipblanksb();
		continue;
	    }
	}
	n--;
    }
    if (doingopcmd) {
	fc = firstchar(DOT.l);
	if (!sameline(DOT, odot) &&
	    (pre_op_dot.o > lastchar(pre_op_dot.l)) &&
	    ((fc >= 0 && DOT.o <= fc) || fc < 0)) {
	    regionshape = rgn_FULLLINE;
	}
    }
    return TRUE;
}
Example #25
0
char* DLLCALL backslash(char* path)
{
	char* p;

	p=lastchar(path);

	if(*p && !IS_PATH_DELIM(*p)) {
#if defined(__unix__)
		/* Convert trailing backslash to forwardslash on *nix */
		if(*p!='\\')
#endif
			p++;
		*p=PATH_DELIM;
		*(++p)=0;
	}
	return(path);
}
Example #26
0
static boolean menusetcommandkeyverb (hdltreenode hparam1, tyvaluerecord *v) {
	
	/*
	menu/op globals are set.  set the command key of the current headline
	*/
	
	bigstring bscommandkey;
	
	flnextparamislast = true;
	
	if (!getstringvalue (hparam1, 1, bscommandkey))
		return (false);
	
	mesetcmdkey (lastchar (bscommandkey), keycommand);
	
	return (setbooleanvalue (true, v));
	} /* menusetcommandkeyverb */
Example #27
0
static Errorclass
gcc45ccom(void)
{
	char *cp, *ccp;
	char **nwordv;
	char *file;

	if (cur_wordc < 2)
		return C_UNKNOWN;

	if (lastchar(cur_wordv[1]) != ':')
		return C_UNKNOWN;

	cp = cur_wordv[1] + strlen(cur_wordv[1]) - 1;
	while (isdigit((unsigned char)*--cp))
		continue;
	if (*cp != ':')
		return C_UNKNOWN;

	ccp = cp;
	while (isdigit((unsigned char)*--cp))
		continue;
	if (*cp != ':')
		return C_UNKNOWN;

	clob_last(cur_wordv[1], '\0');	/* last : */
	*ccp = '\0';			/* middle : */
	*cp = '\0';			/* first : */
	file = cur_wordv[1];
#ifdef notyet
#define EHEAD 2
#else
#define EHEAD 1	/* Nothing to do with column info yet */
#endif
	nwordv = wordvsplice(EHEAD, cur_wordc, cur_wordv + 1);
	nwordv[0] = file;
	nwordv[1] = cp + 1;
#ifdef notyet
	nwordv[2] = ccp + 1;
#endif
	cur_wordc += 1;
	cur_wordv = nwordv - 1;
	language = INCC;
	currentfilename = cur_wordv[1];
	return C_TRUE;
}
Example #28
0
void sbbs_t::log(char *str)
{
	if(logfile_fp==NULL || online==ON_LOCAL) return;
	if(logcol>=78 || (78-logcol)<strlen(str)) {
		fprintf(logfile_fp,"\r\n");
		logcol=1; 
	}
	if(logcol==1) {
		fprintf(logfile_fp,"   ");
		logcol=4; 
	}
	fprintf(logfile_fp,str);
	if(*lastchar(str)==LF) {
		logcol=1;
		fflush(logfile_fp);
	}
	else
		logcol+=strlen(str);
}
Example #29
0
/*
 *	Tell if the error text is to be ignored.
 *	The error must have been canonicalized, with
 *	the file name the zeroth entry in the errorv,
 *	and the linenumber the second.
 *	Return the new categorization of the error class.
 */
Errorclass
discardit(Eptr errorp)
{
	int	language;
	int	i;
	Errorclass	errorclass = errorp->error_e_class;

	switch (errorclass) {
	case C_SYNC:
	case C_NONSPEC:
	case C_UNKNOWN:
		return (errorclass);
	default:
		break;
	}
	if (errorp->error_lgtext < 2) {
		return (C_NONSPEC);
	}
	language = errorp->error_language;
	if (language == INLINT) {
		if (errorclass != C_NONSPEC) {	/* no file */
			for (i = 0; lint_libs[i] != 0; i++) {
				if (strcmp(errorp->error_text[0],
				    lint_libs[i]) == 0) {
					return (C_DISCARD);
				}
			}
		}
		/*
		 * check if the argument to the error message
		 * is to be ignored
		 */
		if (ispunct(lastchar(errorp->error_text[2])))
			clob_last(errorp->error_text[2], '\0');
		if (search_ignore(
		    errorp->error_text[errorclass == C_NONSPEC ? 0 : 2]) >= 0) {
			return (C_NULLED);
		}
	}
	return (errorclass);
}
Example #30
0
STR mtnfile_console_path(STR opt)
{
  int i;
  STR path;
  ARG dirs;
  path = newstr(ctx->remote_path);
  dirs = splitstr(opt, "/");
  for(i=0;dirs[i];i++){
    if(!strcmp(dirs[i], "..")){
      path = modstr(path, dirname(path));
    }else if(!strcmp(dirs[i], ".")){
    }else{
      if(lastchar(path) != '/'){
        path = catstr(path, "/");
      }
      path = catstr(path, dirs[i]);
    }
  }
  dirs = clrarg(dirs);
  return(path);
}