📄 get_abbrev_hdr.c
字号:
/*===========================================================================*//* DMC Interim | get_abbrev_hdr | Header_phase *//*===========================================================================*//* Name: get_abbrev_hdr Purpose: concatenate all SEED abbreviation (type 3x) blockettes preparatory to building a SEED abbreviation control header Usage: int get_abbrev_hdr (); char *bottom; char *top; int error; error = get_abbrev_hdr (&bottom, &top); Input: none Output: bottom = pointer to beginning of abbreviation header data top = pointer to end of header 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 Lrecl - logical record length (globals.h) Messages: none Warnings: none Errors: No abbreviation info available; return null ptrs Fatals: Unable to malloc, realloc sufficient space; quit immediately Called by: Calls to: build_abbrev_path - construct path to abbreviation files 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"int get_abbrev_hdr( bottom, top)char **bottom; /* ptr to start of hdr */char **top; /* ptr just above 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*/ struct input_time start; /* bogus start time */ struct input_time end; /* bogus end time */ if (Debug >= D_MIN) fprintf (D_OUT, "[get_abbrev_hdr] Started.\n"); error = FALSE; /*=====================================*//*=================| construct abbrev header files path |=================*/ /*=====================================*/ if (error = build_abbrev_path (Header_path, abbrevpath)) { error = error_handler (ERROR, "[get_abbrev_hdr] Bad Header_path.\n"); return (error); } /*=====================================*//*=================| load abbreviation (type 3x) info |=================*/ /*=====================================*//* * we don't care what values are in "start" and "end", but make * them reasonable... */ memset( &start, 0, sizeof( struct input_time ) ); memset( &end, 0, sizeof( struct input_time ) ); sprintf (infilename, "%s/H.A", abbrevpath); if (error = load_data (infilename, start, end, bottom, top, &count) ) { *bottom = NULL; *top = NULL; error = error_handler (ERROR, "[get_abbrev_hdr] load_data failed. No abbreviation info available.\n"); return (error); } /*=====================================*//*=================| clean up |=================*/ /*=====================================*/ if (Debug >= D_MIN) fprintf (D_OUT, "[get_abbrev_hdr] Completed.\n"); return (error);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -