mirror of
https://github.com/pfsense/pfsense.git
synced 2025-10-26 11:38:35 +00:00
Add strncpy() utility function
This commit is contained in:
parent
09db10704f
commit
d6fbd4ca29
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user