OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
fileFormatUtils.c File Reference
#include <stdio.h>
#include <genutils.h>
#include <string.h>
#include <strings.h>
#include <stdlib.h>
Include dependency graph for fileFormatUtils.c:

Go to the source code of this file.

Macros

#define THE_STRING_MAX   128
 
#define FILE_FORMAT_FILE   "$OCDATAROOT/common/file_formats.txt"
 

Functions

void readFileFormats ()
 
int getInternalIndex (const char *str)
 
int getFileFormatIndex (const char *str)
 
const char * getFileFormatName (const char *str)
 
const char * getFileFormatExtension (const char *str)
 

Macro Definition Documentation

◆ FILE_FORMAT_FILE

#define FILE_FORMAT_FILE   "$OCDATAROOT/common/file_formats.txt"

Definition at line 8 of file fileFormatUtils.c.

◆ THE_STRING_MAX

#define THE_STRING_MAX   128

Definition at line 7 of file fileFormatUtils.c.

Function Documentation

◆ getFileFormatExtension()

const char* getFileFormatExtension ( const char *  str)

convert the input string to the file format extension. Input string can be index, name or extension Formats are defined in $OCDATAROOT/common/file_formats.txt

Parameters
strinput string
Returns
pointer to internal string holding the file format extension

Definition at line 221 of file fileFormatUtils.c.

◆ getFileFormatIndex()

int getFileFormatIndex ( const char *  str)

convert the input string to the file format index. Input string can be index, name or extension Formats are defined in $OCDATAROOT/common/file_formats.txt

Parameters
strinput string
Returns
index associated with the file format

Definition at line 188 of file fileFormatUtils.c.

◆ getFileFormatName()

const char* getFileFormatName ( const char *  str)

convert the input string to the normalized file format name. Input string can be index, name or extension Formats are defined in $OCDATAROOT/common/file_formats.txt

Parameters
strinput string
Returns
pointer to internal string holding the normalized format string, or NULL

Definition at line 205 of file fileFormatUtils.c.

◆ getInternalIndex()

int getInternalIndex ( const char *  str)

get the internal index into the format arrays

Parameters
strformat string to look up
Returns
index into arrays if found, else -1

Definition at line 136 of file fileFormatUtils.c.

◆ readFileFormats()

void readFileFormats ( )

read the format file into the static format arrays

Definition at line 39 of file fileFormatUtils.c.