+ 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 > DEVPATH_SIZE)
+ count = DEVPATH_SIZE-1;
+ strncpy(path, &bufline[2], count-2);
+ path[count-2] = '\0';
+ break;
+ case 'N':
+ case 'S':
+ if (count > NAME_SIZE)
+ count = NAME_SIZE-1;
+ strncpy(nodename, &bufline[2], count-2);
+ nodename[count-2] = '\0';
+ dbg("compare '%s' '%s'", nodename, name);
+ if (strcmp(nodename, name) == 0) {
+ strncpy(devpath, path, len);
+ devpath[len] = '\0';
+ file_unmap(buf, bufsize);
+ closedir(dir);
+ return 0;
+ }
+ break;
+ default:
+ continue;