📄 m_env.3
字号:
.\"(c) Copyright 1992 by Panagiotis Tsirigotis.\"All rights reserved. The file named COPYRIGHT specifies the terms .\"and conditions for redistribution..\".\" $Id: m_env.3,v 1.1.1.1 2003/02/19 17:29:27 bbraun Exp $.TH ENV 3L "20 October 1992".SH NAMEenv_create, env_destroy, env_make, env_addvar, env_addstr, env_remvar, env_lookup, env_getvars -- environment manipulation functions.SH SYNOPSIS.LP.nf.ft B#include "m_env.h".LP.ft Benv_h env_create( env )env_h env ;.LP.ft Bvoid env_destroy( env )env_h env ;.LP.ft Benv_h env_make( env_strings )char **env_strings ;.LP.ft Bint env_addvar( env, from_env, var )env_h env ;env_h from_env ;char *var ;.LP.ft Bint env_addstr( env, str )env_h env ;char *str ;.LP.ft Bint env_remvar( env, var )env_h env ;char *var ;.LP.ft Bchar **env_getvars( env )env_h env ;.SH DESCRIPTIONThis library handles environments. An environment is a set of stringsof the form .I "name=value".In the following, we will use the term string as a synonym ofNUL-terminated array of .I char..LP.B env_create()creates a new environment. The new environment will be empty unlessthe argument.I envis not.SB ENV_NULL.In that case, the new environment will be a duplicate of .I env(i.e. they will contain the same strings)..LP.B env_destroy()destroys the specified environment..LP.B env_make()creates a new environment which includes the.I env_strings..I env_stringsshould be a NULL-terminated array of strings..LP.B env_addvar()adds the specified variable.I varto.I env.The variable value is obtained from the environment.I from_env.If the variable exists already in .I envthe old value is replaced with the new value..LP.B env_addstr()adds a string of the form.I "name=value"to.I env..LP.B env_remvar()removes the specified variable.I varfrom the environment.I env..LP.B env_lookup()searches.I envfor variable.I var.It returns a string of the form.I "name=value"where.I nameis the name of the variable(i.e. it is equal to.I var)..LP.B env_getvarsreturns a NULL-terminated array of strings of the form.I "name=value"..SH "RETURN VALUES"In case of error, all calls will place an error code in the global variable.I env_errno.Possible error codes:.TP 15.SB ENV_ENOMEMout of memory.TP.SB ENV_EBADVARvariable is not in environment.TP.SB ENV_EBADSTRINGstring is not well-formed (i.e. is not of the form \fIname=value\fR)..LP.B env_create()returns a handle or .SM ENV_NULLif it fails..LP.B env_make()returns a handle or .SM ENV_NULLif it fails..LP.B env_addvar()returns.SM ENV_OKon success or.SM ENV_ERRon failure..LP.B env_addstr()returns.SM ENV_OKon success or.SM ENV_ERRon failure..LP.B env_remvar()returns.SM ENV_OKon success or.SM ENV_ERRif the variable is not part of the environment..LP.B env_loopkup()returns a string on success or.SM NULLon failure..SH "SEE ALSO"environ(5)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -