本文整理汇总了C++中do_cmd函数的典型用法代码示例。如果您正苦于以下问题:C++ do_cmd函数的具体用法?C++ do_cmd怎么用?C++ do_cmd使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了do_cmd函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char *argv[])
{
int i;
setbuf(stdout, NULL);
for(i = 1; i < argc; i++)
do_cmd(argv[i]);
exit(EXIT_SUCCESS);
}
示例2: vxlan_exists
static int
vxlan_exists(int sock)
{
struct ifvxlancfg cfg;
bzero(&cfg, sizeof(cfg));
return (do_cmd(sock, VXLAN_CMD_GET_CONFIG, &cfg, sizeof(cfg), 0) != -1);
}
示例3: vxlan_status
static void
vxlan_status(int s)
{
struct ifvxlancfg cfg;
char src[NI_MAXHOST], dst[NI_MAXHOST];
char srcport[NI_MAXSERV], dstport[NI_MAXSERV];
struct sockaddr *lsa, *rsa;
int vni, mc, ipv6;
bzero(&cfg, sizeof(cfg));
if (do_cmd(s, VXLAN_CMD_GET_CONFIG, &cfg, sizeof(cfg), 0) < 0)
return;
vni = cfg.vxlc_vni;
lsa = &cfg.vxlc_local_sa.sa;
rsa = &cfg.vxlc_remote_sa.sa;
ipv6 = rsa->sa_family == AF_INET6;
/* Just report nothing if the network identity isn't set yet. */
if (vni >= VXLAN_VNI_MAX)
return;
if (getnameinfo(lsa, lsa->sa_len, src, sizeof(src),
srcport, sizeof(srcport), NI_NUMERICHOST | NI_NUMERICSERV) != 0)
src[0] = srcport[0] = '\0';
if (getnameinfo(rsa, rsa->sa_len, dst, sizeof(dst),
dstport, sizeof(dstport), NI_NUMERICHOST | NI_NUMERICSERV) != 0)
dst[0] = dstport[0] = '\0';
if (!ipv6) {
struct sockaddr_in *sin = (struct sockaddr_in *)rsa;
mc = IN_MULTICAST(ntohl(sin->sin_addr.s_addr));
} else {
struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)rsa;
mc = IN6_IS_ADDR_MULTICAST(&sin6->sin6_addr);
}
printf("\tvxlan vni %d", vni);
printf(" local %s%s%s:%s", ipv6 ? "[" : "", src, ipv6 ? "]" : "",
srcport);
printf(" %s %s%s%s:%s", mc ? "group" : "remote", ipv6 ? "[" : "",
dst, ipv6 ? "]" : "", dstport);
if (verbose) {
printf("\n\t\tconfig: ");
printf("%slearning portrange %d-%d ttl %d",
cfg.vxlc_learn ? "" : "no", cfg.vxlc_port_min,
cfg.vxlc_port_max, cfg.vxlc_ttl);
printf("\n\t\tftable: ");
printf("cnt %d max %d timeout %d",
cfg.vxlc_ftable_cnt, cfg.vxlc_ftable_max,
cfg.vxlc_ftable_timeout);
}
putchar('\n');
}
示例4: do_bridgeflag
static void
do_bridgeflag(int sock, const char *ifs, int flag, int set)
{
struct ifbreq req;
strlcpy(req.ifbr_ifsname, ifs, sizeof(req.ifbr_ifsname));
if (do_cmd(sock, BRDGGIFFLGS, &req, sizeof(req), 0) < 0)
err(1, "unable to get bridge flags");
if (set)
req.ifbr_ifsflags |= flag;
else
req.ifbr_ifsflags &= ~flag;
if (do_cmd(sock, BRDGSIFFLGS, &req, sizeof(req), 1) < 0)
err(1, "unable to set bridge flags");
}
示例5: handle_satn
static void handle_satn(ESPState *s)
{
uint8_t buf[32];
int len;
len = get_cmd(s, buf);
if (len)
do_cmd(s, buf);
}
示例6: stop_wpa_client
static void stop_wpa_client( void )
{
if ( ps_exist(WPA_PID) ) {
kill_pidfile(WPA_PID, 15);
unlink(WPA_PID);
} else {
do_cmd(IFCONFIG, WLAN_PORT, "0.0.0.0", "down", NULL);
}
}
示例7: main
int main(void)
{
double omega = (2.0*M_PI*SIN_FREQ*SAMP_TIME)/1.0E9;
RTIME until;
RT_TASK *task;
lsampl_t data[NCHAN*2];
long k, sinewave, retval = 0;
signal(SIGKILL, endme);
signal(SIGTERM, endme);
start_rt_timer(0);
task = rt_task_init_schmod(nam2num("MYTASK"), 1, 0, 0, SCHED_FIFO, 0xF);
printf("COMEDI CMD TEST BEGINS: SAMPLING FREQ: %d, RUN TIME: %d.\n", SAMP_FREQ, RUN_TIME);
if (init_board()) {;
printf("Board initialization failed.\n");
return 1;
}
do_cmd();
mlockall(MCL_CURRENT | MCL_FUTURE);
rt_make_hard_real_time();
until = rt_get_cpu_time_ns() + (long long)RUN_TIME*1000000000;
for (k = 0; k < SAMP_FREQ*RUN_TIME && !end; k++) {
sinewave = (long)(maxdata/4*sin(k*omega));
data[0] = (lsampl_t)( sinewave + maxdata/2);
data[1] = (lsampl_t)(- sinewave + maxdata/2);
while (rt_comedi_command_data_write(dev, subdev, NCHAN, data) != NCHAN) {
rt_sleep(nano2count(SAMP_TIME/2));
}
if (k == TRIGSAMP) {
rt_comedi_trigger(dev, subdev);
}
}
while (until > rt_get_cpu_time_ns()) {
rt_sleep(nano2count(100000));
}
comedi_cancel(dev, subdev);
comedi_close(dev);
comedi_data_write(dev, subdev, 0, 0, AREF_GROUND, 2048);
comedi_data_write(dev, subdev, 1, 0, AREF_GROUND, 2048);
printf("COMEDI TEST ENDS.\n");
if (retval < 0) {
printf("rt_comedi_wait_timed overruns: %d\n", abs(retval));
}
stop_rt_timer();
rt_make_soft_real_time();
rt_task_delete(task);
return 0;
}
示例8: main
int
main(int argc, char *argv[])
{
int i;
for (i = 1; i < argc; i++)
do_cmd(argv[i]); /* once for each command-line arg */
exit(0);
}
示例9: main
int main(void)
{
lb_init(&lb);
event_init();
motor_init();
uart_init(); // init USART
enc_init();
i2c_init();
adc_init();
kalman_init();
sei(); // enable interrupts
// Wait a second at startup
_delay_ms(1000);
// send initial string
printf_P(PSTR("Hello world!\n"));
imu_init();
for (;/*ever*/;)
{
// ADCSRA |= (1<<ADSC); // Set start conversion bit and wait for conversion to finish
// while(ADCSRA&(1<<ADSC));
// OCR1AL = ADCH; // Set ADC reading to timer 0 compare
if(event_pending())
{
event_action();
}
else // No pending operation, do low priority tasks
{
// dequeue receive buffer if any bytes waiting
while (uart_avail())
{
char c = uart_getc();
if (lb_append(&lb, c) == LB_BUFFER_FULL)
{
lb_init(&lb); // Clear line
printf_P(PSTR("\nMax line length exceeded\n"));
}
// Process command if line buffer is ready ...
if (lb_line_ready(&lb))
{
strcpy(cmd_string,lb_gets(&lb));
do_cmd(cmd_string);
lb_init(&lb);
}
}
}
// Process command if line buffer is terminated by a line feed or carriage return
}
return 0;
}
示例10: setbridge_flushall
static void
setbridge_flushall(const char *val, int d, int s, const struct afswtch *afp)
{
struct ifbreq req;
memset(&req, 0, sizeof(req));
req.ifbr_ifsflags = IFBF_FLUSHALL;
if (do_cmd(s, BRDGFLUSH, &req, sizeof(req), 1) < 0)
err(1, "BRDGFLUSH");
}
示例11: main
int
main(int argc,char **argv)
{
int i;
for(i=1;i<argc;i++){
do_cmd(argv[i]);
}
exit(0);
}
示例12: main
int main (int argc, char *argv[])
{
int i;
setbuf (stdout, NULL);
for (i = 1; i < argc; i++) {
do_cmd (argv[i]); /* once for each command-line arg */
}
exit (0);
}
示例13: myping
static int myping()
{
char cmd[100];
filterstdout(pingfilter);
strcpy(cmd,"ping -c 3 10.0.0.3");
do_cmd(cmd);
filterstdout(0);
printf("%d %d %d%%\n",transmitted,received,loss);
return 0;
}
示例14: fcrtest
static void fcrtest(int argc,char *argv[])
{
int i;
char buf[100];
printf("test spi");
sprintf(buf,"spi_read_w25x_id");
do_cmd(buf);
sprintf(buf,"spi_read_w25x_id");
do_cmd(buf);
printf("test i2c");
sprintf(buf,"i2cs 0");
do_cmd(buf);
for(i=0;i<5;i++)
{
delay(1000*1000);
sprintf(buf,"d1 0 10");
do_cmd(buf);
}
}
示例15: unsetbridge_span
static void
unsetbridge_span(const char *val, int d, int s, const struct afswtch *afp)
{
struct ifbreq req;
memset(&req, 0, sizeof(req));
strlcpy(req.ifbr_ifsname, val, sizeof(req.ifbr_ifsname));
if (do_cmd(s, BRDGDELS, &req, sizeof(req), 1) < 0)
err(1, "BRDGDELS %s", val);
}