core/builtins/var.cif
author Tom Sutcliffe <thomas.sutcliffe@accenture.com>
Sun, 18 Jul 2010 18:57:41 +0100
changeset 36 99de8c43cede
parent 0 7f656887cf89
child 60 3ad902ef5222
permissions -rw-r--r--
First cut of thread pools in fshell. Not fully working yet. Removed 4 overloads of CCommandBase::RunCommand[L] that are no longer used at all, and changed one more to not be exported as it's only used internally to iocli.dll. Added a thread pool (CThreadPool) to fshell so that thread commands no longer have to spawn a new thread every time they run. As part of this, CCommandWrapperBase now derives from CActive so that CThreadCommand can use its CActive-ness. CThreadCommand rejigged quite a bit to use CThreadPool (via MTaskRunner interface).

# var.cif
# 
# Copyright (c) 2010 Accenture. All rights reserved.
# This component and the accompanying materials are made available
# under the terms of the "Eclipse Public License v1.0"
# which accompanies this distribution, and is available
# at the URL "http://www.eclipse.org/legal/epl-v10.html".
# 
# Initial Contributors:
# Accenture - Initial contribution
#

==name var

==short-description

Perform an operation involving environment variables.

==long-description

This command returns zero (KErrNone) in the success case, and a non-zero positive code otherwise. Usage:

    var SOMETHING defined # Doesn't cause an error, returns '1'
    var SOMETHING defined && echo Defined # Nothing is echoed
    export SOMETHING 1
    var SOMETHING defined && echo Defined # "Defined" will be printed
    var SOMETHING == 1 && echo "Equal" # "Equal" will be printed
    var SOMETHING add 3 && echo "$SOMETHING" # $SOMETHING now has value "4"

C<==> and C<!=> are text comparisons not numerical, and all environment variables are strings, so the following will I<not> work:

    export VAL 16
    var VAL == 0x10 && echo Equal # Error! "16" does not equal "0x10"

==argument string variable

The environment variable to be operated on.

==argument enum operation

The operation to be performed.

==enum-value defined

Test if the specified environment variable is defined.

==enum-value not-defined

Opposite of C<defined>.

==enum-value ==

Tests if the specified environment variable is an exact string match for the supplied argument.

==enum-value !=

Opposite of C<==>.

==enum-value add

Assume that the specified environment variable holds an integer, and adds the value given by the argument to it. If the variable isn't defined or doesn't contain a decimal integer, it is assumed to have value zero.

==enum-value subtract

Subtracts the given value from the environment variable. Semantics as per add.

==argument string argument optional

The argument to the operation.

==copyright

Copyright (c) 2006-2010 Accenture. All rights reserved.