summaryrefslogtreecommitdiff
path: root/source3/utils
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2008-03-20 01:26:37 +0100
committerGünther Deschner <gd@samba.org>2008-03-20 01:26:37 +0100
commitd8acf199876867189f212837059d1d6ac401c6b5 (patch)
tree014796b56643b4bbc1c53a09d33d15ec1b1bf92d /source3/utils
parent2ee645121295cc416cc190c0d14a1e739ad6fb6d (diff)
downloadsamba-d8acf199876867189f212837059d1d6ac401c6b5.tar.gz
samba-d8acf199876867189f212837059d1d6ac401c6b5.tar.bz2
samba-d8acf199876867189f212837059d1d6ac401c6b5.zip
Move svc_status_string() out of rpc_client/cli_svcctl.c
Guenther (This used to be commit 2860ae2eb2cb99b4febb352f516b3fa9fbd2abbb)
Diffstat (limited to 'source3/utils')
-rw-r--r--source3/utils/net_rpc_service.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/source3/utils/net_rpc_service.c b/source3/utils/net_rpc_service.c
index c4cc19eaa1..1b12bd3114 100644
--- a/source3/utils/net_rpc_service.c
+++ b/source3/utils/net_rpc_service.c
@@ -19,6 +19,43 @@
#include "includes.h"
#include "utils/net.h"
+
+struct svc_state_msg {
+ uint32 flag;
+ const char *message;
+};
+
+static struct svc_state_msg state_msg_table[] = {
+ { SVCCTL_STOPPED, "stopped" },
+ { SVCCTL_START_PENDING, "start pending" },
+ { SVCCTL_STOP_PENDING, "stop pending" },
+ { SVCCTL_RUNNING, "running" },
+ { SVCCTL_CONTINUE_PENDING, "resume pending" },
+ { SVCCTL_PAUSE_PENDING, "pause pending" },
+ { SVCCTL_PAUSED, "paused" },
+ { 0, NULL }
+};
+
+
+/********************************************************************
+********************************************************************/
+const char *svc_status_string( uint32 state )
+{
+ fstring msg;
+ int i;
+
+ fstr_sprintf( msg, "Unknown State [%d]", state );
+
+ for ( i=0; state_msg_table[i].message; i++ ) {
+ if ( state_msg_table[i].flag == state ) {
+ fstrcpy( msg, state_msg_table[i].message );
+ break;
+ }
+ }
+
+ return talloc_strdup(talloc_tos(), msg);
+}
+
/********************************************************************
********************************************************************/