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

📄 build_chnl_path.c

📁 seed格式数据解压程序,地震分析人员必备
💻 C
字号:
/*===========================================================================*//* DMC interim     |             build_chnl_path           |    Header_phase *//*===========================================================================*//*	Name:		build_chnl_path	Purpose:	construct the base path to channel info	Usage:		int build_chnl_path ();				char *channelname;				char *stnpath;				char *path;				int error;				error = build_chnl_path (channelname, stnpath, path);	Input:		channelname = string containing channel name; e.g., "BBZ"					may be either "X" or "X  "; both will work.				stnpath = string containing path to station info (output from					build_stn_path ())	Output:		path = string containing path to channel info				error = error value; FALSE if no error, nonzero otherwise.  It					contains values of MESSAGE, WARNING, ERROR, or FATAL 					(see constants.h)	Externals:	Debug - setting of environment variable DEBUG (globals.h)	Messages:	none	Warnings:	none	Errors:		Channel name contains invalid characters or is too long; return				to caller with empty path	Fatals:		none	Called by:	get_chnl_hdr	Calls to:	error_handler - handle error conditions	Algorithm:	check channel name for validity (return ERROR if not);				construct path to channel info	Notes:		none	Problems:	none known	Debug:		level D_MIN - print out start and finish notices				level D_MED - print out constructed path				level D_MAX - not used	References:	none	Language:	C, more or less ANSI standard, under Sun OS 3.5	Revisions:	02/24/89  Dennis O'Neill  original version				05/04/89  Kevin MacKenzie  changed return status to error,											returning path as a ptr				05/16/95  CL took out the 'C' in channel name*/#include "output.h"#ifndef CTYPE_INCLUDED#include <ctype.h>#define CTYPE_INCLUDED 1#endif#define CHNL_NAME_LENGTH 3int build_chnl_path (channelname, loc, stnpath, path)char *channelname;		/* name of channel */char *loc;			/* name of location code */char *stnpath;			/* path to stn info */char *path;			/* path to channel info */{	int error;			/* return error status */	unsigned int namelength;	/* length of stn name */	unsigned int pathlength;	/* length of path name */	char message[MSGLENGTH+1];	/* error message string */	char *p;			/* internal ptr to path */	int i;				/* general use int */	if (Debug >= D_MIN)		fprintf (D_OUT, "[build_chnl_path] Started.\n");	error = FALSE;                   /*=====================================*//*=================|    check channel name for validity    |=================*/                   /*=====================================*/	namelength = strlen(channelname);	if (namelength > CHNL_NAME_LENGTH)	{		sprintf (message,			"[build_chnl_path] Channel name >>%s<< too long.\n", channelname);		error = ERROR;	}	for (i = 0; i < namelength; i++)	{		if (( isupper(channelname[i]) || channelname[i] == SPACE ||				isdigit (channelname[i])) == FALSE)		{			sprintf (message,				"[build_chnl_path] Bad channel name >>%s<<.\n", channelname);			error = ERROR;		}	}	if (error)	{		sprintf (path, "");		error_handler (ERROR, message);		return (error);	}                   /*=====================================*//*=================|           build path name             |=================*/                   /*=====================================*/	sprintf (path, "%s/%s.%s", stnpath, channelname, loc);	if (Debug >= D_MED)		fprintf (D_OUT, "[build_chnl_path] Path is %s.\n", path);	if (Debug >= D_MIN)		fprintf (D_OUT, "[build_chnl_path] Completed.\n");	return (error);}

⌨️ 快捷键说明

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