- int retval;
- char *devpath;
- char target_path[MAX_NAME_LEN];
- int option;
-
- dbg("argc is %d", argc);
- if (sysfs_get_mnt_path(sysfs_mnt_path, MAX_NAME_LEN)) {
- info("sysfs_get_mnt_path failed: %s",
- strerror(errno));
- exit(1);
- }
-
- while ((option = getopt(argc, argv, "dnux")) != -1 ) {
- if (optarg)
- dbg("option '%c' arg '%s'", option, optarg);
- else
- dbg("option '%c'", option);
+ static const struct option options[] = {
+ { "usb-info", no_argument, NULL, 'u' },
+ { "num-info", no_argument, NULL, 'n' },
+ { "export", no_argument, NULL, 'x' },
+ { "debug", no_argument, NULL, 'd' },
+ { "help", no_argument, NULL, 'h' },
+ {}
+ };
+ struct udev *udev;
+ struct udev_device *dev;
+ char syspath[UTIL_PATH_SIZE];
+ const char *devpath;
+ static int export;
+ int retval = 0;
+
+ udev = udev_new();
+ if (udev == NULL)
+ goto exit;
+
+ logging_init("usb_id");
+ udev_set_log_fn(udev, log_fn);
+
+ while (1) {
+ int option;
+
+ option = getopt_long(argc, argv, "dnuxh", options, NULL);
+ if (option == -1)
+ break;