xdas_util.c File Reference

OpenXDAS common utility functionality. More...

#include "xdas_util.h"
#include <malloc.h>
#include <string.h>

Go to the source code of this file.

Defines

#define FLD_DELIMS   ":"
#define ESC_CHAR   '%'

Functions

static char * xdas_strdup (const char *sp, const char *limit)
 Similar to the C standard library function strdup, except with a limit.
static char * xdas_tokenize (char *str, const char *delims, char esc, char **nextok)
 Similar to the C standard library function strtok.
int xdas_parse_info (const char *info, const char *limit, char **fields, unsigned maxflds)
 Parse colon separated fields into supplied field buffers.


Detailed Description

OpenXDAS common utility functionality.

Author:
John Calcote (jcalcote@novell.com)
Attention:
Please submit patches to http://openxdas.sourceforge.net

Definition in file xdas_util.c.


Define Documentation

#define ESC_CHAR   '%'

Referenced by xdas_parse_info().

#define FLD_DELIMS   ":"

Referenced by xdas_parse_info().


Function Documentation

static char* xdas_strdup ( const char *  sp,
const char *  limit 
) [static]

Similar to the C standard library function strdup, except with a limit.

This version of strdup allows for a limit on the input buffer in case the buffer isn't null-terminated. Pass zero for limit if sp is null terminated.

Parameters:
[in] str - the string to be parsed - should be NULL each time after the first.
[in] delims - the set of token delimiters to be used.
[in] esc - the escape character for delimiters.
[in,out] nextok - context for the search - used internally.
Returns:
A pointer to the next token in the string.

For internal use only.

Definition at line 63 of file xdas_util.c.

References malloc.

Referenced by xdas_parse_info().

static char* xdas_tokenize ( char *  str,
const char *  delims,
char  esc,
char **  nextok 
) [static]

Similar to the C standard library function strtok.

This version of strtok is recursive, accepts an escape character for delimiters (skipping any escaped delimiters) and returns empty fields as zero-length strings when present.

Parameters:
[in] str - the string to be parsed - should be NULL each time after the first.
[in] delims - the set of token delimiters to be used.
[in] esc - the escape character for delimiters.
[in,out] nextok - context for the search - used internally.
Returns:
A pointer to the next token in the string.

For internal use only.

Definition at line 91 of file xdas_util.c.

Referenced by xdas_parse_info().


Generated on Thu Aug 20 22:33:06 2009 for OpenXDAS by  doxygen 1.5.6