65 lines
1.2 KiB
C
65 lines
1.2 KiB
C
/*
|
|
* console.h
|
|
*/
|
|
|
|
#ifndef USER_SHELL_CONSOLE_H_
|
|
#define USER_SHELL_CONSOLE_H_
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
#include <string.h>
|
|
|
|
// pirate tools
|
|
#include "ntshell/core/ntshell.h"
|
|
#include "ntshell/util/ntstdio.h"
|
|
#include "ntshell/util/ntopt.h"
|
|
|
|
|
|
#define CONS_PROMPT_DEFAULT "\r\ngat> "
|
|
#define CONS_PRINT(s) console_write(s, strlen(s), 0)
|
|
|
|
|
|
/* struct */
|
|
typedef struct {
|
|
char *cmd;
|
|
char *usage;
|
|
char *desc;
|
|
uint8_t flags;
|
|
void (*go)(int argc, char **argv);
|
|
void (*help)(void);
|
|
} command_table_t;
|
|
|
|
|
|
/* extern variables */
|
|
extern ntshell_t ntshell;
|
|
extern ntshell_t hijack;
|
|
|
|
extern command_table_t *ctbl;
|
|
extern command_table_t *ctbl_prev;
|
|
|
|
extern char console_line[256];
|
|
|
|
|
|
|
|
/* console prototypes */
|
|
void console_init();
|
|
|
|
void console_set_puts(int (*puts)(char *buf, int cnt));
|
|
void console_set_gets(int (*gets)(char *buf, int cnt));
|
|
|
|
void console_start();
|
|
void console_stop();
|
|
void console_process();
|
|
void console_wait();
|
|
|
|
int console_write(const char *buf, int cnt, void *extobj);
|
|
|
|
|
|
/* hijack the console for per-line input handling */
|
|
void console_hijack(int (*cb)(const char *text, void *extobj));
|
|
|
|
|
|
|
|
#endif /* USER_SHELL_CONSOLE_H_ */
|