summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
Diffstat (limited to 'Master')
-rw-r--r--Master/texmf-dist/doc/latex/ifplatform/README14
-rw-r--r--Master/texmf-dist/doc/latex/ifplatform/ifplatform.pdfbin101106 -> 129729 bytes
-rw-r--r--Master/texmf-dist/source/latex/ifplatform/ifplatform.dtx372
-rw-r--r--Master/texmf-dist/source/latex/ifplatform/ifplatform.ins20
-rw-r--r--Master/texmf-dist/tex/latex/ifplatform/ifplatform.sty144
5 files changed, 383 insertions, 167 deletions
diff --git a/Master/texmf-dist/doc/latex/ifplatform/README b/Master/texmf-dist/doc/latex/ifplatform/README
index 698aa3f76af..8977f40cfc4 100644
--- a/Master/texmf-dist/doc/latex/ifplatform/README
+++ b/Master/texmf-dist/doc/latex/ifplatform/README
@@ -1,16 +1,18 @@
-_____________________
-The ifplatform package
-v0.2 2007/11/18
+______________________
+The IFPLATFORM package
+v0.3a 2009/09/10
-This package uses -shell-escape to establish whether
+This package uses heuristics to establish whether
the document is being processed on Windows or a *NIX
platform (Mac OS X, Linux, etc.).
+Shell escape is required to differentiate different *NIX platforms.
+
Booleans provided are:
- ifwindows
- iflinux
- ifmacosx
-Please request more platforms if you need them.
+ - ifcygwin
Finally, the \platformname macro is also provided that
expands to a string of the platform name.
@@ -18,5 +20,5 @@ expands to a string of the platform name.
Will Robertson wspr 81 at gmail dot com
Johannes Große
-Copyright 2007
+Copyright 2007, 2009 Will Robertson
Distributed under the LaTeX Project Public License
diff --git a/Master/texmf-dist/doc/latex/ifplatform/ifplatform.pdf b/Master/texmf-dist/doc/latex/ifplatform/ifplatform.pdf
index d253aab20e6..e507e3f6200 100644
--- a/Master/texmf-dist/doc/latex/ifplatform/ifplatform.pdf
+++ b/Master/texmf-dist/doc/latex/ifplatform/ifplatform.pdf
Binary files differ
diff --git a/Master/texmf-dist/source/latex/ifplatform/ifplatform.dtx b/Master/texmf-dist/source/latex/ifplatform/ifplatform.dtx
index a220e684bb6..273f71e804c 100644
--- a/Master/texmf-dist/source/latex/ifplatform/ifplatform.dtx
+++ b/Master/texmf-dist/source/latex/ifplatform/ifplatform.dtx
@@ -3,19 +3,21 @@
\iffalse
%</internal>
%<*readme>
-_____________________
-The ifplatform package
-v0.2 2007/11/18
+______________________
+The IFPLATFORM package
+v0.3a 2009/09/10
-This package uses -shell-escape to establish whether
+This package uses heuristics to establish whether
the document is being processed on Windows or a *NIX
platform (Mac OS X, Linux, etc.).
+Shell escape is required to differentiate different *NIX platforms.
+
Booleans provided are:
- ifwindows
- iflinux
- ifmacosx
-Please request more platforms if you need them.
+ - ifcygwin
Finally, the \platformname macro is also provided that
expands to a string of the platform name.
@@ -23,7 +25,7 @@ expands to a string of the platform name.
Will Robertson wspr 81 at gmail dot com
Johannes Große
-Copyright 2007
+Copyright 2007, 2009 Will Robertson
Distributed under the LaTeX Project Public License
%</readme>
%<*internal>
@@ -34,19 +36,18 @@ Distributed under the LaTeX Project Public License
\input docstrip.tex
\keepsilent
\preamble
- ___________________________________________________
- Copyright (C) 2007 Will Robertson & Johannes Große
+ _________________________________________________________
+ Copyright (C) 2007, 2009 Will Robertson & Johannes Große
License information appended.
\endpreamble
\postamble
-Copyright (C) 2007 by Will Robertson & Johannes Große
+Copyright (C) 2007, 2009 by Will Robertson & Johannes Große
Distributable under the LaTeX Project Public License,
version 1.3c or higher (your choice). The latest version of
this license is at: http://www.latex-project.org/lppl.txt
-This work is "maintained" (as per LPPL maintenance status)
-by Will Robertson.
+This work is "author-maintained" by Will Robertson.
This work consists of the file ifplatform.dtx
and the derived files ifplatform.pdf,
@@ -54,15 +55,16 @@ This work consists of the file ifplatform.dtx
ifplatform.ins.
\endpostamble
\askforoverwritefalse
-\generate{\file{\jobname.sty}{\from{\jobname.dtx}{package}}}
+\generate{\file{ifplatform.sty}{\from{ifplatform.dtx}{package}}}
%</batchfile>
%<batchfile>\endbatchfile
%<*internal>
\generate{\file{\jobname.ins}{\from{\jobname.dtx}{batchfile}}}
\nopreamble\nopostamble
\generate{\file{README.txt}{\from{\jobname.dtx}{readme}}}
-\generate{\file{prepare.sh}{\from{\jobname.dtx}{prepare}}}
\endgroup
+\immediate\write18{makeindex -s gind.ist -o \jobname.ind \jobname.idx}
+\immediate\write18{makeindex -s gglo.ist -o \jobname.gls \jobname.glo}
%</internal>
%<*driver>
\documentclass{ltxdoc}
@@ -71,8 +73,10 @@ This work consists of the file ifplatform.dtx
\CodelineIndex
\RecordChanges
%\OnlyDescription
-\usepackage{array,booktabs,color,enumitem,hyperref}
+\usepackage{array,booktabs,color,enumitem,geometry,microtype}
\usepackage[sc,osf]{mathpazo}
+\usepackage[colorlinks]{hyperref}
+\geometry{a5paper,left=3.05cm,right=2cm}
\linespread{1.1} % A bit more space between lines
\frenchspacing % Remove ugly extra space after punctuation
\definecolor{niceblue}{rgb}{0.2,0.4,0.8}
@@ -80,6 +84,15 @@ This work consists of the file ifplatform.dtx
\newcommand*\pkg[1]{\textsf{#1}}
\hfuzz2pt
\usepackage{ifplatform}% for version info
+\ifwindows
+ \typeout{ifplatform debug: using Windows.}
+\fi\iflinux
+ \typeout{ifplatform debug: using Linux.}
+\fi\ifmacosx
+ \typeout{ifplatform debug: using Mac OS X.}
+\fi\ifcygwin
+ \typeout{ifplatform debug: using Cygwin.}
+\fi
\begin{document}
\DocInput{ifplatform.dtx}
\end{document}
@@ -91,56 +104,79 @@ This work consists of the file ifplatform.dtx
% \makeatletter
%
% \title{The \pkg{\jobname} package}
-% \author{Code by Johannes Gro\ss{}e\\
+% \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 \qquad \filedate}
+% \date{\fileversion\thanks{Thanks to Ken Brown, Joseph Wright, Zebb Prime, and others for testing this version.}\qquad \filedate}
%
% \maketitle
%
-% \section{About}
-% This package provides the following conditionals to test
+% \section{Main features and usage}
+%
+% This package provides the three following conditionals to test
% which operating system is being used to run \TeX:
-% \begin{itemize}[nolistsep,label=--]
+% \begin{itemize}[nolistsep,label={}]
% \item \cs{ifwindows}
% \item \cs{iflinux}
% \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
+% 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
+% executing \LaTeX.
%
-% \TeX\ must be invoked with the |-shell-escape| option (or equivalent) for the
-% package to work. \cs{ifshellescape} is also provided to check
-% whether this is the case.
+% 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.
%
-% Also, the \cmd\platformname\ command is defined to expand to a
-% macro that represents the operating system. Default definitions are (respectively):
+% \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\
+% allow you to query shell escape with \verb|\ifnum\pdfshellescape>0|\,.)
%
+% 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}
-% \cmd\windowsname & `Windows' \\
-% \cmd\linuxname & `Linux' \\
-% \cmd\macosxname & `Mac\,OS\,X' \\
+% \cmd\windowsname & `\windowsname' \\
+% \cmd\notwindowsname & `\notwindowsname' (when shell escape is disabled) \\
+% \cmd\linuxname & `\linuxname' \\
+% \cmd\macosxname & `\macosxname' \\
+% \cmd\cygwinname & `\cygwinname' \\
% \cmd\unknownplatform & \emph{whatever is returned by} |uname| \\
% \end{tabular}
-%
-% \noindent Redefine these macros to customise
+% \end{quote}
+% E.g., if \cs{ifwindows} is \emph{true} then \cs{platformname}
+% expands to \cs{windowsname}, which expands to `\windowsname'.
+% Redefine the macros above to customise
% the output of \cmd\platformname.
-% \ifshellescape
-% This documentation was compiled on \platformname.
-% \fi
+%
+% \begin{center}\itshape
+% This documentation was compiled on \platformname.
+% \end{center}
%
% \section{Other platforms}
%
% If greater granularity is required to differentiate between various \textsc{unix}-like operating systems, then \cmd\unknownplatform\ can be interrogated for the platform based on the output of |uname|. Table~\ref{table} lists possible outputs for a range of operating systems.
%
% For example, to test whether the AIX operating system is being used, you could use the following code:
+% \begin{quote}
% \begin{verbatim}
-% \def\@tempa{aix6}
-% \ifx\unknownplatform\@tempa
-% ... AIX is being used ....
-% \else
-% ... or not ...
-% \fi
+%\def\myplatform{aix6}
+%\ifx\myplatform\unknownplatform
+% ... AIX is being used ...
+%\else
+% ... or not ...
+%\fi
% \end{verbatim}
+% \end{quote}
% The \pkg{ifthen} and \pkg{xifthen} packages might be of interest to those who prefer more \LaTeX-like methods of conditional testing.
%
% \begin{table}[hp]
@@ -149,27 +185,55 @@ This work consists of the file ifplatform.dtx
% \toprule
% Platform & uname \textrm{string} \\
% \midrule
-% AIX & {aix6} \\
-% Cray UNICOS & {sn5176} \\
% FreeBSD & {FreeBSD} \\
+% OpenBSD & {OpenBSD} \\
+% Solaris & {SunOS} \\
% HPUX & {HP-UX} \\
% IRIX & {IRIX64} \\
-% Solaris & {SunOS} \\
-% OpenBSD & {OpenBSD} \\
+% AIX & {aix6} \\
+% Cray UNICOS & {sn5176} \\
% \bottomrule
% \end{tabular}
% \caption{List of operating systems and their \texttt{uname} strings. Adapted from % \url{http://en.wikipedia.org/wiki/Uname}.}
% \label{table}
% \end{table}
%
-% \clearpage
+% \section{Limitations}
+%
+% Some technical information in case things go wrong.
+% \begin{itemize}
+% \item \pkg{ifplatform} checks for Windows by the presence or absence of the file `|nul:|'. If you have a file in your search path in *nix called `|nul:.tex|' (or without the |.tex|) then things may become confused.
+%
+% \item \pkg{ifplatform} checks for *nix by the presence or absence of the file `|/dev/null|'. If you have the file in Windows called |/dev/null.tex| (or without the extension) then things might similarly get mixed up.
+%
+% \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|
+% 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
+% appear to be neither.\end{quote}
+% then I'd dearly like to know how it happened. It should
+% never occur, as far as I know.
+% \end{itemize}
+% Keep these points in mind and you'll never run into trouble.
+% I hope you won't run into trouble in any case.
+%
+% \StopEventually{\clearpage\PrintIndex}
% \section{Implementation}
%\iffalse
%<*package>
%\fi
% \begin{macrocode}
\ProvidesPackage{ifplatform}
- [2007/11/18 v0.2 Testing for the operating system]
+ [2009/09/10 v0.3a Testing for the operating system]
+% \end{macrocode}
+% Packages required: (thanks Heiko)
+% \begin{macrocode}
+\RequirePackage{pdftexcmds,catchfile}
% \end{macrocode}
% Conditionals we provide:
% \begin{macrocode}
@@ -177,116 +241,212 @@ This work consists of the file ifplatform.dtx
\newif\ifwindows
\newif\ifmacosx
\newif\iflinux
+\newif\ifcygwin
% \end{macrocode}
+% \begin{macro}{\windowsname}
+% \begin{macro}{\notwindowsname}
+% \begin{macro}{\linuxname}
+% \begin{macro}{\macosxname}
+% \begin{macro}{\cygwinname}
+% \begin{macro}{\unknownplatform}
% Names of operating systems:
% \begin{macrocode}
\newcommand\windowsname{Windows}
+\newcommand\notwindowsname{*NIX}
\newcommand\linuxname{Linux}
\newcommand\macosxname{Mac\,OS\,X}
+\newcommand\cygwinname{Cygwin}
\newcommand\unknownplatform{[Unknown]}
% \end{macrocode}
-% Define test file name and define a hopefully unique string:
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% For internal stuff later:
% \begin{macrocode}
\edef\ip@file{\jobname.w18}
-\edef\ip@sig{write18-test-\the\year\the\month\the\day\the\time}
-\edef\ip@win{'\ip@sig'}
+\newif\if@ip@nix@
% \end{macrocode}
-% Macro to read in a one-line file into a temporary location:
+% \begin{macro}{\ifshellescape}
+% Determine if shell escape is enabled:
% \begin{macrocode}
-\def\ip@read@file{%
- \newread\instream
- \openin\instream=\ip@file
- \@tempcnta=\endlinechar
- \endlinechar=-1
- \read\instream to\@tempa
- \endlinechar=\@tempcnta
- \closein\instream}
+\ifnum\pdf@shellescape=1\relax
+ \shellescapetrue
+\else
+ \PackageWarningNoLine{ifplatform}{^^J \space\space\space
+ shell escape is disabled,
+ so I can only detect \@backslashchar ifwindows%
+ }
+\fi
% \end{macrocode}
-% Use echo to (maybe) write a test file. If it succeeds, continue; else, bail.
+% \end{macro}
+% An error message for when things go wrong:
% \begin{macrocode}
-\immediate\write18{echo \ip@win >"\ip@file"}
-\IfFileExists{\ip@file}{\shellescapetrue}{\shellescapefalse\endinput}
+\def\ip@cantdecide{%
+ \PackageWarningNoLine{ifplatform}{^^J \space\space\space
+ I can't tell if this is Windows or *nix;
+ you appear to be both%
+ }%
+}
% \end{macrocode}
-% Now read the test file into a macro:
+% Test for the null files of Windows and *nix. In a normal situation, this is all we need to do:
% \begin{macrocode}
-\ip@read@file
+\IfFileExists{nul:}{\@ip@nix@false}{\@ip@nix@true}
+\IfFileExists{/dev/null}{\windowsfalse}{\windowstrue}
% \end{macrocode}
-% The contents of the test file reveals several things:
-% \begin{itemize}[nolistsep,label=--]
-% \item test string correct with single quotes: Windows,
-% \item test string correct without single quotes: Linux/Mac OS X,
-% \item test string not correct: did not really write test file, so \cmd\write18\ is not enabled. (This should never happen.)
+% \begin{table}
+% \centering
+% \begin{tabular}{@{}llll@{}}
+% \toprule
+% File & Exists & Windows? & *nix? \\
+% \midrule
+% \texttt{nul:} & true & Probably & Maybe \\
+% & false & Definitely not & Definitely \\
+% \texttt{/dev/null} & true & Maybe & Probably \\
+% & false & Definitely & Definitely not \\
+% \bottomrule
+% \end{tabular}
+% \caption{Possibilities for testing null files and their prospects for determining the platform.}
+% \label{tbl}
+% \end{table}
+% However, sometimes that's not good enough.
+% If things go wrong above, we still don't know which platform. Can only proceed if shell escape is on; fallback heuristic:
+% \begin{itemize}[nolistsep]
+% \item If the tmp file exists
+% \begin{itemize}[nolistsep]
+% \item Tell them to delete it and abort.
+% \item Otherwise:
+% \end{itemize}
+% \item Write to it with |echo| that only works on Windows
+% \item Then see again if it exists
+% \begin{itemize}[nolistsep]
+% \item If the tmp file exists: Windows (and delete the file)
+% \item Otherwise: *nix
% \end{itemize}
-% \begin{macro}{\ifwindows}
-% First test for Windows.
+% \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}%
+ \IfFileExists{\ip@file}{%
+ \immediate\write18{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}
-\ifx\@tempa\ip@sig
- \windowsfalse
+\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
- \ifx\@tempa\ip@win
- \windowstrue
- \else
- \PackageError{ifplatform}
- {There is a problem. Please delete the file \ip@file.}
- {Somehow an old file is lying around telling me the wrong things.
- \MessageBreak This should never happen. Please let us know when it does!}
+ \if@ip@nix@\else
+ \ifshellescape
+ \ip@backupplan
+ \else
+ \ip@cantdecide
+ \fi
\fi
\fi
% \end{macrocode}
-% \end{macro}
+% Needed below:
+% \begin{macrocode}
+\def\ip@only@six#1#2#3#4#5#6#7\@nil{#1#2#3#4#5#6}
+% \end{macrocode}
+%
% \begin{macro}{\iflinux}
% \begin{macro}{\ifmacosx}
-% Now test for the others; directly test for Linux and Mac~OS~X; but what about Solaris or FreeBSD or \dots\ ?
+% \begin{macro}{\ifcygwin}
+% 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}
-\ifwindows\else
- \immediate\write18{uname -s > "\ip@file"}
- \ip@read@file
- \def\@tempb{Linux}
- \ifx\@tempa\@tempb
- \linuxtrue
- \else
- \def\@tempb{Darwin}
+\if@ip@nix@
+\ifshellescape
+ \ifwindows\else
+ \immediate\write18{uname -s > "\ip@file"}
+ \CatchFileDef\@tempa{\ip@file}{}
+ \immediate\write18{rm -- "\ip@file"}
+% \end{macrocode}
+% Kill a trailing space:
+% \begin{macrocode}
+ \edef\@tempa{\expandafter\zap@space\@tempa\@empty}
+ \def\@tempb{Linux}
\ifx\@tempa\@tempb
- \macosxtrue
+ \linuxtrue
\else
- \edef\unknownplatform{\@tempa}
+ \def\@tempb{Darwin}
+ \ifx\@tempa\@tempb
+ \macosxtrue
+ \else
+ \def\@tempb{CYGWIN}
+ \edef\@tempc{\expandafter\ip@only@six\@tempa------\@nil}
+ \ifx\@tempb\@tempc
+ \cygwintrue
+ \else
+ \edef\unknownplatform{\@tempa}
+ \fi
+ \fi
\fi
\fi
-\fi
+\fi\fi
% \end{macrocode}
% \end{macro}
% \end{macro}
+% \end{macro}
%
% \begin{macro}{\platformname}
% Defined in terms of macros so the output is user-customisable.
% \begin{macrocode}
\edef\platformname{%
- \ifwindows\noexpand\windowsname\else
- \iflinux \noexpand\linuxname\else
- \ifmacosx \noexpand\macosxname\else
+ \ifwindows
+ \noexpand\windowsname
+ \else
+ \ifshellescape
+ \iflinux
+ \noexpand\linuxname
+ \else
+ \ifmacosx
+ \noexpand\macosxname
+ \else
+ \ifcygwin
+ \noexpand\cygwinname
+ \else
\noexpand\unknownplatform
- \fi\fi\fi}
+ \fi
+ \fi
+ \fi
+ \else
+ \noexpand\notwindowsname
+ \fi
+ \fi
+}
% \end{macrocode}
% \end{macro}
-% Clean up:
-% \begin{macrocode}
-\immediate\write18{\ifwindows del \else rm -- \fi "\ip@file"}
-% \end{macrocode}
%\iffalse
%</package>
-%<*prepare>
-% \begin{macrocode}
-rm ifplatform.zip
-mv README.txt README
-zip ifplatform.zip ifplatform.dtx ifplatform.ins ifplatform.pdf README
-% \end{macrocode}
-%</prepare>
%\fi
%
+% \Finale
+%
% \typeout{------------------------------------------------------}
% \typeout{ To finish the installation please move the following}
-% \typeout{ file into a directory searched by XeTeX:}
+% \typeout{ file into a directory searched by LaTeX:}
% \typeout{ \space- ifplatform.sty}
% \typeout{------------------------------------------------------}
%
diff --git a/Master/texmf-dist/source/latex/ifplatform/ifplatform.ins b/Master/texmf-dist/source/latex/ifplatform/ifplatform.ins
index 775c63664a7..bca0a93093c 100644
--- a/Master/texmf-dist/source/latex/ifplatform/ifplatform.ins
+++ b/Master/texmf-dist/source/latex/ifplatform/ifplatform.ins
@@ -5,25 +5,24 @@
%% The original source files were:
%%
%% ifplatform.dtx (with options: `batchfile')
-%% ___________________________________________________
-%% Copyright (C) 2007 Will Robertson & Johannes Große
+%% _________________________________________________________
+%% Copyright (C) 2007, 2009 Will Robertson & Johannes Große
%% License information appended.
\input docstrip.tex
\keepsilent
\preamble
- ___________________________________________________
- Copyright (C) 2007 Will Robertson & Johannes Große
+ _________________________________________________________
+ Copyright (C) 2007, 2009 Will Robertson & Johannes Große
License information appended.
\endpreamble
\postamble
-Copyright (C) 2007 by Will Robertson & Johannes Große
+Copyright (C) 2007, 2009 by Will Robertson & Johannes Große
Distributable under the LaTeX Project Public License,
version 1.3c or higher (your choice). The latest version of
this license is at: http://www.latex-project.org/lppl.txt
-This work is "maintained" (as per LPPL maintenance status)
-by Will Robertson.
+This work is "author-maintained" by Will Robertson.
This work consists of the file ifplatform.dtx
and the derived files ifplatform.pdf,
@@ -31,16 +30,15 @@ This work consists of the file ifplatform.dtx
ifplatform.ins.
\endpostamble
\askforoverwritefalse
-\generate{\file{\jobname.sty}{\from{\jobname.dtx}{package}}}
+\generate{\file{ifplatform.sty}{\from{ifplatform.dtx}{package}}}
\endbatchfile
-%% Copyright (C) 2007 by Will Robertson & Johannes Große
+%% Copyright (C) 2007, 2009 by Will Robertson & Johannes Große
%%
%% Distributable under the LaTeX Project Public License,
%% version 1.3c or higher (your choice). The latest version of
%% this license is at: http://www.latex-project.org/lppl.txt
%%
-%% This work is "maintained" (as per LPPL maintenance status)
-%% by Will Robertson.
+%% This work is "author-maintained" by Will Robertson.
%%
%% This work consists of the file ifplatform.dtx
%% and the derived files ifplatform.pdf,
diff --git a/Master/texmf-dist/tex/latex/ifplatform/ifplatform.sty b/Master/texmf-dist/tex/latex/ifplatform/ifplatform.sty
index ed0f046fcde..cd7cfe51318 100644
--- a/Master/texmf-dist/tex/latex/ifplatform/ifplatform.sty
+++ b/Master/texmf-dist/tex/latex/ifplatform/ifplatform.sty
@@ -5,75 +5,131 @@
%% The original source files were:
%%
%% ifplatform.dtx (with options: `package')
-%% ___________________________________________________
-%% Copyright (C) 2007 Will Robertson & Johannes Große
+%% _________________________________________________________
+%% Copyright (C) 2007, 2009 Will Robertson & Johannes Große
%% License information appended.
\ProvidesPackage{ifplatform}
- [2007/11/18 v0.2 Testing for the operating system]
+ [2009/09/10 v0.3a Testing for the operating system]
+\RequirePackage{pdftexcmds,catchfile}
\newif\ifshellescape
\newif\ifwindows
\newif\ifmacosx
\newif\iflinux
+\newif\ifcygwin
\newcommand\windowsname{Windows}
+\newcommand\notwindowsname{*NIX}
\newcommand\linuxname{Linux}
\newcommand\macosxname{Mac\,OS\,X}
+\newcommand\cygwinname{Cygwin}
\newcommand\unknownplatform{[Unknown]}
\edef\ip@file{\jobname.w18}
-\edef\ip@sig{write18-test-\the\year\the\month\the\day\the\time}
-\edef\ip@win{'\ip@sig'}
-\def\ip@read@file{%
- \newread\instream
- \openin\instream=\ip@file
- \@tempcnta=\endlinechar
- \endlinechar=-1
- \read\instream to\@tempa
- \endlinechar=\@tempcnta
- \closein\instream}
-\immediate\write18{echo \ip@win >"\ip@file"}
-\IfFileExists{\ip@file}{\shellescapetrue}{\shellescapefalse\endinput}
-\ip@read@file
-\ifx\@tempa\ip@sig
- \windowsfalse
+\newif\if@ip@nix@
+\ifnum\pdf@shellescape=1\relax
+ \shellescapetrue
\else
- \ifx\@tempa\ip@win
- \windowstrue
- \else
- \PackageError{ifplatform}
- {There is a problem. Please delete the file \ip@file.}
- {Somehow an old file is lying around telling me the wrong things.
- \MessageBreak This should never happen. Please let us know when it does!}
+ \PackageWarningNoLine{ifplatform}{^^J \space\space\space
+ shell escape is disabled,
+ so I can only detect \@backslashchar ifwindows%
+ }
+\fi
+\def\ip@cantdecide{%
+ \PackageWarningNoLine{ifplatform}{^^J \space\space\space
+ I can't tell if this is Windows or *nix;
+ you appear to be both%
+ }%
+}
+\IfFileExists{nul:}{\@ip@nix@false}{\@ip@nix@true}
+\IfFileExists{/dev/null}{\windowsfalse}{\windowstrue}
+\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}%
+ \IfFileExists{\ip@file}{%
+ \immediate\write18{del "\ip@file"}%
+ \windowstrue
+ }{%
+ \@ip@nix@true
+ }%
+ }%
+}
+\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
-\ifwindows\else
- \immediate\write18{uname -s > "\ip@file"}
- \ip@read@file
- \def\@tempb{Linux}
- \ifx\@tempa\@tempb
- \linuxtrue
- \else
- \def\@tempb{Darwin}
+\def\ip@only@six#1#2#3#4#5#6#7\@nil{#1#2#3#4#5#6}
+\if@ip@nix@
+\ifshellescape
+ \ifwindows\else
+ \immediate\write18{uname -s > "\ip@file"}
+ \CatchFileDef\@tempa{\ip@file}{}
+ \immediate\write18{rm -- "\ip@file"}
+ \edef\@tempa{\expandafter\zap@space\@tempa\@empty}
+ \def\@tempb{Linux}
\ifx\@tempa\@tempb
- \macosxtrue
+ \linuxtrue
\else
- \edef\unknownplatform{\@tempa}
+ \def\@tempb{Darwin}
+ \ifx\@tempa\@tempb
+ \macosxtrue
+ \else
+ \def\@tempb{CYGWIN}
+ \edef\@tempc{\expandafter\ip@only@six\@tempa------\@nil}
+ \ifx\@tempb\@tempc
+ \cygwintrue
+ \else
+ \edef\unknownplatform{\@tempa}
+ \fi
+ \fi
\fi
\fi
-\fi
+\fi\fi
\edef\platformname{%
- \ifwindows\noexpand\windowsname\else
- \iflinux \noexpand\linuxname\else
- \ifmacosx \noexpand\macosxname\else
+ \ifwindows
+ \noexpand\windowsname
+ \else
+ \ifshellescape
+ \iflinux
+ \noexpand\linuxname
+ \else
+ \ifmacosx
+ \noexpand\macosxname
+ \else
+ \ifcygwin
+ \noexpand\cygwinname
+ \else
\noexpand\unknownplatform
- \fi\fi\fi}
-\immediate\write18{\ifwindows del \else rm -- \fi "\ip@file"}
-%% Copyright (C) 2007 by Will Robertson & Johannes Große
+ \fi
+ \fi
+ \fi
+ \else
+ \noexpand\notwindowsname
+ \fi
+ \fi
+}
+%% Copyright (C) 2007, 2009 by Will Robertson & Johannes Große
%%
%% Distributable under the LaTeX Project Public License,
%% version 1.3c or higher (your choice). The latest version of
%% this license is at: http://www.latex-project.org/lppl.txt
%%
-%% This work is "maintained" (as per LPPL maintenance status)
-%% by Will Robertson.
+%% This work is "author-maintained" by Will Robertson.
%%
%% This work consists of the file ifplatform.dtx
%% and the derived files ifplatform.pdf,