]> git.sur5r.net Git - openldap/blob - contrib/ldaptcl/ldaperr.tcl
Update man page date.
[openldap] / contrib / ldaptcl / ldaperr.tcl
1 #
2 # ldaperr.tcl: scan ldap.h for error return codes for initializing
3 # errorCode table.
4 #
5
6 proc genstrings {path} {
7     set fp [open $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\[\] = {
12         NULL"
13     set lasterr 0
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
19         incr lasterr
20         while {$lasterr < $value} {
21             puts -nonewline ",\n\tNULL"
22             incr lasterr
23         }
24         puts -nonewline ",\n\t\"$macro\""
25     }
26     puts "\n};"
27     puts "#define LDAPTCL_MAXERR\t$value"
28 }
29
30 #cmdtrace on
31 if !$tcl_interactive {
32     genstrings [lindex $argv 0]
33 }