Subversion Repositories HelenOS

Rev

Rev 4279 | Rev 4281 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4279 Rev 4280
Line 527... Line 527...
527
    }
527
    }
528
 
528
 
529
    dest[dest_off] = '\0';
529
    dest[dest_off] = '\0';
530
}
530
}
531
 
531
 
-
 
532
/** Append one string to another.
-
 
533
 *
-
 
534
 * Append source string @a src to string in destination buffer @a dest.
-
 
535
 * Size of the destination buffer is @a dest. If the size of the output buffer
-
 
536
 * is at least one byte, the output string will always be well-formed, i.e.
-
 
537
 * null-terminated and containing only complete characters.
-
 
538
 *
-
 
539
 * @param dst   Destination buffer.
-
 
540
 * @param count Size of the destination buffer.
-
 
541
 * @param src   Source string.
-
 
542
 */
-
 
543
void str_append(char *dest, size_t size, const char *src)
-
 
544
{
-
 
545
    size_t dstr_size;
-
 
546
 
-
 
547
    dstr_size = str_size(dest);
-
 
548
    str_cpy(dest + dstr_size, size - dstr_size, src);
-
 
549
}
-
 
550
 
532
/** Copy NULL-terminated wide string to string
551
/** Copy NULL-terminated wide string to string
533
 *
552
 *
534
 * Copy source wide string @a src to destination buffer @a dst.
553
 * Copy source wide string @a src to destination buffer @a dst.
535
 * No more than @a size bytes are written. NULL-terminator is always
554
 * No more than @a size bytes are written. NULL-terminator is always
536
 * written after the last succesfully copied character (i.e. if the
555
 * written after the last succesfully copied character (i.e. if the
Line 818... Line 837...
818
    number = _strtoul(nptr, endptr, base, &sgn);
837
    number = _strtoul(nptr, endptr, base, &sgn);
819
 
838
 
820
    return (sgn ? -number : number);
839
    return (sgn ? -number : number);
821
}
840
}
822
 
841
 
823
char *strcat(char *dest, const char *src)
-
 
824
{
-
 
825
    char *orig = dest;
-
 
826
    while (*dest++)
-
 
827
        ;
-
 
828
    --dest;
-
 
829
    while ((*dest++ = *src++))
-
 
830
        ;
-
 
831
    return orig;
-
 
832
}
-
 
833
 
-
 
834
char *str_dup(const char *src)
842
char *str_dup(const char *src)
835
{
843
{
836
    size_t size = str_size(src);
844
    size_t size = str_size(src);
837
    void *dest = malloc(size + 1);
845
    void *dest = malloc(size + 1);
838
 
846