summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2017-10-13 21:40:26 +0000
committerKarl Berry <karl@freefriends.org>2017-10-13 21:40:26 +0000
commitc97f4fb8eda9e467d7694621cc5916d75acef5c7 (patch)
tree74e9ccc100096450d1db6d46ce3fd7a209430787 /Master/texmf-dist/source
parent8b02c12ef1888a8819a0e33ba7449a522a87afba (diff)
ifplatform (13oct17)
git-svn-id: svn://tug.org/texlive/trunk@45533 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source')
-rw-r--r--Master/texmf-dist/source/latex/ifplatform/ifplatform.dtx149
-rw-r--r--Master/texmf-dist/source/latex/ifplatform/ifplatform.ins8
2 files changed, 63 insertions, 94 deletions
diff --git a/Master/texmf-dist/source/latex/ifplatform/ifplatform.dtx b/Master/texmf-dist/source/latex/ifplatform/ifplatform.dtx
index 4b6edfbe0e9..0fe2dd70b53 100644
--- a/Master/texmf-dist/source/latex/ifplatform/ifplatform.dtx
+++ b/Master/texmf-dist/source/latex/ifplatform/ifplatform.dtx
@@ -1,36 +1,7 @@
-%\iffalse
+%\iffalse
%<*internal>
\iffalse
%</internal>
-%<*readme>
-______________________
-The IFPLATFORM package
-v0.4 2010/10/22
-
-This package uses heuristics to establish whether
-the document is being processed on Windows or a *NIX
-platform (Mac OS X, Linux, etc.).
-
-Except if you're using LuaTeX where this information
-is already known. Otherwise, shell escape is required
-to differentiate different *NIX platforms.
-
-Booleans provided are:
- - ifwindows
- - iflinux
- - ifmacosx
- - ifcygwin
-
-Finally, the \platformname macro is also provided that
-expands to a string of the platform name.
-
-Will Robertson wspr 81 at gmail dot com
-Johannes Große
-
-Copyright 2007-2010 Will Robertson
-Copyright 2007 Johannes Große
-Distributed under the LaTeX Project Public License
-%</readme>
%<*internal>
\fi
\begingroup
@@ -40,11 +11,11 @@ Distributed under the LaTeX Project Public License
\keepsilent
\preamble
________________________________________________________
- Copyright (C) 2007-2010 Will Robertson & Johannes Große
+ Copyright (C) 2007-2017 Will Robertson & Johannes Große
License information appended.
\endpreamble
\postamble
-Copyright (C) 2007-2010 by Will Robertson & Johannes Große
+Copyright (C) 2007-2017 by Will Robertson & Johannes Große
Distributable under the LaTeX Project Public License,
version 1.3c or higher (your choice). The latest version of
@@ -54,7 +25,7 @@ This work is "author-maintained" by Will Robertson.
This work consists of the file ifplatform.dtx
and the derived files ifplatform.pdf,
- ifplatform.sty, and
+ ifplatform.sty, and
ifplatform.ins.
\endpostamble
\askforoverwritefalse
@@ -64,7 +35,6 @@ This work consists of the file ifplatform.dtx
%<*internal>
\generate{\file{\jobname.ins}{\from{\jobname.dtx}{batchfile}}}
\nopreamble\nopostamble
-\generate{\file{README.txt}{\from{\jobname.dtx}{readme}}}
\endgroup
\immediate\write18{makeindex -s gind.ist -o \jobname.ind \jobname.idx}
\immediate\write18{makeindex -s gglo.ist -o \jobname.gls \jobname.glo}
@@ -110,8 +80,8 @@ This work consists of the file ifplatform.dtx
% \author{Original code by Johannes Gro\ss{}e\\
% Package by Will Robertson\\
% \color[gray]{0.5}
-% \texttt{wspr\,81\,at\,gmail\,dot\,com}}
-% \date{\fileversion\thanks{Thanks to Ken Brown, Joseph Wright, Zebb Prime, and others for testing this version.}\qquad \filedate}
+% \texttt{http://github.com/wspr/ifplatform}}
+% \date{\fileversion\thanks{Thanks to Ken Brown, Joseph Wright, Zebb Prime, and others for testing this package.}\qquad \filedate}
%
% \maketitle
%
@@ -125,14 +95,14 @@ This work consists of the file ifplatform.dtx
% \item \cs{ifmacosx}
% \item \cs{ifcygwin}
% \end{itemize}
-% If you only wish to detect \cs{ifwindows}, then it does not matter how you
-% load this package. Note then that use of (Linux \emph{or} \macosxname\ \emph{or} Cygwin) can
+% If you only wish to detect \cs{ifwindows}, then it does not matter how you
+% load this package. Note then that use of (Linux \emph{or} \macosxname\ \emph{or} Cygwin) can
% then be detected with \cs{ifwindows}\cs{else}.
-%
+%
% If you also wish to determine the difference between which Unix-variant
% you are using (i.e., also detect \cs{iflinux}, \cs{ifmacosx}, and \cs{ifcygwin}) then shell
% escape must be enabled.
-% This is achieved by using the |-shell-escape| command line option when
+% This is achieved by using the |-shell-escape| command line option when
% executing \LaTeX.
%
% If shell escape is not enabled, \cs{iflinux}, \cs{ifmacosx}, and \cs{ifcygwin} will all return \emph{false}. A warning will be printed in the console output to remind you in this case.
@@ -140,13 +110,13 @@ This work consists of the file ifplatform.dtx
% \section{Auxiliary features}
%
% \cs{ifshellescape} is provided as a conditional to test whether
-% shell escape is active or not. (Note: new versions of pdf\/\TeX\
+% shell escape is active or not. (Note: new versions of pdf\/\TeX\
% allow you to query shell escape with \verb|\ifnum\pdfshellescape>0|\,,
-% and the \pkg{pdftexcmds} provides the wrapper \cs{pdf@shellescape}
+% and the \pkg{pdftexcmds} package provides the wrapper \cs{pdf@shellescape}
% which works with \hologo{XeTeX}, \hologo{pdfTeX}, and \hologo{LuaTeX}.)
%
-% Also, the \cmd\platformname\ command is defined to expand to a
-% macro that represents the operating system. Default definitions are
+% Also, the \cmd\platformname\ command is defined to expand to a
+% macro that represents the operating system. Default definitions are
% (respectively):
% \begin{quote}
% \begin{tabular}{@{}l@{\quad$\to$\quad}l}
@@ -213,15 +183,15 @@ This work consists of the file ifplatform.dtx
%
% \item When both null files are detected (i.e., things aren't right with one of the two tests above), \pkg{ifplatform} uses another test to try and sort itself out. For interest, the test is: `|echo # > \jobname.w18|'. Under Windows you should end up with a text file containing an octothorpe. On *nix, the |#| will be seen as a comment char and the test will be ignored and the file will not be written.
%
-% This `last resort' test will fail if shell escape is not enabled, or if the file |\jobname.w18|
+% This `last resort' test will fail if shell escape is not enabled, or if the file |\jobname.w18|
% somehow already exists, or if the behaviour of |#| isn't as reliable as I think.
%
% \item Note that if you're running \TeX\ binaries from Cygwin on Windows, then your platform will \emph{not} be Windows. It will appear to be a *nix system, with platform name `Cygwin'.
%
% \item If you ever see the error
-% \begin{quote}\ttfamily I can't tell if this is Windows or *nix; you
+% \begin{quote}\ttfamily I can't tell if this is Windows or *nix; you
% appear to be neither.\end{quote}
-% then I'd dearly like to know how it happened. It should
+% then I'd dearly like to know how it happened. It should
% never occur, as far as I know.
% (Update: in previous versions of this package, this message appeared when running under \hologo{LuaTeX}.)
% \end{itemize}
@@ -236,11 +206,11 @@ This work consists of the file ifplatform.dtx
%\fi
% \begin{macrocode}
\ProvidesPackage{ifplatform}
- [2010/10/22 v0.4 Testing for the operating system]
+ [2017/10/13 v0.4a Testing for the operating system]
% \end{macrocode}
% Packages required: (thanks Heiko)
% \begin{macrocode}
-\RequirePackage{pdftexcmds,catchfile,ifluatex}
+\RequirePackage{shellesc,pdftexcmds,catchfile,ifluatex}
% \end{macrocode}
% Conditionals we provide:
% \begin{macrocode}
@@ -283,10 +253,10 @@ This work consists of the file ifplatform.dtx
\shellescapetrue
\else
\ifluatex\else
- \PackageWarningNoLine{ifplatform}{^^J \space\space\space
- shell escape is disabled,
- so I can only detect \@backslashchar ifwindows%
- }
+ \PackageWarningNoLine{ifplatform}{^^J \space\space\space
+ shell escape is disabled,
+ so I can only detect \@backslashchar ifwindows%
+ }
\fi
\fi
% \end{macrocode}
@@ -304,7 +274,7 @@ This work consists of the file ifplatform.dtx
% \begin{macrocode}
\ifluatex
\csname\directlua{
- if os.type == "unix" then
+ if os.type == "unix" then
tex.sprint("@ip@nix@true")
elseif os.type == "windows" then
tex.sprint("windowstrue")
@@ -312,13 +282,13 @@ This work consists of the file ifplatform.dtx
}\endcsname
\else
% \end{macrocode}
-% Otherwise we need to
+% Otherwise we need to
% test for the null files of Windows and *nix.
% (This doesn't work at all in LuaTeX. Not sure why; haven't looked.)
% In a normal situation, this is all we need to do:
% \begin{macrocode}
-\IfFileExists{nul:}{\@ip@nix@false}{\@ip@nix@true}
-\IfFileExists{/dev/null}{\windowsfalse}{\windowstrue}
+ \IfFileExists{nul:}{\@ip@nix@false}{\@ip@nix@true}
+ \IfFileExists{/dev/null}{\windowsfalse}{\windowstrue}
% \end{macrocode}
% \begin{table}
% \centering
@@ -352,43 +322,43 @@ This work consists of the file ifplatform.dtx
% \end{itemize}
% Here's the code for the above `last resort' test:
% \begin{macrocode}
-\edef\ip@windows@echo@test{echo \string# > "\ip@file"}
-\def\ip@backupplan{%
- \IfFileExists{\ip@file}{%
- \PackageWarningNoLine{ifplatform}{^^J \space\space\space
- Please delete the file "\ip@file" and try again%
- }%
- \ip@cantdecide
- }{%
- \immediate\write18{\ip@windows@echo@test}%
+ \edef\ip@windows@echo@test{echo \string# > "\ip@file"}
+ \def\ip@backupplan{%
\IfFileExists{\ip@file}{%
- \immediate\write18{del "\ip@file"}%
- \windowstrue
+ \PackageWarningNoLine{ifplatform}{^^J \space\space\space
+ Please delete the file "\ip@file" and try again%
+ }%
+ \ip@cantdecide
}{%
- \@ip@nix@true
+ \ShellEscape{\ip@windows@echo@test}%
+ \IfFileExists{\ip@file}{%
+ \ShellEscape{del "\ip@file"}%
+ \windowstrue
+ }{%
+ \@ip@nix@true
+ }%
}%
- }%
-}
+ }
% \end{macrocode}
% Now we use some odd logic to deduce what's happening in the edge cases when things go wrong: (see table~\ref{tbl})
% \begin{macrocode}
-\ifwindows
- \if@ip@nix@
- \PackageWarningNoLine{ifplatform}{^^J \space\space\space
- I can't tell if this is Windows or *nix;
- you appear to be neither%
- }
- \fi
-\else
- \if@ip@nix@\else
- \ifshellescape
- \ip@backupplan
- \else
- \ip@cantdecide
+ \ifwindows
+ \if@ip@nix@
+ \PackageWarningNoLine{ifplatform}{^^J \space\space\space
+ I can't tell if this is Windows or *nix;
+ you appear to be neither%
+ }
+ \fi
+ \else
+ \if@ip@nix@\else
+ \ifshellescape
+ \ip@backupplan
+ \else
+ \ip@cantdecide
+ \fi
\fi
\fi
\fi
-\fi
% \end{macrocode}
% Needed below:
% \begin{macrocode}
@@ -401,16 +371,15 @@ This work consists of the file ifplatform.dtx
% Now test for the others; directly test for Linux and Mac\,OS\,X; but what about Solaris or FreeBSD or \dots\ ?
% Define \cmd\unknownplatform\ as the output of |uname| rather than enumerate the possibilities.
% \begin{macrocode}
-\if@ip@nix@
-\ifshellescape
+\if@ip@nix@\ifshellescape
\ifwindows\else
- \immediate\write18{uname -s > "\ip@file"}
+ \ShellEscape{uname -s > "\ip@file"}
\CatchFileDef\@tempa{\ip@file}{}
- \immediate\write18{rm -- "\ip@file"}
+ \ShellEscape{rm -- "\ip@file"}
% \end{macrocode}
% Kill a trailing space:
% \begin{macrocode}
- \edef\@tempa{\expandafter\zap@space\@tempa\@empty}
+ \edef\@tempa{\expandafter\zap@space\@tempa\@empty}
\def\@tempb{Linux}
\ifx\@tempa\@tempb
\linuxtrue
diff --git a/Master/texmf-dist/source/latex/ifplatform/ifplatform.ins b/Master/texmf-dist/source/latex/ifplatform/ifplatform.ins
index bcb67685fd3..d1a940ed533 100644
--- a/Master/texmf-dist/source/latex/ifplatform/ifplatform.ins
+++ b/Master/texmf-dist/source/latex/ifplatform/ifplatform.ins
@@ -6,17 +6,17 @@
%%
%% ifplatform.dtx (with options: `batchfile')
%% ________________________________________________________
-%% Copyright (C) 2007-2010 Will Robertson & Johannes Große
+%% Copyright (C) 2007-2017 Will Robertson & Johannes Große
%% License information appended.
\input docstrip.tex
\keepsilent
\preamble
________________________________________________________
- Copyright (C) 2007-2010 Will Robertson & Johannes Große
+ Copyright (C) 2007-2017 Will Robertson & Johannes Große
License information appended.
\endpreamble
\postamble
-Copyright (C) 2007-2010 by Will Robertson & Johannes Große
+Copyright (C) 2007-2017 by Will Robertson & Johannes Große
Distributable under the LaTeX Project Public License,
version 1.3c or higher (your choice). The latest version of
@@ -32,7 +32,7 @@ This work consists of the file ifplatform.dtx
\askforoverwritefalse
\generate{\file{ifplatform.sty}{\from{ifplatform.dtx}{package}}}
\endbatchfile
-%% Copyright (C) 2007-2010 by Will Robertson & Johannes Große
+%% Copyright (C) 2007-2017 by Will Robertson & Johannes Große
%%
%% Distributable under the LaTeX Project Public License,
%% version 1.3c or higher (your choice). The latest version of