⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 find_btime.c

📁 seed格式数据解压程序,地震分析人员必备
💻 C
字号:
/*===========================================================================*//*                 |                                       |                 *//*===========================================================================*//*	Name:			Purpose:	find effective times of SEED blockettes				from station control headers.	Usage:			Input:		buf		the blockette				count	the number of variable length strings to skip						(may be 0) before applying "offset"				offset	offset from the next character after the "count'th"						variable length string terminator to the start time.				maxlen	maximum possible chars before the count'th						terminator MUST be found. This gets around infinite						loops in case of a mangled blockette.				start	start effective time.				end		end effective time, may be zero if "forever".	Output:			Externals:		Warnings:		Errors:		blockette is mangled; terminator not found	Fatals:	Called by:	is_in_twindow	Calls to:	asc_to_input_time	Algorithm:		Notes:			Problems:		References:		Language:		Author:	    03/22/89  Mark WIederspahn	Revisions:	mm/dd/yy  pgmr name  change				24apr91		mw		change										change start/end debug printout level										from any to >=MAX. This routine gets										called too many times to print this										stuff out.									change										log error instead of printing debug										msg if the blockette seems malformed.*/#include "output.h"int find_btime( buf, count, offset, maxlen, start, end )char	*buf;				/* where the blockette is */int		count;				/* number of terminators to skip, may be 0 */int		offset;				/* distance from STR_TERM+1 to start time */int		maxlen;				/* how long to look for STR_TERM before giving up */struct	input_time	*start;	/* returned start time */struct	input_time	*end;	/* returned end time */{	int				err;			/* return status */	register char	*ip;			/* input pointer */	register char	*op;			/* output pointer */	char			lbuf[22+1];		/* local seed time buffer */	int				tcount;			/* local time buffer counter */	char			msg[101];		/* error msg */	if( Debug >= D_MAX ) fprintf( D_OUT,"[find_btime] start\n" );	err = ERROR;			/* assume the worst */	ip = buf;	while( count-- )	{		while( *ip++ != STR_TERM && maxlen-- );		if( maxlen < 0 ) break;	}	if( maxlen >= 0 )			/* we did not exhaust search limit */	{		ip += offset;			/* point to start of start time */		op = lbuf;		tcount = 23;		while( ((*op++ = *ip++) != STR_TERM) && tcount-- );	/* copy string */		*--op = '\0';								/* and null terminate */		*start = asc_to_input_time( lbuf );		op = lbuf;		tcount = 23;		while( ((*op++ = *ip++) != STR_TERM) && tcount-- );	/* copy string */		*--op = '\0';		*end = asc_to_input_time( lbuf );		err = OK;	}	else	{/*		fprintf( D_OUT,"[find_btime] bad input:%40s\n", buf );	*/		sprintf( msg,"[find_btime] bad blockette input:%.40s\n", buf );		err = error_handler( WARNING,msg );	}	if( Debug >= D_MAX ) fprintf( D_OUT,"[find_btime] end\n" );	return( err );}

⌨️ 快捷键说明

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