From 7274301be24a70c094e8c91a36f3e8b6156f53ba Mon Sep 17 00:00:00 2001 From: Roy Marples Date: Fri, 28 Sep 2007 14:53:38 +0000 Subject: rc_service_state now returns the state as a mask, which means that we can do things with just the one call making is more efficient. --- src/rc-status.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src/rc-status.c') diff --git a/src/rc-status.c b/src/rc-status.c index be0f23ab..dacbe851 100644 --- a/src/rc-status.c +++ b/src/rc-status.c @@ -31,22 +31,23 @@ static void print_service (char *service) { char status[10]; int cols = printf (" %s\n", service); + rc_service_state_t state = rc_service_state (service); einfo_color_t color = ECOLOR_BAD; - if (rc_service_state (service, RC_SERVICE_STOPPING)) + if (state & RC_SERVICE_STOPPING) snprintf (status, sizeof (status), "stopping "); - else if (rc_service_state (service, RC_SERVICE_STARTING)) { + else if (state & RC_SERVICE_STARTING) { snprintf (status, sizeof (status), "starting "); color = ECOLOR_WARN; - } else if (rc_service_state (service, RC_SERVICE_INACTIVE)) { + } else if (state & RC_SERVICE_INACTIVE) { snprintf (status, sizeof (status), "inactive "); color = ECOLOR_WARN; - } else if (geteuid () == 0 && rc_service_state (service, RC_SERVICE_CRASHED)) + } else if (state & RC_SERVICE_CRASHED) snprintf (status, sizeof (status), " crashed "); - else if (rc_service_state (service, RC_SERVICE_STARTED)) { + else if (state & RC_SERVICE_STARTED) { snprintf (status, sizeof (status), " started "); color = ECOLOR_GOOD; - } else if (rc_service_state (service, RC_SERVICE_SCHEDULED)) { + } else if (state & RC_SERVICE_SCHEDULED) { snprintf (status, sizeof (status), "scheduled"); color = ECOLOR_WARN; } else -- cgit v1.2.3