- case NAME:
- if (root) {
- snprintf(result, NAME_SIZE-1, "%s/%s", udev_root, udev.name);
- result[NAME_SIZE-1] = '\0';
- } else {
- strfieldcpy(result, udev.name);
- }
- break;
-
- case SYMLINK:
- if (root) {
- int slen;
- char *spos;
- char slink[NAME_SIZE];
-
- pos = result;
- foreach_strpart(udev.symlink, " \n\r", spos, slen) {
- strncpy(slink, spos, slen);
- slink[slen] = '\0';
- pos += sprintf(pos, "%s/%s ", udev_root, slink);
- }
- } else {
- strfieldcpy(result, udev.symlink);
- }
- break;
-
- case PATH:
- strfieldcpy(result, udev.devpath);
- break;
-
- case ALL:
+ case QUERY_NAME:
+ if (root)
+ printf("%s/%s\n", udev_root, udev.name);
+ else
+ printf("%s\n", udev.name);
+ goto exit;
+ case QUERY_SYMLINK:
+ if (list_empty(&udev.symlink_list))
+ goto exit;
+ if (root)
+ list_for_each_entry(name_loop, &udev.symlink_list, node)
+ printf("%s/%s ", udev_root, name_loop->name);
+ else
+ list_for_each_entry(name_loop, &udev.symlink_list, node)
+ printf("%s ", name_loop->name);
+ printf("\n");
+ goto exit;
+ case QUERY_PATH:
+ printf("%s\n", udev.devpath);
+ goto exit;
+ case QUERY_ENV:
+ list_for_each_entry(name_loop, &udev.env_list, node)
+ printf("%s\n", name_loop->name);
+ goto exit;
+ case QUERY_ALL: