/*
* kmod-modinfo - query kernel module information using libkmod.
*
- * Copyright (C) 2011-2012 ProFUSION embedded systems
+ * Copyright (C) 2011-2013 ProFUSION embedded systems
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include <errno.h>
+#include <getopt.h>
+#include <limits.h>
+#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
-#include <stdbool.h>
-#include <getopt.h>
-#include <errno.h>
#include <string.h>
-#include <limits.h>
-#include <sys/utsname.h>
#include <sys/stat.h>
-#include "libkmod.h"
+#include <sys/utsname.h>
+
+#include <shared/util.h>
+
+#include <libkmod.h>
#include "kmod.h"
"\t-b, --basedir=DIR Use DIR as filesystem root for /lib/modules\n"
"\t-V, --version Show version\n"
"\t-h, --help Show this help\n",
- binname);
+ program_invocation_short_name);
}
static bool is_module_filename(const char *name)
{
struct stat st;
- const char *ptr;
if (stat(name, &st) == 0 && S_ISREG(st.st_mode) &&
- (ptr = strstr(name, ".ko")) != NULL) {
- /*
- * We screened for .ko; make sure this is either at the end of
- * the name or followed by another '.' (e.g. gz or xz modules)
- */
- if(ptr[3] == '\0' || ptr[3] == '.')
+ path_ends_with_kmod_ext(name, strlen(name)))
return true;
- }
return false;
}