sc68fordevelopers  2.2.1
Functions
string68.h File Reference

String functions. More...

Go to the source code of this file.

Functions

int SC68strcmp (const char *a, const char *b)
 Compare two string (case insensitive). More...
 
char * SC68strcat (char *a, const char *b, int l)
 Concatenate two strings. More...
 
char * SC68strdup (const char *s)
 Duplicate a string. More...
 
char * SC68strcatdup (const char *a, const char *b)
 Concat two strings in a duplicate buffer. More...
 
char * SC68time_str (char *buffer, int track_num, int seconds)
 Make a track and time infornmation string. More...
 
char * SC68long_time_str (char *buffer, int time)
 Convert time (in second) to string. More...
 

Detailed Description

String functions.

Author
Benjamin Gerard ben@s.nosp@m.ashi.nosp@m.pa.co.nosp@m.m
Date
2003/08/11
Id
string68.h,v 2.0 2003/08/21 04:58:35 benjihan Exp

Common string operations.

Function Documentation

int SC68strcmp ( const char *  a,
const char *  b 
)

Compare two string (case insensitive).

The SC68strcmp() function compares the two strings a and b, ignoring the case of the characters. It returns an integer less than, equal to, or greater than zero if a is found, respectively, to be less than, to match, or be greater than b.

Parameters
aFirst string to compare
bString to compare with
Returns
Integer result of the two string compare. The difference between last tested characters of a and b.
Return values
0a and b are equal
<0a is less than b
>0a is greater than b
char* SC68strcat ( char *  a,
const char *  b,
int  l 
)

Concatenate two strings.

The SC68strcat() function appends the b string to the a string overwriting the 0 character at the end of dest, and then adds a terminating 0 character. The strings may not overlap. Destination string has a maximum size of l characters. On overflow, the trailing 0 is omitted.

Parameters
aDestination string
bString to append.
lDestination maximum size (including trailing 0)
Returns
Destination string
Return values
a
char* SC68strdup ( const char *  s)

Duplicate a string.

The SC68strdup() function returns a pointer to a new string which is a duplicate of the string s. Memory for the new string is obtained with SC68alloc(), and can be freed with SC68free().

Parameters
sString to duplicate.
Returns
Duplicated string
0 error
char* SC68strcatdup ( const char *  a,
const char *  b 
)

Concat two strings in a duplicate buffer.

The SC68strcatdup() function returns a pointer to a new string which is a duplicate of the string a+b. Memory for the new string is obtained with SC68alloc(), and can be freed with SC68free(). If either a or b is null the function does not failed but replace it by an empty string. If both a and b are null the function returns 0.

Parameters
aLeft string.
bright string.
Returns
Duplicated string a+b
0 error
char* SC68time_str ( char *  buffer,
int  track_num,
int  seconds 
)

Make a track and time infornmation string.

The SC68time_str() function formats a string with track time info. The general format is "TK MN:SS" where:

  • TK is track_num or "--" if track_num < 0 or track_num > 99
  • MN:SS is time minutes and seconds or "--:--" if seconds < 0
Parameters
bufferDestination buffer (0 use default static buffer).
track_numTrack number from 00 to 99, minus values disable.
secondsTime to display in seconds [00..5999], other values disable.
Returns
Pointer to result formatted string in a static buffer.
Warning
The function returns a static buffer. Do try to modify it.
Not thread safe.
See also
SC68utils_make_big_playing_time()
char* SC68long_time_str ( char *  buffer,
int  time 
)

Convert time (in second) to string.

The SC68long_time_str() function converts a time in seconds to days, hours, minutes and second string. Day and hour unit are removed if they are null (not signifiant). The output string looks like : [D days, ][H h, ] MN' SS"

Parameters
bufferDestination buffer (0 use default static buffer).
timeTime in second to convert to string.
Returns
pointer to result time string (given buffer or static buffer).
Warning
Not thread safe when using static buffer.
See also
SC68utils_make_track_time_info()