[Previous] [Contents] [Index] [Next]

PxConfigNextString()

Get the next entry in the current section

Synopsis:

#include <photon/PxProto.h>

const char *PxConfigNextString( char *value,
                                short maxlen );

Description:

This function returns the next entry in the current section as a string. A pointer to the entry name is returned, and its configuration value (up to a maximum of maxlen-1 characters) is copied as a string into the buffer at address value. This may be used to process a configuration section consisting of unknown entries, but where each entry is to be processed in a similar fashion.

Returns:

A string containing the next entry name within the current section if one exists, NULL otherwise.


Note:
  • This string is a shared static character array that will be overwritten by subsequent calls to PxConfigNextString().
  • If PxConfigNextString() detects the end of the section, it returns NULL. If you call PxConfigNextString() again, it gets the next entry in the next section.

Examples:

char *env, val[128];
if (PxConfigSection("Environment") != NULL)
    while ((env = PxConfigNextString(val, sizeof(val))) != NULL)
        setenv(env, val, ~0);

Classification:

Photon

Safety:
Interrupt handler No
Signal handler No
Thread No

See also:

PxConfigNextSection(), PxConfigOpen(), PxConfigSection()


[Previous] [Contents] [Index] [Next]