core/builtins/var.cif
author Tom Sutcliffe <thomas.sutcliffe@accenture.com>
Thu, 26 Aug 2010 00:49:35 +0100
changeset 37 534b01198c2d
parent 0 7f656887cf89
child 51 3ad902ef5222
permissions -rw-r--r--
Added ENotifyKeypresses and ECaptureCtrlC flags to CCommandBase. Commands can now get keypresses and handle ctrl-C via callbacks instead of having to implement custom active objects. As part of this extended the CCommandBase extension interface to MCommandExtensionsV2 for the new virtual functions KeyPressed(TUint aKeyCode, TUint aModifiers) and CtrlCPressed(). sudo now cleans up correctly by using ECaptureCtrlC.

# 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.