• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ CMD函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中CMD函数的典型用法代码示例。如果您正苦于以下问题:C++ CMD函数的具体用法?C++ CMD怎么用?C++ CMD使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了CMD函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: exec_pipe

int	exec_pipe(char **cmd, char **env)
{
    t_pip	p;

    p.ret = 0;
    if (pipe(p.fd) == -1)
        return (my_putstr("QuadriSH: Error pipe.\n", 2));
    if ((p.pid = fork()) < 0)
        return (1);
    if (p.pid == 0)
    {
        close(p.fd[0]);
        dup2(p.fd[1], 1);
        my_parser(my_str_to_wordtab(CMD(cmd[0])), 1, env);
        exit(0);
    }
    else
    {
        close(p.fd[1]);
        dup2(p.fd[0], 0);
        my_parser(my_str_to_wordtab(CMD(cmd[1])), 1, env);
        wait(&p.ret);
        exit(0);
    }
    return (p.ret);
}
开发者ID:TH3Mjuss,项目名称:QuadriSH,代码行数:26,代码来源:pipe.c


示例2: LCD_INIT

void LCD_INIT()
{

DDRD=0xFF;                                                    

DDRC=0xFF;


PORTD=0x38;
CMD ();
_delay_ms(100);
PORTD=0x0E;
CMD ();
_delay_ms(100);
PORTD=0x01;
CMD ();
_delay_ms(100);
PORTD=0x06;
CMD ();
_delay_ms(100);
PORTD=0x80;
CMD ();
_delay_ms(100);

PORTD=0x00;
}
开发者ID:ashishrai12,项目名称:LCD_ADC_AVR,代码行数:26,代码来源:LCD_ADC.c


示例3: FlashSingleProgram

ReturnType FlashSingleProgram(udword udAddrOff,uCPUBusType ucValue)
/****************************************************************************
* INPUT(S)             :
* OUTPUT(S)            :
* DESIGN DOC.          :
* FUNCTION DESCRIPTION :
*
****************************************************************************/
{
  uCPUBusType val;

  OS_Use(&mSemaFlashDrv);

  FlashWrite( 0x00555, (uCPUBusType)CMD(0x00AA) );  /* 1st cycle */
  FlashWrite( 0x002AA, (uCPUBusType)CMD(0x0055) );  /* 2nd cycle */
  FlashWrite( 0x00555, (uCPUBusType)CMD(0x00A0) );  /* Program command */
  FlashWrite( udAddrOff,ucValue );                  /* Program value */
  FlashDataToggle();
  val = FlashRead( udAddrOff );
  if (val != ucValue)
  {
    return Flash_OperationTimeOut;
  }

  OS_Unuse(&mSemaFlashDrv);

  return Flash_Success;
}
开发者ID:Strongc,项目名称:DC_source,代码行数:28,代码来源:c1648.c


示例4: locate_cmd

/*-------------------------------------------------------------------*/
int locate_cmd(int argc, char *argv[], char *cmdline)
{
    int rc = 0;

    UNREFERENCED(cmdline);

    if (argc > 1 && CMD(argv[1],sysblk,6))
    {
        rc = locate_sysblk(argc, argv, cmdline);
    }
    else
    if (argc > 1 && CMD(argv[1],regs,4))
    {
        rc = locate_regs(argc, argv, cmdline);
    }
    else
    if (argc > 1 && CMD(argv[1],hostinfo,4))
    {
        rc = locate_hostinfo(argc, argv, cmdline);
    }
    else
    {
        WRMSG( HHC02299, "E", argv[0] );
        rc = -1;
    }

    return rc;
}
开发者ID:IanWorthington,项目名称:hercules-390,代码行数:29,代码来源:hscloc.c


示例5: setup_gpioexp_stm32

void setup_gpioexp_stm32(void)
{
  uint8_t data[16];
  int sz;
  int ret;

  Serial.println("starting stm32 gpio code");

  ret = stm32_cmd(CMD(0, 0), NULL, 0, data, 3);
  if (ret < 0) {
    Serial.println("Failed to find stm32 info");
  } else {
    sz = data[2];
    if (sz > sizeof(data)) {
       Serial.println("truncating info buffer size");
       sz = sizeof(data);
    }
      
    ret = stm32_cmd(CMD(0,0), NULL, 0, data, sz);
    if (ret) {
      Serial.println("failed to read all stm32 info");
    } else {
      Serial.println("Found stm32 info:");
      Serial.print("Major version "); Serial.println(data[0]);
      Serial.print("Minor version "); Serial.println(data[1]);
    }
  }
}
开发者ID:HACManchester,项目名称:haccess-code,代码行数:28,代码来源:stm32_support.cpp


示例6: manage_env

void	manage_env(t_group *grp)
{
	int		i;
	int		j;
	int		pos;

	i = -1;
	j = -1;
	pos = list_to_tab(0, grp->first, NULL);
	while (++i < grp->define_cmd[namenv] &&
		CMD(cmd_split)[i + grp->define_cmd[e_opt] + 1])
		pos += 1;
	grp->env = (char **)malloc(sizeof(char *) * (pos + 1));
	grp->env_save = (char **)malloc(sizeof(char *) * (pos + 1));
	while (++j < pos + 1)
	{
		grp->env[j] = NULL;
		grp->env_save[j] = NULL;
	}
	i = -1;
	pos = list_to_tab(1, grp->first, &(grp->env));
	while (++i < grp->define_cmd[namenv] &&
		CMD(cmd_split)[i + grp->define_cmd[e_opt] + 1])
	{
		grp->env[pos + i] =
		SDUP(CMD(cmd_split)[i + grp->define_cmd[e_opt] + 1]);
	}
}
开发者ID:jmontija,项目名称:21sh,代码行数:28,代码来源:pre_exec.c


示例7: shell_run

void shell_run(tree_t e, struct tree_rd_ctx *ctx)
{
   const int ndecls = tree_decls(e);
   hash_t *decl_hash = hash_new(ndecls * 2, true);
   for (int i = 0; i < ndecls; i++) {
      tree_t d = tree_decl(e, i);
      hash_put(decl_hash, tree_ident(d), d);
   }

   Tcl_Interp *interp = Tcl_CreateInterp();

   bool have_quit = false;

   Tcl_CreateExitHandler(shell_exit_handler, &have_quit);

   shell_cmd_t shell_cmds[] = {
      CMD(quit,      &have_quit, "Exit simulation"),
      CMD(run,       ctx,        "Start or resume simulation"),
      CMD(restart,   NULL,       "Restart simulation"),
      CMD(show,      decl_hash,  "Display simulation objects"),
      CMD(help,      shell_cmds, "Display this message"),
      CMD(copyright, NULL,       "Display copyright information"),
      CMD(signals,   e,          "Find signal objects in the design"),
      CMD(now,       NULL,       "Display current simulation time"),
      CMD(watch,     decl_hash,  "Trace changes to a signal"),
      CMD(unwatch,   decl_hash,  "Stop tracing signals"),

      { NULL, NULL, NULL, NULL}
   };

   qsort(shell_cmds, ARRAY_LEN(shell_cmds) - 1, sizeof(shell_cmd_t),
         compare_shell_cmd);

   for (shell_cmd_t *c = shell_cmds; c->name != NULL; c++)
      Tcl_CreateObjCommand(interp, c->name, c->fn, c->cd, NULL);

   show_banner();

   slave_post_msg(SLAVE_RESTART, NULL, 0);

   char *line;
   while (!have_quit && (line = shell_get_line())) {
      switch (Tcl_Eval(interp, line)) {
      case TCL_OK:
         break;
      case TCL_ERROR:
         errorf("%s", Tcl_GetStringResult(interp));
         break;
      default:
         assert(false);
      }

      free(line);
   }

   Tcl_Exit(EXIT_SUCCESS);
}
开发者ID:a4a881d4,项目名称:nvc,代码行数:57,代码来源:shell.c


示例8: my_commands

static void my_commands (void)
{
	extern int nsp (int argc, char *argv[]);
	extern int psp (int argc, char *argv[]);
	extern int keysp (int argc, char *argv[]);

	CMD(ns,		"# list nodes");
	CMD(ps,		"# list processes and avatars");
	CMD(keys,	"# list processes and keys");
}
开发者ID:taysom,项目名称:tau,代码行数:10,代码来源:main.c


示例9: init_dir

void init_dir (void)
{
	int		rc;

	rc = sw_local("dir_cmd", &Dir_key);
	if (rc) failure("sw_local", rc);

	CMD(cr,		"<path> # create a dir entry");
	CMD(prtree,	"# have dirfs print full directory tree");
	CMD(prbackup,	"# have dirfs print backup tree");
	CMD(rd,		"[inode num]+ # get and print a dir");
	CMD(ls,		"# list dir tree");
}
开发者ID:taysom,项目名称:tau,代码行数:13,代码来源:cmd_dir.c


示例10: handleCommand

void handleCommand(string command)
{
	hC_begin

	CMD("look")
		cout << "You see:" << endl;
		for (unsigned i = 0; i < stuff.size(); i++)
			cout << " * " << stuff[i] << endl;
	CMD("open")
		if (args[1] == "door")
			if (has_item("key"))
			{
				cout << "The door opened!" << endl;
				ACHIEVE(DOOR_OPEN);
				goNextLevel();
			}
			else
				cout << "The door is locked!" << endl;
	CMD("take")
		if (args[1] == "comment")
		{
			if (has_achievement(EA_CAPTCHA)) {
				FIND("comment");
			} else
				cout << "You can't! It's not your's!" << endl;
		}
		if (args[1] == "captcha")
			FIND("captcha");
	CMD("say")
		if (args[1] == "captcha")
			if (has_item("captcha"))
			{
				cout << "Man, that captcha was lamer than i thought!" << endl;
				ACHIEVE(CAPTCHA);
			}
			else
				cout << "What does that captcha say? I don't know!" << endl;
	CMD("post")
		if (args[1] == "comment")
			if (has_item("comment"))
			{
				FIND("key");
				ACHIEVE(COMMENT);
			}
			else
				cout << "You can't! It's not your's!" << endl;
	CMD("help")
		cout << "The following commands are availeble:" << endl << " * look\n * open\n * take\n * say\n * post\n";

	hC_end
}
开发者ID:roelforg,项目名称:textgame,代码行数:51,代码来源:main.cpp


示例11: main

int main(int argc, const char **argv)
{
    setlocale(LC_ALL, "");
    /* Hack:
     * Right-to-left scripts don't work properly in many terminals.
     * Hebrew speaking people say he_IL.utf8 looks so mangled
     * they prefer en_US.utf8 instead.
     */
    const char *msg_locale = setlocale(LC_MESSAGES, NULL);
    if (msg_locale && strcmp(msg_locale, "he_IL.utf8") == 0)
        setlocale(LC_MESSAGES, "en_US.utf8");
#if ENABLE_NLS
    bindtextdomain(PACKAGE, LOCALEDIR);
    textdomain(PACKAGE);
#endif

    abrt_init((char **)argv);

    argv++;
    argc--;

    const char *abrt_cli_usage_string = _(
                                            "Usage: abrt-cli [--version] COMMAND [DIR]..."
                                        );

    const struct cmd_struct commands[] = {
        CMD(list, _("List problems [in DIRs]")),
        CMD(rm, _("Remove problem directory DIR")),
        CMD(report, _("Analyze and report problem data in DIR")),
        CMD(info, _("Print information about DIR")),
        CMD(status, _("Print the count of the recent crashes")),
        {NULL, NULL, NULL}
    };

    migrate_to_xdg_dirs();

    unsigned skip = handle_internal_options(argc, argv, abrt_cli_usage_string);
    argc -= skip;
    argv += skip;
    if (argc > 0)
        handle_internal_command(argc, argv, commands);

    /* user didn't specify command; print out help */
    printf("%s\n\n", abrt_cli_usage_string);
    list_cmds_help(commands);
    printf("\n%s\n", _("See 'abrt-cli COMMAND --help' for more information"));

    return 0;
}
开发者ID:shlomif,项目名称:abrt,代码行数:49,代码来源:abrt-cli.c


示例12: st7565Init

void st7565Init(FONT_DEF_STRUCT * font)
{
  // Note: This can be optimised to set all pins to output and high
  // in two commands by manipulating the registers directly (assuming
  // that the pins are located in the same GPIO bank).  The code is left
  // as is for clarity sake in case the pins are not all located in the
  // same bank.

	ST7565_CS_DIR	 		= OUTPUT;
	ST7565_RST_DIR	 	= OUTPUT;
	ST7565_A0_DIR	 		= OUTPUT;
	ST7565_SCL_DIR	 	= OUTPUT;
	ST7565_SDA_DIR	 	= OUTPUT;

	ST7565_SDA = 1;
  ST7565_SCL = 1;
	ST7565_A0  = 1;
	ST7565_RST = 1;
	ST7565_CS  = 1;

  // Reset
	ST7565_CS  = 0;
	ST7565_RST = 0;
	_delay_ms(500);
	ST7565_RST = 1;

	currentFont = font;

  // Configure Display
  //CMD(ST7565_CMD_SET_BIAS_7);                       // LCD Bias Select									0xA3		0xA2
  CMD(ST7565_CMD_SET_BIAS_9);                         // LCD Bias Select									0xA3		0xA2
  CMD(ST7565_CMD_SET_ADC_NORMAL);                     // ADC Select												0xA0		0xA6
  CMD(ST7565_CMD_SET_COM_NORMAL);                     // SHL Select												0xC0		0xc8
  //CMD(ST7565_CMD_SET_COM_REVERSE);                     // SHL Select												0xC0		0xc8
  CMD(ST7565_CMD_SET_DISP_START_LINE);                // Initial Display Line							0x40		0x40
  CMD(ST7565_CMD_SET_POWER_CONTROL | 0x04);           // Turn on voltage converter (VC=1, VR=0, VF=0)			0x28		0x24
  _delay_ms(50);                											// Wait 50mS
  CMD(ST7565_CMD_SET_POWER_CONTROL | 0x06);           // Turn on voltage regulator (VC=1, VR=1, VF=0)
  _delay_ms(50);                											// Wait 50mS
  CMD(ST7565_CMD_SET_POWER_CONTROL | 0x07);           // Turn on voltage follower
  _delay_ms(10);                											// Wait 10mS
  CMD(ST7565_CMD_SET_RESISTOR_RATIO | 0x6);           // Set LCD operating voltage

  // Turn display on
  CMD(ST7565_CMD_DISPLAY_ON);													// 0xAF
  CMD(ST7565_CMD_SET_ALLPTS_NORMAL);									// 0xA4
  st7565SetBrightness(0x11);	// 0x18
}
开发者ID:bytepicker,项目名称:kk20,代码行数:48,代码来源:st7565.c


示例13: bot_disconnect

int bot_disconnect(struct bot* b)
{
	printf("Dying...\n");
	CMD(b->conn, "PRIVMSG", NULL, "EXIT CBOT is dying.");
	globalkill=1;
	return 0;
}
开发者ID:Detegr,项目名称:CBot,代码行数:7,代码来源:bot.c


示例14: writeBuffer

void writeBuffer(uint8_t *buffer) 
{
  uint8_t c, p;

  for(p = 0; p < 8; p++) 
  {
    CMD(ST7565_CMD_SET_PAGE | (7-p));
//    CMD(ST7565_CMD_SET_PAGE | (p));
      CMD(ST7565_CMD_SET_COLUMN_LOWER | (0x0 & 0xf));
    CMD(ST7565_CMD_SET_COLUMN_UPPER | ((0x0 >> 4) & 0xf));
    CMD(ST7565_CMD_RMW);
    
    for(c = 0; c < 128; c++) 
    {
      DATA(buffer[(128*p)+c]);
    }
  }
}
开发者ID:bytepicker,项目名称:kk20,代码行数:18,代码来源:st7565.c


示例15: stm32_gpio_set

extern int stm32_gpio_set(unsigned int gpio, unsigned int state)
{
  uint8_t data;
  int ret;
  
  data = (gpio << 3) | (state ? 1 : 0);
  ret = stm32_cmd(CMD(STM_CMD_SET, 0), &data, 1, NULL, 0);
  return ret;
}
开发者ID:HACManchester,项目名称:haccess-code,代码行数:9,代码来源:stm32_support.cpp


示例16: init_cmd

void init_cmd (void)
{
	CMD(q,     "         # quit");
	CMD(inuse, "         # dump inuse cache buffers");
	CMD(gen,   "[n]      # generate n random directories, defaults to 10");
	CMD(mkdir, "<name>*  # create the named directories");
	CMD(ls,    "<name>*  # list content of directories");
	CMD(inodes,"         # list content of directories");
	CMD(cr,    "<name>+  # create the named files");
	CMD(rw,    "<name>+  # read/write test of given files");
}
开发者ID:wtaysom,项目名称:tau,代码行数:11,代码来源:main.c


示例17: bot_connect

int bot_connect(struct bot* b, const char* server, unsigned int port)
{
	if(conn_connect(b->conn, server, port)==0)
	{
		const char** nick = config_getvals(b->conf, "nick");
		const char** realname = config_getvals(b->conf, "realname");

		CMD(b->conn, "NICK", NULL, *nick);
		char name[64]; *name=0;
		concat(name, 5, *nick, " ", *nick, " * :", *realname);
		CMD(b->conn, "USER", NULL, name);

		return 0;
	}
	else
	{
		fprintf(stderr, "Couldn't connect to %s:%d\n", server, port);
		return -1;
	}
}
开发者ID:Detegr,项目名称:CBot,代码行数:20,代码来源:bot.c


示例18: mpu401_uninit

int
mpu401_uninit(struct mpu401 *m)
{
	int retval;

	CMD(m, MPU_RESET);
	retval = midi_uninit(m->mid);
	if (retval)
		return retval;
	free(m, M_MIDI);
	return 0;
}
开发者ID:ele7enxxh,项目名称:dtrace-pf,代码行数:12,代码来源:mpu401.c


示例19: define_arg_cmd

void	define_arg_cmd(t_group *grp)
{
	int	i;

	i = 0;
	while (CMD(cmd_split) && CMD(cmd_split)[++i])
	{
		if (CMD(cmd_split)[i][0] == '-' &&
			grp->define_cmd[namenv] == false &&
			grp->define_cmd[utils] == false)
			grp->define_cmd[e_opt] = i;
		else if (is_env(CMD(cmd_split)[i]) > 0 &&
			grp->define_cmd[utils] == false)
			grp->define_cmd[namenv] = i;
		else
		{
			grp->define_cmd[utils] = i;
			break ;
		}
	}
}
开发者ID:jmontija,项目名称:21sh,代码行数:21,代码来源:pre_exec.c


示例20: bot_execcmd

int bot_execcmd(struct bot* b, char* msg)
{
	char* p = strstr(msg, " ");
	if(p)
	{
		*p=0;
		CMD(b->conn, msg, NULL, ++p);
		//printf("CMD: %s, TOKEN: %s\n", msg, p);
		return 0;	
	}
	return -1;
}
开发者ID:Detegr,项目名称:CBot,代码行数:12,代码来源:bot.c



注:本文中的CMD函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ CMDQ_ERR函数代码示例发布时间:2022-05-30
下一篇:
C++ CL_WritePacket函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap