[FreeNX-kNX] nxserver low performance when querying sessions (patch included)

Mario Becroft mb at gem.win.co.nz
Wed Jul 29 15:28:46 UTC 2009


Boris Savelev <boris.savelev at gmail.com> writes:

>> @@ -26,9 +26,9 @@
>>
>>  # Reread boot command line; echo last parameter's argument or return false.
>>  getparam(){
>> -stringinstring "&$1=" "$CMDLINE" || return 1
>> -echo "$CMDLINE" |  tr "&" "\n" | egrep "^"$1"=" | awk -F= '{ VAL=$2 } END { print VAL }'
>> -return 0
>> +    [[ "&$CMDLINE" =~ ".*&$1=([^&]*)" ]]
>> +    echo ${BASH_REMATCH[1]}
>> +    [ "$BASH_REMATCH" != "" ]
>>  }
>
> it doesnt works for me
>
> but
> <cut>
> getparam(){
> pattern=".*&$1=([^&]*)"
> [[ $CMDLINE =~ $pattern ]]
> [ "${BASH_REMATCH[1]}" != "" ] && echo "${BASH_REMATCH[1]}"
> [ "$BASH_REMATCH" != "" ]
> }
> <cut>
> works fine

My mistake, I forgot to quote ${BASH_REMATCH[1]} (although here, it
works fine anyway).

It was intentional that it always echos the result even if empty, even
though this behaviour is different to the original behaviour. However
your version is also different to the original. I think maybe you meant:

[ "$BASH_REMATCH" != "" ] && echo "${BASH_REMATCH[1]}"

which should achieve the original behaviour of not echoing anything when
the parameter does not exist. I was trying to keep it as simple as
possible, and I found that it worked anyway so I didn't bother with
this.

-- 
Mario Becroft <mb at gem.win.co.nz>



More information about the FreeNX-kNX mailing list