Guardtime KSI c SDK
Functions
Cross-platform Compatibility Functions

Functions

size_t KSI_snprintf (char *buf, size_t n, const char *format,...)
 
size_t KSI_vsnprintf (char *buf, size_t n, const char *format, va_list va)
 
char * KSI_strncpy (char *destination, const char *source, size_t n)
 
int KSI_strdup (const char *from, char **to)
 
time_t KSI_CalendarTimeToUnixTime (struct tm *time)
 
int KSI_strcasecmp (const char *s1, const char *s2)
 

Detailed Description

Function Documentation

time_t KSI_CalendarTimeToUnixTime ( struct tm *  time)

Platform independent modified version of mktime that takes calendar time interpreted as UTC time (local time zone is ignored) as input and converts the value to Unix time.

Parameters
[in]timePointer to struct tm containing calendar time broken into its components.
Returns
The number of seconds elapsed since 1970-01-01 00:00:00 UTC. If a calendar time cannot be represented or time is NULL, -1 is returned.
size_t KSI_snprintf ( char *  buf,
size_t  n,
const char *  format,
  ... 
)

Platform independent version of snprintf.

Parameters
[in]bufPointer to buffer.
[in]nMaximum number of bytes to be written into buffer. Includes terminating NUL character.
[in]formatFormat string.
[in]...Extra parameters for formatting.
Returns
The number of characters written, not including terminating NUL character. On error 0 is returned.
int KSI_strcasecmp ( const char *  s1,
const char *  s2 
)

Platform independent case-insensitive string compare.

Parameters
[in]s1String 1 to be compared.
[in]s2String 2 to be compared.
Returns
retruns 0 if both are equal. If one of the arguments is NULL, KSI_INVALID_ARGUMENT is returnd.
int KSI_strdup ( const char *  from,
char **  to 
)

Platform independent string duplicate function. It will create a new null-terminated string from the initial version.

Parameters
[in]fromString to be copied.
[in]toPointer to the receiving pointer.
Returns
On success returns KSI_OK, otherwise a status code is returned (see KSI_StatusCode).
char* KSI_strncpy ( char *  destination,
const char *  source,
size_t  n 
)

Platform independent version of strncpy that guarantees NULL terminated destination. To copy N characters from source to destination n and size of destination must be N+1.

Parameters
[in]destinationPointer to destination.
[in]sourcePointer to source.
[in]nMaximum number of characters to be copied including terminating NUL
Returns
The pointer to destination is returned. On error NULL is returned.
size_t KSI_vsnprintf ( char *  buf,
size_t  n,
const char *  format,
va_list  va 
)

Platform independent version of vsnprintf.

Parameters
[in]bufPointer to buffer.
[in]nMaximum number of bytes to be written into buffer. Includes terminating NUL character.
[in]formatFormat string.
[in]vavariable list.
Returns
The number of characters written, not including terminating NUL character. On error 0 is returned.