updated config
This commit is contained in:
1 parent
ced999e944
commit
cb6052a9d3
19 files changed
+331
-155
No files matched your search
@@ -139,3 +139,20 @@ pscanf(const char *path, const char *fmt, ...)
|
||||
|
||||
return (n == EOF) ? -1 : n;
|
||||
}
|
||||
|
||||
int
|
||||
lscanf(FILE *fp, const char *key, const char *fmt, void *res)
|
||||
{
|
||||
int n;
|
||||
char line[256];
|
||||
|
||||
n = -1;
|
||||
while (fgets(line, sizeof(line), fp))
|
||||
if (strncmp(line, key, strlen(key)) == 0) {
|
||||
n = sscanf(line + strlen(key), fmt, res);
|
||||
break;
|
||||
}
|
||||
|
||||
rewind(fp);
|
||||
return (n == 1) ? 1 : -1;
|
||||
}
|
||||
Reference in new issue
Block a user