\hypertarget{group__env__functions}{}\doxysection{Environment Functions} \label{group__env__functions}\index{Environment Functions@{Environment Functions}} \doxysubsection*{Functions} \begin{DoxyCompactItemize} \item \+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} \mbox{\hyperlink{group__env__functions_gace276d74dd56457b85b1382d71fcf041}{Qore\+::getenv}} (\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} var) \begin{DoxyCompactList}\small\item\em Retrieves the value of an environment variable or \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} if the variable is not set. \end{DoxyCompactList}\item nothing \mbox{\hyperlink{group__env__functions_gab8f2a8aa7e4c632b0f059c9a1dd0c48c}{Qore\+::getenv}} () \begin{DoxyCompactList}\small\item\em This function variant does nothing at all; it is only included for backwards-\/compatibility with qore prior to version 0.\+8.\+0 for functions that would ignore type errors in arguments. \end{DoxyCompactList}\item \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} \mbox{\hyperlink{group__env__functions_gafc5304fccb2c7903ca1ecd1015d9730a}{Qore\+::setenv}} (\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} env, softstring val) \begin{DoxyCompactList}\small\item\em Sets an environment variable to a value. \end{DoxyCompactList}\item nothing \mbox{\hyperlink{group__env__functions_gad0a17803f2c2014c5384bd250c686c08}{Qore\+::setenv}} () \begin{DoxyCompactList}\small\item\em This function variant does nothing at all; it is only included for backwards-\/compatibility with qore prior to version 0.\+8.\+0 for functions that would ignore type errors in arguments. \end{DoxyCompactList}\item \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} \mbox{\hyperlink{group__env__functions_ga9ed7b7400e10b55f434d2cbc9ba18282}{Qore\+::unsetenv}} (\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} env) \begin{DoxyCompactList}\small\item\em Unsets an environment variable. \end{DoxyCompactList}\item nothing \mbox{\hyperlink{group__env__functions_gadb729e27243c0dcc739a6c4e7deb1501}{Qore\+::unsetenv}} () \begin{DoxyCompactList}\small\item\em This function variant does nothing at all; it is only included for backwards-\/compatibility with qore prior to version 0.\+8.\+0 for functions that would ignore type errors in arguments. \end{DoxyCompactList}\end{DoxyCompactItemize} \doxysubsection{Detailed Description} Environment functions \doxysubsection{Function Documentation} \mbox{\Hypertarget{group__env__functions_gab8f2a8aa7e4c632b0f059c9a1dd0c48c}\label{group__env__functions_gab8f2a8aa7e4c632b0f059c9a1dd0c48c}} \index{Environment Functions@{Environment Functions}!getenv@{getenv}} \index{getenv@{getenv}!Environment Functions@{Environment Functions}} \doxysubsubsection{\texorpdfstring{getenv()}{getenv()}\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}} {\footnotesize\ttfamily nothing Qore\+::getenv (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})} This function variant does nothing at all; it is only included for backwards-\/compatibility with qore prior to version 0.\+8.\+0 for functions that would ignore type errors in arguments. \begin{DoxyParagraph}{Restrictions\+:} \mbox{\hyperlink{group__parse__options_ga213aab826b55076c29ffeecebbaea237}{Qore\+::\+PO\+\_\+\+NO\+\_\+\+EXTERNAL\+\_\+\+INFO}} \end{DoxyParagraph} \begin{DoxyParagraph}{Code Flags\+:} \mbox{\hyperlink{code_flags_NOOP}{NOOP}} \end{DoxyParagraph} \mbox{\Hypertarget{group__env__functions_gace276d74dd56457b85b1382d71fcf041}\label{group__env__functions_gace276d74dd56457b85b1382d71fcf041}} \index{Environment Functions@{Environment Functions}!getenv@{getenv}} \index{getenv@{getenv}!Environment Functions@{Environment Functions}} \doxysubsubsection{\texorpdfstring{getenv()}{getenv()}\hspace{0.1cm}{\footnotesize\ttfamily [2/2]}} {\footnotesize\ttfamily \+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} Qore\+::getenv (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{var }\end{DoxyParamCaption})} Retrieves the value of an environment variable or \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} if the variable is not set. \begin{DoxyParagraph}{Restrictions\+:} \mbox{\hyperlink{group__parse__options_ga213aab826b55076c29ffeecebbaea237}{Qore\+::\+PO\+\_\+\+NO\+\_\+\+EXTERNAL\+\_\+\+INFO}} \end{DoxyParagraph} \begin{DoxyParagraph}{Code Flags\+:} \mbox{\hyperlink{code_flags_CONSTANT}{CONSTANT}} \end{DoxyParagraph} \begin{DoxyParams}{Parameters} {\em var} & the name of the environment variable\\ \hline \end{DoxyParams} \begin{DoxyReturn}{Returns} the value of an environment variable or \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} if the variable is not set \end{DoxyReturn} \begin{DoxyParagraph}{Example\+:} \begin{DoxyCode}{0} \DoxyCodeLine{*string v = \mbox{\hyperlink{group__env__functions_gace276d74dd56457b85b1382d71fcf041}{getenv}}(\textcolor{stringliteral}{"{}PATH"{}});} \end{DoxyCode} \end{DoxyParagraph} \begin{DoxySince}{Since} Qore 0.\+8.\+4 tagged with PO\+\_\+\+NO\+\_\+\+EXTERNAL\+\_\+\+INFO \end{DoxySince} \mbox{\Hypertarget{group__env__functions_gad0a17803f2c2014c5384bd250c686c08}\label{group__env__functions_gad0a17803f2c2014c5384bd250c686c08}} \index{Environment Functions@{Environment Functions}!setenv@{setenv}} \index{setenv@{setenv}!Environment Functions@{Environment Functions}} \doxysubsubsection{\texorpdfstring{setenv()}{setenv()}\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}} {\footnotesize\ttfamily nothing Qore\+::setenv (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})} This function variant does nothing at all; it is only included for backwards-\/compatibility with qore prior to version 0.\+8.\+0 for functions that would ignore type errors in arguments. \begin{DoxyParagraph}{Restrictions\+:} \mbox{\hyperlink{group__parse__options_ga10d8e3f76c427b0f974529de572dd0ec}{Qore\+::\+PO\+\_\+\+NO\+\_\+\+PROCESS\+\_\+\+CONTROL}} \end{DoxyParagraph} \begin{DoxyParagraph}{Code Flags\+:} \mbox{\hyperlink{code_flags_NOOP}{NOOP}} \end{DoxyParagraph} \mbox{\Hypertarget{group__env__functions_gafc5304fccb2c7903ca1ecd1015d9730a}\label{group__env__functions_gafc5304fccb2c7903ca1ecd1015d9730a}} \index{Environment Functions@{Environment Functions}!setenv@{setenv}} \index{setenv@{setenv}!Environment Functions@{Environment Functions}} \doxysubsubsection{\texorpdfstring{setenv()}{setenv()}\hspace{0.1cm}{\footnotesize\ttfamily [2/2]}} {\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} Qore\+::setenv (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{env, }\item[{softstring}]{val }\end{DoxyParamCaption})} Sets an environment variable to a value. \begin{DoxyParagraph}{Restrictions\+:} \mbox{\hyperlink{group__parse__options_ga10d8e3f76c427b0f974529de572dd0ec}{Qore\+::\+PO\+\_\+\+NO\+\_\+\+PROCESS\+\_\+\+CONTROL}} \end{DoxyParagraph} \begin{DoxyParams}{Parameters} {\em env} & the name of the environment variable \\ \hline {\em val} & the new value of the environment variable\\ \hline \end{DoxyParams} \begin{DoxyReturn}{Returns} -\/1 for error or 0 for success; if an error occurs, \mbox{\hyperlink{namespace_qore_abcf45c25ca1234fc8c54761750324cda}{errno()}} and/or \mbox{\hyperlink{namespace_qore_a13d9bb498eef9caffe641130bd8a1c73}{strerror()}} can be used to get the error code or message \end{DoxyReturn} \begin{DoxyParagraph}{Example\+:} \begin{DoxyCode}{0} \DoxyCodeLine{\textcolor{keywordflow}{if} (\mbox{\hyperlink{group__env__functions_gafc5304fccb2c7903ca1ecd1015d9730a}{setenv}}(\textcolor{stringliteral}{"{}PATH"{}}, \textcolor{stringliteral}{"{}/bin:/usr/bin"{}}))} \DoxyCodeLine{ \mbox{\hyperlink{group__string__functions_ga32070517a9f8a70a32ef48f83a6f128e}{printf}}(\textcolor{stringliteral}{"{}error setting PATH: \%s\(\backslash\)n"{}}, strerror());} \end{DoxyCode} \end{DoxyParagraph} \begin{DoxySeeAlso}{See also} \mbox{\hyperlink{group__env__functions_ga9ed7b7400e10b55f434d2cbc9ba18282}{unsetenv()}} to unset or clear an environment variable \end{DoxySeeAlso} \begin{DoxySince}{Since} Qore 0.\+8.\+4 tagged with PO\+\_\+\+NO\+\_\+\+PROCESS \end{DoxySince} \mbox{\Hypertarget{group__env__functions_gadb729e27243c0dcc739a6c4e7deb1501}\label{group__env__functions_gadb729e27243c0dcc739a6c4e7deb1501}} \index{Environment Functions@{Environment Functions}!unsetenv@{unsetenv}} \index{unsetenv@{unsetenv}!Environment Functions@{Environment Functions}} \doxysubsubsection{\texorpdfstring{unsetenv()}{unsetenv()}\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}} {\footnotesize\ttfamily nothing Qore\+::unsetenv (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})} This function variant does nothing at all; it is only included for backwards-\/compatibility with qore prior to version 0.\+8.\+0 for functions that would ignore type errors in arguments. \begin{DoxyParagraph}{Restrictions\+:} \mbox{\hyperlink{group__parse__options_ga213aab826b55076c29ffeecebbaea237}{Qore\+::\+PO\+\_\+\+NO\+\_\+\+EXTERNAL\+\_\+\+INFO}} \end{DoxyParagraph} \begin{DoxyParagraph}{Code Flags\+:} \mbox{\hyperlink{code_flags_NOOP}{NOOP}} \end{DoxyParagraph} \mbox{\Hypertarget{group__env__functions_ga9ed7b7400e10b55f434d2cbc9ba18282}\label{group__env__functions_ga9ed7b7400e10b55f434d2cbc9ba18282}} \index{Environment Functions@{Environment Functions}!unsetenv@{unsetenv}} \index{unsetenv@{unsetenv}!Environment Functions@{Environment Functions}} \doxysubsubsection{\texorpdfstring{unsetenv()}{unsetenv()}\hspace{0.1cm}{\footnotesize\ttfamily [2/2]}} {\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} Qore\+::unsetenv (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{env }\end{DoxyParamCaption})} Unsets an environment variable. \begin{DoxyParagraph}{Restrictions\+:} \mbox{\hyperlink{group__parse__options_ga10d8e3f76c427b0f974529de572dd0ec}{Qore\+::\+PO\+\_\+\+NO\+\_\+\+PROCESS\+\_\+\+CONTROL}} \end{DoxyParagraph} \begin{DoxyParams}{Parameters} {\em env} & the name of the environment variable to unset\\ \hline \end{DoxyParams} \begin{DoxyReturn}{Returns} -\/1 for error or 0 for success; if an error occurs, \mbox{\hyperlink{namespace_qore_abcf45c25ca1234fc8c54761750324cda}{errno()}} and/or \mbox{\hyperlink{namespace_qore_a13d9bb498eef9caffe641130bd8a1c73}{strerror()}} can be used to get the error code or message \end{DoxyReturn} \begin{DoxyParagraph}{Example\+:} \begin{DoxyCode}{0} \DoxyCodeLine{\textcolor{keywordflow}{if} (\mbox{\hyperlink{group__env__functions_ga9ed7b7400e10b55f434d2cbc9ba18282}{unsetenv}}(\textcolor{stringliteral}{"{}PATH"{}}))} \DoxyCodeLine{ \mbox{\hyperlink{group__string__functions_ga32070517a9f8a70a32ef48f83a6f128e}{printf}}(\textcolor{stringliteral}{"{}error unsetting PATH: \%s\(\backslash\)n"{}}, strerror());} \end{DoxyCode} \end{DoxyParagraph} \begin{DoxySeeAlso}{See also} \mbox{\hyperlink{group__env__functions_gafc5304fccb2c7903ca1ecd1015d9730a}{setenv()}} to set an environment variable to a value \end{DoxySeeAlso} \begin{DoxySince}{Since} Qore 0.\+8.\+4 tagged with PO\+\_\+\+NO\+\_\+\+PROCESS \end{DoxySince}