View | Details | Raw Unified | Return to bug 1051465
Collapse All | Expand All

(-)a/man/udev.xml (+4 lines)
Lines 736-741 Link Here
736
          </listitem>
736
          </listitem>
737
        </varlistentry>
737
        </varlistentry>
738
      </variablelist>
738
      </variablelist>
739
740
      <para>The count of characters to be substituted may be limited by specifying
741
      the format length value. For example, <literal>%3s{file}</literal> will
742
      only insert the first three characters of the sysfs attribute.</para>
739
  </refsect1>
743
  </refsect1>
740
744
741
  <refsect1>
745
  <refsect1>
(-)a/src/udev/udev-event.c (-1 / +16 lines)
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
- 

Return to bug 1051465