+ cur = 0;
+ while (cur < bufsize) {
+ count = buf_get_line(buf, bufsize, cur);
+ bufline = &buf[cur];
+ cur += count+1;
+
+ switch(bufline[0]) {
+ case 'P':
+ if (count > sizeof(path))
+ count = sizeof(path);
+ strlcpy(path, &bufline[2], count-1);
+ break;
+ case 'N':
+ case 'S':
+ if (count > sizeof(nodename))
+ count = sizeof(nodename);
+ strlcpy(nodename, &bufline[2], count-1);
+ dbg("compare '%s' '%s'", nodename, name);
+ if (strcmp(nodename, name) == 0) {
+ strlcpy(devpath, path, len);
+ file_unmap(buf, bufsize);
+ closedir(dir);
+ return 0;
+ }
+ break;
+ default:
+ continue;