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]

Re: Accessing config parameters in define_proc code


On Thu, 2002-10-31 at 11:36, Andrew Lunn wrote:
> 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?

I'm sure that Bart will correct me if I'm wrong, but I'm pretty 
sure that the ability to use CDL variables like this was never
implemented. 

I'd suggest that either you leave the value undefined, or jusr
hard-code the rot13() of the default string and document how it
works.

-- 
------------------------------------------------------------
Gary Thomas                  |
eCosCentric, Ltd.            |  
+1 (970) 229-1963            |  eCos & RedBoot experts
gthomas@ecoscentric.com      |
http://www.ecoscentric.com/  |
------------------------------------------------------------


-- 
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]