mirror of
https://github.com/troglobit/finit.git
synced 2026-11-07 16:01:08 +00:00
plugins: minor coding style cleanup
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
1 parent
38f3ecf01f
commit
d994420d4d
1 file changed
+18
-12
+18
-12
@@ -40,36 +40,42 @@
|
|||||||
|
|
||||||
static void load(void *arg)
|
static void load(void *arg)
|
||||||
{
|
{
|
||||||
FILE *fp;
|
struct dirent *d;
|
||||||
DIR *dirp;
|
|
||||||
struct dirent *direntp;
|
|
||||||
char line[256];
|
char line[256];
|
||||||
int index = 1;
|
int index = 1;
|
||||||
|
FILE *fp;
|
||||||
|
DIR *dir;
|
||||||
|
|
||||||
_d("Scanning " MODULES_LOAD_PATH " for config files ...");
|
_d("Scanning " MODULES_LOAD_PATH " for config files ...");
|
||||||
|
|
||||||
dirp = opendir(MODULES_LOAD_PATH);
|
dir = opendir(MODULES_LOAD_PATH);
|
||||||
if (!dirp) return;
|
if (!dir)
|
||||||
|
return;
|
||||||
|
|
||||||
while ((direntp = readdir(dirp)))
|
while ((d = readdir(dir))) {
|
||||||
{
|
|
||||||
char module_path[PATH_MAX];
|
char module_path[PATH_MAX];
|
||||||
|
|
||||||
strlcpy(module_path, MODULES_LOAD_PATH "/", sizeof(module_path));
|
strlcpy(module_path, MODULES_LOAD_PATH "/", sizeof(module_path));
|
||||||
strlcat(module_path, direntp->d_name, sizeof(module_path));
|
strlcat(module_path, d->d_name, sizeof(module_path));
|
||||||
|
|
||||||
fp = fopen(module_path, "r");
|
fp = fopen(module_path, "r");
|
||||||
if (!fp) continue;
|
if (!fp)
|
||||||
|
continue;
|
||||||
|
|
||||||
while (fgets(line, sizeof(line), fp)) {
|
while (fgets(line, sizeof(line), fp)) {
|
||||||
char cmd[CMD_SIZE], *mod, *args;
|
char cmd[CMD_SIZE], *mod, *args;
|
||||||
|
|
||||||
mod = strip_line(line);
|
mod = strip_line(line);
|
||||||
if (!*mod) continue;
|
if (!*mod)
|
||||||
|
continue;
|
||||||
|
|
||||||
mod = chomp(mod);
|
mod = chomp(mod);
|
||||||
if (!mod || !*mod) continue;
|
if (!mod || !*mod)
|
||||||
|
continue;
|
||||||
|
|
||||||
mod = strtok_r(mod, " ", &args);
|
mod = strtok_r(mod, " ", &args);
|
||||||
|
if (!mod)
|
||||||
|
continue;
|
||||||
|
|
||||||
snprintf(cmd, sizeof(cmd), SERVICE_LINE, index, mod, mod, args, mod);
|
snprintf(cmd, sizeof(cmd), SERVICE_LINE, index, mod, mod, args, mod);
|
||||||
service_register(SVC_TYPE_TASK, cmd, global_rlimit, NULL);
|
service_register(SVC_TYPE_TASK, cmd, global_rlimit, NULL);
|
||||||
@@ -80,7 +86,7 @@ static void load(void *arg)
|
|||||||
fclose(fp);
|
fclose(fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
closedir(dirp);
|
closedir(dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
static plugin_t plugin = {
|
static plugin_t plugin = {
|
||||||
|
|||||||
Reference in new issue
Block a user