aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2020-03-09 22:07:47 -0700
committerRob Landley <rob@landley.net>2020-03-10 09:48:15 -0500
commite6b3ac496f8b72f089247e93e6892bb6fa094976 (patch)
tree6f5751e14011383f2f5e78a92e3f266ed6da6160 /lib
parentbdcb9de92aba82c13554b7d198d3fffabecd976b (diff)
downloadtoybox-e6b3ac496f8b72f089247e93e6892bb6fa094976.tar.gz
modinfo: various fixes.
I came here because the new -Wno-unreachable-code-loop-increment warning didn't like the for loop on line 86. That loop is indeed not necessary. Use strend() to do a string suffix match. Use memmem() to search. It's available on macOS and Android by default, but it's behind _GNU_SOURCE for glibc, so add that to portability.h. Output the tags in the same order as the Debian modinfo. I've left "parmtype" in even though the Debian modinfo doesn't output it at all. Also fix the tests so that they work on a device that has modules for multiple kernels installed (like my laptop) --- make sure that the two modules we pick come from the same kernel.
Diffstat (limited to 'lib')
-rw-r--r--lib/portability.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/portability.h b/lib/portability.h
index d81ddead..76790f4d 100644
--- a/lib/portability.h
+++ b/lib/portability.h
@@ -103,6 +103,8 @@ char *dirname(char *path);
char *__xpg_basename(char *path);
static inline char *basename(char *path) { return __xpg_basename(path); }
char *strcasestr(const char *haystack, const char *needle);
+void *memmem(const void *haystack, size_t haystack_length,
+ const void *needle, size_t needle_length);
#endif // defined(glibc)
// getopt_long(), getopt_long_only(), and struct option.