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

📄 output_tspan.c

📁 seed格式数据解压程序,地震分析人员必备
💻 C
字号:
/*===========================================================================*//* UTIG DMC        |          output_tspan                 | Output_phase    *//*===========================================================================*//*	Name:	output_tspan.c	Purpose:to transmit the memory images of the time span control			headers to the output SEED logical volume.	Usage:	struct logrec_list *output_tspan( file, t, err )	Input:		FILE	file	output file pointer, already open		struct	logrec_list 	*t		linked list of tspan header logical recs	Output:				int	*err	0 if no errors		function value	pointer to next unused tspan logrec,		or NULL if at end of list	Externals:		Warnings:		Errors:			Fatals:	Called by:		Calls to:		Algorithm:		Notes:			Problems:		References:		Language:	Sun OS 3.5 C	Author:		Mark Wiederspahn, who knows when; March 1989?	Revisions:	mm/dd/yy  pgmr name  change			07/14/89 mw Whoops! old code traversed logrec_list looking			for T type records (timespan logical records)			and quit when the next record was not T or			was T but was not * continuation. This logic			was based on an incorrect understanding of			what the continuation flag means. It means only			that a blockette has been split across a			logical record, NOT that a logical record			type has been continued. The proper condition			is to quit if another T with an 070 blockette			is seen - this means we point to the next			T logrec in a volume which has more than one			tspan. Thanks to Tim Ahern, aka The			Destroyer, for finding this one.04/13/90	mw	Friday the 13th! bugfix			previous "fix" did strncmp( (char *)p+8, which			is most emphatically not a pointer to a 			timespan header +8. This failed the first time			that multiple timespans per volume was			attempted. (Thanks Becky!)*/#include "output.h"#define SPACE 32	/* ascii space character */struct logrec_list *output_tspan( file, t, err )FILE	*file;		/* output file pointer, already open */struct	logrec_list *t;	/* list of time span control headers */int *err;		/* return status */{register struct logrec_list *p;	/* link traversal */struct	io_buf	buf;		/* where to put them, from logrec package */int		ntspan;		/* number of tspans seen this call */	if( Debug >= D_MIN ) fprintf( D_OUT,"[output_tspan] start\n");/* * for each logical record in the linked list, output it. Quit on * any error, since this is the directory of the volume. * * For each call to this routine, we output only one tspan. This * means the inital logical record of type T, which starts with 070 blockette, * plus however many additional logrecs there in this tspan:  * There may be other Tspans in the logrec_list linked list; we identify * such be the non-presence of a continuation flag AND a first blockette * type of 070. To restate: if a logrec of type T with a continuation is * seen, OR type T without continuation but not 070, then this logrec * belongs to the current tspan, and is output here. * Just in case, we check for a NULL input. */	p = t;	if( p != NULL )	{		do		{			if( Debug >= D_SOME ) fprintf( D_OUT,"[output_tspan] tspan hdr\n");			buf = put_logrec( file, p->record, Lrecl, 0, err );			if( *err )				if( (*err=error_handler( FATAL,"[output_tspan] put_logrec")) )					return( p );			p = p->next;		}		while( p != NULL &&			( (struct hdr_logrec *)p->record )->type == 'T'  &&			( ( (struct hdr_logrec *)p->record )->cont != SPACE ||			     strncmp( (char *)( (struct hdr_logrec *)p->record )+8,							"070", 3 ) ) );/* * if we are at the end of the list OR the next is not a Timespan, done. */		if( p != NULL )			if( ( (struct hdr_logrec *)p->record )->type != 'T' ) p = NULL;	}	if( Debug >= D_MIN ) fprintf( D_OUT,"[output_tspan] end\n");	return( p );}

⌨️ 快捷键说明

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