ppsparse()

Updated: May 06, 2022

Parse an object read from PPS

Synopsis:

#include <sys/pps.h>
            
extern pps_status_t ppsparse(char **ppsdata,
                             const char * const *objnames,
                             const char * const *attrnames,
                             pps_attrib_t *info,
                             int parse_flags);

Arguments:

ppsdata
A pointer to a pointer to the current position in the buffer of PPS data. The function updates this pointer as it parses the options.
objnames
A pointer to a NULL-terminated array of object names. If this value isn't NULL, ppsparse() looks up any object name it finds and provides its index in the pps_attrib_t structure.
attrnames
A pointer to a NULL-terminated array of attribute names. If this value isn't NULL, ppsparse() looks up any attribute name it finds and provides its index in the pps_attrib_t structure.
info
A pointer to the data structure pps_attrib_t, which carries details about a line of PPS data.
parse_flags
Reserved for future use; specify 0 for this argument.

Library:

libpps

Description:

The function ppsparse() provides a lower-level alternative to the pps_decoder_*() functions (which themselves use pps_parse()). Except in special circumstances, it's better to use the pps_decoder_*() functions than to use ppsparse().

The function ppsparse() parses the next line of a buffer of PPS data. This buffer must be terminated by a null ("\0") in C or hexadecimal 0x00).

The first time you call this function after reading PPS data, you should set ppsdata to reference the start of the buffer with the data. As it parses each line of data, ppsparse():

When it successfully completes parsing a line, ppsparse() returns the type of line parsed or end of data in the pps_status_t data structure.

Returns:

>=0
Success.
-1
An error occurred (errno is set).

Classification:

QNX Neutrino

Safety:  
Interrupt handler No
Signal handler No
Thread Yes

Caveats:

During parsing, separators (":" and "\n") in the input string may be changed to null characters.