1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-06-06 05:21:22 +03:00

emulation on host: avoid closing STDIN (#8577)

- avoid closing STDIN
- less verbose during compilation
- better handling user directories
- missing str{,n}case_P declarations
This commit is contained in:
david gauchard 2022-05-20 16:54:27 +02:00 committed by GitHub
parent 8f71d2c042
commit b080c50713
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 6 deletions

View File

@ -374,9 +374,10 @@ ssl: # download source and build BearSSL
cd ../../tools/sdk/ssl && $(MAKE) native$(N32) cd ../../tools/sdk/ssl && $(MAKE) native$(N32)
ULIBPATHS = $(shell echo $(ULIBDIRS) | sed 's,:, ,g') ULIBPATHS = $(shell echo $(ULIBDIRS) | sed 's,:, ,g')
USERLIBDIRS = $(shell test -z "$(ULIBPATHS)" || for d in $(ULIBPATHS); do for dd in $$d $$d/src $$d/src/libmad; do test -d $$dd && { echo -I$$dd; echo "userlib: using directory '$$dd'" 1>&2; } done; done) USERLIBDIRS = $(shell test -z "$(ULIBPATHS)" || for d in $(ULIBPATHS); do for dd in $$d $$d/utility $$d/src $$d/src/utility; do test -d $$dd && echo $$dd; done; done)
USERLIBSRCS = $(shell test -z "$(ULIBPATHS)" || for d in $(ULIBPATHS); do for ss in $$d/*.cpp $$d/src/*.cpp $$d/src/libmad/*.c; do test -r $$ss && echo $$ss; done; done) USERLIBSRCS := $(shell test -z "$(USERLIBDIRS)" || for d in $(USERLIBDIRS); do for ss in $$d/*.c $$d/*.cpp; do test -r $$ss && echo $$ss; done; done)
INC_PATHS += $(USERLIBDIRS) USERLIBINCS = $(shell for d in $(USERLIBDIRS); do echo -I$$d; done)
INC_PATHS += $(USERLIBINCS)
INC_PATHS += -I$(INODIR)/.. INC_PATHS += -I$(INODIR)/..
CPP_OBJECTS_CORE_EMU = $(CPP_SOURCES_CORE_EMU:.cpp=.cpp.o) $(USERLIBSRCS:.cpp=.cpp.o) $(USERCXXSOURCES:.cpp=.cpp.o) CPP_OBJECTS_CORE_EMU = $(CPP_SOURCES_CORE_EMU:.cpp=.cpp.o) $(USERLIBSRCS:.cpp=.cpp.o) $(USERCXXSOURCES:.cpp=.cpp.o)
C_OBJECTS_CORE_EMU = $(USERCSOURCES:.c=.c.o) C_OBJECTS_CORE_EMU = $(USERCSOURCES:.c=.c.o)

View File

@ -115,8 +115,14 @@ static int mock_stop_uart(void)
static uint8_t mock_read_uart(void) static uint8_t mock_read_uart(void)
{ {
uint8_t ch = 0; uint8_t ch = 0;
return (read(STDIN, &ch, 1) == 1) ? ch : 0; int ret = read(STDIN, &ch, 1);
if (ret == -1)
{
perror("read(STDIN,1)");
return 0;
}
return (ret == 1) ? ch : 0;
} }
void help(const char* argv0, int exitcode) void help(const char* argv0, int exitcode)

View File

@ -129,7 +129,7 @@ bool WiFiServer::hasClient()
void WiFiServer::close() void WiFiServer::close()
{ {
if (pcb2int(_listen_pcb) >= 0) if (pcb2int(_listen_pcb) >= 3) // 0=stdin 1=stdout 2=stderr
::close(pcb2int(_listen_pcb)); ::close(pcb2int(_listen_pcb));
_listen_pcb = int2pcb(-1); _listen_pcb = int2pcb(-1);
} }

View File

@ -75,10 +75,12 @@ inline int vsnprintf_P(char* str, size_t size, const char* format, va_list ap)
#define memmove_P memmove #define memmove_P memmove
#define strncpy_P strncpy #define strncpy_P strncpy
#define strcmp_P strcmp #define strcmp_P strcmp
#define strcasecmp_P strcasecmp
#define memccpy_P memccpy #define memccpy_P memccpy
#define snprintf_P snprintf #define snprintf_P snprintf
#define sprintf_P sprintf #define sprintf_P sprintf
#define strncmp_P strncmp #define strncmp_P strncmp
#define strncasecmp_P strncasecmp
#define strcat_P strcat #define strcat_P strcat
#endif #endif