summaryrefslogtreecommitdiff
path: root/udev
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@vrfy.org>2009-05-19 12:56:17 +0200
committerKay Sievers <kay.sievers@vrfy.org>2009-05-19 12:56:17 +0200
commita0ee5a05bb3a9a838c35e07ff7a0bb7bbd2d0c9b (patch)
tree48729c7d9c0a490d0718bd4b6cfc4687f3151344 /udev
parent055e40edc647d8ccfc27c9cd3163ab5dbf63ed6c (diff)
remove format char string truncation syntax
Diffstat (limited to 'udev')
-rw-r--r--udev/udev-event.c27
-rw-r--r--udev/udev.xml3
2 files changed, 0 insertions, 30 deletions
diff --git a/udev/udev-event.c b/udev/udev-event.c
index 345fb20e22..03ae352415 100644
--- a/udev/udev-event.c
+++ b/udev/udev-event.c
@@ -77,32 +77,12 @@ static char *get_format_attribute(struct udev *udev, char **str)
return attr;
}
-/* extract possible format length and move str behind it*/
-static int get_format_len(struct udev *udev, char **str)
-{
- int num;
- char *tail;
-
- if (isdigit(*str[0])) {
- num = (int) strtoul(*str, &tail, 10);
- if (num > 0) {
- *str = tail;
- dbg(udev, "format length=%i\n", num);
- return num;
- } else {
- err(udev, "format parsing error '%s'\n", *str);
- }
- }
- return -1;
-}
-
void udev_event_apply_format(struct udev_event *event, char *string, size_t maxsize)
{
struct udev_device *dev = event->dev;
char temp[UTIL_PATH_SIZE];
char temp2[UTIL_PATH_SIZE];
char *head, *tail, *cpos, *attr, *rest;
- int len;
int i;
int count;
enum subst_type {
@@ -153,7 +133,6 @@ void udev_event_apply_format(struct udev_event *event, char *string, size_t maxs
head = string;
while (1) {
- len = -1;
while (head[0] != '\0') {
if (head[0] == '$') {
/* substitute named variable */
@@ -188,7 +167,6 @@ void udev_event_apply_format(struct udev_event *event, char *string, size_t maxs
}
head[0] = '\0';
tail = head+1;
- len = get_format_len(event->udev, &tail);
for (subst = map; subst->name; subst++) {
if (tail[0] == subst->fmt) {
type = subst->type;
@@ -447,11 +425,6 @@ found:
err(event->udev, "unknown substitution type=%i\n", type);
break;
}
- /* possibly truncate to format-char specified length */
- if (len >= 0 && len < (int)strlen(head)) {
- head[len] = '\0';
- dbg(event->udev, "truncate to %i chars, subtitution string becomes '%s'\n", len, head);
- }
util_strlcat(string, temp, maxsize);
}
}
diff --git a/udev/udev.xml b/udev/udev.xml
index 084c13bd98..cd4884d3b5 100644
--- a/udev/udev.xml
+++ b/udev/udev.xml
@@ -620,9 +620,6 @@
</listitem>
</varlistentry>
</variablelist>
- <para>The count of characters to be substituted may be limited by specifying
- the format length value. For example, '%3s{file}' will only
- insert the first three characters of the sysfs attribute</para>
</refsect2>
</refsect1>