Mercurial > hg > toybox
comparison lib/lib.c @ 870:aa5bd0a358dd
More ifconfig cleanup.
author | Rob Landley <rob@landley.net> |
---|---|
date | Sat, 20 Apr 2013 23:33:48 -0500 |
parents | 34ac05521d94 |
children | aca8323e2690 |
comparison
equal
deleted
inserted
replaced
869:571e95bdf6af | 870:aa5bd0a358dd |
---|---|
9 */ | 9 */ |
10 | 10 |
11 #include "toys.h" | 11 #include "toys.h" |
12 | 12 |
13 // Strcpy with size checking: exit if there's not enough space for the string. | 13 // Strcpy with size checking: exit if there's not enough space for the string. |
14 void xstrcpy(char *dest, char *src, size_t size) | 14 void xstrncpy(char *dest, char *src, size_t size) |
15 { | 15 { |
16 if (strlen(src)+1 > size) error_exit("xstrcpy"); | 16 if (strlen(src)+1 > size) error_exit("xstrcpy"); |
17 strcpy(dest, src); | 17 strcpy(dest, src); |
18 } | 18 } |
19 | 19 |