Logo Search packages:      
Sourcecode: pcsc-lite version File versions  Download package

int LTPBundleFindOptionalValueWithKey ( const char *  fileName,
const char *  tokenKey,
char *  tokenValue,
int  tokenIndice 
)

Find an optional key in a configuration file No error is logged if the key is not found

Parameters:
fileName file name
tokenKey key value
[out] tokenValue token value (if key found)
tokenIndice indice of the desired key
Return values:
-1 configuration file not found
0 OK
1 key not found

Definition at line 1876 of file tokenparser.c.

Referenced by LTPBundleFindValueWithKey().

{
      FILE *file = NULL;
      int ret = 0;

      desiredIndex  = tokenIndice;
      pcDesiredKey  = tokenKey;
      pcFinValue[0] = '\0';

      file = fopen(fileName, "r");

      if (!file)
            return 1;

      tpin = file;

      do
      {
            (void)tplex();
      } while (!feof(file));

      if ('\0' == pcFinValue[0])
            ret = -1;
      else
            (void)strlcpy(tokenValue, pcFinValue, TOKEN_MAX_VALUE_SIZE);

      (void)fclose(file);
      return ret;
}


Generated by  Doxygen 1.6.0   Back to index