|
Lines 158-169
size_t udev_event_apply_format(struct udev_event *event,
Link Here
|
| 158 |
} else if (from[0] == '%') { |
158 |
} else if (from[0] == '%') { |
| 159 |
/* substitute format char */ |
159 |
/* substitute format char */ |
| 160 |
unsigned int i; |
160 |
unsigned int i; |
|
|
161 |
unsigned int num = 0; |
| 162 |
char from1 = from[1]; |
| 161 |
|
163 |
|
| 162 |
if (from[1] == '%') { |
164 |
if (from[1] == '%') { |
| 163 |
from++; |
165 |
from++; |
| 164 |
goto copy; |
166 |
goto copy; |
| 165 |
} |
167 |
} |
| 166 |
|
168 |
|
|
|
169 |
/* extract possible format length and move from behind it*/ |
| 170 |
if (isdigit(from1)) { |
| 171 |
char *tail; |
| 172 |
|
| 173 |
from++; |
| 174 |
num = (int) strtoul(from, &tail, 10); |
| 175 |
if (num > 0) { |
| 176 |
log_debug("format length='%i'", num); |
| 177 |
from = strjoina("%", tail); |
| 178 |
l = num+1; |
| 179 |
} else |
| 180 |
log_error("format parsing error '%s'", from); |
| 181 |
} |
| 182 |
|
| 167 |
for (i = 0; i < ELEMENTSOF(map); i++) { |
183 |
for (i = 0; i < ELEMENTSOF(map); i++) { |
| 168 |
if (from[1] == map[i].fmt) { |
184 |
if (from[1] == map[i].fmt) { |
| 169 |
type = map[i].type; |
185 |
type = map[i].type; |
| 170 |
- |
|
|