plugins: minor coding style cleanup
static void load(void *arg)
{
- FILE *fp;
- DIR *dirp;
- struct dirent *direntp;
+ struct dirent *d;
char line[256];
int index = 1;
+ FILE *fp;
+ DIR *dir;
_d("Scanning " MODULES_LOAD_PATH " for config files ...");
- dirp = opendir(MODULES_LOAD_PATH);
- if (!dirp) return;
+ dir = opendir(MODULES_LOAD_PATH);
+ if (!dir)
+ return;
- while ((direntp = readdir(dirp)))
- {
+ while ((d = readdir(dir))) {
char module_path[PATH_MAX];
+
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");
- if (!fp) continue;
+ if (!fp)
+ continue;
while (fgets(line, sizeof(line), fp)) {
char cmd[CMD_SIZE], *mod, *args;
mod = strip_line(line);
- if (!*mod) continue;
+ if (!*mod)
+ continue;
mod = chomp(mod);
- if (!mod || !*mod) continue;
+ if (!mod || !*mod)
+ continue;
mod = strtok_r(mod, " ", &args);
+ if (!mod)
+ continue;
snprintf(cmd, sizeof(cmd), SERVICE_LINE, index, mod, mod, args, mod);
service_register(SVC_TYPE_TASK, cmd, global_rlimit, NULL);
@@ -80,7 +86,7 @@ static void load(void *arg)
fclose(fp);
}
- closedir(dirp);
+ closedir(dir);
}
static plugin_t plugin = {
