i = 0;
while (hp[i] != NULL)
{
- sscanf(hp[i], "%*s %s", cPath);
- if (strlen(cPath) && strnicmp(cPath, AFS, strlen(AFS)) == 0)
+ if (sscanf(hp[i], "%*s %s", cPath))
{
- sscanf(hp[i], "%*s %*s %*s %*s %s", cWeight);
- if (atoi(cWeight) < last_weight)
+ if (strnicmp(cPath, AFS, strlen(AFS)) == 0)
{
- strcpy(path, cPath);
- last_weight = (int)atoi(cWeight);
- }
+ if (sscanf(hp[i], "%*s %*s %*s %*s %s", cWeight))
+ {
+ if (atoi(cWeight) < last_weight)
+ {
+ strcpy(path, cPath);
+ last_weight = (int)atoi(cWeight);
+ }
+ }
+ else
+ strcpy(path, cPath);
+ }
}
++i;
}