#length()
DESCRIPTION
returns the length (number of characters) in a string
SYNOPSIS
#length(s)
ARGUMENTS
s - a string, or string expression
EXAMPLES
rule
if #length($password) == 0
output mail "User $username has no password!"
endif
rule // magic cookie?
if #nis
&& #length($username) == 1
#if ! webapp
output mail "Illegal magic cookie line: $inline"
#endif
next
endif
#if sunos // | linux
rule // passwd wrong length
if ! #nis
&& #length($password) != 13
&& $password ne "" // empty password reported in
// PasswordFileProblemsUrgent
&& $password ne "*"
output mail "User $uname's password $password not prescribed 13 chars"
endif
#endif
rule
#if adminsys
if #true() // all users, on admin systems
#else
if $user eq "root" // root only, on user systems
#endif
#if solaris | sunos
&& ( #length($idle) == 0
|| $idle =~ "^[0-9]+$" // idle time in minutes,
// not hours or days
)
#elif linux
&& ( $idle =~ "^[[:digit:]]+\\.[[:digit:]]+s$"
|| $idle =~ "^[[:digit:]]+:[[:digit:]]$"
)
#endif
output log "=afterhoursuseractivity_log" $inline
// output mail $inline
// output print $inline
endif
SEE ALSO
#inlen(), #inputlength()
Numerical Functions
String Functions