|
@@ -14,6 +14,7 @@ static int
|
|
find_device_by_model(ssize_t maxlen, char *conffile, char *model, int print)
|
|
find_device_by_model(ssize_t maxlen, char *conffile, char *model, int print)
|
|
{
|
|
{
|
|
// Check config/%model.conf in the current working directory
|
|
// Check config/%model.conf in the current working directory
|
|
|
|
+
|
|
snprintf(conffile, maxlen, "config/%s.conf", model);
|
|
snprintf(conffile, maxlen, "config/%s.conf", model);
|
|
if (print) {
|
|
if (print) {
|
|
printf("- %s\n", conffile);
|
|
printf("- %s\n", conffile);
|
|
@@ -46,7 +47,7 @@ find_device_by_model(ssize_t maxlen, char *conffile, char *model, int print)
|
|
}
|
|
}
|
|
|
|
|
|
int
|
|
int
|
|
-libmegapixels_find_config_verbose(char *configfile, int print)
|
|
|
|
|
|
+libmegapixels_find_config_verbose(ssize_t maxlen, char *configfile, int print)
|
|
{
|
|
{
|
|
char model[512];
|
|
char model[512];
|
|
FILE *fp;
|
|
FILE *fp;
|
|
@@ -63,7 +64,7 @@ libmegapixels_find_config_verbose(char *configfile, int print)
|
|
}
|
|
}
|
|
*(modelptr++) = (char) c;
|
|
*(modelptr++) = (char) c;
|
|
if (c == 0) {
|
|
if (c == 0) {
|
|
- if (find_device_by_model(sizeof(model), configfile, model, print)) {
|
|
|
|
|
|
+ if (find_device_by_model(maxlen, configfile, model, print)) {
|
|
return 1;
|
|
return 1;
|
|
}
|
|
}
|
|
modelptr = model;
|
|
modelptr = model;
|
|
@@ -72,7 +73,7 @@ libmegapixels_find_config_verbose(char *configfile, int print)
|
|
}
|
|
}
|
|
|
|
|
|
int
|
|
int
|
|
-libmegapixels_find_config(char *configfile)
|
|
|
|
|
|
+libmegapixels_find_config(ssize_t maxlen, char *configfile)
|
|
{
|
|
{
|
|
- return libmegapixels_find_config_verbose(configfile, 0);
|
|
|
|
|
|
+ return libmegapixels_find_config_verbose(maxlen, configfile, 0);
|
|
}
|
|
}
|