Skip to content

Commit 8d172da

Browse files
committed
Slide/notes on environment variables translated.
1 parent 473c6c5 commit 8d172da

File tree

1 file changed

+31
-27
lines changed

1 file changed

+31
-27
lines changed

intro.tex

Lines changed: 31 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1952,49 +1952,53 @@
19521952
%%%%%
19531953

19541954
\begin{slide}
1955-
\sltitle{Promìnné prostøedí}
1955+
\sltitle{Environment variables}
19561956
\begin{itemize}
1957-
\item seznam v¹ech promìnných prostøedí (\emph{environment
1958-
variables}) se pøedává jako promìnná\\ \texttt{extern char
1957+
\item the list of \emph{environment
1958+
variables} is passed as\\ \texttt{extern char
19591959
**\funnm{environ};}
1960-
\item je to pole ukazatelù (ukonèené NULL) na øetìzce ve tvaru:\\
1961-
\texttt{\emph{promìnná}=\emph{hodnota}}
1960+
\item it is an array of strings terminated by \texttt{NULL} of the
1961+
format: \texttt{\emph{variable\_name}=\emph{value}}
19621962
\end{itemize}
19631963
\begin{center}
19641964
\input{img/tex/environ.pstex_t}
19651965
\end{center}
19661966
\end{slide}
19671967

19681968
\begin{itemize}
1969-
\item shell pøedává spu¹tìnému programu ty promìnné, které jsou oznaèeny jako
1970-
exportované (Bourne-like shellech pøíkazem \texttt{export \emph{variable}}). Po
1971-
zmìnì obsahu ji¾ jednou exportované promìnné samozøejmì není potøeba promìnnou
1972-
znovu exportovat. Pøíkaz \texttt{env} vám vypí¹e aktuální promìnné
1973-
prostøedí.
1974-
Abyste pøidali promìnnou do prostøedí spou¹tìného programu staèí provést
1975-
pøiøazení na pøíkazové øádce, ani¾ byste museli mìnit prostøedí va¹eho
1976-
shellu:
1969+
\item A shell passes an executed program those variables marked as exported
1970+
(in Bourne-like shells via an internal command \texttt{export \emph{variable}}).
1971+
After you export a variable, you do not need to export it again after its value
1972+
is changed. The command \texttt{env} prints current enviroment variables.
1973+
You can also add a variable to the environment of an executed program without
1974+
changing the environment of your current shell:
1975+
19771976
\begin{verbatim}
19781977
$ date
19791978
Sun Oct 7 13:13:58 PDT 2007
19801979
$ LC_TIME=fr date
19811980
dimanche 7 octobre 2007 13 h 14 PDT
19821981
\end{verbatim}
19831982

1984-
nedivte se, pokud to na va¹em systému takto fungovat nebude, v tom pøípadì
1985-
nemáte instalovaný balík s francouzskou lokalizací (co¾ je pravdìpodobné).
1986-
\item pøi nahrazení aktuálního obrazu procesu obrazem jiným se pøedává, pokud
1987-
se neøekne jinak, synovským procesùm celé pole \texttt{environ} automaticky.
1988-
Je mo¾né ve volání pøíslu¹né varianty funkce \texttt{exec} pøedat pole jiné.
1989-
\item jaké promìnné prostøedí konkrétní pøíkaz pou¾ívá (a jak je pou¾ívá) by
1990-
mìlo být v manuálové stránce. Typicky v sekci nazvané \emph{ENVIRONMENT} nebo
1991-
\emph{ENVIRONMENT VARIABLES}
1992-
\item \texttt{man} napøíklad pou¾ívá \texttt{PAGER}, \texttt{vipw} pak
1993-
promìnnou \texttt{EDITOR} apod.
1994-
\item pokud je \texttt{envp} tøetím parametrem funkce \texttt{main}, tak je to
1995-
stejná hodnota co je v ukazateli \texttt{environ}.
1996-
\item pøíklad: \example{main/print-env.c} (vèetnì pou¾ití
1997-
\texttt{env} pøíkazu zpùsobem, který vyèistí zdìdìné promìnné prostøedí).
1983+
It may not work like that in your shell as very probably your system will not
1984+
have a french localization package installed.
1985+
\item When replacing the current process image with a different program (page
1986+
\pageref{EXEC}), the child will by default get the full environment from its
1987+
parent. You can pass a different array as an argument to the function
1988+
\texttt{exec()}, including passing an empty one.
1989+
\item Different commands use different environment variables. That should be
1990+
documented in their respective manual pages, sometimes in a separate section
1991+
named \emph{ENVIRONMENT} or \emph{ENVIRONMENT VARIABLES}.
1992+
\item For example, the \texttt{man} command uses \texttt{PAGER}, \texttt{vipw}
1993+
uses \texttt{EDITOR} etc. The variables are usually in caps but it is just a
1994+
convension. \texttt{wget} does not follow that, for example, it uses
1995+
\texttt{http\_proxy} and \texttt{https\_proxy} as environment variables to set
1996+
the proxy to be used, and other lower case variables as well.
1997+
\item If \emph{envp} is the 3rd argument of \texttt{main} it is the same pointer
1998+
as is in the standard global variable \texttt{environ}.
1999+
\item Example: \example{main/print-env.c} (see below how to clear out inherited
2000+
environment from the shell using the \texttt{env} command):
2001+
19982002
\begin{verbatim}
19992003
$ cc print-env.c
20002004
$ env - XXX=yyy aaa=ABC ./a.out

0 commit comments

Comments
 (0)