openldap/contrib/ldaptcl/ldaperr.tcl
Randy Kunkee 11eafc253c Ldaptcl package version 1.2:
- Filter no longer a required controlArray member, defaults to objectclass=*.
- Sets errorCode with LDAP macro string value (better to test than the more
  human readable values).
- Shorten minimum required characters for search scope definitions: now allows
  "base", "one", and "sub".  For the latter two, additional characters are
  ignored.
- Now compiles successfully with -devel branch (though less tested).
- Client cache management code enabled for OpenLDAP versions <= 1.2.4.  (This
  code is relatively untested and feedback is welcome.)
- More installation cleanups to work easily as a dynamically loadable Tcl
  package.
1999-08-03 07:23:03 +00:00

34 lines
880 B
Tcl

#
# ldaperr.tcl: scan ldap.h for error return codes for initializing
# errorCode table.
#
proc genstrings {path} {
set fp [open $path]
while {[gets $fp line] != -1 &&
![string match "#define LDAP_SUCCESS*" $line]} { }
puts "/* This file automatically generated, hand edit at your own risk! */"
puts -nonewline "char *ldaptclerrorcode\[\] = {
NULL"
set lasterr 0
while {[gets $fp line] != -1} {
if {[clength $line] == 0 || [ctype space $line]} continue
if {![string match #define* $line]} break
if {![string match "#define LDAP_*" $line]} continue
lassign $line define macro value
incr lasterr
while {$lasterr < $value} {
puts -nonewline ",\n\tNULL"
incr lasterr
}
puts -nonewline ",\n\t\"$macro\""
}
puts "\n};"
puts "#define LDAPTCL_MAXERR\t$value"
}
#cmdtrace on
if !$tcl_interactive {
genstrings [lindex $argv 0]
}