summaryrefslogtreecommitdiff
path: root/udevinfo.c
diff options
context:
space:
mode:
authorkay.sievers@vrfy.org <kay.sievers@vrfy.org>2004-11-10 10:19:39 +0100
committerGreg KH <gregkh@suse.de>2005-04-26 22:21:20 -0700
commit31fd340352236c06c30a85fa9fbdbfbbd10bd439 (patch)
tree40bb22076ccb6fd31bf8732a79d7aa800c67710a /udevinfo.c
parent38753167e4e49879f97003f075158cc642bf0b0d (diff)
[PATCH] make udevinfo's -r option also workimg for symlink queries
[kay@pim udev.kay]$ ./udevinfo -r -q symlink -p /class/video4linux/video0 /dev/camera0 /dev/kamera0 /dev/videocam0 /dev/webcam0 [kay@pim udev.kay]$ ./udevinfo -q symlink -p /class/video4linux/video0 camera0 kamera0 videocam0 webcam0
Diffstat (limited to 'udevinfo.c')
-rw-r--r--udevinfo.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/udevinfo.c b/udevinfo.c
index 8fab86ca8c..290a09e880 100644
--- a/udevinfo.c
+++ b/udevinfo.c
@@ -266,7 +266,7 @@ static int process_options(void)
int root = 0;
int attributes = 0;
enum query_type query = NONE;
- char result[NAME_SIZE] = "";
+ char result[1024] = "";
char path[NAME_SIZE] = "";
char name[NAME_SIZE] = "";
char temp[NAME_SIZE];
@@ -401,7 +401,20 @@ print:
break;
case SYMLINK:
- strfieldcpy(result, udev.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: