mirror of
https://github.com/cesanta/mongoose.git
synced 2026-11-09 16:21:45 +00:00
Remove MG_ENABLE_DIRLIST
This commit is contained in:
1 parent
969b84043c
commit
5bc164de76
10 files changed
+35
-33
No files matched your search
@@ -241,7 +241,6 @@ Here is a list of build constants and their default values:
|
|||||||
|MG_ENABLE_LOG | 1 | Enable `LOG()` macro |
|
|MG_ENABLE_LOG | 1 | Enable `LOG()` macro |
|
||||||
|MG_ENABLE_MD5 | 0 | Use native MD5 implementation |
|
|MG_ENABLE_MD5 | 0 | Use native MD5 implementation |
|
||||||
|MG_ENABLE_SSI | 1 | Enable serving SSI files by `mg_http_serve_dir()` |
|
|MG_ENABLE_SSI | 1 | Enable serving SSI files by `mg_http_serve_dir()` |
|
||||||
|MG_ENABLE_DIRLIST | 0 | Enable directory listing |
|
|
||||||
|MG_ENABLE_CUSTOM_RANDOM | 0 | Provide custom RNG function `mg_random()` |
|
|MG_ENABLE_CUSTOM_RANDOM | 0 | Provide custom RNG function `mg_random()` |
|
||||||
|MG_ENABLE_PACKED_FS | 0 | Enable embedded FS support |
|
|MG_ENABLE_PACKED_FS | 0 | Enable embedded FS support |
|
||||||
|MG_ENABLE_FATFS | 0 | Enable embedded FAT FS support |
|
|MG_ENABLE_FATFS | 0 | Enable embedded FAT FS support |
|
||||||
|
|||||||
+16
-5
@@ -3900,9 +3900,17 @@ const char *mg_strstr(const struct mg_str haystack,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool is_digit(int c) {
|
||||||
|
return c >= '0' && c <= '9';
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool is_space(int c) {
|
||||||
|
return c == ' ' || c == '\r' || c == '\n' || c == '\t';
|
||||||
|
}
|
||||||
|
|
||||||
struct mg_str mg_strstrip(struct mg_str s) {
|
struct mg_str mg_strstrip(struct mg_str s) {
|
||||||
while (s.len > 0 && isspace((int) *s.ptr)) s.ptr++, s.len--;
|
while (s.len > 0 && is_space((int) *s.ptr)) s.ptr++, s.len--;
|
||||||
while (s.len > 0 && isspace((int) *(s.ptr + s.len - 1))) s.len--;
|
while (s.len > 0 && is_space((int) *(s.ptr + s.len - 1))) s.len--;
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4115,14 +4123,14 @@ size_t mg_vsnprintf(char *buf, size_t len, const char *fmt, va_list ap) {
|
|||||||
if (c == '#') x++, c = fmt[++i];
|
if (c == '#') x++, c = fmt[++i];
|
||||||
if (c == '-') minus++, c = fmt[++i];
|
if (c == '-') minus++, c = fmt[++i];
|
||||||
if (c == '0') pad = '0', c = fmt[++i];
|
if (c == '0') pad = '0', c = fmt[++i];
|
||||||
while (isdigit(c)) w *= 10, w += (size_t) (c - '0'), c = fmt[++i];
|
while (is_digit(c)) w *= 10, w += (size_t) (c - '0'), c = fmt[++i];
|
||||||
if (c == '.') {
|
if (c == '.') {
|
||||||
c = fmt[++i];
|
c = fmt[++i];
|
||||||
if (c == '*') {
|
if (c == '*') {
|
||||||
pr = (size_t) va_arg(ap, int);
|
pr = (size_t) va_arg(ap, int);
|
||||||
c = fmt[++i];
|
c = fmt[++i];
|
||||||
} else {
|
} else {
|
||||||
while (isdigit(c)) pr *= 10, pr += (size_t) (c - '0'), c = fmt[++i];
|
while (is_digit(c)) pr *= 10, pr += (size_t) (c - '0'), c = fmt[++i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
while (c == 'h') c = fmt[++i]; // Treat h and hh as int
|
while (c == 'h') c = fmt[++i]; // Treat h and hh as int
|
||||||
@@ -4170,7 +4178,10 @@ size_t mg_vsnprintf(char *buf, size_t len, const char *fmt, va_list ap) {
|
|||||||
if (n < len) buf[n] = '%';
|
if (n < len) buf[n] = '%';
|
||||||
n++;
|
n++;
|
||||||
} else {
|
} else {
|
||||||
abort(); // Unsupported format specifier
|
if (n < len) buf[n] = '%';
|
||||||
|
n++;
|
||||||
|
if (n < len) buf[n] = c;
|
||||||
|
n++;
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
+1
-11
@@ -121,7 +121,6 @@ extern "C" {
|
|||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
#define MG_PATH_MAX 128
|
#define MG_PATH_MAX 128
|
||||||
#define MG_ENABLE_DIRLIST 1
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -148,7 +147,6 @@ extern "C" {
|
|||||||
#include <esp_system.h>
|
#include <esp_system.h>
|
||||||
|
|
||||||
#define MG_PATH_MAX 128
|
#define MG_PATH_MAX 128
|
||||||
#define MG_ENABLE_DIRLIST 1
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -316,10 +314,6 @@ struct timeval {
|
|||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#ifndef MG_ENABLE_DIRLIST
|
|
||||||
#define MG_ENABLE_DIRLIST 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
@@ -409,10 +403,6 @@ typedef int socklen_t;
|
|||||||
#define S_ISDIR(x) (((x) &_S_IFMT) == _S_IFDIR)
|
#define S_ISDIR(x) (((x) &_S_IFMT) == _S_IFDIR)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef MG_ENABLE_DIRLIST
|
|
||||||
#define MG_ENABLE_DIRLIST 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
@@ -466,7 +456,7 @@ typedef int socklen_t;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef MG_ENABLE_DIRLIST
|
#ifndef MG_ENABLE_DIRLIST
|
||||||
#define MG_ENABLE_DIRLIST 0
|
#define MG_ENABLE_DIRLIST 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef MG_ENABLE_CUSTOM_RANDOM
|
#ifndef MG_ENABLE_CUSTOM_RANDOM
|
||||||
|
|||||||
@@ -18,6 +18,5 @@
|
|||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
#define MG_PATH_MAX 128
|
#define MG_PATH_MAX 128
|
||||||
#define MG_ENABLE_DIRLIST 1
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -22,6 +22,5 @@
|
|||||||
#include <esp_system.h>
|
#include <esp_system.h>
|
||||||
|
|
||||||
#define MG_PATH_MAX 128
|
#define MG_PATH_MAX 128
|
||||||
#define MG_ENABLE_DIRLIST 1
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -30,8 +30,4 @@
|
|||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#ifndef MG_ENABLE_DIRLIST
|
|
||||||
#define MG_ENABLE_DIRLIST 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -86,8 +86,4 @@ typedef int socklen_t;
|
|||||||
#define S_ISDIR(x) (((x) &_S_IFMT) == _S_IFDIR)
|
#define S_ISDIR(x) (((x) &_S_IFMT) == _S_IFDIR)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef MG_ENABLE_DIRLIST
|
|
||||||
#define MG_ENABLE_DIRLIST 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
+1
-1
@@ -50,7 +50,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef MG_ENABLE_DIRLIST
|
#ifndef MG_ENABLE_DIRLIST
|
||||||
#define MG_ENABLE_DIRLIST 0
|
#define MG_ENABLE_DIRLIST 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef MG_ENABLE_CUSTOM_RANDOM
|
#ifndef MG_ENABLE_CUSTOM_RANDOM
|
||||||
|
|||||||
@@ -81,9 +81,17 @@ const char *mg_strstr(const struct mg_str haystack,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool is_digit(int c) {
|
||||||
|
return c >= '0' && c <= '9';
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool is_space(int c) {
|
||||||
|
return c == ' ' || c == '\r' || c == '\n' || c == '\t';
|
||||||
|
}
|
||||||
|
|
||||||
struct mg_str mg_strstrip(struct mg_str s) {
|
struct mg_str mg_strstrip(struct mg_str s) {
|
||||||
while (s.len > 0 && isspace((int) *s.ptr)) s.ptr++, s.len--;
|
while (s.len > 0 && is_space((int) *s.ptr)) s.ptr++, s.len--;
|
||||||
while (s.len > 0 && isspace((int) *(s.ptr + s.len - 1))) s.len--;
|
while (s.len > 0 && is_space((int) *(s.ptr + s.len - 1))) s.len--;
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -296,14 +304,14 @@ size_t mg_vsnprintf(char *buf, size_t len, const char *fmt, va_list ap) {
|
|||||||
if (c == '#') x++, c = fmt[++i];
|
if (c == '#') x++, c = fmt[++i];
|
||||||
if (c == '-') minus++, c = fmt[++i];
|
if (c == '-') minus++, c = fmt[++i];
|
||||||
if (c == '0') pad = '0', c = fmt[++i];
|
if (c == '0') pad = '0', c = fmt[++i];
|
||||||
while (isdigit(c)) w *= 10, w += (size_t) (c - '0'), c = fmt[++i];
|
while (is_digit(c)) w *= 10, w += (size_t) (c - '0'), c = fmt[++i];
|
||||||
if (c == '.') {
|
if (c == '.') {
|
||||||
c = fmt[++i];
|
c = fmt[++i];
|
||||||
if (c == '*') {
|
if (c == '*') {
|
||||||
pr = (size_t) va_arg(ap, int);
|
pr = (size_t) va_arg(ap, int);
|
||||||
c = fmt[++i];
|
c = fmt[++i];
|
||||||
} else {
|
} else {
|
||||||
while (isdigit(c)) pr *= 10, pr += (size_t) (c - '0'), c = fmt[++i];
|
while (is_digit(c)) pr *= 10, pr += (size_t) (c - '0'), c = fmt[++i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
while (c == 'h') c = fmt[++i]; // Treat h and hh as int
|
while (c == 'h') c = fmt[++i]; // Treat h and hh as int
|
||||||
@@ -351,7 +359,10 @@ size_t mg_vsnprintf(char *buf, size_t len, const char *fmt, va_list ap) {
|
|||||||
if (n < len) buf[n] = '%';
|
if (n < len) buf[n] = '%';
|
||||||
n++;
|
n++;
|
||||||
} else {
|
} else {
|
||||||
abort(); // Unsupported format specifier
|
if (n < len) buf[n] = '%';
|
||||||
|
n++;
|
||||||
|
if (n < len) buf[n] = c;
|
||||||
|
n++;
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -18,3 +18,4 @@
|
|||||||
|
|
||||||
#define MG_PATH_MAX 100
|
#define MG_PATH_MAX 100
|
||||||
#define MG_ENABLE_SOCKET 0
|
#define MG_ENABLE_SOCKET 0
|
||||||
|
#define MG_ENABLE_DIRLIST 0
|
||||||
Reference in new issue
Block a user