chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[PATCH] update TODO with some new, small items.
[elogind.git]
/
namedev.c
diff --git
a/namedev.c
b/namedev.c
index 80ab96afe53df483f4d7fb5444cc2b66816af9c0..0e1af9385fac995862570c30bddd9c464f63c287 100644
(file)
--- a/
namedev.c
+++ b/
namedev.c
@@
-151,20
+151,21
@@
static mode_t get_default_mode(struct sysfs_class_device *class_dev)
static void apply_format(struct udevice *udev, unsigned char *string)
{
static void apply_format(struct udevice *udev, unsigned char *string)
{
- char name[NAME_SIZE];
char temp[NAME_SIZE];
char temp[NAME_SIZE];
+ char temp1[NAME_SIZE];
char *tail;
char *pos;
char *pos2;
char *pos3;
int num;
char *tail;
char *pos;
char *pos2;
char *pos3;
int num;
+ pos = string;
while (1) {
num = 0;
while (1) {
num = 0;
- pos = strchr(
string
, '%');
+ pos = strchr(
pos
, '%');
if (pos) {
if (pos) {
-
*pos
= '\0';
+
pos[0]
= '\0';
tail = pos+1;
if (isdigit(tail[0])) {
num = (int) strtoul(&pos[1], &tail, 10);
tail = pos+1;
if (isdigit(tail[0])) {
num = (int) strtoul(&pos[1], &tail, 10);
@@
-173,7
+174,7
@@
static void apply_format(struct udevice *udev, unsigned char *string)
break;
}
}
break;
}
}
- strfieldcpy(
name
, tail+1);
+ strfieldcpy(
temp
, tail+1);
switch (tail[0]) {
case 'b':
switch (tail[0]) {
case 'b':
@@
-217,8
+218,8
@@
static void apply_format(struct udevice *udev, unsigned char *string)
break;
if (num) {
/* get part of return string */
break;
if (num) {
/* get part of return string */
- strncpy(temp
, udev->program_result, sizeof(temp
));
- pos2 = temp;
+ strncpy(temp
1, udev->program_result, sizeof(temp1
));
+ pos2 = temp
1
;
while (num) {
num--;
pos3 = strsep(&pos2, " ");
while (num) {
num--;
pos3 = strsep(&pos2, " ");
@@
-236,11
+237,15
@@
static void apply_format(struct udevice *udev, unsigned char *string)
dbg("substitute result string '%s'", udev->program_result);
}
break;
dbg("substitute result string '%s'", udev->program_result);
}
break;
+ case '%':
+ strcat(pos, "%");
+ pos++;
+ break;
default:
dbg("unknown substitution type '%%%c'", pos[1]);
break;
}
default:
dbg("unknown substitution type '%%%c'", pos[1]);
break;
}
- strcat(string,
name
);
+ strcat(string,
temp
);
} else
break;
}
} else
break;
}
@@
-309,7
+314,7
@@
static int execute_program(char *path, char *value, int len)
int value_set = 0;
char buffer[256];
char *pos;
int value_set = 0;
char buffer[256];
char *pos;
- char *args[
CALLOUT
_MAXARG];
+ char *args[
PROGRAM
_MAXARG];
int i;
dbg("executing '%s'", path);
int i;
dbg("executing '%s'", path);
@@
-331,7
+336,7
@@
static int execute_program(char *path, char *value, int len)
if (strchr(path, ' ')) {
/* exec with arguments */
pos = path;
if (strchr(path, ' ')) {
/* exec with arguments */
pos = path;
- for (i=0; i <
CALLOUT
_MAXARG-1; i++) {
+ for (i=0; i <
PROGRAM
_MAXARG-1; i++) {
args[i] = strsep(&pos, " ");
if (args[i] == NULL)
break;
args[i] = strsep(&pos, " ");
if (args[i] == NULL)
break;
@@
-449,7
+454,7
@@
static int match_id(struct config_device *dev, struct sysfs_class_device *class_
int found;
char *temp = NULL;
int found;
char *temp = NULL;
- /* we have to have a sysfs device for
NUMBER
to work */
+ /* we have to have a sysfs device for
ID
to work */
if (!sysfs_device)
return -ENODEV;
if (!sysfs_device)
return -ENODEV;
@@
-480,7
+485,7
@@
static int match_place(struct config_device *dev, struct sysfs_class_device *cla
int found;
char *temp = NULL;
int found;
char *temp = NULL;
- /* we have to have a sysfs device for
NUMBER
to work */
+ /* we have to have a sysfs device for
PLACE
to work */
if (!sysfs_device)
return -ENODEV;
if (!sysfs_device)
return -ENODEV;
@@
-716,7
+721,7
@@
int namedev_name_device(struct sysfs_class_device *class_dev, struct udevice *ud
}
/* Yup, this rule belongs to us! */
}
/* Yup, this rule belongs to us! */
- dbg("found matching rule, '%s' becomes '%s'", dev->kernel,
u
dev->name);
+ dbg("found matching rule, '%s' becomes '%s'", dev->kernel, dev->name);
strfieldcpy(udev->name, dev->name);
strfieldcpy(udev->symlink, dev->symlink);
goto found;
strfieldcpy(udev->name, dev->name);
strfieldcpy(udev->symlink, dev->symlink);
goto found;