aboutsummaryrefslogtreecommitdiff
path: root/src/pies.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/pies.c')
-rw-r--r--src/pies.c40
1 files changed, 18 insertions, 22 deletions
diff --git a/src/pies.c b/src/pies.c
index 3734b47..653a865 100644
--- a/src/pies.c
+++ b/src/pies.c
@@ -1924,13 +1924,12 @@ set_state_file_names (const char *base)
size_t pies_master_argc;
char **pies_master_argv;
int
main (int argc, char **argv)
{
- int index;
pid_t pid;
extern char **environ;
struct grecs_list_entry *ep;
int diag_flags;
set_program_name (argv[0]);
@@ -1998,24 +1997,30 @@ main (int argc, char **argv)
config_file_add_type (CONF_PIES, "/etc/pies.init");
}
#else
config_file_add_type (CONF_INITTAB, "/etc/inittab");
config_file_add_type (CONF_PIES, "/etc/pies.init");
#endif
- for (index = 1; index < argc; index++)
+ sysvinit_parse_argv (argc, argv);
+ }
+ else
+ {
+ int index;
+
+ parse_options (argc, argv, &index);
+ argc -= index;
+ argv += index;
+
+ if (argc && !(command == COM_RESTART_COMPONENT
+ || command == COM_TRACE_DEPEND
+ || command == COM_TRACE_PREREQ))
{
- if (!strcmp (argv[index], "single") || !strcmp (argv[index], "-s"))
- dfl_level = 'S';
- else if (strchr("0123456789sS", argv[index][0]) && !argv[index][1])
- {
- dfl_level = toupper (argv[index][0]);
- }
+ logmsg (LOG_ERR, "extra command line arguments");
+ exit (EX_USAGE);
}
}
- else
- parse_options (argc, argv, &index);
if (!instance)
{
instance = strrchr (program_name, '/');
if (!instance)
instance = (char*) program_name;
@@ -2056,21 +2061,12 @@ main (int argc, char **argv)
if (lint_mode)
exit (0);
/* Re-setup logging: it might have been reset in the config file */
diag_setup (log_to_stderr_only ? DIAG_TO_STDERR : 0);
- if (argc != index
- && !(command == COM_RESTART_COMPONENT
- || command == COM_TRACE_DEPEND
- || command == COM_TRACE_PREREQ))
- {
- logmsg (LOG_ERR, "extra command line arguments");
- exit (EX_CONFIG);
- }
-
if (!control.url)
{
char const *str = default_control_url[init_process];
if (pies_url_create (&control.url, str))
{
logmsg (LOG_CRIT, _("%s: cannot create control URL: %s"),
@@ -2083,13 +2079,13 @@ main (int argc, char **argv)
switch (command)
{
case COM_RESTART_COMPONENT:
pies_priv_setup (&pies_privs);
if (pies_umask)
umask (pies_umask);
- exit (request_restart_components (argc - index, argv + index));
+ exit (request_restart_components (argc, argv));
case COM_RELOAD:
exit (request_reload ());
case COM_STATUS:
exit (request_status ());
@@ -2099,17 +2095,17 @@ main (int argc, char **argv)
case COM_DUMP_DEPMAP:
components_dump_depmap ();
exit (0);
case COM_TRACE_DEPEND:
- components_trace (argv + index, depmap_row);
+ components_trace (argv, depmap_row);
exit (0);
case COM_TRACE_PREREQ:
- components_trace (argv + index, depmap_col);
+ components_trace (argv, depmap_col);
exit (0);
default:
pies_priv_setup (&pies_privs);
if (pies_umask)
umask (pies_umask);

Return to:

Send suggestions and report system problems to the System administrator.