if (r < 0)
return r;
- p = startswith(fdinfo, "mnt_id:");
- if (!p) {
- p = strstr(fdinfo, "\nmnt_id:");
- if (!p) /* The mnt_id field is a relatively new addition */
- return -EOPNOTSUPP;
-
- p += 8;
- }
+ p = find_line_startswith(fdinfo, "mnt_id:");
+ if (!p) /* The mnt_id field is a relatively new addition */
+ return -EOPNOTSUPP;
p += strspn(p, WHITESPACE);
p[strcspn(p, WHITESPACE)] = 0;
if (r < 0)
return r;
- p = startswith(fdinfo, "Pid:");
- if (!p) {
- p = strstr(fdinfo, "\nPid:");
- if (!p)
- return -ENOTTY; /* not a pidfd? */
-
- p += 5;
- }
+ p = find_line_startswith(fdinfo, "Pid:");
+ if (!p)
+ return -ENOTTY; /* not a pidfd? */
p += strspn(p, WHITESPACE);
p[strcspn(p, WHITESPACE)] = 0;
buf[n] = 0;
- p = startswith(buf, "X_IMPORT_PROGRESS=");
- if (!p) {
- p = strstr(buf, "\nX_IMPORT_PROGRESS=");
- if (!p)
- return 0;
-
- p += 19;
- }
+ p = find_line_startswith(buf, "X_IMPORT_PROGRESS=");
+ if (!p)
+ return 0;
e = strchrnul(p, '\n');
*e = 0;
if (r < 0)
return log_error_errno(r, "Failed to find catalog entry: %m");
- weblink = startswith(t, "Documentation:");
- if (!weblink) {
- weblink = strstr(t + 1, "\nDocumentation:");
- if (!weblink)
- goto notfound;
-
- weblink += 15;
- }
+ weblink = find_line_startswith(t, "Documentation:");
+ if (!weblink)
+ goto notfound;
/* Skip whitespace to value */
weblink += strspn(weblink, " \t");