Slight naming changes for Bro version information.

Main API now looks like this:

@if ( Version::number >= 20500 )
or
@if ( Version::at_least("2.5") )
This commit is contained in:
Johanna Amann 2016-09-29 13:36:47 -07:00
parent 35465aaf30
commit f66ef7b1e6
2 changed files with 7 additions and 7 deletions

View file

@ -44,7 +44,7 @@ export {
## version_string: Version to check against the current running version. ## version_string: Version to check against the current running version.
## ##
## Returns: True if running version greater or equal to the given version. ## Returns: True if running version greater or equal to the given version.
global greater_equal: function(version_string: string): bool; global at_least: function(version_string: string): bool;
} }
function parse(version_string: string): VersionDescription function parse(version_string: string): VersionDescription
@ -78,13 +78,13 @@ export {
## The format of the number is ABBCC with A being the major version, ## The format of the number is ABBCC with A being the major version,
## bb being the minor version (2 digits) and CC being the patchlevel (2 digits). ## bb being the minor version (2 digits) and CC being the patchlevel (2 digits).
## As an example, Bro 2.4.1 results in the number 20401 ## As an example, Bro 2.4.1 results in the number 20401
const num = Version::parse(bro_version())$version_num; const number = Version::parse(bro_version())$version_num;
## `VersionDescription` record pertaining to the currently running version of Bro. ## `VersionDescription` record pertaining to the currently running version of Bro.
const info = Version::parse(bro_version()); const info = Version::parse(bro_version());
} }
function greater_equal(version_string: string): bool function at_least(version_string: string): bool
{ {
return Version::parse(version_string)$version_num >= Version::num; return Version::parse(version_string)$version_num >= Version::number;
} }

View file

@ -23,7 +23,7 @@ Version::parse(bro_version());
@TEST-START-NEXT @TEST-START-NEXT
@if ( Version::num >= 20500 ) @if ( Version::number >= 20500 )
print "yup"; print "yup";
@endif @endif
@ -31,10 +31,10 @@ print "yup";
print "yup"; print "yup";
@endif @endif
@if ( Version::greater_equal("2.5") ) @if ( Version::at_least("2.5") )
print "yup"; print "yup";
@endif @endif
@if ( Version::greater_equal("2.4") ) @if ( Version::at_least("2.4") )
print "no"; print "no";
@endif @endif