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

C++ set_env函数代码示例

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

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



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

示例1: main

int
main(int argc, char** argv)
{
	set_env();
	environ = NULL;
	test_env();

	set_env();
	environ[0] = NULL;
	test_env();

	static char* emptyEnv[1] = {NULL};
	set_env();
	environ = emptyEnv;
	test_env();

	set_env();
	environ = (char**)calloc(1, sizeof(*environ));
	test_env();

	// clearenv() is not part of the POSIX specs
#if 1
	set_env();
	clearenv();
	test_env();
#endif

	return 0;
}
开发者ID:SummerSnail2014,项目名称:haiku,代码行数:29,代码来源:clearenv.cpp


示例2: add_environment

static ret_t
add_environment (cherokee_handler_cgi_t *cgi,
		 cherokee_connection_t  *conn)
{
	ret_t                        ret;
	cherokee_handler_cgi_base_t *cgi_base = HDL_CGI_BASE(cgi);
	cherokee_buffer_t           *tmp      = THREAD_TMP_BUF2(CONN_THREAD(conn));

	ret = cherokee_handler_cgi_base_build_envp (HDL_CGI_BASE(cgi), conn);
	if (unlikely (ret != ret_ok))
		return ret;

	/* CONTENT_LENGTH
	 */
	if (http_method_with_input (conn->header.method)) {
		cherokee_buffer_clean (tmp);
		cherokee_buffer_add_ullong10 (tmp, conn->post.len);
		set_env (cgi_base, "CONTENT_LENGTH", tmp->buf, tmp->len);
	}

	/* SCRIPT_FILENAME
	 */
	if (cgi_base->executable.len <= 0)
		return ret_error;

	set_env (cgi_base, "SCRIPT_FILENAME",
		 cgi_base->executable.buf,
		 cgi_base->executable.len);

	return ret_ok;
}
开发者ID:felipebuarque,项目名称:PL-Stats,代码行数:31,代码来源:handler_cgi.c


示例3: handle_exit_status

void			handle_exit_status(char ***env, int child_status,
									char **cmds, int i)
{
	char	buf[25];
	char	*tmp;

	if (WIFEXITED(child_status) == 1)
	{
		set_env(env, "?", tmp = ft_itoa(WEXITSTATUS(child_status)));
		ft_strdel(&tmp);
	}
	else if (WIFSIGNALED(child_status) == 1)
	{
		set_env(env, "?", tmp = ft_itoa(child_status));
		ft_strdel(&tmp);
		set_message(buf, WTERMSIG(child_status));
		if (buf[0] != '\0')
		{
			ft_putstr_fd(singleton_state()->shell_name, 2);
			ft_putstr_fd(": ", 2);
			ft_putstr_fd(buf, 2);
			ft_putstr_fd(": ", 2);
			ft_putendl_fd(ft_remove_blank_begin_end(cmds[i]), 2);
		}
	}
}
开发者ID:agadiffe,项目名称:ft_sh,代码行数:26,代码来源:exit_status.c


示例4: setenv_from_config

void
setenv_from_config(void)
{
	int i, lim = sizeof(envname) / sizeof(char *);
	STRBUF *sb = strbuf_open(0);

	for (i = 0; i < lim; i++) {
		if (getenv(envname[i]) == NULL) {
			strbuf_reset(sb);
			if (getconfs(envname[i], sb))
				set_env(envname[i], strbuf_value(sb));
			else if (getconfb(envname[i]))
				set_env(envname[i], "");
		}
	}
	/*
	 * For upper compatibility.
	 * htags_options is deprecated.
	 */
	if (getenv("HTAGS_OPTIONS") == NULL) {
		strbuf_reset(sb);
		if (getconfs("htags_options", sb))
			set_env("HTAGS_OPTIONS", strbuf_value(sb));
	}
	strbuf_close(sb);
}
开发者ID:badwtg1111,项目名称:emacs-c-ide-demo,代码行数:26,代码来源:env.c


示例5: stdenv

bool stdenv(lisp_env *env)
{
    /* Arithmetic, logical */
    set_env(env, "+", (lisp_obj*) &lisp_add);
    set_env(env, "-", (lisp_obj*) &lisp_sub);
    set_env(env, "*", (lisp_obj*) &lisp_mul);
    set_env(env, "<", (lisp_obj*) &lisp_lt);
    set_env(env, "real", (lisp_obj*) &lisp_real);

    /* Repl, i/o */
    set_env(env, "display", (lisp_obj*) &lisp_display);
    set_env(env, "exit", (lisp_obj*) &lisp_exit);

    /* Debug, internal */
    set_env(env, "refcount", (lisp_obj*) &lisp_refcount);
    set_env(env, "dmp", (lisp_obj*) &lisp_dump_env);

    /* Lisp plumbery */
    lisp_obj *res = NULL;
    for (size_t i=0; i<sizeof(lisp_stubs)/sizeof(lisp_stubs[0]); i++){
        res = eval(lisp_stubs[i], env, NULL);
        if (res != NIL){
            return false;
        }
    }
    
    return true;
}
开发者ID:titouanc,项目名称:tinylisp,代码行数:28,代码来源:lisp.c


示例6: set_rd_prompt

static void	set_rd_prompt(char **pt, int lap)
{
  if (lap == 0)
    {
      *pt = my_strdup(get_env("PS1"));
      set_env("PS1", "> ");
      return ;
    }
  set_env("PS1", *pt);
  free(*pt);
}
开发者ID:Colliotv,项目名称:42.sh,代码行数:11,代码来源:redir_d_left.c


示例7: add_env

int add_env( char * name, char * value ) {
	int res = 0 ;
	char * npst = getenv( name ), * vpst = NULL ;
	if( npst==NULL ) { res = set_env( name, value ) ; }
	else {
		vpst = (char*) malloc( strlen(npst)+strlen(value)+20 ) ; 
		sprintf( vpst, "%s=%s;%s", name, npst, value ) ;
		res = set_env( name, vpst ) ;
		free( vpst ) ;
		}
	return res ;
	}
开发者ID:pigfoot,项目名称:KiTTY,代码行数:12,代码来源:kitty_tools.c


示例8: start_win_emulator

int
start_win_emulator(char* emu, char *start_prog, char** argv, int start_detached)
{
    int result;

    windowed = 1;
    if (start_detached) {
	char *buff;
	close(0);
	close(1);
	close(2);
	
	set_env("ERL_CONSOLE_MODE", "detached");
	set_env(DLL_ENV, emu);

	argv[0] = start_prog;
	argv = fnuttify_argv(argv);
	result = spawnv(_P_DETACH, start_prog, argv);
	free_fnuttified(argv);
    } else {
	int argc = 0;
#ifdef LOAD_BEAM_DYNAMICALLY
	HMODULE beam_module = load_win_beam_dll(emu);
#endif	
	set_env("ERL_CONSOLE_MODE", "window");
	while (argv[argc] != NULL) {
	    ++argc;
	}
#ifdef ARGS_HARDDEBUG
	{
	    char sbuf[2048] = "";
	    int i;
	    for (i = 0; i < argc; ++i) {
		strcat(sbuf,"|");
		strcat(sbuf, argv[i]);
		strcat(sbuf,"| ");
	    }
	    MessageBox(NULL, sbuf, "Werl", MB_OK|MB_ICONERROR);
	}
#endif
#ifdef LOAD_BEAM_DYNAMICALLY
	(*sys_primitive_init_p)(beam_module);
	(*erl_start_p)(argc,argv);
#else
	erl_start(argc, argv);
#endif
	result = 0;
    }
    if (result == -1) {
	error("Failed to execute %s: %s", emu, win32_errorstr(_doserrno));
    }
    return 0;
}
开发者ID:system,项目名称:erlang-otp,代码行数:53,代码来源:win_erlexec.c


示例9: ft_setenv

void			ft_setenv(char **env, char *name, char *value)
{
	int		i;
	int		j;
	int		g;
	char	*e_title;

	i = 0;
	g = 0;
	while (env[i])
	{
		j = 0;
		while (env[i][j] != '\0' && env[i][j] != '=')
			j++;
		if (env[i][j] != '\0')
		{
			e_title = ft_strsub(env[i], 0, j);
			if (ft_strcmp(e_title, name) == 0)
			{
				set_env(env, i, j, value);
				g++;
			}
			ft_memdel((void **)&e_title);
		}
		i++;
	}
	if (g == 0)
		add_env(env, i, name, value);
}
开发者ID:kbunel,项目名称:ecole_42,代码行数:29,代码来源:ft_setenv.c


示例10: set_env_keyval

void	set_env_keyval(t_env **env, char *keyval)
{
	char **split;

	if (!keyval)
		return ;
	split = ft_strsplit(keyval, '=');
	if (split[0] == NULL)
	{
		set_env(env, "", ft_strdup(""));
	}
	else
		set_env(env, split[0], split[1]);
	free(split[0]);
	free(split);
}
开发者ID:Liliaze,项目名称:Projets,代码行数:16,代码来源:env_utils2.c


示例11: w_exec_avp

inline static int w_exec_avp(struct sip_msg* msg, char* cmd, char* avpl)
{
	environment_t *backup;
	int ret;
	str command;
	
	if(msg==0 || cmd==0)
		return -1;
	
	backup=0;
	if (setvars) {
		backup=set_env(msg);
		if (!backup) {
			LM_ERR("no env created\n");
			return -1;
		}
	}

	if(fixup_get_svalue(msg, (gparam_p)cmd, &command)!=0)
	{
		LM_ERR("invalid command parameter");
		return -1;
	}
	
	LM_DBG("executing [%s]\n", command.s);

	ret=exec_avp(msg, command.s, (pvname_list_p)avpl);
	if (setvars) {
		unset_env(backup);
	}
	return ret;
}
开发者ID:dynamicpacket-public,项目名称:opensips,代码行数:32,代码来源:exec_mod.c


示例12: print_pipe_error_then_exit

void		print_pipe_error_then_exit(t_state *state)
{
	ft_putstr_fd(state->shell_name, 2);
	ft_putendl_fd(": pipe() error", 2);
	set_env(&state->env, "?", "1");
	exit(1);
}
开发者ID:agadiffe,项目名称:ft_sh,代码行数:7,代码来源:print_functions_error.c


示例13: print_command_not_found

void		print_command_not_found(t_state *state, char *cmd, char *s)
{
	ft_putstr_fd(cmd, 2);
	ft_putstr_fd(": command not found: ", 2);
	ft_putendl_fd(s, 2);
	set_env(&state->env, "?", "127");
}
开发者ID:agadiffe,项目名称:ft_sh,代码行数:7,代码来源:print_functions_cmd.c


示例14: ft_isbuiltin

int		ft_isbuiltin(t_env *env, char *line)
{
	char	**line2;
	int		i;
	t_main w;

	i = 0;
	line2 = ft_strsplit(line, ' ');
	if (ft_strcmp(line2[0], "echo") == 0 && (i = 1))
	{
		line = ft_strfcut(line, 5);
		ft_echo(line);
	}
	else if (ft_strncmp(line, "cd", 2) == 0 && (i = 1))
		ft_cd(line);
	else if (ft_strncmp(line, "unsetenv", 7) == 0 && (i = 1))
		env = ft_unsetenv(env);
	else if (ft_strncmp(line, "env", 2) == 0 && (i = 1))
		print_env(env);
	else if (ft_strncmp(line, "setenv", 5) == 0 && (i = 1))
	{
		line = ft_strrw(line);
		line2 = ft_strsplit(line, ' ');
		env = set_env(line2, env);
	}
	if (i == 1)
		ft_doublecoms(env, &w, 0);
	return (1);
}
开发者ID:speedy-ln,项目名称:21sh,代码行数:29,代码来源:extras.c


示例15: load_default_env

static void load_default_env(void)
{
	int i;
	char *tmp;
	int mum = 1;
	char load_buf[20]={0};
	printk("[%s]load default env\n",MODULE_NAME);
	
	tmp = get_env(DATA_FREE_SIZE_TH_NAME);
	if(tmp == NULL){
		printk("[%s]can not find %s,set the default value\n",MODULE_NAME,DATA_FREE_SIZE_TH_NAME);
		sprintf(load_buf,"%d",DATA_FREE_SIZE_TH_DEFAULT);
		set_env(DATA_FREE_SIZE_TH_NAME,load_buf);
		return;
	}
	for(i=0;i<strlen(tmp);i++){
		if(tmp[i] == 'M' || tmp[i] == 'm'){
			mum = 1024*1024;
			break;
		}else if(tmp[i] == 'K' || tmp[i] == 'k'){
			mum = 1024;
			break;
		}else{
			load_buf[i] = tmp[i];
		}
	}
	data_free_size_th =(long long)simple_strtol(load_buf,NULL,10)*mum;
	
	printk("[%s]find %s = %llx\n",MODULE_NAME,DATA_FREE_SIZE_TH_NAME,data_free_size_th);
}
开发者ID:4Fwolf,项目名称:signal75-kernel-3.10.61,代码行数:30,代码来源:env.c


示例16: w_exec_msg

inline static int w_exec_msg(struct sip_msg* msg, char* p1, char* foo)
{
        str cmd;
	environment_t *backup;
	int ret;

	if (get_str_fparam(&cmd, msg, (fparam_t*)p1) < 0) {
	    ERR("Error while obtaining command name\n");
	    return -1;
	}

	backup=0;
	if (setvars) {
		backup=set_env(msg);
		if (!backup) {
			LOG(L_ERR, "ERROR: w_exec_msg: no env created\n");
			return -1;
		}
	}
	ret=exec_msg(msg, &cmd);
	if (setvars) {
		unset_env(backup);
	}
	return ret;
}
开发者ID:Gaoithe,项目名称:openimscore_ims,代码行数:25,代码来源:exec_mod.c


示例17: main

int		main(void)
{
	int x;
	int y;
	int nb_it;
	double x_f;
	double y_f;
	double stepx;
	double stepy;
	t_env e;

	set_env(&e, "titre", WX, WY);
	x = 0;
	x_f = e.xmin;
	while (x <= WX)
	{
		y = 0;
		y_f = e.ymin;
		while (y <= WY)
		{
			nb_it = is_converg((mandelbrot), x_f, y_f);
			//	printf("val x_f = %lf, val de y_f = %lf, val de nb_it = %d\n", x_f, y_f, nb_it);
			if (nb_it < 1000)
				mlx_pixel_put_img(e.img, x, y, rainbow_gen(nb_it * 40));
			y++;
			y_f += e.stepy;
		}
		x_f += e.stepx;
		x++;
	}
	mlx_put_image_to_window(e.mlx, e.win, e.img, 0,0);
	mlx_mouse_hook(e.win, mouse_hook, &e);
	mlx_loop(e.mlx);
	return (0);
}
开发者ID:hhismans,项目名称:fractol,代码行数:35,代码来源:fractol.c


示例18: print_permission_denied

void		print_permission_denied(t_state *state, char *cmd, char *s)
{
	ft_putstr_fd(cmd, 2);
	ft_putstr_fd(": permission denied: ", 2);
	ft_putendl_fd(s, 2);
	set_env(&state->env, "?", "126");
}
开发者ID:agadiffe,项目名称:ft_sh,代码行数:7,代码来源:print_functions_cmd.c


示例19: w_exec_dset

inline static int w_exec_dset(struct sip_msg* msg, char* p1, char* foo)
{
        str cmd;
	str *uri;
	environment_t *backup;
	int ret;

	if (get_str_fparam(&cmd, msg, (fparam_t*)p1) < 0) {
	    ERR("Error while obtaining command name\n");
	    return -1;
	}

	backup=0;
	if (setvars) {
		backup=set_env(msg);
		if (!backup) {
			LOG(L_ERR, "ERROR: w_exec_msg: no env created\n");
			return -1;
		}
	}

	if (msg->new_uri.s && msg->new_uri.len)
		uri=&msg->new_uri;
	else
		uri=&msg->first_line.u.request.uri;

	ret=exec_str(msg, &cmd, uri->s, uri->len);
	if (setvars) {
		unset_env(backup);
	}
	return ret;
}
开发者ID:Gaoithe,项目名称:openimscore_ims,代码行数:32,代码来源:exec_mod.c


示例20: print_bad_assignment

void		print_bad_assignment(t_state *state, char *s)
{
	ft_putstr_fd("setenv: bad assignment: ", 2);
	ft_putchar_fd('`', 2);
	ft_putstr_fd(s, 2);
	ft_putendl_fd("`", 2);
	set_env(&state->env, "?", "0");
}
开发者ID:agadiffe,项目名称:ft_sh,代码行数:8,代码来源:print_functions_cmd.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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