本文整理汇总了C++中shell_output函数的典型用法代码示例。如果您正苦于以下问题:C++ shell_output函数的具体用法?C++ shell_output怎么用?C++ shell_output使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了shell_output函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: shell_start
/*---------------------------------------------------------------------------*/
void
shell_start(void)
{
shell_output("uIP command shell", "");
shell_output("Type '?' and return for help", "");
shell_prompt(SHELL_PROMPT);
}
示例2: shell_start
/*---------------------------------------------------------------------------*/
void
shell_start(void)
{
shell_output("Welcome to FP server(based on uIP1.0)", "");
shell_output("Type '?' for help", "");
shell_prompt(SHELL_PROMPT);
}
示例3: shell_input
// I need this to work yesterday... I'm sorry!
void shell_input(char * js)
{
char * cmd = strchr(js, '"') + 1;
if (strncmp(cmd,"getvalues", 4) == 0) {
JSONCMD_CONF_GETCALLBACK(values);
shell_prompt("{\"response\":\"OK\",\"values\":[");
for (int i=0; i < 8; i++) {
char buf[10];
inttostr(buf, values[i]);
shell_prompt(buf);
if ( i < 7 ) {
shell_prompt(",");
}
}
shell_output("]}", "");
}
else if (strncmp(cmd, "setvalues", 4) == 0) {
cmd = strchr(cmd, '[')+1;
for( int i=0; i < 8; i++) {
sscanf(cmd, "%d", &values[i]);
cmd = strchr(cmd, ',') + 1;
}
JSONCMD_CONF_SETCALLBACK(values);
shell_output("{\"response\":\"OK\"}","");
}
else {
shell_output("{\"response\":\"error\"}","");
}
}
示例4: shell_network
static void shell_network(char *str)
{
char *pos = str + sizeof("network");
uint8_t is_error = 0;
char dstr[DSTR_BUF];
if (strncmp_P(pos, PSTR("set "), 4) == 0)
{
pos += 4;
if (strncmp_P(pos, PSTR("ip "), 3) == 0)
{
pos += 3;
is_error = net_conf_set_ip_string(pos);
}
else if (strncmp_P(pos, PSTR("gw "), 3) == 0)
{
pos += 3;
is_error = net_conf_set_gw_string(pos);
}
else if (strncmp_P(pos, PSTR("nm "), 3) == 0)
{
pos += 3;
is_error = net_conf_set_nm_string(pos);
}
else if (strncmp_P(pos, PSTR("dhcp "), 5) == 0)
{
pos += 5;
is_error = net_conf_set_dhcpc_string(pos);
}
else
{
shell_output("unknown set operation: ", pos);
}
}
else if (strncmp_P(pos, PSTR("show"), 4) == 0)
{
pos += 5;
net_conf_get_mac_string(dstr, DSTR_BUF);
shell_output("MAC: ", dstr);
net_conf_get_ip_string(dstr, DSTR_BUF);
shell_output("IP: ", dstr);
net_conf_get_nm_string(dstr, DSTR_BUF);
shell_output("NM: ", dstr);
net_conf_get_gw_string(dstr, DSTR_BUF);
shell_output("GW: ", dstr);
}
else if (strncmp_P(pos, PSTR("load"), 4) == 0)
{
net_conf_load();
}
else if (strncmp_P(pos, PSTR("save"), 4) == 0)
{
net_conf_save();
}
else
{
shell_output_P(PSTR("options: show, set, load, save"),PSTR(""));
}
}
示例5: killproc
/*-----------------------------------------------------------------------------------*/
static void
killproc(char *str)
{
char procnum, j, c;
char procstr[5];
nullterminate(str);
procnum = 0;
for(j = 0; j < 4; ++j) {
c = str[j];
if(c >= '0' && c <= '9') {
procnum = procnum * 10 + (str[j] - '0');
} else {
break;
}
}
if(procnum != 0) {
inttostr(procstr, procnum);
shell_output("Killing process ", procstr);
ek_post(procnum, EK_EVENT_REQUEST_EXIT, NULL);
} else {
shell_output("Invalid process number", "");
}
}
示例6: PROCESS_THREAD
/*---------------------------------------------------------------------------*/
PROCESS_THREAD(shell_profile_process, ev, data)
{
int i;
char buf[100];
PROCESS_BEGIN();
#if DETAILED_AGGREGATES
for(i = 0; i < aggregates_list_ptr; ++i) {
sprintf(buf, "-- %s: %lu / %u = %lu", aggregates[i].ptr,
aggregates[i].cycles,
aggregates[i].episodes,
aggregates[i].cycles / aggregates[i].episodes);
shell_output(buf, "");
}
#else
for(i = 0; i < aggregates_list_ptr; ++i) {
sprintf(buf, "-- %c%c: %lu / %u = %lu",
aggregates[i].ptr[0], aggregates[i].ptr[1],
aggregates[i].cycles,
aggregates[i].episodes,
aggregates[i].cycles / aggregates[i].episodes);
shell_output(buf, "");
}
#endif
sprintf(buf, "Memory for aggregates: %d * %d = %d\n",
(int)sizeof(struct aggregate), aggregates_list_ptr,
(int)sizeof(struct aggregate) * aggregates_list_ptr);
shell_output(buf, "");
PROCESS_END();
}
示例7: write_chunk_pt
/*---------------------------------------------------------------------------*/
static int
write_chunk_pt(struct rudolph0_conn *c, int offset, int flag,
uint8_t *data, int datalen)
{
PT_BEGIN(&recvnetfilept);
PT_WAIT_UNTIL(&recvnetfilept, receiving_file);
leds_on(LEDS_YELLOW);
leds_on(LEDS_RED);
PT_WAIT_UNTIL(&recvnetfilept, flag == RUDOLPH0_FLAG_NEWFILE);
leds_off(LEDS_RED);
do {
if(datalen > 0) {
shell_output(&recvnetfile_command, data, datalen, "", 0);
/* printf("write_chunk wrote %d bytes at %d\n", datalen, offset);*/
}
PT_YIELD(&recvnetfilept);
} while(flag != RUDOLPH0_FLAG_LASTCHUNK);
shell_output(&recvnetfile_command, data, datalen, "", 0);
/* printf("write_chunk wrote %d bytes at %d\n", datalen, offset);*/
shell_output(&recvnetfile_command, "", 0, "", 0);
leds_off(LEDS_YELLOW);
receiving_file = 0;
process_post(&shell_recvnetfile_process, PROCESS_EVENT_CONTINUE, NULL);
PT_END(&recvnetfilept);
}
示例8: shell_start
/*-----------------------------------------------------------------------------------*/
void
shell_start(void)
{
showingdir = 0;
shell_output("Contiki command shell", "");
shell_output("Type '?' and return for help", "");
shell_prompt("contiki-c64> ");
}
示例9: help
/*---------------------------------------------------------------------------*/
static void
help(char *str)
{
shell_output("Available commands:", "");
shell_output("led_on - turn on leds", "");
shell_output("led_off - turn off led7s", "");
shell_output("help, ? - show help", "");
shell_output("exit - exit shell", "");
}
示例10: shell_start
/*---------------------------------------------------------------------------*/
void
shell_start(void)
{
mode = COMMAND_MODE;
shell_output("Greetings and salutations, sir or madam.", "");
shell_output("I bid you welcome to the IGOR command shell!", "");
shell_output("How may I serve you today?", "");
shell_output("Please, type '?' and return for help.", "");
shell_prompt(SHELL_PROMPT);
}
示例11: shell_start
/*---------------------------------------------------------------------------*/
void
shell_start(void)
{
str_t *tp;
do_init(tp);
shell_output(tp->resp,"");
shell_output("uIP command shell", "");
shell_output("command 'quit' to return.\n","");
shell_prompt(CLI_PROMPT);
}
示例12: runfile
/*-----------------------------------------------------------------------------------*/
static void
runfile(char *str)
{
nullterminate(str);
if(strlen(str) > 0) {
/* Call loader function. */
program_handler_load(str, NULL);
shell_output("Starting program ", str);
} else {
shell_output("Must supply a program name", "");
}
}
示例13: processes
/*-----------------------------------------------------------------------------------*/
static void
processes(char *str)
{
static char idstr[5];
struct ek_proc *p;
shell_output("Processes:", "");
/* Step through each possible process ID and see if there is a
matching process. */
for(p = EK_PROCS(); p != NULL; p = p->next) {
inttostr(idstr, p->id);
shell_output(idstr, (char *)p->name);
}
}
示例14: directory
/*-----------------------------------------------------------------------------------*/
static void
directory(char *str)
{
if(cfs_opendir(&dir, "/") != 0) {
shell_output("Cannot open directory", "");
showingdir = 0;
} else {
shell_output("Disk directory:", "");
showingdir = 1;
totsize = 0;
ek_post(EK_PROC_ID(EK_CURRENT()), EK_EVENT_CONTINUE, NULL);
}
}
示例15: read_sd
//Read one sector from the memory card and dump it to the shell
void
read_sd(void)
{
char lbastr[5];
inttostr(lbastr, lba);
shell_output("Reading SD card: Sector", lbastr);
uint8_t data[512];
if (mmc_readsector(lba, data) == 0)
hexdump(data, 512);
else
shell_output("Failed to read that sector", "");
}