tm.c

来自「<B>Digital的Unix操作系统VAX 4.2源码</B>」· C语言 代码 · 共 68 行

C
68
字号
#ifndef lintstatic char sccsid[] = "@(#)tm.c	4.2 8/11/83";#endif /* tm.c: split numerical fields */# include "t..c"maknew(str)	char *str;{	/* make two numerical fields */	int dpoint, c;	char *p, *q, *ba;	p = str;	for (ba= 0; c = *str; str++)		if (c == '\\' && *(str+1)== '&')			ba=str;	str=p;	if (ba==0)		{		for (dpoint=0; *str; str++)			{			if (*str=='.' && !ineqn(str,p) &&				(str>p && digit(*(str-1)) ||				digit(*(str+1))))					dpoint=(int)str;			}		if (dpoint==0)			for(; str>p; str--)			{			if (digit( * (str-1) ) && !ineqn(str, p))				break;			}		if (!dpoint && p==str) /* not numerical, don't split */			return(0);		if (dpoint) str=(char *)dpoint;		}	else		str = ba;	p =str;	if (exstore ==0 || exstore >exlim)		{		exstore = chspace();		exlim= exstore+MAXCHS;		}	q = exstore;	while (*exstore++ = *str++);	*p = 0;	return((int)q);	}ineqn (s, p)	char *s, *p;{/* true if s is in a eqn within p */int ineq = 0, c;while (c = *p)	{	if (s == p)		return(ineq);	p++;	if ((ineq == 0) && (c == delim1))		ineq = 1;	else	if ((ineq == 1) && (c == delim2))		ineq = 0;	}return(0);}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?