Skip to content

Commit

Permalink
Merge pull request esp8266#516 from esp8266/feature/ssdp
Browse files Browse the repository at this point in the history
SSDP library
  • Loading branch information
igrr committed Jul 7, 2015
2 parents 7891a84 + 1be16c7 commit b482a97
Show file tree
Hide file tree
Showing 7 changed files with 707 additions and 6 deletions.
4 changes: 2 additions & 2 deletions cores/esp8266/Print.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ size_t ICACHE_FLASH_ATTR Print::write(const uint8_t *buffer, size_t size) {
size_t Print::printf(const char *format, ...) {
va_list arg;
va_start(arg, format);
char temp[256];
size_t len = ets_vsnprintf(temp, 256, format, arg);
char temp[1460];
size_t len = ets_vsnprintf(temp, 1460, format, arg);
len = print(temp);
va_end(arg);
return len;
Expand Down
57 changes: 53 additions & 4 deletions cores/esp8266/libc_replacements.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,6 @@ size_t ICACHE_FLASH_ATTR strnlen(const char *s, size_t len) {
return (size_t)(cp - s);
}

char* strstr(const char *haystack, const char *needle) {
return ets_strstr(haystack, needle);
}

char* ICACHE_FLASH_ATTR strchr(const char * str, int character) {
while(1) {
if(*str == 0x00) {
Expand Down Expand Up @@ -443,3 +439,56 @@ int* ICACHE_FLASH_ATTR __errno(void) {
return &errno_var;
}


/*
* begin newlib/string/strlcpy.c
*
* Copyright (c) 1998 Todd C. Miller <[email protected]>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

size_t ICACHE_FLASH_ATTR strlcpy(char* dst, const char* src, size_t size) {
const char *s = src;
size_t n = size;

if (n != 0 && --n != 0) {
do {
if ((*dst++ = *s++) == 0)
break;
} while (--n != 0);
}

if (n == 0) {
if (size != 0)
*dst = 0;
while (*s++);
}

return(s - src - 1);
}
/*
* end of newlib/string/strlcpy.c
*/

Loading

0 comments on commit b482a97

Please sign in to comment.