2 %%% Applied Crypto Hardening
5 %%% configfiles.tex -- macros for automatically inserting config file parts
12 \RequirePackage{etoolbox}
13 \RequirePackage{ifplatform}
16 \newwrite\configfileout
17 \immediate\openout\configfileout configfiles.txt
19 % do not trace everything
20 \newif\iftracingsections
22 \newcommand*\currentsectionname{}%
23 \newcommand*\currentsubsectionname{}%
26 \def\@configurationdir{configuration}
27 \newcommand*\configurationdir[1]{%
28 \gdef\@configurationdir{#1}}
29 \def\@configurationbaseurl{}
30 \newcommand*\configurationbaseurl[1]{%
31 \gdef\@configurationbaseurl{#1}}
33 % patch the section command to record information for our config files
37 \def\sectn@me{section}%
38 \def\subsectn@me{subsection}%
41 \ifx\tempa\sectn@me\relax%
42 \expandafter\xdef\expandafter\currentsectionname{\tempn@me}%
44 \ifx\tempa\subsectn@me\relax%
45 \expandafter\xdef\expandafter\currentsubsectionname%
46 {\tempn@me}\else\relax\fi%
52 % \configfile[args]{filename}{range}
53 % --> \lstinputlisting[linerange={range},args]{configurations/Section/Subsection/filename}
55 \newcommand*\configfile[4][]{%
57 \edef\configfilen@me{\@configurationdir/\currentsectionname/\currentsubsectionname/#2}
58 \edef\configfilename{\expandafter\detokenize\expandafter{\configfilen@me}}
59 \def\configfilepres{\expandafter\protect\expandafter\path\expandafter{\configfilename}}
60 \immediate\write\configfileout{\configfilename}
61 \ifwindows\def\dummy@ext{.}\else\let\dummy@ext\empty\fi%
66 caption={[#4\\\configfilepres]%
67 #4\\\mbox{\protect\href{\@configurationbaseurl\configfilename}{%
68 {\upshape [\configfilepres]}%
70 #1]{\configfilename\dummy@ext}%
71 \marginpar{\vspace*{-2\baselineskip}\protect\href{\@configurationbaseurl\configfilename}{%
72 \includegraphics[height=2\baselineskip]{img/ConfigIcns}}}
74 \@warning{\string\configfile outside a sectiontraced region}%
79 % start tracing section commands to record (sub)section names
80 \newcommand*\startconfigfiles{%
85 % stop tracing section commands
86 \newcommand*\stopconfigfiles{%
87 \tracingsectionsfalse%
88 \renewcommand*\currentsectionname{%
89 \@warning{\string\currentsectionname outside sectiontraced region}}%
90 \renewcommand*\currentsubsectionname{%
91 \@warning{\string\currentsubsectionname outside sectiontraced region}}%
99 %%% TeX-master: "../applied-crypto-hardening"