n Windows, 'popen' accepts "[rw][bt]?" as valid modes
Added the modifiers 'b' and 't' to valid modes for 'popen' in Windows.
This commit is contained in:
18
liolib.c
18
liolib.c
@@ -52,12 +52,6 @@ static int l_checkmode (const char *mode) {
|
|||||||
** =======================================================
|
** =======================================================
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if !defined(l_checkmodep)
|
|
||||||
/* By default, Lua accepts only "r" or "w" as mode */
|
|
||||||
#define l_checkmodep(m) ((m[0] == 'r' || m[0] == 'w') && m[1] == '\0')
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#if !defined(l_popen) /* { */
|
#if !defined(l_popen) /* { */
|
||||||
|
|
||||||
#if defined(LUA_USE_POSIX) /* { */
|
#if defined(LUA_USE_POSIX) /* { */
|
||||||
@@ -70,6 +64,12 @@ static int l_checkmode (const char *mode) {
|
|||||||
#define l_popen(L,c,m) (_popen(c,m))
|
#define l_popen(L,c,m) (_popen(c,m))
|
||||||
#define l_pclose(L,file) (_pclose(file))
|
#define l_pclose(L,file) (_pclose(file))
|
||||||
|
|
||||||
|
#if !defined(l_checkmodep)
|
||||||
|
/* Windows accepts "[rw][bt]?" as valid modes */
|
||||||
|
#define l_checkmodep(m) ((m[0] == 'r' || m[0] == 'w') && \
|
||||||
|
(m[1] == '\0' || ((m[1] == 'b' || m[1] == 't') && m[2] == '\0')))
|
||||||
|
#endif
|
||||||
|
|
||||||
#else /* }{ */
|
#else /* }{ */
|
||||||
|
|
||||||
/* ISO C definitions */
|
/* ISO C definitions */
|
||||||
@@ -83,6 +83,12 @@ static int l_checkmode (const char *mode) {
|
|||||||
|
|
||||||
#endif /* } */
|
#endif /* } */
|
||||||
|
|
||||||
|
|
||||||
|
#if !defined(l_checkmodep)
|
||||||
|
/* By default, Lua accepts only "r" or "w" as valid modes */
|
||||||
|
#define l_checkmodep(m) ((m[0] == 'r' || m[0] == 'w') && m[1] == '\0')
|
||||||
|
#endif
|
||||||
|
|
||||||
/* }====================================================== */
|
/* }====================================================== */
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user