commonservices/sysutil/src/sysutilsetup.cpp
changeset 0 4e1aa6a622a0
equal deleted inserted replaced
-1:000000000000 0:4e1aa6a622a0
       
     1 // Copyright (c) 2008-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".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #include <e32base.h>
       
    17 #include <bafl/sysutil.h>
       
    18 #include "sysutilpatchdata.h"
       
    19 #include "sysutildebug.h"			// debug helper
       
    20 #include "sysutilsetup.h"
       
    21 
       
    22 /**
       
    23 Calls a function in SysUtil.dll which sets up one or more Publish and Subscribe values. 
       
    24 The function called is determined by the flags passed to sysutilsetup.exe when it is run. 
       
    25 The valid flags can be found in sysutilsetup.h.
       
    26 */
       
    27 TInt MainL()
       
    28 	{
       
    29 	TBuf<16> flags;
       
    30 	User::CommandLine( flags );
       
    31 	TLex lex( flags );
       
    32 	
       
    33 	for ( TPtrC token = lex.NextToken(); token.Length() != 0; token.Set( lex.NextToken() ) )
       
    34 		{
       
    35 		if ( token.CompareF(KSetVersionPropertiesFlag) == 0 )
       
    36 			{
       
    37 			__SYSUTIL_TRACE("Calling SetVersionPropertiesL().");
       
    38 			SetVersionPropertiesL();
       
    39 			__SYSUTIL_TRACE("Called SetVersionPropertiesL().");
       
    40 			}
       
    41 		else if ( token.CompareF(KSetDeviceTypeInfoPropertyFlag) == 0 )
       
    42 			{
       
    43 			__SYSUTIL_TRACE("Calling SetDeviceTypeInfoPropertyL().");
       
    44 			SetDeviceTypeInfoPropertyL();
       
    45 			__SYSUTIL_TRACE("Called SetDeviceTypeInfoPropertyL().");
       
    46 			}
       
    47 		else if ( token.CompareF(KDeletePropertiesFlag) == 0 )
       
    48 			{
       
    49 			DeletePSPropertiesL();
       
    50 			break;
       
    51 			}
       
    52 		else
       
    53 			{
       
    54 			return KErrArgument;
       
    55 			}
       
    56 		}
       
    57 	
       
    58 	return KErrNone;
       
    59 	}
       
    60 
       
    61 TInt E32Main()
       
    62 	{
       
    63 	__UHEAP_MARK;
       
    64 	__SYSUTIL_TRACE("Entered sysutilsetup.exe E32Main.");
       
    65 	CTrapCleanup* cleanup = CTrapCleanup::New();
       
    66 	
       
    67 	TInt err = KErrNoMemory;
       
    68 	if ( cleanup != NULL )
       
    69 		{
       
    70 		TRAP( err, MainL() );
       
    71 		delete cleanup;
       
    72 		}
       
    73 	
       
    74 	__SYSUTIL_TRACE("Leaving sysutilsetup.exe E32Main.");
       
    75 	__UHEAP_MARKEND;
       
    76 	return err;
       
    77 	}