diff options
author | Kay Sievers <kay.sievers@vrfy.org> | 2007-09-20 15:25:29 +0200 |
---|---|---|
committer | Kay Sievers <kay.sievers@vrfy.org> | 2007-09-20 15:25:29 +0200 |
commit | 18770246edda383eef523a7e3aedd08ebbbde5cf (patch) | |
tree | 68050e39e0c070233208c2d0e58fe625f07fc764 /udevinfo.c | |
parent | c952356635a30f610a4d1b84e84d678fee7772c8 (diff) |
udevinfo: simplify symlink printing logic
Diffstat (limited to 'udevinfo.c')
-rw-r--r-- | udevinfo.c | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/udevinfo.c b/udevinfo.c index 8e54705fe3..eb9b353404 100644 --- a/udevinfo.c +++ b/udevinfo.c @@ -385,21 +385,14 @@ int main(int argc, char *argv[], char *envp[]) printf("%s\n", udev->name); break; case QUERY_SYMLINK: - if (list_empty(&udev->symlink_list)) - goto exit; - if (root) - list_for_each_entry(name_loop, &udev->symlink_list, node) - if (name_loop->node.next != &udev->symlink_list) - printf("%s/%s ", udev_root, name_loop->name); - else - printf("%s/%s", udev_root, name_loop->name); - else - list_for_each_entry(name_loop, &udev->symlink_list, node) - if (name_loop->node.next != &udev->symlink_list) - printf("%s ", name_loop->name); - else - printf("%s", name_loop->name); - printf("\n"); + list_for_each_entry(name_loop, &udev->symlink_list, node) { + char c = name_loop->node.next != &udev->symlink_list ? ' ' : '\n'; + + if (root) + printf("%s/%s%c", udev_root, name_loop->name, c); + else + printf("%s%c", name_loop->name, c); + } break; case QUERY_PATH: printf("%s\n", udev->dev->devpath); |