From: Erik M. <er...@us...> - 2001-09-15 20:14:26
|
Update of /cvsroot/blob/blob/include In directory usw-pr-cvs1:/tmp/cvs-serv23633/include Modified Files: command.h Log Message: Initial new command line stuff. It has some strange bugs right now, but it allows Russ to see what's going on :) Index: command.h =================================================================== RCS file: /cvsroot/blob/blob/include/command.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- command.h 2001/06/27 19:47:42 1.1.1.1 +++ command.h 2001/09/15 20:14:23 1.2 @@ -34,7 +34,40 @@ #ifndef BLOB_COMMAND_H #define BLOB_COMMAND_H +#include "types.h" + +#define COMMAND_MAGIC (0x436d6420) /* "Cmd " */ + + +typedef int(*commandfunc_t)(int, char *[]); + + +typedef struct commandlist { + u32 magic; + char *name; + char *help; + commandfunc_t callback; + struct commandlist *next; +} commandlist_t; + + +#define __command __attribute__((unused, __section__(".commandlist"))) + +#define __commandlist(fn, nm, hlp) \ +static commandlist_t __commandlist_##fn __command = { \ + magic: COMMAND_MAGIC, \ + name: nm, \ + help: hlp, \ + callback: fn } + + + +void init_commands(void); +int parse_command(char *cmdline); + + void DisplayPrompt(char *prompt); int GetCommand(char *command, int len, int timeout); + #endif |