summaryrefslogtreecommitdiff
path: root/namedev.c
diff options
context:
space:
mode:
authorkay.sievers@vrfy.org <kay.sievers@vrfy.org>2004-02-17 01:29:03 -0800
committerGreg KH <gregkh@suse.de>2005-04-26 21:32:28 -0700
commit88f09368b3dc2d17cf2ce1a4841e42a120a4dbb9 (patch)
tree788fc630fa0a494b10d9906277fe6fd949706b38 /namedev.c
parent16378373cb9d96e5d424921806ff71f218e92694 (diff)
[PATCH] udev - switch callout part selector to {attribute}
Here we change the magic callout part number selector to the new atribute syntax. The syntax to select the second part of the callout string: '%2c' is now '%c{2}' I think it's more clear and we no longer misuse the length argument. The old syntax is still supported, but we should remove it some time in the future.
Diffstat (limited to 'namedev.c')
-rw-r--r--namedev.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/namedev.c b/namedev.c
index 942788b2a2..186a9f5cc2 100644
--- a/namedev.c
+++ b/namedev.c
@@ -219,6 +219,7 @@ static void apply_format(struct udevice *udev, unsigned char *string, struct sys
char *pos3;
char *attr;
int num;
+ int i;
char c;
struct sysfs_attribute *tmpattr;
@@ -270,11 +271,15 @@ static void apply_format(struct udevice *udev, unsigned char *string, struct sys
case 'c':
if (strlen(udev->program_result) == 0)
break;
- if (num > 0) {
+ /* get part part of the result string */
+ i = num; /* num syntax is deprecated and will be removed */
+ if (attr != NULL)
+ i = atoi(attr);
+ if (i > 0) {
strncpy(temp1, udev->program_result, sizeof(temp1));
pos2 = temp1;
- while (num) {
- num--;
+ while (i) {
+ i--;
pos3 = strsep(&pos2, " ");
if (pos3 == NULL) {
dbg("requested part of result string not found");