25 |
* SUCH DAMAGE. |
* SUCH DAMAGE. |
26 |
* |
* |
27 |
* |
* |
28 |
* $Id: misc.c,v 1.2 2005/05/07 02:13:29 debug Exp $ |
* $Id: misc.c,v 1.3 2005/06/20 05:52:47 debug Exp $ |
29 |
*/ |
*/ |
30 |
|
|
31 |
#include <stdio.h> |
#include <stdio.h> |
32 |
#include <stdlib.h> |
#include <stdlib.h> |
33 |
|
#include <string.h> |
34 |
#include <fcntl.h> |
#include <fcntl.h> |
35 |
|
|
36 |
#include "misc.h" |
#include "misc.h" |
124 |
return h; |
return h; |
125 |
} |
} |
126 |
|
|
127 |
|
|
128 |
|
#ifdef USE_STRLCPY_REPLACEMENTS |
129 |
|
/* |
130 |
|
* mystrlcpy(): |
131 |
|
* |
132 |
|
* Quick hack strlcpy() replacement for systems that lack that function. |
133 |
|
* NOTE: No length checking is done. |
134 |
|
*/ |
135 |
|
size_t mystrlcpy(char *dst, const char *src, size_t size) |
136 |
|
{ |
137 |
|
strcpy(dst, src); |
138 |
|
return strlen(src); |
139 |
|
} |
140 |
|
|
141 |
|
|
142 |
|
/* |
143 |
|
* mystrlcat(): |
144 |
|
* |
145 |
|
* Quick hack strlcat() replacement for systems that lack that function. |
146 |
|
* NOTE: No length checking is done. |
147 |
|
*/ |
148 |
|
size_t mystrlcat(char *dst, const char *src, size_t size) |
149 |
|
{ |
150 |
|
size_t orig_dst_len = strlen(dst); |
151 |
|
strcat(dst, src); |
152 |
|
return strlen(src) + orig_dst_len; |
153 |
|
} |
154 |
|
#endif |
155 |
|
|