Add strncpy() utility function

This commit is contained in:
Bill Marquette 2005-07-23 18:57:37 +00:00
parent 09db10704f
commit d6fbd4ca29

View File

@ -989,4 +989,20 @@ function generate_random_mac() {
return $mac;
}
/****f* pfsense-utils/strncpy
* NAME
* strncpy - copy strings
* INPUTS
* &$dst, $src, $length
* RESULT
* none
******/
function strncpy(&$dst, $src, $length) {
if (strlen($src) > $length) {
$dst = substr($src, 0, $length);
} else {
$dst = $src;
}
}
?>