char *display_name;
int (*sc_main)(yaz_sc_t s, int argc, char **argv);
void (*sc_stop)(yaz_sc_t s);
+ int argc;
+ char **argv;
#ifdef WIN32
SERVICE_STATUS_HANDLE gSvcStatusHandle;
SERVICE_STATUS gSvcStatus;
break;
}
}
- *argc_p -= skip_opt;
+ *argc_p = *argc_p - skip_opt;
for (; i < *argc_p; i++)
(*argv_p)[i] = (*argv_p)[i + skip_opt];
+ /* now look for the service arguments */
/* we must have a YAZ log file to work with */
+ skip_opt = 0;
for (i = 1; i < *argc_p; i++)
{
const char *opt = (*argv_p)[i];
}
if (s->run_flag)
{ /* remove -l logfile for a running service */
+ *argc_p = *argc_p - skip_opt;
for (; i < *argc_p; i++)
(*argv_p)[i] = (*argv_p)[i + skip_opt];
+
}
}
sc_ReportSvcStatus(s, SERVICE_START_PENDING, NO_ERROR, 3000);
- ret_code = s->sc_main(s, argc, argv);
+ ret_code = s->sc_main(s, s->argc, s->argv);
sc_ReportSvcStatus(s, SERVICE_STOPPED,
ret_code ? ERROR_SERVICE_SPECIFIC_ERROR : NO_ERROR, ret_code);
dt[1].lpServiceName = 0;
dt[1].lpServiceProc = 0;
+ s->argc = argc;
+ s->argv = argv;
if (!StartServiceCtrlDispatcher(dt))
{
yaz_log(YLOG_FATAL|YLOG_ERRNO, "Service %s could not be controlled",