diff --git a/ase/cmn/str.c b/ase/cmn/str.c index 1e09c4c3..53d143ac 100644 --- a/ase/cmn/str.c +++ b/ase/cmn/str.c @@ -86,6 +86,28 @@ ase_size_t ase_strxncpy ( return n; } +ase_size_t ase_strxcat (ase_char_t* buf, ase_size_t bsz, const ase_char_t* str) +{ + ase_char_t* p, * p2; + ase_size_t blen; + + blen = ase_strlen(buf); + if (blen >= bsz) return blen; /* something wrong */ + + p = buf + blen; + p2 = buf + bsz - 1; + + while (p < p2) + { + if (*str == ASE_T('\0')) break; + *p++ = *str++; + } + + if (bsz > 0) *p = ASE_T('\0'); + return p - buf; +} + + ase_size_t ase_strxncat ( ase_char_t* buf, ase_size_t bsz, const ase_char_t* str, ase_size_t len) { diff --git a/ase/cmn/str.h b/ase/cmn/str.h index 4de01c5d..70ed0ba0 100644 --- a/ase/cmn/str.h +++ b/ase/cmn/str.h @@ -42,6 +42,8 @@ ase_size_t ase_strncpy ( ase_size_t ase_strxncpy ( ase_char_t* buf, ase_size_t bsz, const ase_char_t* str, ase_size_t len); +ase_size_t ase_strxcat ( + ase_char_t* buf, ase_size_t bsz, const ase_char_t* str); ase_size_t ase_strxncat ( ase_char_t* buf, ase_size_t bsz, const ase_char_t* str, ase_size_t len);