📄 get_blk71_hdr.c
字号:
/*===========================================================================*//* DMC Interim | get_blk71_hdr | Header_phase *//*===========================================================================*//* Name: get_blk71_hdr Purpose: parse all SEED event (type 3x) blockettes preparatory to building a SEED time-span control header Usage: int get_blk71_hdr (); int error; error = get_blk71_hdr (&bottom, &top); Input: none Output: error = error value; FALSE if no error, nonzero otherwise. It contains values of MESSAGE, WARNING, ERROR, or FATAL (see constants.h) Externals: Debug - environment varible to set debug response level Messages: none Warnings: none Errors: No event info available; return null ptrs Fatals: Unable to malloc, realloc sufficient space; quit immediately Called by: Calls to: error_handler - handle error conditions Algorithm: Notes: This uses pointers-to-pointers to pass the alterred values of "stn_hdr" and "top" back to the caller; all work is performed internally using a local pointer "bottom", and the mapping of addresses for "stn_hdr" and "top" is done at the very end. This routine assumes that relevant information resides in files called something/B050 and something/B051. Problems: none known Debug: level D_MIN - print out start and finish notices level D_MED - show files opened and closed, memory allocation level D_MAX - show contents of read files References: none Language: C, more or less ANSI standard, under Sun OS 3.5 Revisions: 02/25/89 Dennis O'Neill original version 03/06/89 Mark Wiederspahn clean up pointers 05/04/89 Kevin MacKenzie change return status to error as count available from *top-*bottom*/#include "output.h"#include <unistd.h>int get_blk71_hdr(){ int error; /* return error status */ char abbrevpath[PATHLENGTH+1]; /* path to abbrev info */ char infilename[PATHLENGTH+1]; /* name of input file */ FILE *infile; /* input file ptr */ char c; /* input stream char */ int i; /* general use integer */ int count; /* count of blockettes copied*/ int found = 0; if (Debug >= D_MIN) fprintf (D_OUT, "[get_blk71_hdr] Started.\n"); error = FALSE; /*=====================================*//*=================| load event (type 3x) info |=================*/ /*=====================================*/ sprintf (infilename, "%s/B071", Header_path); if (access(infilename, R_OK) == -1) { /* check current directory - assumes that the script:makevol * chdirs to the "data" directory ./data_files */ strcpy(infilename, "B071"); if (access(infilename, R_OK) == 0) { found = TRUE; } if (!found) { /* optional block - return */ return(0); } } if (error = load_event (infilename) ) { error = error_handler (ERROR, "[get_blk71_hdr] load_event failed. No event info available.\n"); return (error); } /*=====================================*//*=================| clean up |=================*/ /*=====================================*/ if (Debug >= D_MIN) fprintf (D_OUT, "[get_blk71_hdr] Completed.\n"); return (error);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -