2 # ldaperr.tcl: scan ldap.h for error return codes for initializing
6 proc genstrings {path} {
8 while {[gets $fp line] != -1 &&
9 ![string match "#define LDAP_SUCCESS*" $line]} { }
10 puts "/* This file automatically generated, hand edit at your own risk! */"
11 puts -nonewline "char *ldaptclerrorcode\[\] = {
14 while {[gets $fp line] != -1} {
15 if {[clength $line] == 0 || [ctype space $line]} continue
16 if {![string match #define* $line]} break
17 if {![string match "#define LDAP_*" $line]} continue
18 lassign $line define macro value
20 while {$lasterr < $value} {
21 puts -nonewline ",\n\tNULL"
24 puts -nonewline ",\n\t\"$macro\""
27 puts "#define LDAPTCL_MAXERR\t$value"
31 if !$tcl_interactive {
32 genstrings [lindex $argv 0]