提交 9c38e704 编写于 作者: wafwerar's avatar wafwerar

build: add win package

上级 0405c4fb
...@@ -10,7 +10,9 @@ ELSEIF (TD_WINDOWS) ...@@ -10,7 +10,9 @@ ELSEIF (TD_WINDOWS)
# INSTALL(DIRECTORY ${TD_SOURCE_DIR}/src/connector/python DESTINATION connector) # INSTALL(DIRECTORY ${TD_SOURCE_DIR}/src/connector/python DESTINATION connector)
# INSTALL(DIRECTORY ${TD_SOURCE_DIR}/src/connector/C\# DESTINATION connector) # INSTALL(DIRECTORY ${TD_SOURCE_DIR}/src/connector/C\# DESTINATION connector)
# INSTALL(DIRECTORY ${TD_SOURCE_DIR}/examples DESTINATION .) # INSTALL(DIRECTORY ${TD_SOURCE_DIR}/examples DESTINATION .)
INSTALL(FILES ${TD_SOURCE_DIR}/packaging/cfg/taos.cfg DESTINATION cfg) INSTALL(CODE "IF (NOT EXISTS ${CMAKE_INSTALL_PREFIX}/cfg/taos.cfg)
execute_process(COMMAND ${CMAKE_COMMAND} -E copy ${TD_SOURCE_DIR}/packaging/cfg/taos.cfg ${CMAKE_INSTALL_PREFIX}/cfg/taos.cfg)
ENDIF ()")
INSTALL(FILES ${TD_SOURCE_DIR}/include/client/taos.h DESTINATION include) INSTALL(FILES ${TD_SOURCE_DIR}/include/client/taos.h DESTINATION include)
INSTALL(FILES ${TD_SOURCE_DIR}/include/util/taoserror.h DESTINATION include) INSTALL(FILES ${TD_SOURCE_DIR}/include/util/taoserror.h DESTINATION include)
INSTALL(FILES ${TD_SOURCE_DIR}/include/libs/function/taosudf.h DESTINATION include) INSTALL(FILES ${TD_SOURCE_DIR}/include/libs/function/taosudf.h DESTINATION include)
......
...@@ -27,6 +27,10 @@ else () ...@@ -27,6 +27,10 @@ else ()
cat("${TD_SUPPORT_DIR}/taosadapter_CMakeLists.txt.in" ${CONTRIB_TMP_FILE}) cat("${TD_SUPPORT_DIR}/taosadapter_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
endif() endif()
if(TD_LINUX_64 AND JEMALLOC_ENABLED)
cat("${TD_SUPPORT_DIR}/jemalloc_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
endif()
# pthread # pthread
if(${BUILD_PTHREAD}) if(${BUILD_PTHREAD})
cat("${TD_SUPPORT_DIR}/pthread_CMakeLists.txt.in" ${CONTRIB_TMP_FILE}) cat("${TD_SUPPORT_DIR}/pthread_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
...@@ -392,6 +396,19 @@ if(${BUILD_WITH_SQLITE}) ...@@ -392,6 +396,19 @@ if(${BUILD_WITH_SQLITE})
endif(NOT TD_WINDOWS) endif(NOT TD_WINDOWS)
endif(${BUILD_WITH_SQLITE}) endif(${BUILD_WITH_SQLITE})
# jemalloc
IF (TD_LINUX_64 AND JEMALLOC_ENABLED)
include(ExternalProject)
ExternalProject_Add(jemalloc
PREFIX "jemalloc"
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/jemalloc
BUILD_IN_SOURCE 1
CONFIGURE_COMMAND ./autogen.sh COMMAND ./configure --prefix=${CMAKE_BINARY_DIR}/build/
BUILD_COMMAND ${MAKE}
)
INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR}/build/include)
ENDIF ()
# addr2line # addr2line
if(${BUILD_ADDR2LINE}) if(${BUILD_ADDR2LINE})
if(NOT ${TD_WINDOWS}) if(NOT ${TD_WINDOWS})
......
...@@ -57,7 +57,7 @@ extern "C" { ...@@ -57,7 +57,7 @@ extern "C" {
#if defined(WINDOWS) #if defined(WINDOWS)
char *stpcpy (char *dest, const char *src); char *stpcpy (char *dest, const char *src);
char *stpncpy (char *dest, const char *src, size_t n); char *stpncpy (char *dest, const char *src, int n);
// specific // specific
#ifndef __COMPAR_FN_T #ifndef __COMPAR_FN_T
...@@ -77,7 +77,7 @@ extern "C" { ...@@ -77,7 +77,7 @@ extern "C" {
char * strsep(char **stringp, const char *delim); char * strsep(char **stringp, const char *delim);
char * getpass(const char *prefix); char * getpass(const char *prefix);
char * strndup(const char *s, size_t n); char * strndup(const char *s, int n);
// for send function in tsocket.c // for send function in tsocket.c
#define MSG_NOSIGNAL 0 #define MSG_NOSIGNAL 0
......
...@@ -2,61 +2,78 @@ ...@@ -2,61 +2,78 @@
set internal_dir=%~dp0\..\..\ set internal_dir=%~dp0\..\..\
set community_dir=%~dp0\.. set community_dir=%~dp0\..
cd %community_dir% set package_dir=%cd%
git checkout -- .
cd %community_dir%\packaging
:: %1 name %2 version :: %1 name %2 version
if !%1==! GOTO USAGE if !%1==! GOTO USAGE
if !%2==! GOTO USAGE if !%2==! GOTO USAGE
if %1 == taos GOTO TAOS
if %1 == power GOTO POWER if "%1" == "cluster" (
if %1 == tq GOTO TQ set work_dir=%internal_dir%
if %1 == pro GOTO PRO set packagServerName_x64=TDengine-enterprise-server-%2-beta-Windows-x64
if %1 == kh GOTO KH set packagServerName_x86=TDengine-enterprise-server-%2-beta-Windows-x86
if %1 == jh GOTO JH set packagClientName_x64=TDengine-enterprise-client-%2-beta-Windows-x64
GOTO USAGE set packagClientName_x86=TDengine-enterprise-client-%2-beta-Windows-x86
) else (
:TAOS set work_dir=%community_dir%
goto RELEASE set packagServerName_x64=TDengine-server-%2-Windows-x64
set packagServerName_x86=TDengine-server-%2-Windows-x86
:POWER set packagClientName_x64=TDengine-client-%2-Windows-x64
call sed_power.bat %community_dir% set packagClientName_x86=TDengine-client-%2-Windows-x86
goto RELEASE )
:TQ echo release windows-client for %1, version: %2
call sed_tq.bat %community_dir% if not exist %work_dir%\debug (
goto RELEASE md %work_dir%\debug
)
:PRO if not exist %work_dir%\debug\ver-%2-x64 (
call sed_pro.bat %community_dir% md %work_dir%\debug\ver-%2-x64
goto RELEASE
:KH
call sed_kh.bat %community_dir%
goto RELEASE
:JH
call sed_jh.bat %community_dir%
goto RELEASE
:RELEASE
echo release windows-client-64 for %1, version: %2
if not exist %internal_dir%\debug\ver-%2-64bit-%1 (
md %internal_dir%\debug\ver-%2-64bit-%1
) else ( ) else (
rd /S /Q %internal_dir%\debug\ver-%2-64bit-%1 rd /S /Q %work_dir%\debug\ver-%2-x64
md %internal_dir%\debug\ver-%2-64bit-%1 md %work_dir%\debug\ver-%2-x64
) )
cd %internal_dir%\debug\ver-%2-64bit-%1 if not exist %work_dir%\debug\ver-%2-x86 (
call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64 md %work_dir%\debug\ver-%2-x86
cmake ../../ -G "NMake Makefiles" -DVERNUMBER=%2 -DCPUTYPE=x64 ) else (
set CL=/MP4 rd /S /Q %work_dir%\debug\ver-%2-x86
nmake install md %work_dir%\debug\ver-%2-x86
)
cd %work_dir%\debug\ver-%2-x64
call vcvarsall.bat x64
cmake ../../ -G "NMake Makefiles JOM" -DCMAKE_MAKE_PROGRAM=jom -DBUILD_TOOLS=true -DBUILD_HTTP=false -DVERNUMBER=%2 -DCPUTYPE=x64
cmake --build .
rd /s /Q C:\TDengine
cmake --install .
if not %errorlevel% == 0 ( call :RUNFAILED build x64 failed & exit /b 1)
cd %package_dir%
iscc /DMyAppInstallName="%packagServerName_x64%" /DMyAppVersion="%2" /DMyAppExcludeSource="" tools\tdengine.iss /O..\release
if not %errorlevel% == 0 ( call :RUNFAILED package %packagServerName_x64% failed & exit /b 1)
iscc /DMyAppInstallName="%packagClientName_x64%" /DMyAppVersion="%2" /DMyAppExcludeSource="taosd.exe" tools\tdengine.iss /O..\release
if not %errorlevel% == 0 ( call :RUNFAILED package %packagClientName_x64% failed & exit /b 1)
cd %work_dir%\debug\ver-%2-x86
call vcvarsall.bat x86
cmake ../../ -G "NMake Makefiles JOM" -DCMAKE_MAKE_PROGRAM=jom -DBUILD_TOOLS=true -DBUILD_HTTP=false -DVERNUMBER=%2 -DCPUTYPE=x86
cmake --build .
rd /s /Q C:\TDengine
cmake --install .
if not %errorlevel% == 0 ( call :RUNFAILED build x86 failed & exit /b 1)
cd %package_dir%
iscc /DMyAppInstallName="%packagServerName_x86%" /DMyAppVersion="%2" /DMyAppExcludeSource="" tools\tdengine.iss /O..\release
if not %errorlevel% == 0 ( call :RUNFAILED package %packagServerName_x86% failed & exit /b 1)
iscc /DMyAppInstallName="%packagClientName_x86%" /DMyAppVersion="%2" /DMyAppExcludeSource="taosd.exe" tools\tdengine.iss /O..\release
if not %errorlevel% == 0 ( call :RUNFAILED package %packagClientName_x86% failed & exit /b 1)
goto EXIT0 goto EXIT0
:USAGE :USAGE
echo Usage: release.bat $productName $version echo Usage: release.bat $verMode $version
goto EXIT0 goto EXIT0
:EXIT0 :EXIT0
\ No newline at end of file exit /b
:RUNFAILED
echo %*
cd %package_dir%
goto :eof
\ No newline at end of file
...@@ -26,7 +26,7 @@ soMode=dynamic # [static | dynamic] ...@@ -26,7 +26,7 @@ soMode=dynamic # [static | dynamic]
dbName=taos # [taos | ...] dbName=taos # [taos | ...]
allocator=glibc # [glibc | jemalloc] allocator=glibc # [glibc | jemalloc]
verNumber="" verNumber=""
verNumberComp="2.0.0.0" verNumberComp="3.0.0.0"
httpdBuild=false httpdBuild=false
while getopts "hv:V:c:o:l:s:d:a:n:m:H:" arg; do while getopts "hv:V:c:o:l:s:d:a:n:m:H:" arg; do
......
...@@ -30,7 +30,6 @@ configDir="/etc/taos" ...@@ -30,7 +30,6 @@ configDir="/etc/taos"
installDir="/usr/local/taos" installDir="/usr/local/taos"
adapterName="taosadapter" adapterName="taosadapter"
benchmarkName="taosBenchmark" benchmarkName="taosBenchmark"
tmqName="tmq_sim"
dumpName="taosdump" dumpName="taosdump"
demoName="taosdemo" demoName="taosdemo"
......
...@@ -60,7 +60,7 @@ if [ "$pagMode" == "lite" ]; then ...@@ -60,7 +60,7 @@ if [ "$pagMode" == "lite" ]; then
strip ${build_dir}/bin/${serverName} strip ${build_dir}/bin/${serverName}
strip ${build_dir}/bin/${clientName} strip ${build_dir}/bin/${clientName}
# lite version doesn't include taosadapter, which will lead to no restful interface # lite version doesn't include taosadapter, which will lead to no restful interface
bin_files="${build_dir}/bin/${serverName} ${build_dir}/bin/${clientName} ${script_dir}/remove.sh ${script_dir}/startPre.sh ${build_dir}/bin/taosBenchmark ${build_dir}/bin/tmq_sim" bin_files="${build_dir}/bin/${serverName} ${build_dir}/bin/${clientName} ${script_dir}/remove.sh ${script_dir}/startPre.sh ${build_dir}/bin/taosBenchmark "
taostools_bin_files="" taostools_bin_files=""
else else
...@@ -78,7 +78,6 @@ else ...@@ -78,7 +78,6 @@ else
taostools_bin_files=" ${build_dir}/bin/taosdump \ taostools_bin_files=" ${build_dir}/bin/taosdump \
${build_dir}/bin/taosBenchmark \ ${build_dir}/bin/taosBenchmark \
${build_dir}/bin/tmq_sim \
${build_dir}/bin/TDinsight.sh \ ${build_dir}/bin/TDinsight.sh \
$tdinsight_caches" $tdinsight_caches"
......
@echo off
cd C:\TDengine
if not "%1" == "" (
%1 --help
@cmd /k
)
\ No newline at end of file
#define MyAppName "TDengine"
#define MyAppPublisher "taosdata"
#define MyAppURL "http://www.taosdata.com/"
#define MyAppBeforeInstallTxt "windows_before_install.txt"
#define MyAppIco "favicon.ico"
#define MyAppInstallDir "C:\TDengine"
#define MyAppOutputDir "./"
#define MyAppSourceDir "C:\TDengine"
;#define MyAppAllFile "\*"
#define MyAppCfgName "\cfg\*"
#define MyAppDriverName "\driver\*"
#define MyAppConnectorName "\connector\*"
#define MyAppExamplesName "\examples\*"
#define MyAppIncludeName "\include\*"
#define MyAppExeName "\*.exe"
#define MyAppTaosExeName "\taos.bat"
#define MyAppTaosdemoExeName "\taosBenchmark.exe"
#define MyAppDLLName "\driver\taos.dll"
;#define MyAppVersion "3.0"
;#define MyAppInstallName "TDengine"
[Setup]
VersionInfoVersion={#MyAppVersion}
AppId={{A0F7A93C-79C4-485D-B2B8-F0D03DF42FAB}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={#MyAppInstallDir}
DefaultGroupName={#MyAppName}
DisableProgramGroupPage=yes
InfoBeforeFile={#MyAppBeforeInstallTxt}
OutputDir={#MyAppOutputDir}
OutputBaseFilename={#MyAppInstallName}
SetupIconFile={#MyAppIco}
Compression=lzma
SolidCompression=yes
DisableDirPage=yes
Uninstallable=yes
[Languages]
Name: "chinesesimp"; MessagesFile: "compiler:Default.isl"
;Name: "english"; MessagesFile: "compiler:Languages\English.isl"
[Files]
;Source: {#MyAppSourceDir}{#MyAppAllFile}; DestDir: "{app}"; Flags: igNoreversion recursesubdirs createallsubdirs
Source: taos.bat; DestDir: "{app}\include"; Flags: igNoreversion;
;Source: taosdemo.png; DestDir: "{app}\include"; Flags: igNoreversion;
;Source: taosShell.png; DestDir: "{app}\include"; Flags: igNoreversion;
Source: favicon.ico; DestDir: "{app}\include"; Flags: igNoreversion;
Source: {#MyAppSourceDir}{#MyAppDLLName}; DestDir: "{win}\System32"; Flags: igNoreversion;
Source: {#MyAppSourceDir}{#MyAppCfgName}; DestDir: "{app}\cfg"; Flags: igNoreversion recursesubdirs createallsubdirs onlyifdoesntexist uninsneveruninstall
Source: {#MyAppSourceDir}{#MyAppDriverName}; DestDir: "{app}\driver"; Flags: igNoreversion recursesubdirs createallsubdirs
;Source: {#MyAppSourceDir}{#MyAppConnectorName}; DestDir: "{app}\connector"; Flags: igNoreversion recursesubdirs createallsubdirs
;Source: {#MyAppSourceDir}{#MyAppExamplesName}; DestDir: "{app}\examples"; Flags: igNoreversion recursesubdirs createallsubdirs
Source: {#MyAppSourceDir}{#MyAppIncludeName}; DestDir: "{app}\include"; Flags: igNoreversion recursesubdirs createallsubdirs
Source: {#MyAppSourceDir}{#MyAppExeName}; DestDir: "{app}"; Excludes: {#MyAppExcludeSource} ; Flags: igNoreversion recursesubdirs createallsubdirs
Source: {#MyAppSourceDir}{#MyAppTaosdemoExeName}; DestDir: "{app}"; Flags: igNoreversion recursesubdirs createallsubdirs
[UninstallDelete]
Name: {app}\driver; Type: filesandordirs
Name: {app}\connector; Type: filesandordirs
Name: {app}\examples; Type: filesandordirs
Name: {app}\include; Type: filesandordirs
[Tasks]
Name: "desktopicon";Description: "{cm:CreateDesktopIcon}"; GroupDescription:"{cm:AdditionalIcons}"; Flags: checkablealone
[Icons]
Name:"{group}\Taos Shell"; Filename: "{app}\include\{#MyAppTaosExeName}" ; Parameters: "taos.exe" ; IconFilename: "{app}\include\{#MyAppIco}"
Name:"{group}\Open TDengine Directory"; Filename: "{app}\"
Name:"{group}\Taosdemo"; Filename: "{app}\include\{#MyAppTaosExeName}" ; Parameters: "taosdemo.exe" ; IconFilename: "{app}\include\{#MyAppIco}"
Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}" ; IconFilename: "{app}\include\{#MyAppIco}"
Name:"{commondesktop}\Taos Shell"; Filename: "{app}\include\{#MyAppTaosExeName}" ; Parameters: "taos.exe" ; Tasks: desktopicon; WorkingDir: "{app}" ; IconFilename: "{app}\include\{#MyAppIco}"
[Messages]
ConfirmUninstall=Do you really want to uninstall TDengine from your computer?%n%nPress [Y] to completely delete %1 and all its components;%nPress [N] to keep the software on your computer.
TDengine is a high-efficient, scalable, high-available distributed time-series database, which makes a lot of optimizations on inserting and querying data, which is far more efficient than normal regular databases. So TDengine can meet the high requirements of IOT and other areas on storing and querying a large amount of data.
TDengine will be installed under C:\TDengine, users can modify configuration file C:\TDengine\cfg\taos.cfg, set the log file path or other parameters.
\ No newline at end of file
...@@ -193,7 +193,13 @@ void* interlocked_sub_fetch_ptr(void* volatile* ptr, void* val) { ...@@ -193,7 +193,13 @@ void* interlocked_sub_fetch_ptr(void* volatile* ptr, void* val) {
} }
int32_t interlocked_fetch_sub_32(int32_t volatile* ptr, int32_t val) { return _InterlockedExchangeAdd(ptr, -val); } int32_t interlocked_fetch_sub_32(int32_t volatile* ptr, int32_t val) { return _InterlockedExchangeAdd(ptr, -val); }
int64_t interlocked_fetch_sub_64(int64_t volatile* ptr, int64_t val) { return _InterlockedExchangeAdd64(ptr, -val); } int64_t interlocked_fetch_sub_64(int64_t volatile* ptr, int64_t val) {
#ifdef _TD_WINDOWS_32
return _InterlockedExchangeAdd((int32_t volatile*)ptr, -(int32_t)val);
#else
return _InterlockedExchangeAdd64(ptr, -val);
#endif
}
void* interlocked_fetch_sub_ptr(void* volatile* ptr, void* val) { void* interlocked_fetch_sub_ptr(void* volatile* ptr, void* val) {
#ifdef WINDOWS #ifdef WINDOWS
...@@ -375,8 +381,11 @@ int32_t atomic_exchange_32(int32_t volatile* ptr, int32_t val) { ...@@ -375,8 +381,11 @@ int32_t atomic_exchange_32(int32_t volatile* ptr, int32_t val) {
int64_t atomic_exchange_64(int64_t volatile* ptr, int64_t val) { int64_t atomic_exchange_64(int64_t volatile* ptr, int64_t val) {
#ifdef WINDOWS #ifdef WINDOWS
#ifdef _TD_WINDOWS_32
return _InterlockedExchange((int32_t volatile*)(ptr), (int32_t)(val));
#else
return _InterlockedExchange64((int64_t volatile*)(ptr), (int64_t)(val)); return _InterlockedExchange64((int64_t volatile*)(ptr), (int64_t)(val));
#elif defined(_TD_NINGSI_60) #endif#elif defined(_TD_NINGSI_60)
return atomic_exchange_64_impl((int64_t*)ptr, (int64_t)val); return atomic_exchange_64_impl((int64_t*)ptr, (int64_t)val);
#else #else
return __atomic_exchange_n((ptr), (val), __ATOMIC_SEQ_CST); return __atomic_exchange_n((ptr), (val), __ATOMIC_SEQ_CST);
...@@ -529,8 +538,11 @@ int32_t atomic_fetch_add_32(int32_t volatile* ptr, int32_t val) { ...@@ -529,8 +538,11 @@ int32_t atomic_fetch_add_32(int32_t volatile* ptr, int32_t val) {
int64_t atomic_fetch_add_64(int64_t volatile* ptr, int64_t val) { int64_t atomic_fetch_add_64(int64_t volatile* ptr, int64_t val) {
#ifdef WINDOWS #ifdef WINDOWS
#ifdef _TD_WINDOWS_32
return _InterlockedExchangeAdd((int32_t volatile*)(ptr), (int32_t)(val));
#else
return _InterlockedExchangeAdd64((int64_t volatile*)(ptr), (int64_t)(val)); return _InterlockedExchangeAdd64((int64_t volatile*)(ptr), (int64_t)(val));
#elif defined(_TD_NINGSI_60) #endif#elif defined(_TD_NINGSI_60)
return __sync_fetch_and_add((ptr), (val)); return __sync_fetch_and_add((ptr), (val));
#else #else
return __atomic_fetch_add((ptr), (val), __ATOMIC_SEQ_CST); return __atomic_fetch_add((ptr), (val), __ATOMIC_SEQ_CST);
...@@ -631,7 +643,11 @@ int32_t atomic_fetch_sub_32(int32_t volatile* ptr, int32_t val) { ...@@ -631,7 +643,11 @@ int32_t atomic_fetch_sub_32(int32_t volatile* ptr, int32_t val) {
int64_t atomic_fetch_sub_64(int64_t volatile* ptr, int64_t val) { int64_t atomic_fetch_sub_64(int64_t volatile* ptr, int64_t val) {
#ifdef WINDOWS #ifdef WINDOWS
#ifdef _TD_WINDOWS_32
return _InterlockedExchangeAdd((int32_t volatile*)(ptr), -(int32_t)(val));
#else
return _InterlockedExchangeAdd64((int64_t volatile*)(ptr), -(int64_t)(val)); return _InterlockedExchangeAdd64((int64_t volatile*)(ptr), -(int64_t)(val));
#endif
#elif defined(_TD_NINGSI_60) #elif defined(_TD_NINGSI_60)
return __sync_fetch_and_sub((ptr), (val)); return __sync_fetch_and_sub((ptr), (val));
#else #else
......
...@@ -48,7 +48,7 @@ char *strsep(char **stringp, const char *delim) { ...@@ -48,7 +48,7 @@ char *strsep(char **stringp, const char *delim) {
/* NOTREACHED */ /* NOTREACHED */
} }
/* Duplicate a string, up to at most size characters */ /* Duplicate a string, up to at most size characters */
char *strndup(const char *s, size_t size) { char *strndup(const char *s, int size) {
size_t l; size_t l;
char * s2; char * s2;
l = strlen(s); l = strlen(s);
...@@ -62,7 +62,7 @@ char *strndup(const char *s, size_t size) { ...@@ -62,7 +62,7 @@ char *strndup(const char *s, size_t size) {
} }
/* Copy no more than N characters of SRC to DEST, returning the address of /* Copy no more than N characters of SRC to DEST, returning the address of
the terminating '\0' in DEST, if any, or else DEST + N. */ the terminating '\0' in DEST, if any, or else DEST + N. */
char *stpncpy(char *dest, const char *src, size_t n) { char *stpncpy(char *dest, const char *src, int n) {
size_t size = strnlen(src, n); size_t size = strnlen(src, n);
memcpy(dest, src, size); memcpy(dest, src, size);
dest += size; dest += size;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册