diff options
Diffstat (limited to 'eurephiadm')
-rw-r--r-- | eurephiadm/commands.h | 28 | ||||
-rw-r--r-- | eurephiadm/eurephiadm.c | 27 |
2 files changed, 28 insertions, 27 deletions
diff --git a/eurephiadm/commands.h b/eurephiadm/commands.h index e707f10..141fadd 100644 --- a/eurephiadm/commands.h +++ b/eurephiadm/commands.h @@ -23,7 +23,35 @@ #ifndef EUREPHIADM_COMMANDS_H_ # define EUREPHIADM_COMMANDS_H_ +/* struct used for definition of commands, help info and function pointers to the command */ +typedef struct { + char *command; + int need_session; + char *arghint; + char *helpinfo; + char *helpdescr; + int (*function)(eurephiaCTX *, eurephiaSESSION *, eurephiaVALUES *, int argc, char **argv); +} eurephiadm_functions; + +/* eurephiadm commands, found in eurephiadm.c */ +int cmd_Help(eurephiaCTX *, eurephiaSESSION *, eurephiaVALUES *cfg, int argc, char **argv); +int cmd_Logout(eurephiaCTX *, eurephiaSESSION *, eurephiaVALUES *cfg, int argc, char **argv); +int cmd_ShowCfg(eurephiaCTX *, eurephiaSESSION *, eurephiaVALUES *cfg, int argc, char **argv); + + +/* Commands listed are found in ./commands/{command}.c files - one file per command*/ int cmd_ListUsers(eurephiaCTX *, eurephiaSESSION *, eurephiaVALUES *cfg, int argc, char **argv); +/* Declaration of all commands */ +static const eurephiadm_functions cmdline_functions[] = { + // command, need_session, arghints, helpinfo, helpdescr, function + {"help", 0, NULL, "This help screen", NULL, cmd_Help}, + {"logout", 1, NULL, "Logout from an open session", NULL, cmd_Logout}, + {"listusers", 1, NULL, "List all registered users", NULL, cmd_ListUsers}, + {"show-config", 1, NULL, "List all config settings", NULL, cmd_ShowCfg}, + {"show-configfile", 0, NULL, "List only config file settings", NULL, cmd_ShowCfg}, + {NULL, 0, NULL, NULL, NULL, NULL} +}; + #endif /* !COMMANDS_H_ */ diff --git a/eurephiadm/eurephiadm.c b/eurephiadm/eurephiadm.c index f9dc7ed..8eac0a6 100644 --- a/eurephiadm/eurephiadm.c +++ b/eurephiadm/eurephiadm.c @@ -44,33 +44,6 @@ #define MAX_ARGUMENTS 64 -typedef struct { - char *command; - int need_session; - char *arghint; - char *helpinfo; - char *helpdescr; - int (*function)(eurephiaCTX *, eurephiaSESSION *, eurephiaVALUES *, int argc, char **argv); -} eurephiadm_functions; - -/* eurephiadm commands located in this file */ -int cmd_Help(eurephiaCTX *, eurephiaSESSION *, eurephiaVALUES *cfg, int argc, char **argv); -int cmd_Logout(eurephiaCTX *, eurephiaSESSION *, eurephiaVALUES *cfg, int argc, char **argv); -int cmd_ShowCfg(eurephiaCTX *, eurephiaSESSION *, eurephiaVALUES *cfg, int argc, char **argv); - - -// Other commands are declared in ./commands.h and the function implemented in -// ./commands/*.c ... where each command should have their own file. - -static const eurephiadm_functions cmdline_functions[] = { - {"help", 0, NULL, "This help screen", NULL, cmd_Help}, - {"logout", 1, NULL, "Logout from an open session", NULL, cmd_Logout}, - {"listusers", 1, NULL, "List all registered users", NULL, cmd_ListUsers}, - {"show-config", 1, NULL, "List all config settings", NULL, cmd_ShowCfg}, - {"show-configfile", 0, NULL, "List only config file settings", NULL, cmd_ShowCfg}, - {NULL, 0, NULL, NULL, NULL} -}; - char *print_version(char *fprg) { char *prg = basename(fprg); |