+ /* process options */
+ if (query != NONE) {
+ if (path[0] == '\0') {
+ printf("query needs device path specified\n");
+ return -EINVAL;
+ }
+
+ retval = udevdb_open_ro();
+ if (retval != 0) {
+ printf("unable to open udev database\n");
+ return -EACCES;
+ }
+ retval = udevdb_get_dev(path, &dev);
+ if (retval == 0) {
+ switch(query) {
+ case NAME:
+ if (root)
+ strfieldcpy(result, udev_root);
+ strncat(result, dev.name, sizeof(result));
+ break;
+
+ case SYMLINK:
+ strfieldcpy(result, dev.symlink);
+ break;
+
+ case GROUP:
+ strfieldcpy(result, dev.group);
+ break;
+
+ case OWNER:
+ strfieldcpy(result, dev.owner);
+ break;
+
+ default:
+ break;
+ }
+ printf("%s\n", result);
+ } else {
+ printf("device not found in udev database\n");
+ }
+ udevdb_exit();
+ return retval;
+ }
+
+ if (root) {
+ printf("%s\n", udev_root);
+ return 0;
+ }
+