Move convenience functions into common; d_echo no longer adds "\n" automatically

This commit is contained in:
Paul Gear
2015-06-16 08:27:57 +10:00
parent c873cafbae
commit a2baae3ccf
3 changed files with 90 additions and 51 deletions
-17
View File
@@ -805,23 +805,6 @@ function snmp_gen_auth (&$device)
return $cmd;
}
/*
* Shorten the name to so it works as an RRD data source.
* Substitute for $subst if necessary.
* @return the shortened name
*/
function name_shorten($name, $common, $subst = "mibval", $len = 19)
{
if (strlen($name) > $len && strpos($name, $common) >= 0) {
$newname = str_replace($common, '', $name);
$name = $newname;
}
if (strlen($name) > $len) {
$name = $subst;
}
return $name;
}
/*
* Translate the given MIB into a vaguely useful PHP array. Each keyword becomes an array index.
*