Update contrib.
1 // Copyright (c) 2005-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.
15 // Part of : libc library
16 // executes a given command/executable.
21 #include <stdlib_r.h> //mbstowcs
22 #include "sysreent.h" //_wsystem_r
28 #define MAXPATHLEN 260 /* E32STD.H: KMaxFullName + 4 to avoid data loss */
30 int _system_r (struct _reent *r, const char* cmd);
36 EXPORT_C int system (const char* cmd)
38 return _system_r (_REENT,cmd);
42 A reentrant version of system().
44 int _system_r (struct _reent *r, const char* cmd)
46 wchar_t wcmd[MAXPATHLEN+1];
50 return 1; // special case, says that we do support system().
53 if(strlen(cmd) > MAXPATHLEN)
59 if (((size_t)-1 != mbstowcs(wcmd, cmd, MAXPATHLEN)))
60 return _wsystem_r(&r->_errno, wcmd);