diff options
author | Bill Marquette <billm@pfsense.org> | 2005-07-23 18:57:37 +0000 |
---|---|---|
committer | Bill Marquette <billm@pfsense.org> | 2005-07-23 18:57:37 +0000 |
commit | d6fbd4ca29d76a3865b84c62a85648325806d320 (patch) | |
tree | 2295a5f0cab97b690dd2c1db6297319ca87270be | |
parent | 09db10704f47f7993e877f83a73ee52a33c64f19 (diff) | |
download | pfsense-d6fbd4ca29d76a3865b84c62a85648325806d320.zip pfsense-d6fbd4ca29d76a3865b84c62a85648325806d320.tar.gz |
Add strncpy() utility function
-rw-r--r-- | etc/inc/pfsense-utils.inc | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/etc/inc/pfsense-utils.inc b/etc/inc/pfsense-utils.inc index ccbe302..c759003 100644 --- a/etc/inc/pfsense-utils.inc +++ b/etc/inc/pfsense-utils.inc @@ -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; + } +} + ?> |