@@ -94,10 +94,6 @@ size_t ICACHE_FLASH_ATTR strnlen(const char *s, size_t len) {
94
94
return (size_t )(cp - s );
95
95
}
96
96
97
- char * strstr (const char * haystack , const char * needle ) {
98
- return ets_strstr (haystack , needle );
99
- }
100
-
101
97
char * ICACHE_FLASH_ATTR strchr (const char * str , int character ) {
102
98
while (1 ) {
103
99
if (* str == 0x00 ) {
@@ -443,3 +439,56 @@ int* ICACHE_FLASH_ATTR __errno(void) {
443
439
return & errno_var ;
444
440
}
445
441
442
+
443
+ /*
444
+ * begin newlib/string/strlcpy.c
445
+ *
446
+ * Copyright (c) 1998 Todd C. Miller <[email protected] >
447
+ * All rights reserved.
448
+ *
449
+ * Redistribution and use in source and binary forms, with or without
450
+ * modification, are permitted provided that the following conditions
451
+ * are met:
452
+ * 1. Redistributions of source code must retain the above copyright
453
+ * notice, this list of conditions and the following disclaimer.
454
+ * 2. Redistributions in binary form must reproduce the above copyright
455
+ * notice, this list of conditions and the following disclaimer in the
456
+ * documentation and/or other materials provided with the distribution.
457
+ * 3. The name of the author may not be used to endorse or promote products
458
+ * derived from this software without specific prior written permission.
459
+ *
460
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
461
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
462
+ * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
463
+ * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
464
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
465
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
466
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
467
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
468
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
469
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
470
+ */
471
+
472
+ size_t ICACHE_FLASH_ATTR strlcpy (char * dst , const char * src , size_t size ) {
473
+ const char * s = src ;
474
+ size_t n = size ;
475
+
476
+ if (n != 0 && -- n != 0 ) {
477
+ do {
478
+ if ((* dst ++ = * s ++ ) == 0 )
479
+ break ;
480
+ } while (-- n != 0 );
481
+ }
482
+
483
+ if (n == 0 ) {
484
+ if (size != 0 )
485
+ * dst = 0 ;
486
+ while (* s ++ );
487
+ }
488
+
489
+ return (s - src - 1 );
490
+ }
491
+ /*
492
+ * end of newlib/string/strlcpy.c
493
+ */
494
+
0 commit comments