2008-07-29 11:08:54 +00:00
|
|
|
// eLua shell
|
|
|
|
|
|
|
|
#ifndef __SHELL_H__
|
|
|
|
#define __SHELL_H__
|
|
|
|
|
2012-11-14 00:00:24 +02:00
|
|
|
#include "type.h"
|
|
|
|
|
2012-10-07 23:54:28 +03:00
|
|
|
#define SHELL_WELCOMEMSG "\neLua %s Copyright (C) 2007-2011 www.eluaproject.net\n"
|
|
|
|
#define SHELL_PROMPT "eLua# "
|
|
|
|
#define SHELL_ERRMSG "Invalid command, type 'help' for help\n"
|
|
|
|
#define SHELL_MAXSIZE 50
|
|
|
|
#define SHELL_MAX_LUA_ARGS 8
|
2008-07-29 11:08:54 +00:00
|
|
|
|
2012-11-14 00:00:24 +02:00
|
|
|
// Shell command handler function
|
|
|
|
typedef void( *p_shell_handler )( int argc, char **argv );
|
|
|
|
|
|
|
|
// Command/handler pair structure
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
const char* cmd;
|
|
|
|
p_shell_handler handler_func;
|
|
|
|
} SHELL_COMMAND;
|
|
|
|
|
2008-10-31 21:32:15 +00:00
|
|
|
int shell_init();
|
2008-07-29 11:08:54 +00:00
|
|
|
void shell_start();
|
2012-11-14 00:00:24 +02:00
|
|
|
const SHELL_COMMAND* shellh_execute_command( char* cmd, int interactive_mode );
|
2012-10-07 23:54:28 +03:00
|
|
|
int shellh_cp_file( const char *src, const char *dst, int flags );
|
|
|
|
void shellh_not_implemented_handler( int argc, char **argv );
|
|
|
|
void shellh_show_help( const char *cmd, const char *helptext );
|
|
|
|
|
|
|
|
#define SHELL_SHOW_HELP( cmd ) shellh_show_help( #cmd, shell_help_##cmd )
|
|
|
|
|
|
|
|
// Helpers for various functions
|
|
|
|
int shellh_ask_yes_no();
|
|
|
|
|
|
|
|
// Flags for various operations
|
|
|
|
#define SHELL_F_RECURSIVE 1
|
|
|
|
#define SHELL_F_FORCE_DESTINATION 2
|
|
|
|
#define SHELL_F_ASK_CONFIRMATION 4
|
|
|
|
#define SHELL_F_SIMULATE_ONLY 8
|
|
|
|
#define SHELL_F_SILENT 16
|
|
|
|
#define SHELL_F_MOVE 32
|
2008-07-29 11:08:54 +00:00
|
|
|
|
2008-08-04 12:04:36 +00:00
|
|
|
#endif // #ifndef __SHELL_H__
|
2012-10-07 23:54:28 +03:00
|
|
|
|