Update contrib.
1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
17 #include <e32property.h>
18 #include <numberconversion.h>
19 #include <swi/swispubsubdefs.h>
23 _LIT(KSeparator, "|"); // Invalid filepath char used to separate filenames
26 //This function defines a P&S variable as requested by the parameters
27 static TInt CreateVariableL(TUid aCategory, TInt aKey, TInt aAttr)
29 TSecurityPolicy readPolicy = TSecurityPolicy::EAlwaysPass;
30 TSecurityPolicy writePolicy = TSecurityPolicy::EAlwaysPass;
32 TInt err = RProperty::Define(aCategory, aKey, aAttr, readPolicy, writePolicy);
34 if(err != KErrAlreadyExists)
36 //This will leave for any value other than KErrNone
37 User::LeaveIfError(err);
40 //If the variable is already defined then return KErrNone as this is fine,
44 GLDEF_C TInt E32Main()
47 CTrapCleanup* cleanup = CTrapCleanup::New();
52 User::CommandLine(args);
55 TInt pos = args.Find(KSeparator);
59 TInt32 category = NumberConversion::ConvertFirstNumber(args.Mid(0,pos), length, digitType);
60 TUid categoryUid = TUid::Uid(category);
61 TPtrC remainder = args.Mid(pos+1, args.Length()-(pos+1));
62 pos = remainder.Find(KSeparator);
63 TUint key = NumberConversion::ConvertFirstNumber(remainder.Mid(0,pos), length, digitType);
64 TInt attr = NumberConversion::ConvertFirstNumber(
65 remainder.Mid(pos+1, remainder.Length()-(pos+1)), length, digitType
68 //create the appropriate variable
69 error = CreateVariableL(categoryUid, key, attr);