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

C++ cmd_free函数代码示例

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

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



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

示例1: reply_and_free

void
reply_and_free (command_context * ctx, sbuf * reply)
{
  command_manager *mgr = ctx->my_mgr;

  // "delay" and "pgs_del" commands are not cancelable, because these commands
  // have post action after receiving responses from workers. If cmd_cancel()
  // function is called due to client disconnection, these commands with 
  // unable-to-cancel flag continue the execution and just swallow the reply
  // after execution finishes and reply_and_free() is called.
  if (ctx->swallow)
    {
      assert (ctx->unable_to_cancel);
      cmd_free (ctx);
      return;
    }

  ctx->reply_cb (reply, ctx->cbarg);

  mgr->stat.numcommands++;
  if (ctx->local)
    {
      mgr->stat.numcommands_local++;
    }

  cmd_free (ctx);
}
开发者ID:LichKing-lee,项目名称:nbase-arc,代码行数:27,代码来源:gw_cmd_mgr.c


示例2: cmd_tcp_write

void
cmd_tcp_write(evutil_socket_t fd, short which, void *arg)
{
	struct tcp_con *con = arg;
	int len;
	
	TRACE(fd, len = write(fd, con->readbuf, con->rlen));
	
	if (len == -1) {
		if (errno == EINTR || errno == EAGAIN)
			goto again;
		cmd_free(&con->cmd);
		return;
	} else if (len == 0) {
		cmd_free(&con->cmd);
		return;
	}

	memmove(con->readbuf, con->readbuf + len, con->rlen - len);
	con->rlen -= len;

	/* Shut down the connection if we received a FIN and sent all data */
	if (con->rlen == 0 && con->cmd.fdgotfin)
		TRACE(con->cmd_pfd, shutdown(con->cmd_pfd, SHUT_WR));

 again:
	cmd_trigger_write(&con->cmd, con->rlen);
}
开发者ID:cmdrclueless,项目名称:honeyd,代码行数:28,代码来源:tcp.c


示例3: bye

void bye(void)
{
    cliLogCommand("End Session");


    //Set flag for thread to terminate
    terminate_cli_check_session_thread = ACD_TRUE;

    //Reset EditLine (useful if el_gets() did not complete normally)
    if (el != NULL)
        el_end(el);

    //Free dynamically-allocated data
    cli_command_cleanup(CLEAR_STATIC_DATA);
    cli_free_command_cleanup_arr();

    //Kill session
    if (session_id)
        cli_delete_session();

    //Free IPC handles
    cmd_free(&cli_backend_handle);
    cmd_free(&cli_check_session_thread_ipc_handle);
#ifdef ACCEDIAN_CONFIG_DISCOVERY_ENABLED    
    if (acd_cap_discovery())
    {
      discovery_module_cleanup();
    }
#endif
}
开发者ID:thechinh,项目名称:play-with-code,代码行数:30,代码来源:cli.c


示例4: compare

int __cdecl compare(const void *arg1,const void *arg2)
{
    FileName * File1;
    FileName * File2;
    INT ret;

    File1 = cmd_alloc(sizeof(FileName));
    if (!File1)
        return 0;

    File2 = cmd_alloc(sizeof(FileName));
    if (!File2)
    {
        cmd_free(File1);
        return 0;
    }

    memcpy(File1,arg1,sizeof(FileName));
    memcpy(File2,arg2,sizeof(FileName));

    /* ret = _tcsicmp(File1->Name, File2->Name); */
    ret = lstrcmpi(File1->Name, File2->Name);

    cmd_free(File1);
    cmd_free(File2);
    return ret;
}
开发者ID:reactos,项目名称:reactos,代码行数:27,代码来源:filecomp.c


示例5: cmd_udp_write

void
cmd_udp_write(int fd, short which, void *arg)
{
	struct udp_con *con = arg;
	struct conbuffer *buf;
	ssize_t len;

	buf = TAILQ_FIRST(&con->incoming);
	if (buf == NULL)
		return;
	TRACE(fd, len = write(fd, buf->buf, buf->len));

	if (len == -1) {
		if (errno == EINTR || errno == EAGAIN)
			goto again;
		cmd_free(&con->cmd);
		return;
	} else if (len == 0) {
		cmd_free(&con->cmd);
		return;
	}

	TAILQ_REMOVE(&con->incoming, buf, next);
	con->nincoming--;

	free(buf->buf);
	free(buf);

 again:
	cmd_trigger_write(&con->cmd, TAILQ_FIRST(&con->incoming) != NULL);
}
开发者ID:ChristosKon,项目名称:honeyd-ipv6,代码行数:31,代码来源:udp.c


示例6: del

static
VOID del(LPHIST_ENTRY item)
{
	if (item==NULL || item==Top || item==Bottom)
	{
		TRACE ("del in " __FILE__ ": returning\n"
			    "item is 0x%08x (Bottom is0x%08x)\n",
			    item, Bottom);
		return;
	}



	/*free string's mem*/
	if (item->string)
		cmd_free(item->string);

	/*set links in prev and next item*/
	item->next->prev=item->prev;
	item->prev->next=item->next;

	cmd_free(item);

	size--;
}
开发者ID:RareHare,项目名称:reactos,代码行数:25,代码来源:history.c


示例7: CleanHistory

VOID CleanHistory(VOID)
{
	while (Bottom->next!=Top)
		del(Bottom->next);

	cmd_free(Top);
	cmd_free(Bottom);
}
开发者ID:RareHare,项目名称:reactos,代码行数:8,代码来源:history.c


示例8: PrintAllAssociations

static INT
PrintAllAssociations()
{
    DWORD return_val = 0;
    HKEY hKey = NULL;
    DWORD numKeys = 0;

    DWORD extLength = 0;
    LPTSTR extName = NULL;
    DWORD keyCtr = 0;

    return_val = RegOpenKeyEx(HKEY_LOCAL_MACHINE, _T("SOFTWARE\\Classes"), 0, KEY_READ, &hKey);

    if (return_val != ERROR_SUCCESS)
    {
        RegCloseKey(hKey);
        return -1;
    }

    return_val = RegQueryInfoKey(hKey, NULL, NULL, NULL, &numKeys, &extLength, NULL, NULL, NULL, NULL, NULL, NULL);

    if (return_val != ERROR_SUCCESS)
    {
        RegCloseKey(hKey);
        return -2;
    }

    extLength++;
    extName = cmd_alloc(extLength * sizeof(TCHAR));

    for(keyCtr = 0; keyCtr < numKeys; keyCtr++)
    {
        DWORD buffer_size = extLength;
        return_val = RegEnumKeyEx(hKey, keyCtr, extName, &buffer_size, NULL, NULL, NULL, NULL);

        if (return_val == ERROR_SUCCESS || return_val == ERROR_MORE_DATA)
        {
            if (*extName == _T('.'))
                PrintAssociation(extName);
        }
        else
        {
            cmd_free(extName);
            RegCloseKey(hKey);
            return -1;
        }
    }

    RegCloseKey(hKey);

    if (extName)
        cmd_free(extName);

    return numKeys;
}
开发者ID:AJMartel,项目名称:IRTriageCMD,代码行数:55,代码来源:assoc.c


示例9: ClearBatch

/*
 * free the allocated memory of a batch file
 */
VOID ClearBatch()
{
    TRACE ("ClearBatch  mem = %08x    free = %d\n", bc->mem, bc->memfree);

    if (bc->mem && bc->memfree)
        cmd_free(bc->mem);

    if (bc->raw_params)
        cmd_free(bc->raw_params);

    if (bc->params)
        cmd_free(bc->params);
}
开发者ID:vaualbus,项目名称:reactos,代码行数:16,代码来源:batch.c


示例10: cmd_wpas_parse_cipher

static int cmd_wpas_parse_cipher(const char *value)
{
	int val = 0, last;
	char *start, *end, *buf;

	buf = cmd_strdup(value);
	if (buf == NULL)
		return -1;
	start = buf;

	while (*start != '\0') {
		while (*start == ' ' || *start == '\t')
			start++;
		if (*start == '\0')
			break;
		end = start;
		while (*end != ' ' && *end != '\t' && *end != '\0')
			end++;
		last = *end == '\0';
		*end = '\0';
		if (cmd_strcmp(start, "CCMP-256") == 0)
			val |= WPA_CIPHER_CCMP_256;
		else if (cmd_strcmp(start, "GCMP-256") == 0)
			val |= WPA_CIPHER_GCMP_256;
		else if (cmd_strcmp(start, "CCMP") == 0)
			val |= WPA_CIPHER_CCMP;
		else if (cmd_strcmp(start, "GCMP") == 0)
			val |= WPA_CIPHER_GCMP;
		else if (cmd_strcmp(start, "TKIP") == 0)
			val |= WPA_CIPHER_TKIP;
		else if (cmd_strcmp(start, "WEP104") == 0)
			val |= WPA_CIPHER_WEP104;
		else if (cmd_strcmp(start, "WEP40") == 0)
			val |= WPA_CIPHER_WEP40;
		else if (cmd_strcmp(start, "NONE") == 0)
			val |= WPA_CIPHER_NONE;
		else if (cmd_strcmp(start, "GTK_NOT_USED") == 0)
			val |= WPA_CIPHER_GTK_NOT_USED;
		else {
			cmd_free(buf);
			return -1;
		}

		if (last)
			break;
		start = end + 1;
	}
	cmd_free(buf);

	return val;
}
开发者ID:diguokaituozhe,项目名称:XR871,代码行数:51,代码来源:cmd_wlan.c


示例11: cmd_free

void
cmd_free(command_t *cmd)
{
	int i;

	// It's OK to cmd_free(NULL).
	if (!cmd)
		return;

	/* Your code here. */
	cmd_free(cmd->subshell);
	cmd_free(cmd->next);
	free(cmd);
}
开发者ID:xueyanSEU,项目名称:NYU-CS202-Lab2-Shell,代码行数:14,代码来源:cmdparse.c


示例12: cmd_path

INT cmd_path (LPTSTR param)
{

	if (!_tcsncmp (param, _T("/?"), 2))
	{
		ConOutResPaging(TRUE,STRING_PATH_HELP1);
		return 0;
	}

	nErrorLevel = 0;

	/* if param is empty, display the PATH environment variable */
	if (!param || !*param)
	{
		DWORD  dwBuffer;
		LPTSTR pszBuffer;

		pszBuffer = (LPTSTR)cmd_alloc (ENV_BUFFER_SIZE * sizeof(TCHAR));
		dwBuffer = GetEnvironmentVariable (_T("PATH"), pszBuffer, ENV_BUFFER_SIZE);
		if (dwBuffer == 0)
		{
			cmd_free(pszBuffer);
			ConOutResPrintf(STRING_VOL_HELP2, _T("PATH"));
			return 0;
		}
		else if (dwBuffer > ENV_BUFFER_SIZE)
		{
			pszBuffer = (LPTSTR)cmd_realloc (pszBuffer, dwBuffer * sizeof (TCHAR));
			GetEnvironmentVariable (_T("PATH"), pszBuffer, dwBuffer);
		}

		ConOutPrintf (_T("PATH=%s\n"), pszBuffer);
		cmd_free (pszBuffer);

		return 0;
	}

	/* skip leading '=' */
	if (*param == _T('='))
		param++;

	/* set PATH environment variable */
	if (!SetEnvironmentVariable (_T("PATH"), param))
	{
		nErrorLevel = 1;
		return 1;
	}

	return 0;
}
开发者ID:RareHare,项目名称:reactos,代码行数:50,代码来源:path.c


示例13: os_run

/*
 * By Tuwei
 * Here is big problem which is the father process cannot
 * get the return value of the child process. so we cannot
 * know the command itself is right or not.
 *
 * in the next version.we need to add the waitpid() function
 * which can tell the result of the child process. but then
 * we should use the multi-process technology.
 */
int
os_run(char* command)
{
	int ret = -1;
	char** p = cmd_getsegs(command);
	if (p == NULL)
	{
		return -1;
	}

	signal(SIGCHLD, sig_handle);

	pid_t pid = fork();
	if (pid == 0)
	{
		if (execvp(p[0], p) == -1)
		{
			exit(-1);
		}
	}
	else if (pid > 0)
	{
		ret = pid;
	}
	else
	{
		ret = -1;
	}

	cmd_free(p);

	return ret;
}
开发者ID:mubawa,项目名称:TDE,代码行数:43,代码来源:unix.c


示例14: cmd_tcp_connect_cb

void
cmd_tcp_connect_cb(evutil_socket_t fd, short which, void *arg)
{
	struct tcp_con *con = arg;
        int error = 0;
        socklen_t errsz = sizeof(error);

	/* Everything is ready */
	cmd_ready_fd(&con->cmd, &cb_tcp, con);

	if (which == EV_TIMEOUT)
		goto out;

        /* Check if the connection completed */
        if (getsockopt(fd, SOL_SOCKET, SO_ERROR, &error, &errsz) == -1) {
                warn("%s: getsockopt for %d", __FUNCTION__, fd);
                goto out;
        }

        if (error) {
                warnx("%s: getsockopt: %s", __FUNCTION__, strerror(error));
		goto out;
	}

	cmd_trigger_read(&con->cmd, con->psize - con->plen);
	cmd_trigger_write(&con->cmd, con->rlen);
	return;

 out:	
	/* Connection failed, bring this down gracefully */
	cmd_free(&con->cmd);
	tcp_sendfin(con);
}
开发者ID:cmdrclueless,项目名称:honeyd,代码行数:33,代码来源:tcp.c


示例15: PrintAlias

static VOID
PrintAlias (VOID)
{
    LPTSTR Aliases;
    LPTSTR ptr;
    DWORD len;

    len = GetConsoleAliasesLength(_T("cmd.exe"));
    if (len == 0)
        return;

    /* allocate memory for an extra \0 char to make parsing easier */
    ptr = cmd_alloc(len + sizeof(TCHAR));
    if (!ptr)
    {
        WARN("Cannot allocate memory for ptr!\n");
        return;
    }

    Aliases = ptr;

    ZeroMemory(Aliases, len + sizeof(TCHAR));

    if (GetConsoleAliases(Aliases, len, _T("cmd.exe")) != 0)
    {
        while (*Aliases != '\0')
        {
            ConOutPrintf(_T("%s\n"), Aliases);
            Aliases = Aliases + lstrlen(Aliases);
            Aliases++;
        }
    }
    cmd_free(ptr);
}
开发者ID:Moteesh,项目名称:reactos,代码行数:34,代码来源:alias.c


示例16: do_raw

void
do_raw (char *cmd) {
    int      argc;
    char     **argv;
    int      c;
    int      n_args;

    
    printf ("$ %s\n", cmd);

    argv = cmd_to_argc_argv (cmd, &argc);

    while ((c = cmd_get_next_option (argc, argv, options)) > 0);

    if (c == CMD_NOT_ALLOWED_OPTION ||
        c == CMD_MISSING_ARGUMENT) {
        cmd_print_error_message ();
        return;
    }

    n_args = argc - optind;
    cmd_free (argv);
    free (cmd);
    return;
}
开发者ID:Ptival,项目名称:Pire2Pire,代码行数:25,代码来源:do_raw.c


示例17: cmd_tcp_eread

void
cmd_tcp_eread(evutil_socket_t fd, short which, void *arg)
{
	extern FILE *honeyd_servicefp;
	struct tcp_con *con = arg;
	char line[1024];
	int nread;
	struct command *cmd = &con->cmd;

	TRACE(fd, nread = read(fd, line, sizeof(line)));

	if (nread <= 0) {
		if (cmd->fdwantclose) {
			/* Stdin is already closed */
			cmd_free(&con->cmd);
			
			tcp_sendfin(con);
		} else {
			/* Now stdin will takes us down */
			cmd->fdwantclose = 1;
		}
		return;
	}

	if (nread == sizeof(line))
		nread--;
	line[nread] = '\0';
	
	honeyd_log_service(honeyd_servicefp, IP_PROTO_TCP, &con->conhdr, line);

	TRACE(event_get_fd(cmd->peread), event_add(cmd->peread, NULL));
}
开发者ID:cmdrclueless,项目名称:honeyd,代码行数:32,代码来源:tcp.c


示例18: ConWrite

static VOID ConWrite(TCHAR *str, DWORD len, DWORD nStdHandle)
{
	DWORD dwWritten;
	HANDLE hOutput = GetStdHandle(nStdHandle);

	if (WriteConsole(hOutput, str, len, &dwWritten, NULL))
		return;

	/* We're writing to a file or pipe instead of the console. Convert the
	 * string from TCHARs to the desired output format, if the two differ */
	if (bUnicodeOutput)
	{
#ifndef _UNICODE
		WCHAR *buffer = cmd_alloc(len * sizeof(WCHAR));
		if (!buffer)
		{
			error_out_of_memory();
			return;
		}
		len = MultiByteToWideChar(OutputCodePage, 0, str, len, buffer, len);
		str = (PVOID)buffer;
#endif
		WriteFile(hOutput, str, len * sizeof(WCHAR), &dwWritten, NULL);
#ifndef _UNICODE
		cmd_free(buffer);
#endif
	}
	else
	{
#ifdef _UNICODE
		CHAR *buffer = cmd_alloc(len * MB_LEN_MAX * sizeof(CHAR));
		if (!buffer)
		{
			error_out_of_memory();
			return;
		}
		len = WideCharToMultiByte(OutputCodePage, 0, str, len, buffer, len * MB_LEN_MAX, NULL, NULL);
		str = (PVOID)buffer;
#endif
		WriteFile(hOutput, str, len, &dwWritten, NULL);
#ifdef _UNICODE
		cmd_free(buffer);
#endif
	}
}
开发者ID:farp90,项目名称:nativecmd,代码行数:45,代码来源:console.c


示例19: cmd_wpas_parse_proto

static int cmd_wpas_parse_proto(const char *value)
{
	int val = 0, last, errors = 0;
	char *start, *end, *buf;

	buf = cmd_strdup(value);
	if (buf == NULL)
		return -1;
	start = buf;

	while (*start != '\0') {
		while (*start == ' ' || *start == '\t')
			start++;
		if (*start == '\0')
			break;
		end = start;
		while (*end != ' ' && *end != '\t' && *end != '\0')
			end++;
		last = *end == '\0';
		*end = '\0';

		/* softAP work on open mode. */
		if (cmd_strcmp(start, "NONE") == 0) {
			val = 0;
			break;
		}

		if (cmd_strcmp(start, "WPA") == 0)
			val |= WPA_PROTO_WPA;
		else if (cmd_strcmp(start, "RSN") == 0 ||
			 cmd_strcmp(start, "WPA2") == 0)
			val |= WPA_PROTO_RSN;
		else if (cmd_strcmp(start, "OSEN") == 0)
			val |= WPA_PROTO_OSEN;
		else {
			CMD_DBG("Invalid proto '%s'\n", start);
			errors++;
		}

		if (last)
			break;
		start = end + 1;
	}
	cmd_free(buf);

/* softAP work on open mode. */
#if 0
	if (val == 0) {
		CMD_DBG("No proto values configured\n");
		errors++;
	}
#endif

	CMD_DBG("proto: 0x%x\n", val);
	return errors ? -1 : val;
}
开发者ID:diguokaituozhe,项目名称:XR871,代码行数:56,代码来源:cmd_wlan.c


示例20: cmd_cancel

void
cmd_cancel (command_context * ctx)
{
  if (ctx->unable_to_cancel)
    {
      ctx->swallow = 1;
      return;
    }
  cmd_free (ctx);
}
开发者ID:LichKing-lee,项目名称:nbase-arc,代码行数:10,代码来源:gw_cmd_mgr.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ cmd_ln_boolean_r函数代码示例发布时间:2022-05-30
下一篇:
C++ cmd_find_window函数代码示例发布时间: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