- 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);
+ int retval = 0;
+ const char *env;
+ char devpath[MAX_PATH_LEN];
+ static int export;
+ static const struct option options[] = {
+ { "usb-info", 0, NULL, 'u' },
+ { "num-info", 0, NULL, 'n' },
+ { "export", 0, NULL, 'x' },
+ { "help", 0, NULL, 'h' },
+ {}
+ };
+
+ logging_init("usb_id");
+ sysfs_init();
+
+ while (1) {
+ int option;
+
+ option = getopt_long(argc, argv, "nuxh", options, NULL);
+ if (option == -1)
+ break;