00001 /*[ 00002 * Copyright (c) 2007 Integration Engineering Laboratory 00003 University of California, Davis 00004 * 00005 * Permission to use, copy, and distribute this software and its 00006 * documentation for any purpose with or without fee is hereby granted, 00007 * provided that the above copyright notice appear in all copies and 00008 * that both that copyright notice and this permission notice appear 00009 * in supporting documentation. 00010 * 00011 * Permission to modify the software is granted, but not the right to 00012 * distribute the complete modified source code. Modifications are to 00013 * be distributed as patches to the released version. Permission to 00014 * distribute binaries produced by compiling modified sources is granted, 00015 * provided you 00016 * 1. distribute the corresponding source modifications from the 00017 * released version in the form of a patch file along with the binaries, 00018 * 2. add special version identification to distinguish your version 00019 * in addition to the base release version number, 00020 * 3. provide your name and address as the primary contact for the 00021 * support of your modified version, and 00022 * 4. retain our contact information in regard to use of the base 00023 * software. 00024 * Permission to distribute the released version of the source code along 00025 * with corresponding source modifications in the form of a patch file is 00026 * granted with same provisions 2 through 4 for binary distributions. 00027 * 00028 * This software is provided "as is" without express or implied warranty 00029 * to the extent permitted by applicable law. 00030 ]*/ 00031 00032 #ifndef _CMD_PROMPT_H_ 00033 #define _CMD_PROMPT_H_ 00034 #define CMDLINE_SIZE 80 00035 #include "macros.h" 00036 00037 struct mc_platform_s; 00038 typedef struct cmd_prompt_s { 00039 THREAD_T thread; 00040 } cmd_prompt_t; 00041 typedef cmd_prompt_t* cmd_prompt_p; 00042 00043 typedef struct command_s { 00044 int index; 00045 int num_args; 00046 char **args; 00047 } command_t; 00048 typedef command_t* command_p; 00049 00050 int 00051 cmd_prompt_Destroy(cmd_prompt_p cmd_prompt); 00052 00053 cmd_prompt_p 00054 cmd_prompt_Initialize(struct mc_platform_s* mc_platform); 00055 00056 void 00057 cmd_prompt_Start( struct mc_platform_s* mc_platform ); 00058 00059 int split_string(char ***args, const char *buf); 00060 int process_command(command_t *cmd); 00061 #ifndef _WIN32 00062 void* 00063 cmd_prompt_Thread(void* arg); 00064 #else 00065 DWORD WINAPI 00066 cmd_prompt_Thread(LPVOID arg); 00067 #endif 00068 int exec_command(command_t cmd, struct mc_platform_s* global); 00069 int dealloc_command(command_t *cmd); 00070 #endif