- /* skip nonprintable values */
- while (len) {
- if (isprint(value[len-1]) == 0)
- break;
- len--;
- }
- if (len == 0)
- printf(" SYSFS{%s}=\"%s\"\n", attr->name, value);
+ /* remove trailing newlines */
+ while (len && value[len-1] == '\n')
+ value[--len] = '\0';
+ /* skip nonprintable attributes */
+ while (len && isprint(value[len-1]))
+ len--;
+ if (len) {
+ dbg("attribute value of '%s' non-printable, skip", attr->name);
+ continue;