--- trunk/src/misc.c 2007/10/08 16:18:11 6 +++ upstream/0.4.0.1/src/misc.c 2007/10/08 16:20:18 27 @@ -1,5 +1,5 @@ /* - * Copyright (C) 2005 Anders Gavare. All rights reserved. + * Copyright (C) 2005-2006 Anders Gavare. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -25,11 +25,15 @@ * SUCH DAMAGE. * * - * $Id: misc.c,v 1.2 2005/05/07 02:13:29 debug Exp $ + * $Id: misc.c,v 1.5 2006/02/25 12:55:19 debug Exp $ + * + * This file contains things that don't fit anywhere else, and fake/dummy + * implementations of libc functions that are missing on some systems. */ #include #include +#include #include #include "misc.h" @@ -123,3 +127,32 @@ return h; } + +#ifdef USE_STRLCPY_REPLACEMENTS +/* + * mystrlcpy(): + * + * Quick hack strlcpy() replacement for systems that lack that function. + * NOTE: No length checking is done. + */ +size_t mystrlcpy(char *dst, const char *src, size_t size) +{ + strcpy(dst, src); + return strlen(src); +} + + +/* + * mystrlcat(): + * + * Quick hack strlcat() replacement for systems that lack that function. + * NOTE: No length checking is done. + */ +size_t mystrlcat(char *dst, const char *src, size_t size) +{ + size_t orig_dst_len = strlen(dst); + strcat(dst, src); + return strlen(src) + orig_dst_len; +} +#endif +