* From: https://github.com/meshtastic/firmware/blob/3b0232de1b6282eacfbff6e50b68fca7e67b8511/src/meshUtils.cpp#L40 */
| 21 | * From: https://github.com/meshtastic/firmware/blob/3b0232de1b6282eacfbff6e50b68fca7e67b8511/src/meshUtils.cpp#L40 |
| 22 | */ |
| 23 | char* strnstr(const char* s, const char* find, size_t slen) { |
| 24 | char c; |
| 25 | if ((c = *find++) != '\0') { |
| 26 | char sc; |
| 27 | size_t len; |
| 28 | |
| 29 | len = strlen(find); |
| 30 | do { |
| 31 | do { |
| 32 | if (slen-- < 1 || (sc = *s++) == '\0') |
| 33 | return (nullptr); |
| 34 | } while (sc != c); |
| 35 | if (len > slen) |
| 36 | return (nullptr); |
| 37 | } while (strncmp(s, find, len) != 0); |
| 38 | s--; |
| 39 | } |
| 40 | return ((char*)s); |
| 41 | } |
| 42 | |
| 43 | /** |
| 44 | * From: https://github.com/meshtastic/firmware/blob/f81d3b045dd1b7e3ca7870af3da915ff4399ea98/src/gps/GPS.cpp |