本文整理汇总了C++中do_cmd函数的典型用法代码示例。如果您正苦于以下问题:C++ do_cmd函数的具体用法?C++ do_cmd怎么用?C++ do_cmd使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了do_cmd函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
开发者ID:Og192,项目名称:CPro,代码行数:9,代码来源:sys_time.c
示例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);
}
开发者ID:hmatyschok,项目名称:MeshBSD,代码行数:9,代码来源:ifvxlan.c
示例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');
}
开发者ID:hmatyschok,项目名称:MeshBSD,代码行数:57,代码来源:ifvxlan.c
示例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");
}
开发者ID:2trill2spill,项目名称:freebsd,代码行数:18,代码来源:ifbridge.c
示例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);
}
开发者ID:EgoIncarnate,项目名称:qemu-rr,代码行数:9,代码来源:esp.c
示例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);
}
}
开发者ID:feimengspirit,项目名称:galen-emacs,代码行数:9,代码来源:securesoho_network.c
示例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;
}
开发者ID:cjecho,项目名称:RTAI,代码行数:57,代码来源:aocmd.c
示例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);
}
开发者ID:crazyleen,项目名称:apue,代码行数:9,代码来源:times1.c
示例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;
}
开发者ID:jacoblannen,项目名称:MCHA3000,代码行数:56,代码来源:main.c
示例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");
}
开发者ID:2trill2spill,项目名称:freebsd,代码行数:10,代码来源:ifbridge.c
示例11: main
int
main(int argc,char **argv)
{
int i;
for(i=1;i<argc;i++){
do_cmd(argv[i]);
}
exit(0);
}
开发者ID:woai110120130,项目名称:unix,代码行数:10,代码来源:testtimes.c
示例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);
}
开发者ID:chenjianlong,项目名称:books-code,代码行数:10,代码来源:fig8.30.c
示例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;
}
开发者ID:xmyth,项目名称:pmon-osolution,代码行数:10,代码来源:net.c
示例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);
}
}
开发者ID:BernardXiong,项目名称:loongson1-pmon,代码行数:19,代码来源:tgt_cmd.c
示例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);
}
开发者ID:2trill2spill,项目名称:freebsd,代码行数:10,代码来源:ifbridge.c
示例16: bridge_status
static void
bridge_status(int s)
{
struct ifbropreq ifbp;
struct ifbrparam param;
u_int16_t pri;
u_int8_t ht, fd, ma, hc, pro;
u_int8_t lladdr[ETHER_ADDR_LEN];
u_int16_t bprio;
u_int32_t csize, ctime;
if (do_cmd(s, BRDGGCACHE, ¶m, sizeof(param), 0) < 0)
return;
csize = param.ifbrp_csize;
if (do_cmd(s, BRDGGTO, ¶m, sizeof(param), 0) < 0)
return;
ctime = param.ifbrp_ctime;
if (do_cmd(s, BRDGPARAM, &ifbp, sizeof(ifbp), 0) < 0)
return;
pri = ifbp.ifbop_priority;
pro = ifbp.ifbop_protocol;
ht = ifbp.ifbop_hellotime;
fd = ifbp.ifbop_fwddelay;
hc = ifbp.ifbop_holdcount;
ma = ifbp.ifbop_maxage;
PV2ID(ifbp.ifbop_bridgeid, bprio, lladdr);
printf("\tid %s priority %u hellotime %u fwddelay %u\n",
ether_ntoa((struct ether_addr *)lladdr), pri, ht, fd);
printf("\tmaxage %u holdcnt %u proto %s maxaddr %u timeout %u\n",
ma, hc, stpproto[pro], csize, ctime);
PV2ID(ifbp.ifbop_designated_root, bprio, lladdr);
printf("\troot id %s priority %d ifcost %u port %u\n",
ether_ntoa((struct ether_addr *)lladdr), bprio,
ifbp.ifbop_root_path_cost, ifbp.ifbop_root_port & 0xfff);
bridge_interfaces(s, "\tmember: ");
return;
}
开发者ID:2trill2spill,项目名称:freebsd,代码行数:42,代码来源:ifbridge.c
示例17: esp_do_dma
static int esp_do_dma(ESPState *s)
{
int len, len2;
int to_device;
to_device = (s->ti_size < 0);
len = s->dma_left;
if (s->do_cmd) {
s->dma_memory_read(s->dma_opaque, &s->cmdbuf[s->cmdlen], len);
s->ti_size = 0;
s->cmdlen = 0;
s->do_cmd = 0;
do_cmd(s, s->cmdbuf);
return 1;
}
if (s->async_len == 0) {
/* Defer until data is available. */
return 1;
}
if (len > s->async_len) {
len = s->async_len;
}
len2 = len;
if (to_device) {
len = s->dma_memory_read(s->dma_opaque, s->async_buf, len2);
} else {
len = s->dma_memory_write(s->dma_opaque, s->async_buf, len2);
}
if (len < 0)
len = len2;
s->dma_left -= len;
s->async_buf += len;
s->async_len -= len;
if (to_device)
s->ti_size += len;
else
s->ti_size -= len;
if (s->async_len == 0) {
scsiesp_req_continue(s->current_req);
/* If there is still data to be read from the device then
complete the DMA operation immediately. Otherwise defer
until the scsi layer has completed. */
if (to_device || s->dma_left != 0 || s->ti_size == 0) {
return 1;
}
}
if (len2 > len && s->dma_left > 0)
return 0;
/* Partially filled a scsi buffer. Complete immediately. */
esp_dma_done(s);
return 1;
}
开发者ID:jorditorrentsguillen,项目名称:WinUAE,代码行数:54,代码来源:esp.cpp
示例18: main
int main(int argc, char *argv[])
{
int i;
setbuf(stdout, NULL);
for(i = 1; i < argc; i++)
{
do_cmd(argv[i]);
}
exit(0);
}
开发者ID:wugsh,项目名称:wgs,代码行数:11,代码来源:8-31.c
示例19: main
int main(int argc, char *argv[])
{
int i;
//void setbuf(FILE *stream, char *buf);
setbuf(stdout, NULL);
for(i = 1; i < argc; i++){
do_cmd(argv[i]);
}
exit(0);
}
开发者ID:Airead,项目名称:excise,代码行数:11,代码来源:time.c
示例20: main
int main(int argc, char *argv[])
{
int i = 0;
setbuf(stdout, NULL); //why set unbuffered ?
for (i = 1; i < argc; i++)
{
do_cmd(argv[i]);
}
exit(0);
}
开发者ID:isshe,项目名称:2.Advanced_programming,代码行数:12,代码来源:p224_times.c
注:本文中的do_cmd函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论