chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
unit-name: fix escaping logic in unit_name_mangle_with_suffix()
[elogind.git]
/
src
/
udev
/
udevadm-test-builtin.c
diff --git
a/src/udev/udevadm-test-builtin.c
b/src/udev/udevadm-test-builtin.c
index f4aa21ee72fcc95fcd8d185ca0d68a63bd22fec6..a300e1e9d7cde1490ee3d3cc58f78d4e672390eb 100644
(file)
--- a/
src/udev/udevadm-test-builtin.c
+++ b/
src/udev/udevadm-test-builtin.c
@@
-23,7
+23,6
@@
#include <errno.h>
#include <dirent.h>
#include <fcntl.h>
#include <errno.h>
#include <dirent.h>
#include <fcntl.h>
-#include <syslog.h>
#include <getopt.h>
#include <signal.h>
#include <time.h>
#include <getopt.h>
#include <signal.h>
#include <time.h>
@@
-34,16
+33,14
@@
#include "udev.h"
#include "udev.h"
-static void help(struct udev *udev)
-{
+static void help(struct udev *udev) {
fprintf(stderr, "\n");
fprintf(stderr, "\n");
- fprintf(stderr, "Usage: udevadm builtin [--help]
<command> <syspath>
\n");
+ fprintf(stderr, "Usage: udevadm builtin [--help]
COMMAND SYSPATH
\n");
udev_builtin_list(udev);
fprintf(stderr, "\n");
}
udev_builtin_list(udev);
fprintf(stderr, "\n");
}
-static int adm_builtin(struct udev *udev, int argc, char *argv[])
-{
+static int adm_builtin(struct udev *udev, int argc, char *argv[]) {
static const struct option options[] = {
{ "help", no_argument, NULL, 'h' },
{}
static const struct option options[] = {
{ "help", no_argument, NULL, 'h' },
{}
@@
-53,21
+50,14
@@
static int adm_builtin(struct udev *udev, int argc, char *argv[])
char filename[UTIL_PATH_SIZE];
struct udev_device *dev = NULL;
enum udev_builtin_cmd cmd;
char filename[UTIL_PATH_SIZE];
struct udev_device *dev = NULL;
enum udev_builtin_cmd cmd;
- int rc = EXIT_SUCCESS;
+ int rc = EXIT_SUCCESS
, c
;
- for (;;) {
- int option;
-
- option = getopt_long(argc, argv, "h", options, NULL);
- if (option == -1)
- break;
-
- switch (option) {
+ while ((c = getopt_long(argc, argv, "h", options, NULL)) >= 0)
+ switch (c) {
case 'h':
help(udev);
goto out;
}
case 'h':
help(udev);
goto out;
}
- }
command = argv[optind++];
if (command == NULL) {
command = argv[optind++];
if (command == NULL) {
@@
-79,7
+69,7
@@
static int adm_builtin(struct udev *udev, int argc, char *argv[])
syspath = argv[optind++];
if (syspath == NULL) {
syspath = argv[optind++];
if (syspath == NULL) {
- fprintf(stderr, "syspath missing\n
\n
");
+ fprintf(stderr, "syspath missing\n");
rc = 3;
goto out;
}
rc = 3;
goto out;
}