mirror of
https://github.com/troglobit/finit.git
synced 2026-11-07 16:01:08 +00:00
initctl: Refactor, use struct command rather than command_t
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
1 parent
8f00ac2e90
commit
112ab2c22f
2 files changed
+7
-7
No files matched your search
@@ -27,11 +27,6 @@
|
|||||||
#include "finit.h"
|
#include "finit.h"
|
||||||
#include "svc.h"
|
#include "svc.h"
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
char *cmd;
|
|
||||||
int (*cb)(char *arg);
|
|
||||||
} command_t;
|
|
||||||
|
|
||||||
int client_connect (void);
|
int client_connect (void);
|
||||||
int client_disconnect (void);
|
int client_disconnect (void);
|
||||||
|
|
||||||
|
|||||||
+7
-2
@@ -43,6 +43,11 @@
|
|||||||
|
|
||||||
#define _PATH_COND _PATH_VARRUN "finit/cond/"
|
#define _PATH_COND _PATH_VARRUN "finit/cond/"
|
||||||
|
|
||||||
|
struct command {
|
||||||
|
char *cmd;
|
||||||
|
int (*cb)(char *arg);
|
||||||
|
};
|
||||||
|
|
||||||
int verbose = 0;
|
int verbose = 0;
|
||||||
int runlevel = 0;
|
int runlevel = 0;
|
||||||
|
|
||||||
@@ -272,7 +277,7 @@ static int do_cond(char *cmd)
|
|||||||
{
|
{
|
||||||
int c;
|
int c;
|
||||||
char *arg;
|
char *arg;
|
||||||
command_t command[] = {
|
struct command command[] = {
|
||||||
{ "show", do_cond_show },
|
{ "show", do_cond_show },
|
||||||
{ "set", do_cond_set },
|
{ "set", do_cond_set },
|
||||||
{ "clear", do_cond_clear },
|
{ "clear", do_cond_clear },
|
||||||
@@ -564,7 +569,7 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
int c;
|
int c;
|
||||||
char *cmd, arg[120];
|
char *cmd, arg[120];
|
||||||
command_t command[] = {
|
struct command command[] = {
|
||||||
{ "debug", toggle_debug },
|
{ "debug", toggle_debug },
|
||||||
{ "help", do_help },
|
{ "help", do_help },
|
||||||
{ "version", show_version },
|
{ "version", show_version },
|
||||||
|
|||||||
Reference in new issue
Block a user