diff -r 000000000000 -r 2c201484c85f securityanddataprivacytools/securitytools/certapp/api/certapp-api.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securityanddataprivacytools/securitytools/certapp/api/certapp-api.c Wed Jul 08 11:25:26 2009 +0100 @@ -0,0 +1,155 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "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: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +#include +#include +#include +#include + +#include "certapp-api.h" + +#define CERTAPP "certapp" +typedef const char *ArgPtr; + +#ifdef __LINUX__ +#include +#include +#else +#include +#endif + +#ifndef BULLSEYE_OFF +#ifdef _BullseyeCoverage +#define BULLSEYE_OFF "BullseyeCoverage save off"; +#define BULLSEYE_RESTORE "BullseyeCoverage restore"; +#else +#define BULLSEYE_OFF +#define BULLSEYE_RESTORE +#endif +#endif + +static const char * const OPT_PROGRESS = "--progress="; +static const char * const OPT_ERRORS = "--errors="; + +int RunCertApp(const char *aProgress, const char *aErrors, + int argc, char **argv) +{ + int ret = -1; +BULLSEYE_OFF + if(argc<0) abort(); // Bad argument +BULLSEYE_RESTORE + + int newArgc = argc+4; + const char **newArgv = (const char **)malloc(sizeof(ArgPtr)*newArgc); + + const char *progFile = (aProgress) ? (aProgress) : ("-"); + const char *errorsFile = (aErrors) ? (aErrors) : ("-"); + + char *progress=(char *)malloc(strlen(OPT_PROGRESS)+strlen(progFile)+1); + strcpy(progress, OPT_PROGRESS); + strcat(progress, progFile); + + char *errors=(char *)malloc(strlen(OPT_ERRORS)+strlen(errorsFile)+1); + strcpy(errors, OPT_ERRORS); + strcat(errors, errorsFile); + + newArgv[0] = CERTAPP; + newArgv[1] = progress; + newArgv[2] = errors; + int i=0; + for(i=0; i