mirror of https://github.com/FreeRDP/FreeRDP
61 lines
1.3 KiB
C
61 lines
1.3 KiB
C
|
/**
|
||
|
* WinPR: Windows Portable Runtime
|
||
|
* String Manipulation (CRT)
|
||
|
*
|
||
|
* Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
||
|
*
|
||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
|
* you may not use this file except in compliance with the License.
|
||
|
* You may obtain a copy of the License at
|
||
|
*
|
||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||
|
*
|
||
|
* Unless required by applicable law or agreed to in writing, software
|
||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
|
* See the License for the specific language governing permissions and
|
||
|
* limitations under the License.
|
||
|
*/
|
||
|
|
||
|
#include <winpr/crt.h>
|
||
|
|
||
|
/* String Manipulation (CRT): http://msdn.microsoft.com/en-us/library/f0151s4x.aspx */
|
||
|
|
||
|
#ifndef _WIN32
|
||
|
|
||
|
char* _strdup(const char* strSource)
|
||
|
{
|
||
|
char* strDestination;
|
||
|
|
||
|
if (strSource == NULL)
|
||
|
return NULL;
|
||
|
|
||
|
strDestination = strdup(strSource);
|
||
|
|
||
|
if (strDestination == NULL)
|
||
|
perror("strdup");
|
||
|
|
||
|
return strDestination;
|
||
|
}
|
||
|
|
||
|
wchar_t* _wcsdup(const wchar_t* strSource)
|
||
|
{
|
||
|
wchar_t* strDestination;
|
||
|
|
||
|
if (strSource == NULL)
|
||
|
return NULL;
|
||
|
|
||
|
#if sun
|
||
|
strDestination = wsdup(strSource);
|
||
|
#else
|
||
|
strDestination = wcsdup(strSource);
|
||
|
#endif
|
||
|
|
||
|
if (strDestination == NULL)
|
||
|
perror("wcsdup");
|
||
|
|
||
|
return strDestination;
|
||
|
}
|
||
|
|
||
|
#endif
|