103 lines
5.6 KiB
TeX
103 lines
5.6 KiB
TeX
\doxysection{src/env.h File Reference}
|
|
\hypertarget{env_8h}{}\label{env_8h}\index{src/env.h@{src/env.h}}
|
|
{\ttfamily \#include "{}struct.\+h"{}}\newline
|
|
{\ttfamily \#include $<$stdlib.\+h$>$}\newline
|
|
{\ttfamily \#include $<$string.\+h$>$}\newline
|
|
Include dependency graph for env.\+h\+:
|
|
% FIG 0
|
|
This graph shows which files directly or indirectly include this file\+:
|
|
% FIG 1
|
|
\doxysubsubsection*{Functions}
|
|
\begin{DoxyCompactItemize}
|
|
\item
|
|
char \texorpdfstring{$\ast$}{*} \mbox{\hyperlink{env_8h_a0ce3d2cd4284dee64477512b489ddb4f}{get\+\_\+env\+\_\+value}} (char \texorpdfstring{$\ast$}{*}key)
|
|
\begin{DoxyCompactList}\small\item\em Recherche et retourne la valeur d\textquotesingle{}une variable d\textquotesingle{}environnement d\textquotesingle{}après sa clé. \end{DoxyCompactList}\item
|
|
int \mbox{\hyperlink{env_8h_a2447e9b952249197b828841281389e8f}{set\+\_\+env\+\_\+value}} (char \texorpdfstring{$\ast$}{*}key, char \texorpdfstring{$\ast$}{*}value)
|
|
\begin{DoxyCompactList}\small\item\em Modifie la valeur d\textquotesingle{}une variable d\textquotesingle{}environnement existante. \end{DoxyCompactList}\item
|
|
int \mbox{\hyperlink{env_8h_a684d25b4cc5d9bf14dd67309de8568bf}{get\+\_\+env\+\_\+len}} (\mbox{\hyperlink{structenv}{env}} \texorpdfstring{$\ast$}{*}envs)
|
|
\begin{DoxyCompactList}\small\item\em Calcule le nombre de variables d\textquotesingle{}environnement actives dans le tableau. \end{DoxyCompactList}\item
|
|
\mbox{\hyperlink{structenv}{env}} \texorpdfstring{$\ast$}{*} \mbox{\hyperlink{env_8h_a9f03a70f263b1c039d6a3975b02cfadd}{init\+\_\+envs}} ()
|
|
\begin{DoxyCompactList}\small\item\em Initialise le tableau des variables d\textquotesingle{}environnement par défaut. \end{DoxyCompactList}\end{DoxyCompactItemize}
|
|
|
|
|
|
\doxysubsection{Function Documentation}
|
|
\Hypertarget{env_8h_a684d25b4cc5d9bf14dd67309de8568bf}\label{env_8h_a684d25b4cc5d9bf14dd67309de8568bf}
|
|
\index{env.h@{env.h}!get\_env\_len@{get\_env\_len}}
|
|
\index{get\_env\_len@{get\_env\_len}!env.h@{env.h}}
|
|
\doxysubsubsection{\texorpdfstring{get\_env\_len()}{get\_env\_len()}}
|
|
{\footnotesize\ttfamily int get\+\_\+env\+\_\+len (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{structenv}{env}} \texorpdfstring{$\ast$}{*}}]{envs }\end{DoxyParamCaption})}
|
|
|
|
|
|
|
|
Calcule le nombre de variables d\textquotesingle{}environnement actives dans le tableau.
|
|
|
|
Parcourt le tableau de structures jusqu\textquotesingle{}à rencontrer la sentinelle (clé égale à NULL).
|
|
|
|
|
|
\begin{DoxyParams}{Parameters}
|
|
{\em envs} & Pointeur vers le tableau de variables d\textquotesingle{}environnement. \\
|
|
\hline
|
|
\end{DoxyParams}
|
|
\begin{DoxyReturn}{Returns}
|
|
int Le nombre de variables stockées (hors sentinelle).
|
|
\end{DoxyReturn}
|
|
\Hypertarget{env_8h_a0ce3d2cd4284dee64477512b489ddb4f}\label{env_8h_a0ce3d2cd4284dee64477512b489ddb4f}
|
|
\index{env.h@{env.h}!get\_env\_value@{get\_env\_value}}
|
|
\index{get\_env\_value@{get\_env\_value}!env.h@{env.h}}
|
|
\doxysubsubsection{\texorpdfstring{get\_env\_value()}{get\_env\_value()}}
|
|
{\footnotesize\ttfamily char \texorpdfstring{$\ast$}{*} get\+\_\+env\+\_\+value (\begin{DoxyParamCaption}\item[{char \texorpdfstring{$\ast$}{*}}]{key }\end{DoxyParamCaption})}
|
|
|
|
|
|
|
|
Recherche et retourne la valeur d\textquotesingle{}une variable d\textquotesingle{}environnement d\textquotesingle{}après sa clé.
|
|
|
|
|
|
\begin{DoxyParams}{Parameters}
|
|
{\em key} & Le nom de la variable recherchée (ex\+: "{}\+PWD"{}). \\
|
|
\hline
|
|
\end{DoxyParams}
|
|
\begin{DoxyReturn}{Returns}
|
|
char\texorpdfstring{$\ast$}{*} Un pointeur vers la chaîne de caractères contenant la valeur, ou NULL si la clé n\textquotesingle{}a pas été trouvée.
|
|
\end{DoxyReturn}
|
|
\Hypertarget{env_8h_a9f03a70f263b1c039d6a3975b02cfadd}\label{env_8h_a9f03a70f263b1c039d6a3975b02cfadd}
|
|
\index{env.h@{env.h}!init\_envs@{init\_envs}}
|
|
\index{init\_envs@{init\_envs}!env.h@{env.h}}
|
|
\doxysubsubsection{\texorpdfstring{init\_envs()}{init\_envs()}}
|
|
{\footnotesize\ttfamily \mbox{\hyperlink{structenv}{env}} \texorpdfstring{$\ast$}{*} init\+\_\+envs (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}
|
|
|
|
|
|
|
|
Initialise le tableau des variables d\textquotesingle{}environnement par défaut.
|
|
|
|
Alloue l\textquotesingle{}espace mémoire pour les variables de base ("{}\+PWD"{}, "{}\+USER"{}, "{}\+HOST"{}) et ajoute une sentinelle NULL à la fin pour permettre un parcours sûr.
|
|
|
|
\begin{DoxyReturn}{Returns}
|
|
env\texorpdfstring{$\ast$}{*} Un pointeur vers le tableau d\textquotesingle{}environnements alloué, ou NULL en cas d\textquotesingle{}échec du malloc.
|
|
\end{DoxyReturn}
|
|
\Hypertarget{env_8h_a2447e9b952249197b828841281389e8f}\label{env_8h_a2447e9b952249197b828841281389e8f}
|
|
\index{env.h@{env.h}!set\_env\_value@{set\_env\_value}}
|
|
\index{set\_env\_value@{set\_env\_value}!env.h@{env.h}}
|
|
\doxysubsubsection{\texorpdfstring{set\_env\_value()}{set\_env\_value()}}
|
|
{\footnotesize\ttfamily int set\+\_\+env\+\_\+value (\begin{DoxyParamCaption}\item[{char \texorpdfstring{$\ast$}{*}}]{key, }\item[{char \texorpdfstring{$\ast$}{*}}]{value }\end{DoxyParamCaption})}
|
|
|
|
|
|
|
|
Modifie la valeur d\textquotesingle{}une variable d\textquotesingle{}environnement existante.
|
|
|
|
\begin{DoxyNote}{Note}
|
|
La nouvelle valeur est dupliquée dynamiquement en mémoire via {\ttfamily strdup}.
|
|
\end{DoxyNote}
|
|
\begin{DoxyWarning}{Warning}
|
|
Cette fonction ne gère pas l\textquotesingle{}ajout d\textquotesingle{}une nouvelle clé si elle n\textquotesingle{}existe pas déjà.
|
|
\end{DoxyWarning}
|
|
|
|
\begin{DoxyParams}{Parameters}
|
|
{\em key} & Le nom de la variable à modifier. \\
|
|
\hline
|
|
{\em value} & La nouvelle chaîne de caractères à affecter. \\
|
|
\hline
|
|
\end{DoxyParams}
|
|
\begin{DoxyReturn}{Returns}
|
|
int 1 si la modification a réussi, 0 si la clé n\textquotesingle{}existe pas dans le tableau.
|
|
\end{DoxyReturn}
|