string.c
来自「RT-Thread是发展中的下一代微内核嵌入式实时操作系统」· C语言 代码 · 共 47 行
C
47 行
/* * File : string.c * This file is part of RT-Thread RTOS * COPYRIGHT (C) 2008, RT-Thread Development Team * * The license and distribution terms for this file may be * found in the file LICENSE in this distribution or at * http://www.rt-thread.org/license/LICENSE * * Change Logs: * Date Author Notes * 2008-08-14 Bernard the first version */#include <rtthread.h>#if !defined (RT_USING_NEWLIB) && defined (RT_USING_MINILIBC)#include "string.h"/* there is no strcpy and strcmp implementation in RT-Thread */char *strcpy(char *dest, const char *src){ return rt_strncpy(dest, src, rt_strlen(src) + 1);}int strcmp (const char *s1, const char *s2){ while (*s1 && *s1 == *s2) s1++, s2++; return (*s1 - *s2);}#ifdef RT_USING_HEAPchar *strdup(const char *s){ size_t len = strlen(s) + 1; char *tmp = (char *)rt_malloc(len); if(!tmp) return NULL; rt_memcpy(tmp, s, len); return tmp;}#endif#endif
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?