#include "alloc-util.h"
#include "hwdb-util.h"
#include "selinux-util.h"
-#include "string-util.h"
#include "terminal-util.h"
#include "util.h"
#include "verbs.h"
static bool arg_strict = false;
static int verb_query(int argc, char *argv[], void *userdata) {
- _cleanup_(sd_hwdb_unrefp) sd_hwdb *hwdb = NULL;
- const char *key, *value;
- const char *modalias;
- int r;
-
- assert(argc >= 2);
- assert(argv);
-
- modalias = argv[1];
-
- r = sd_hwdb_new(&hwdb);
- if (r < 0)
- return r;
-
- SD_HWDB_FOREACH_PROPERTY(hwdb, modalias, key, value)
- printf("%s=%s\n", key, value);
-
- return 0;
+ return hwdb_query(argv[1]);
}
static int verb_update(int argc, char *argv[], void *userdata) {
/* SPDX-License-Identifier: LGPL-2.1+ */
#include <ctype.h>
+#include <stdio.h>
#include "alloc-util.h"
#include "conf-files.h"
return r;
}
+
+int hwdb_query(const char *modalias) {
+ _cleanup_(sd_hwdb_unrefp) sd_hwdb *hwdb = NULL;
+ const char *key, *value;
+ int r;
+
+ assert(modalias);
+
+ r = sd_hwdb_new(&hwdb);
+ if (r < 0)
+ return r;
+
+ SD_HWDB_FOREACH_PROPERTY(hwdb, modalias, key, value)
+ printf("%s=%s\n", key, value);
+
+ return 0;
+}
bool hwdb_validate(sd_hwdb *hwdb);
int hwdb_update(const char *root, const char *hwdb_bin_dir, bool strict, bool compat);
+int hwdb_query(const char *modalias);
#include <getopt.h>
-#include "sd-hwdb.h"
-
-#include "alloc-util.h"
#include "hwdb-util.h"
-#include "string-util.h"
#include "udevadm.h"
#include "util.h"
static bool arg_update = false;
static bool arg_strict = false;
-static int hwdb_test(void) {
- _cleanup_(sd_hwdb_unrefp) sd_hwdb *hwdb = NULL;
- const char *key, *value;
- int r;
-
- r = sd_hwdb_new(&hwdb);
- if (r < 0)
- return r;
-
- SD_HWDB_FOREACH_PROPERTY(hwdb, arg_test, key, value)
- printf("%s=%s\n", key, value);
-
- return 0;
-}
-
static int help(void) {
printf("%s hwdb [OPTIONS]\n\n"
" -h --help Print this message\n"
}
if (arg_test)
- return hwdb_test();
+ return hwdb_query(arg_test);
return 0;
}