<cmdsynopsis>
<command>udevadm verify</command>
<arg choice="opt" rep="repeat">options</arg>
- <arg choice="plain" rep="repeat"><replaceable>file</replaceable></arg>
+ <arg choice="opt" rep="repeat"><replaceable>file</replaceable></arg>
</cmdsynopsis>
<cmdsynopsis>
<command>udevadm wait <optional>options</optional> <replaceable>device|syspath</replaceable></command>
<refsect2>
<title>udevadm verify
<arg choice="opt"><replaceable>options</replaceable></arg>
- <arg choice="plain" rep="repeat"><replaceable>file</replaceable></arg>
+ <arg choice="opt" rep="repeat"><replaceable>file</replaceable></arg>
…
</title>
<para>Verify syntactic and semantic correctness of udev rules files.</para>
- <para>Positional arguments should be used to specify one or more files to check.</para>
+ <para>Positional arguments could be used to specify one or more files to check.
+ If no files are specified, the udev rules are read from the files located in
+ the same udev/rules.d directories that are processed by the udev daemon.</para>
<para>The exit status is <constant>0</constant> if all specified udev rules files
are syntactically and semantically correct, and a non-zero error code otherwise.</para>
#include <stdlib.h>
#include <unistd.h>
+#include "conf-files.h"
+#include "constants.h"
#include "log.h"
#include "pretty-print.h"
#include "strv.h"
if (r < 0)
return log_oom();
- printf("%s verify [OPTIONS] FILE...\n"
+ printf("%s verify [OPTIONS] [FILE...]\n"
"\n%sVerify udev rules files.%s\n\n"
" -h --help Show this help\n"
" -V --version Show package version\n"
assert_not_reached();
}
- if (optind == argc)
- return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "No rules file specified.");
-
return 1;
}
if (!rules)
return -ENOMEM;
+ if (optind == argc) {
+ const char* const* rules_dirs = STRV_MAKE_CONST(CONF_PATHS("udev/rules.d"));
+ _cleanup_strv_free_ char **files = NULL;
+
+ r = conf_files_list_strv(&files, ".rules", NULL, 0, rules_dirs);
+ if (r < 0)
+ return log_error_errno(r, "Failed to enumerate rules files: %m");
+
+ return verify_rules(rules, files);
+ }
+
return verify_rules(rules, strv_skip(argv, optind));
}
assert_0 --version
assert_0 /dev/null
-# No rules file specified.
-assert_1
# unrecognized option '--unknown'
assert_1 --unknown
# option requires an argument -- 'N'