aboutsummaryrefslogtreecommitdiff
path: root/src/progman.c
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2009-11-26 12:54:14 +0200
committerSergey Poznyakoff <gray@gnu.org.ua>2009-11-26 12:59:30 +0200
commitc0802ebe4ebd7e7bb173c6efa2c6e59dd5440cc3 (patch)
tree13dafb18363877a5d34db5e62777c57b397cbf2c /src/progman.c
parent849e60108f8df449367f4a05eb489017bea35281 (diff)
downloadpies-c0802ebe4ebd7e7bb173c6efa2c6e59dd5440cc3.tar.gz
pies-c0802ebe4ebd7e7bb173c6efa2c6e59dd5440cc3.tar.bz2
Allow to specify several config files in the command line.
Change output --status format. * src/pies.c (instance): New global. (conffile): Remove. (pidfile,ctlfile,statfile,qotdfile): Remove initializers. (config_syntax, config_file): New types. (conf_head, conf_tail): New variables. (config_syntax_tab): New variable. (add_config): New function. (options): New option --syntax. (current_syntax): New variable. (parse_opt): Change handling of -i (mkfilename, set_file_names): New functions. (main): Allow to specify several different config files in the command line. * src/progman.c (progman_dump_stats): Change output format.
Diffstat (limited to 'src/progman.c')
-rw-r--r--src/progman.c58
1 files changed, 45 insertions, 13 deletions
diff --git a/src/progman.c b/src/progman.c
index 1235d81..89be1f5 100644
--- a/src/progman.c
+++ b/src/progman.c
@@ -2056,42 +2056,74 @@ progman_dump_stats (const char *filename)
for (prog = proghead; prog; prog = prog->next)
{
int i;
+ char fbuf[5];
+ int fidx = 0;
+ fprintf (fp, "%-16s ", prog->tag);
switch (prog->type)
{
case TYPE_COMPONENT:
- fprintf (fp, "component %s ", prog->tag);
+ fbuf[fidx++] = 'C';
+ if (prog->v.p.comp->mode == pies_comp_inetd
+ && prog->v.p.listener)
+ fbuf[fidx++] = 'i';
+
if (prog->pid)
{
- fprintf (fp, "%lu", (unsigned long) prog->pid);
if (prog->v.p.status == status_stopping)
- fprintf (fp, " (stopping)");
+ fbuf[fidx++] = 'S';
+ else
+ fbuf[fidx++] = 'R';
}
else if (prog->v.p.status == status_sleeping)
{
- time_t t = prog->v.p.timestamp + SLEEPTIME;
- fprintftime (fp, _("[disabled; scheduled for %c]"),
- localtime (&t), 0, 0);
+ fbuf[fidx++] = 's';
}
else if (prog->v.p.status == status_disabled)
- fprintf (fp, _("[disabled]"));
+ fbuf[fidx++] = 'D';
else if (prog->v.p.status == status_listener)
- fprintf (fp, _("[listener]"));
+ fbuf[fidx++] = 'I';
+ break;
+
+ case TYPE_REDIRECTOR:
+ fbuf[fidx++] = 'R';
+ break;
+
+ case TYPE_COMMAND:
+ fbuf[fidx++] = 'E';
+ }
+ fbuf[fidx++] = 0;
+ fprintf (fp, "%-8.8s ", fbuf);
+
+ switch (prog->type)
+ {
+ case TYPE_COMPONENT:
+ if (prog->pid)
+ fprintf (fp, "%10lu ", (unsigned long) prog->pid);
+ else if (prog->v.p.status == status_listener
+ && prog->v.p.comp->socket_url)
+ fprintf (fp, "%-10s ", prog->v.p.comp->socket_url->string);
else
- fprintf (fp, _("[not running]"));
+ fprintf (fp, "%-10s ", "N/A");
+
+ if (prog->v.p.status == status_sleeping)
+ {
+ time_t t = prog->v.p.timestamp + SLEEPTIME;
+ fprintftime (fp, "%H:%M:%S", localtime (&t), 0, 0);
+ }
+
for (i = 0; i < prog->v.p.comp->argc; i++)
fprintf (fp, " %s", quotearg (prog->v.p.comp->argv[i]));
- fputc ('\n', fp);
break;
case TYPE_REDIRECTOR:
- fprintf (fp, _("redirector %s %lu\n"), prog->tag,
- (unsigned long) prog->pid);
+ fprintf (fp, "%10lu ", (unsigned long) prog->pid);
break;
case TYPE_COMMAND:
- fprintf (fp, _("command %s: %s\n"), prog->tag, prog->v.c.command);
+ fprintf (fp, "%s", prog->v.c.command);
}
+ fputc ('\n', fp);
}
fclose (fp);
unlink (filename);

Return to:

Send suggestions and report system problems to the System administrator.