summaryrefslogtreecommitdiffabout
path: root/src/configuration.cc
Side-by-side diff
Diffstat (limited to 'src/configuration.cc') (more/less context) (show whitespace changes)
-rw-r--r--src/configuration.cc5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/configuration.cc b/src/configuration.cc
index eb010c1..edc8c04 100644
--- a/src/configuration.cc
+++ b/src/configuration.cc
@@ -71,72 +71,77 @@ static DOTCONF_CB(dco_notify) { dc_context *dcc = (dc_context*)ctx;
break;
case DCC_PROCESS:
dcc->ps->notify = cmd->data.str;
break;
default:
return "Unexpected Notify";
}
return NULL;
}
static DOTCONF_CB(dco_process) { dc_context *dcc = (dc_context*)ctx;
string id = cmd->data.str;
if(id[id.length()-1]=='>')
id.erase(id.length()-1);
dcc->ps = &(dcc->cf->processes[id]);
dcc->ctx = DCC_PROCESS;
return NULL;
}
static DOTCONF_CB(dco__process) { dc_context *dcc = (dc_context*)ctx;
dcc->ps = NULL;
dcc->ctx = DCC_ROOT;
return NULL;
}
+static DOTCONF_CB(dco_process_name) { dc_context *dcc = (dc_context*)ctx;
+ dcc->ps->process_name = cmd->data.str;
+ return NULL;
+}
static DOTCONF_CB(dco_restart_command) { dc_context *dcc = (dc_context*)ctx;
dcc->ps->restart_cmd = cmd->data.str;
return NULL;
}
static DOTCONF_CB(dco_user) { dc_context *dcc = (dc_context*)ctx;
dcc->ps->user = cmd->data.str;
return NULL;
}
static DOTCONF_CB(dco_group) { dc_context *dcc = (dc_context*)ctx;
dcc->ps->group = cmd->data.str;
return NULL;
}
static DOTCONF_CB(dco_chroot) { dc_context *dcc = (dc_context*)ctx;
dcc->ps->chroot = cmd->data.str;
return NULL;
}
static const configoption_t dc_options[] = {
{ "CheckInterval", ARG_INT, dco_check_interval, NULL, DCC_ROOT },
{ "Daemonize", ARG_TOGGLE, dco_daemonize, NULL, DCC_ROOT },
{ "PidFile", ARG_STR, dco_pid_file, NULL, DCC_ROOT|DCC_PROCESS },
{ "MailtoHeader", ARG_STR, dco_mailto_header, NULL, DCC_ROOT|DCC_PROCESS },
{ "Notify", ARG_STR, dco_notify, NULL, DCC_ROOT|DCC_PROCESS },
{ "<Process", ARG_STR, dco_process, NULL, DCC_ROOT },
+ { "ProcessName", ARG_STR, dco_process_name, NULL, DCC_PROCESS },
{ "RestartCommand", ARG_STR, dco_restart_command, NULL, DCC_PROCESS },
{ "User", ARG_STR, dco_user, NULL, DCC_PROCESS },
{ "Group", ARG_STR, dco_group, NULL, DCC_PROCESS },
{ "Chroot", ARG_STR, dco_chroot, NULL, DCC_PROCESS },
{ "</Process>", ARG_NONE, dco__process, NULL, DCC_PROCESS },
LAST_OPTION
};
static const char *dc_context_checker(command_t *cmd,unsigned long mask) {
dc_context *dcc = (dc_context*)cmd->context;
if( (mask==CTX_ALL) || ((mask&dcc->ctx)==dcc->ctx) )
return NULL;
return "misplaced option";
}
static FUNC_ERRORHANDLER(dc_error_handler) {
throw runtime_error(string("error parsing config file: ")+msg);
}
void configuration::parse(const string& cfile) {
struct dc_context dcc;
dcc.cf = this;
dcc.ctx = DCC_ROOT;
configfile_t *cf = dotconf_create((char*)cfile.c_str(),dc_options,(context_t*)&dcc,CASE_INSENSITIVE);
if(!cf)