NCEPLIBS-g2c  1.7.0
util.c File Reference

Internal utility functions for the g2c library. More...

#include "grib2_int.h"
#include <stdarg.h>

Go to the source code of this file.

Functions

int g2c_check_msg (unsigned char *cgrib, g2int *lencurr, int verbose)
 Check for 'GRIB' at the beginning of a GRIB message, and check to see if the message is already terminated with '7777'. More...
 
int g2c_set_log_level (int new_level)
 Use this to set the global log level. More...
 

Detailed Description

Internal utility functions for the g2c library.

Author
Ed Hartnett
Date
Nov 11, 2021

Definition in file util.c.

Function Documentation

◆ g2c_check_msg()

int g2c_check_msg ( unsigned char *  cgrib,
g2int lencurr,
int  verbose 
)

Check for 'GRIB' at the beginning of a GRIB message, and check to see if the message is already terminated with '7777'.

Parameters
cgribBuffer that contains the GRIB message.
lencurrPointer that gets the length of the GRIB message.
verboseIf non-zero, print any error messages to stdout.
Returns
Author
Ed Hartnett
Date
Nov 11, 2021

Definition at line 26 of file util.c.

References G2C_MSG_COMPLETE, G2C_NO_ERROR, G2C_NOT_GRIB, and gbit().

Referenced by g2_addfield(), g2_addgrid(), g2_addlocal(), and g2_gribend().

◆ g2c_set_log_level()

int g2c_set_log_level ( int  new_level)

Use this to set the global log level.

Set it to -1 to turn off all logging. Set it to 0 to show only errors, and to higher numbers to show more and more logging details. If logging is not enabled when building NCEPLIBS-g2c, this function will do nothing.

Parameters
new_levelThe new logging level.
Returns
G2_NO_ERROR No error.
Author
Ed Hartnett

Definition at line 124 of file util.c.

References G2C_NO_ERROR, and LOG.