This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Accessing config parameters in define_proc code


Hi Folks

Rather advanced CDL question....

Is it possible to access a configuration variable inside a define_proc
statement?

What i have is:

                cdl_option CYGDAT_REDBOOT_PASSWD {
                    display       "Password for RedBoot"
                    no_define
                    flavor        data
                    default_value {"\"0penSezerU\""} 

                    define_proc   { 
proc rot13 { line } {
    set string1 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
    set string2 "NOPQRSTUVWXYZABCDEFGHIJKLMnopqrstuvwxyzabcdefghijklm"
    set newline ""
    for { set num 0 } {$num < [string length $line]} {incr num 1} {
        set char [string index $line $num]
        set idx [string first $char $string1]
        if {$idx >= 0} {
            append newline [string index $string2 $idx]
        } else {
            append newline $char
        }
    }
    return $newline
}

set password [rot13 {"0penSezerU"} ]
puts $::cdl_header "#define CYGDAT_REDBOOT_PASSWD $password"
}

ie it does ROT13 obfustication. This is my test code which I've hard
coded into the define_proc the string to ROT13. What i want to do is
access the config variable CYGDAT_REDBOOT_PASSWD. I tried the obvious
$CYGDAT_REDBOOT_PASSWD, but that failed. 

Is this possible?

   Thanks
        Andrew


-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]