1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-24 21:34:56 +03:00

Move svc_status_string() out of rpc_client/cli_svcctl.c

Guenther
(This used to be commit 2860ae2eb2)
This commit is contained in:
Günther Deschner 2008-03-20 01:26:37 +01:00
parent 2ee6451212
commit d8acf19987
2 changed files with 37 additions and 36 deletions

View File

@ -21,42 +21,6 @@
#include "includes.h"
#include "rpc_client.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);
}
/*******************************************************************
*******************************************************************/

View File

@ -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);
}
/********************************************************************
********************************************************************/