diff --git a/cmd_auth.c b/cmd_auth.c index ec408cc..0c69ff7 100644 --- a/cmd_auth.c +++ b/cmd_auth.c @@ -1,5 +1,6 @@ /* * Copyright (C) 2013 Bryan Christ + * 2014 Johannes Schauer * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2, as published by @@ -34,13 +35,18 @@ static char* _get_passwd_from_user(void); int -mfshell_cmd_auth(mfshell_t *mfshell) +mfshell_cmd_auth(mfshell_t *mfshell, int argc, char **argv) { int retval; if(mfshell == NULL) return -1; if(mfshell->server == NULL) return -1; + if (argc != 1) { + fprintf(stderr, "Invalid number of arguments\n"); + return -1; + } + // free and invalidate existing user name if(mfshell->user != NULL) { diff --git a/cmd_chdir.c b/cmd_chdir.c index 5e163e3..9a45f97 100644 --- a/cmd_chdir.c +++ b/cmd_chdir.c @@ -1,5 +1,6 @@ /* * Copyright (C) 2013 Bryan Christ + * 2014 Johannes Schauer * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2, as published by @@ -27,14 +28,22 @@ #include "command.h" int -mfshell_cmd_chdir(mfshell_t *mfshell,const char *folderkey) +mfshell_cmd_chdir(mfshell_t *mfshell, int argc, char **argv) { folder_t *folder_new; const char *folder_curr; const char *folder_parent; + const char *folderkey; int retval; if(mfshell == NULL) return -1; + + if (argc != 2) { + fprintf(stderr, "Invalid number of arguments\n"); + return -1; + } + + folderkey = argv[1]; if(folderkey == NULL) return -1; // change to root diff --git a/cmd_debug.c b/cmd_debug.c index 40fe3d3..bc325a0 100644 --- a/cmd_debug.c +++ b/cmd_debug.c @@ -1,5 +1,6 @@ /* * Copyright (C) 2013 Bryan Christ + * 2014 Johannes Schauer * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2, as published by @@ -27,8 +28,13 @@ #include "command.h" int -mfshell_cmd_debug(mfshell_t *mfshell) +mfshell_cmd_debug(mfshell_t *mfshell, int argc, char **argv) { + if (argc != 1) { + fprintf(stderr, "Invalid number of arguments\n"); + return -1; + } + printf(" %-15.15s %s\n\r", "server:", mfshell->server); diff --git a/cmd_file.c b/cmd_file.c index b769e9d..79eb701 100644 --- a/cmd_file.c +++ b/cmd_file.c @@ -1,5 +1,6 @@ /* * Copyright (C) 2013 Bryan Christ + * 2014 Johannes Schauer * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2, as published by @@ -25,14 +26,22 @@ #include "private.h" int -mfshell_cmd_file(mfshell_t *mfshell,const char *quickkey) +mfshell_cmd_file(mfshell_t *mfshell, int argc, char **argv) { extern int term_width; file_t *file; int len; int retval; + const char *quickkey; if(mfshell == NULL) return -1; + + if (argc != 2) { + fprintf(stderr, "Invalid number of arguments\n"); + return -1; + } + + quickkey = argv[1]; if(quickkey == NULL) return -1; len = strlen(quickkey); diff --git a/cmd_get.c b/cmd_get.c index 9f1aec3..ca3a14f 100644 --- a/cmd_get.c +++ b/cmd_get.c @@ -1,5 +1,6 @@ /* * Copyright (C) 2013 Bryan Christ + * 2014 Johannes Schauer * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2, as published by @@ -29,15 +30,23 @@ #include "download.h" int -mfshell_cmd_get(mfshell_t *mfshell,const char *quickkey) +mfshell_cmd_get(mfshell_t *mfshell, int argc, char **argv) { extern int term_width; file_t *file; int len; int retval; ssize_t bytes_read; + const char *quickkey; if(mfshell == NULL) return -1; + + if (argc != 2) { + fprintf(stderr, "Invalid number of arguments\n"); + return -1; + } + + quickkey = argv[1]; if(quickkey == NULL) return -1; len = strlen(quickkey); diff --git a/cmd_help.c b/cmd_help.c index 4a926de..dc30d29 100644 --- a/cmd_help.c +++ b/cmd_help.c @@ -1,5 +1,6 @@ /* * Copyright (C) 2013 Bryan Christ + * 2014 Johannes Schauer * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2, as published by @@ -26,8 +27,8 @@ #include "private.h" #include "command.h" -void -mfshell_cmd_help(void) +int +mfshell_cmd_help(mfshell_t *mfshell, int argc, char **argv) { printf( " arguments:\n\r" @@ -36,26 +37,22 @@ mfshell_cmd_help(void) printf("\n\r"); - printf( - " help show this help\n\r" - " debug show debug information\n\r" + int column1_width = 0; + int column2_width = 0; - " host change target server\n\r" - " auth authenticate with active server\n\r" - " whoami show basic user info\n\r" + _cmd_t* curr_cmd; + for (curr_cmd = mfshell->commands; curr_cmd->name != NULL; curr_cmd++) { + if (strlen(curr_cmd->name) > column1_width) + column1_width = strlen(curr_cmd->name); + if (strlen(curr_cmd->argstring) > column2_width) + column2_width = strlen(curr_cmd->argstring); + } - " ls show contents of active folder\n\r" - " cd [folderkey] change active folder\n\r" - " pwd show the active folder\n\r" - " lpwd show the local working directory\n\r" - " lcd [dir] change the local working directory\n\r" - " mkdir [folder name] create a new folder\n\r" + for (curr_cmd = mfshell->commands; curr_cmd->name != NULL; curr_cmd++) { + printf("%*s %*s %s\n", column1_width, curr_cmd->name, column2_width, curr_cmd->argstring, curr_cmd->help); + } - " file [quickkey] show file information\n\r" - " links [quickkey] show access urls for the file\n\r" - " get [quickkey] download a file\n\r"); - - return; + return 0; } diff --git a/cmd_host.c b/cmd_host.c index e64ca67..66168b2 100644 --- a/cmd_host.c +++ b/cmd_host.c @@ -1,5 +1,6 @@ /* * Copyright (C) 2013 Bryan Christ + * 2014 Johannes Schauer * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2, as published by @@ -30,16 +31,22 @@ static char* _get_host_from_user(void); int -mfshell_cmd_host(mfshell_t *mfshell,const char *host) +mfshell_cmd_host(mfshell_t *mfshell, int argc, char **argv) { char *alt_host = NULL; + char *host; - if(mfshell == NULL) return -1; - - if(host == NULL) - { - alt_host = _get_host_from_user(); - host = alt_host; + switch (argc) { + case 1: + alt_host = _get_host_from_user(); + host = alt_host; + break; + case 2: + host = argv[1]; + break; + default: + fprintf(stderr, "Invalid number of arguments\n"); + return -1; } if(mfshell->server != NULL) diff --git a/cmd_lcd.c b/cmd_lcd.c index 4ebf5c2..09a831d 100644 --- a/cmd_lcd.c +++ b/cmd_lcd.c @@ -1,5 +1,6 @@ /* * Copyright (C) 2013 Bryan Christ + * 2014 Johannes Schauer * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2, as published by @@ -27,11 +28,19 @@ #include "mfshell.h" int -mfshell_cmd_lcd(mfshell_t *mfshell,const char *dir) +mfshell_cmd_lcd(mfshell_t *mfshell, int argc, char **argv) { int retval; + const char *dir; if(mfshell == NULL) return -1; + + if (argc != 2) { + fprintf(stderr, "Invalid number of arguments\n"); + return -1; + } + + dir = argv[1]; if(dir == NULL) return -1; if(strlen(dir) < 1) return -1; diff --git a/cmd_links.c b/cmd_links.c index a618a6a..5104286 100644 --- a/cmd_links.c +++ b/cmd_links.c @@ -1,5 +1,6 @@ /* * Copyright (C) 2013 Bryan Christ + * 2014 Johannes Schauer * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2, as published by @@ -25,14 +26,22 @@ #include "private.h" int -mfshell_cmd_links(mfshell_t *mfshell,const char *quickkey) +mfshell_cmd_links(mfshell_t *mfshell, int argc, char **argv) { extern int term_width; file_t *file; int len; int retval; + const char *quickkey; if(mfshell == NULL) return -1; + + if (argc != 2) { + fprintf(stderr, "Invalid number of arguments\n"); + return -1; + } + + quickkey = argv[1]; if(quickkey == NULL) return -1; len = strlen(quickkey); diff --git a/cmd_list.c b/cmd_list.c index d465562..78d798f 100644 --- a/cmd_list.c +++ b/cmd_list.c @@ -1,5 +1,6 @@ /* * Copyright (C) 2013 Bryan Christ + * 2014 Johannes Schauer * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2, as published by @@ -27,13 +28,18 @@ #include "command.h" int -mfshell_cmd_list(mfshell_t *mfshell) +mfshell_cmd_list(mfshell_t *mfshell, int argc, char **argv) { int retval; const char *folder_curr; if(mfshell == NULL) return -1; + if (argc != 1) { + fprintf(stderr, "Invalid number of arguments\n"); + return -1; + } + folder_curr = folder_get_key(mfshell->folder_curr); // safety check... this should never happen diff --git a/cmd_lpwd.c b/cmd_lpwd.c index cfa2254..b75cdc0 100644 --- a/cmd_lpwd.c +++ b/cmd_lpwd.c @@ -1,5 +1,6 @@ /* * Copyright (C) 2013 Bryan Christ + * 2014 Johannes Schauer * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2, as published by @@ -27,13 +28,18 @@ #include "private.h" int -mfshell_cmd_lpwd(mfshell_t *mfshell) +mfshell_cmd_lpwd(mfshell_t *mfshell, int argc, char **argv) { extern int term_width; int trim_size; if(mfshell == NULL) return -1; + if (argc != 1) { + fprintf(stderr, "Invalid number of argumens\n"); + return -1; + } + if(mfshell->local_working_dir == NULL) { mfshell->local_working_dir = (char*)calloc(PATH_MAX + 1,sizeof(char)); diff --git a/cmd_mkdir.c b/cmd_mkdir.c index c6f6e78..764baab 100644 --- a/cmd_mkdir.c +++ b/cmd_mkdir.c @@ -1,5 +1,6 @@ /* * Copyright (C) 2013 Bryan Christ + * 2014 Johannes Schauer * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2, as published by @@ -27,13 +28,22 @@ #include "command.h" int -mfshell_cmd_mkdir(mfshell_t *mfshell,const char *name) +mfshell_cmd_mkdir(mfshell_t *mfshell, int argc, char **argv) { int retval; const char *folder_curr; + const char *name; if(mfshell == NULL) return -1; + if (argc != 2) { + fprintf(stderr, "Invalid number of arguments\n"); + return -1; + } + + name = argv[1]; + if (name == NULL) return -1; + folder_curr = folder_get_key(mfshell->folder_curr); // safety check... this should never happen diff --git a/cmd_pwd.c b/cmd_pwd.c index 55cfe3c..01fc409 100644 --- a/cmd_pwd.c +++ b/cmd_pwd.c @@ -1,5 +1,6 @@ /* * Copyright (C) 2013 Bryan Christ + * 2014 Johannes Schauer * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2, as published by @@ -27,7 +28,7 @@ #include "command.h" int -mfshell_cmd_pwd(mfshell_t *mfshell) +mfshell_cmd_pwd(mfshell_t *mfshell, int argc, char **argv) { const char *folder_name; char *folder_name_tmp = NULL; @@ -35,6 +36,11 @@ mfshell_cmd_pwd(mfshell_t *mfshell) if(mfshell == NULL) return -1; if(mfshell->folder_curr == NULL) return -1; + if (argc != 1) { + fprintf(stderr, "Invalid number of arguments\n"); + return -1; + } + folder_name = folder_get_name(mfshell->folder_curr); if(folder_name[0] == '\0') return -1; diff --git a/cmd_whoami.c b/cmd_whoami.c index edb86f9..a09eaef 100644 --- a/cmd_whoami.c +++ b/cmd_whoami.c @@ -1,5 +1,6 @@ /* * Copyright (C) 2013 Bryan Christ + * 2014 Johannes Schauer * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2, as published by @@ -27,10 +28,15 @@ #include "command.h" int -mfshell_cmd_whoami(mfshell_t *mfshell) +mfshell_cmd_whoami(mfshell_t *mfshell, int argc, char **argv) { int retval; + if (argc != 1) { + fprintf(stderr, "Invalid number of arguments\n"); + return -1; + } + retval = mfshell->user_get_info(mfshell); mfshell->update_secret_key(mfshell); diff --git a/command.h b/command.h index 9b4efa5..75c28cb 100644 --- a/command.h +++ b/command.h @@ -1,5 +1,6 @@ /* * Copyright (C) 2013 Bryan Christ + * 2014 Johannes Schauer * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2, as published by @@ -22,32 +23,34 @@ #include "mfshell.h" -void mfshell_cmd_help(void); +int mfshell_cmd_help(mfshell_t *mfshell, int argc, char **argv); -int mfshell_cmd_debug(mfshell_t *mfshell); +int mfshell_cmd_debug(mfshell_t *mfshell, int argc, char **argv); -int mfshell_cmd_host(mfshell_t *mfshell,const char *host); +int mfshell_cmd_host(mfshell_t *mfshell, int argc, char **argv); -int mfshell_cmd_auth(mfshell_t *mfshell); +int mfshell_cmd_auth(mfshell_t *mfshell, int argc, char **argv); -int mfshell_cmd_whomai(mfshell_t *mfshell); +int mfshell_cmd_whomai(mfshell_t *mfshell, int argc, char **argv); -int mfshell_cmd_list(mfshell_t *mfshell); +int mfshell_cmd_list(mfshell_t *mfshell, int argc, char **argv); -int mfshell_cmd_chdir(mfshell_t *mfshell,const char *folderkey); +int mfshell_cmd_chdir(mfshell_t *mfshell, int argc, char **argv); -int mfshell_cmd_pwd(mfshell_t *mfshell); +int mfshell_cmd_pwd(mfshell_t *mfshell, int argc, char **argv); -int mfshell_cmd_lpwd(mfshell_t *mfshell); +int mfshell_cmd_lpwd(mfshell_t *mfshell, int argc, char **argv); -int mfshell_cmd_lcd(mfshell_t *mfshell,const char *dir); +int mfshell_cmd_lcd(mfshell_t *mfshell, int argc, char **argv); -int mfshell_cmd_file(mfshell_t *mfshell,const char *quickkey); +int mfshell_cmd_file(mfshell_t *mfshell, int argc, char **argv); -int mfshell_cmd_links(mfshell_t *mfshell,const char *quickkey); +int mfshell_cmd_links(mfshell_t *mfshell, int argc, char **argv); -int mfshell_cmd_mkdir(mfshell_t *mfshell,const char *name); +int mfshell_cmd_mkdir(mfshell_t *mfshell, int argc, char **argv); -int mfshell_cmd_get(mfshell_t *mfshell,const char *quickkey); +int mfshell_cmd_get(mfshell_t *mfshell, int argc, char **argv); + +int mfshell_cmd_whoami(mfshell_t *mfshell, int argc, char **argv); #endif diff --git a/console.c b/console.c index ac6ae7e..2a39c9c 100644 --- a/console.c +++ b/console.c @@ -1,5 +1,6 @@ /* * Copyright (C) 2013 Bryan Christ + * 2014 Johannes Schauer * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2, as published by @@ -124,99 +125,12 @@ _execute_shell_command(mfshell_t *mfshell,char *command) argc = stringv_len(argv); - if(strcmp(argv[0],"whoami") == 0) - { - retval = mfshell->user_get_info(mfshell); - mfshell->update_secret_key(mfshell); - } - - if(strcmp(argv[0],"help") == 0) - { - mfshell->help(); - } - - if(strcmp(argv[0],"host") == 0) - { - if(argc > 1 && argv[1] != '\0') - { - retval = mfshell->host(mfshell,argv[1]); - } - else - { - retval = mfshell->host(mfshell,NULL); - } - } - - if(strcmp(argv[0],"debug") == 0) - { - retval = mfshell->debug(mfshell); - } - - if((strcmp(argv[0],"ls") == 0) || strcmp(argv[0],"list") == 0) - { - retval = mfshell->list(mfshell); - } - - if((strcmp(argv[0],"cd") == 0) || strcmp(argv[0],"chdir") == 0) - { - if(argc > 1 && argv[1] != '\0') - { - retval = mfshell->chdir(mfshell,argv[1]); - } - } - - if(strcmp(argv[0],"pwd") == 0) - { - retval = mfshell->pwd(mfshell); - } - - if(strcmp(argv[0],"lpwd") == 0) - { - retval = mfshell->lpwd(mfshell); - } - - if(strcmp(argv[0],"lcd") == 0) - { - if(argc > 1 && argv[1] != '\0') - { - retval = mfshell->lcd(mfshell,argv[1]); - } - } - - if(strcmp(argv[0],"file") == 0) - { - if(argc > 1 && argv[1] != '\0') - { - retval = mfshell->file(mfshell,argv[1]); - } - } - - if(strcmp(argv[0],"links") == 0) - { - if(argc > 1 && argv[1] != '\0') - { - retval = mfshell->links(mfshell,argv[1]); - } - } - - if(strcmp(argv[0],"get") == 0) - { - if(argc > 1 && argv[1] != '\0') - { - retval = mfshell->get(mfshell,argv[1]); - } - } - - if(strcmp(argv[0],"auth") == 0) - { - retval = mfshell->auth(mfshell); - } - - if(strcmp(argv[0],"mkdir") == 0) - { - if(argc > 1 && argv[1] != '\0') - { - retval = mfshell->mkdir(mfshell,argv[1]); + _cmd_t* curr_cmd; + for (curr_cmd = mfshell->commands; curr_cmd->name != NULL; curr_cmd++) { + if (strcmp(argv[0], curr_cmd->name) == 0) { + // TODO: handle retval + retval = curr_cmd->handler(mfshell, argc, argv); + break; } } diff --git a/main.c b/main.c index 8c6d033..0e9065a 100644 --- a/main.c +++ b/main.c @@ -1,5 +1,6 @@ /* * Copyright (C) 2013 Bryan Christ + * 2014 Johannes Schauer * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2, as published by @@ -67,7 +68,7 @@ int main(int argc,char **argv) "2c6dq0gb2sr8rgsue5a347lzpjnaay46yjazjcjg",server); printf("\n\r"); - mfshell->auth(mfshell); + mfshell->exec(mfshell, "auth"); // begin shell mode mfshell_run(mfshell); diff --git a/mfshell.c b/mfshell.c index 8109bd7..60407e6 100644 --- a/mfshell.c +++ b/mfshell.c @@ -1,5 +1,6 @@ /* * Copyright (C) 2013 Bryan Christ + * 2014 Johannes Schauer * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2, as published by @@ -37,6 +38,28 @@ #include "file_links.h" #include "folder_create.h" +struct _cmd_s commands[] = { + {"help", "", "show this help", mfshell_cmd_help}, + {"debug", "", "show debug information", mfshell_cmd_debug}, + {"host", "", "change target server", mfshell_cmd_host}, + {"auth", "", "authenticate with active server", + mfshell_cmd_auth}, + {"whoami", "", "show basic user info", mfshell_cmd_whoami}, + {"ls", "", "show contents of active folder", + mfshell_cmd_list}, + {"cd", "[folderkey]", "change active folder", mfshell_cmd_chdir}, + {"pwd", "", "show the active folder", mfshell_cmd_pwd}, + {"lpwd", "", "show the local working directory", + mfshell_cmd_lpwd}, + {"lcd", "[dir]", "change the local working directory", + mfshell_cmd_lcd}, + {"mkdir", "[folder name]", "create a new folder", mfshell_cmd_mkdir}, + {"file", "[quickkey]", "show file information", mfshell_cmd_file}, + {"links", "[quickkey]", "show access urls for the file", + mfshell_cmd_links}, + {"get", "[quickkey]", "download a file", mfshell_cmd_get}, + {NULL, NULL, NULL, NULL} +}; mfshell_t* mfshell_create(int app_id,char *app_key,char *server) @@ -68,21 +91,6 @@ mfshell_create(int app_id,char *app_key,char *server) mfshell->exec = _execute_shell_command; - // console commands - mfshell->debug = mfshell_cmd_debug; - mfshell->list = mfshell_cmd_list; - mfshell->chdir = mfshell_cmd_chdir; - mfshell->pwd = mfshell_cmd_pwd; - mfshell->help = mfshell_cmd_help; - mfshell->file = mfshell_cmd_file; - mfshell->links = mfshell_cmd_links; - mfshell->host = mfshell_cmd_host; - mfshell->auth = mfshell_cmd_auth; - mfshell->lpwd = mfshell_cmd_lpwd; - mfshell->lcd = mfshell_cmd_lcd; - mfshell->mkdir = mfshell_cmd_mkdir; - mfshell->get = mfshell_cmd_get; - // configure REST API callbacks mfshell->get_session_token = _get_session_token; mfshell->user_get_info = _user_get_info; @@ -97,6 +105,9 @@ mfshell_create(int app_id,char *app_key,char *server) mfshell->folder_curr = folder_alloc(); folder_set_key(mfshell->folder_curr,"myfiles"); + // shell commands + mfshell->commands = commands; + return mfshell; } diff --git a/mfshell.h b/mfshell.h index e5d2262..f6b7498 100644 --- a/mfshell.h +++ b/mfshell.h @@ -1,5 +1,6 @@ /* * Copyright (C) 2013 Bryan Christ + * 2014 Johannes Schauer * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2, as published by @@ -23,6 +24,7 @@ typedef struct _mfshell_s mfshell_t; typedef struct _folder_s folder_t; typedef struct _file_s file_t; +typedef struct _cmd_s cmd_t; mfshell_t* mfshell_create(int app_id,char *app_key,char *server); diff --git a/private.h b/private.h index 0b66346..980d510 100644 --- a/private.h +++ b/private.h @@ -1,5 +1,6 @@ /* * Copyright (C) 2013 Bryan Christ + * 2014 Johannes Schauer * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2, as published by @@ -25,6 +26,15 @@ typedef struct _mfshell_s _mfshell_t; typedef struct _folder_s _folder_t; typedef struct _file_s _file_t; +typedef struct _cmd_s _cmd_t; + +struct _cmd_s +{ + char *name; + char *argstring; + char *help; + int (*handler) (_mfshell_t *mfshell, int argc, char **argv); +}; struct _folder_s { @@ -76,22 +86,6 @@ struct _mfshell_s int (*exec) (_mfshell_t*,char*); - /* console commands */ - void (*help) (void); - int (*debug) (_mfshell_t*); - int (*whoami) (_mfshell_t*); - int (*list) (_mfshell_t*); - int (*chdir) (_mfshell_t*,const char*); - int (*pwd) (_mfshell_t*); - int (*file) (_mfshell_t*,const char*); - int (*links) (_mfshell_t*,const char*); - int (*host) (_mfshell_t*,const char*); - int (*auth) (_mfshell_t*); - int (*get) (_mfshell_t*,const char*); - int (*lpwd) (_mfshell_t*); - int (*lcd) (_mfshell_t*,const char*); - int (*mkdir) (_mfshell_t*,const char*); - /* REST API calls */ int (*get_session_token) (_mfshell_t*); @@ -110,6 +104,8 @@ struct _mfshell_s /* Local tracking */ char *local_working_dir; + /* shell commands */ + _cmd_t *commands; }; void