summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/ifplatform
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2007-11-22 18:58:32 +0000
committerKarl Berry <karl@freefriends.org>2007-11-22 18:58:32 +0000
commit5f24b7cfebd86d4ec19ff264e850d9e14c193fed (patch)
tree3337c26846b64a7d4fdfa901d3f01d76f1e3017d /Master/texmf-dist/tex/latex/ifplatform
parenta56e4d6cbedf78ba65218189765039dc3750d13a (diff)
new latex package ifplatform (20nov07)
git-svn-id: svn://tug.org/texlive/trunk@5555 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/ifplatform')
-rw-r--r--Master/texmf-dist/tex/latex/ifplatform/ifplatform.sty83
1 files changed, 83 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/ifplatform/ifplatform.sty b/Master/texmf-dist/tex/latex/ifplatform/ifplatform.sty
new file mode 100644
index 00000000000..ed0f046fcde
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/ifplatform/ifplatform.sty
@@ -0,0 +1,83 @@
+%%
+%% This is file `ifplatform.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% ifplatform.dtx (with options: `package')
+%% ___________________________________________________
+%% Copyright (C) 2007 Will Robertson & Johannes Große
+%% License information appended.
+\ProvidesPackage{ifplatform}
+ [2007/11/18 v0.2 Testing for the operating system]
+\newif\ifshellescape
+\newif\ifwindows
+\newif\ifmacosx
+\newif\iflinux
+\newcommand\windowsname{Windows}
+\newcommand\linuxname{Linux}
+\newcommand\macosxname{Mac\,OS\,X}
+\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
+\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!}
+ \fi
+\fi
+\ifwindows\else
+ \immediate\write18{uname -s > "\ip@file"}
+ \ip@read@file
+ \def\@tempb{Linux}
+ \ifx\@tempa\@tempb
+ \linuxtrue
+ \else
+ \def\@tempb{Darwin}
+ \ifx\@tempa\@tempb
+ \macosxtrue
+ \else
+ \edef\unknownplatform{\@tempa}
+ \fi
+ \fi
+\fi
+\edef\platformname{%
+ \ifwindows\noexpand\windowsname\else
+ \iflinux \noexpand\linuxname\else
+ \ifmacosx \noexpand\macosxname\else
+ \noexpand\unknownplatform
+ \fi\fi\fi}
+\immediate\write18{\ifwindows del \else rm -- \fi "\ip@file"}
+%% Copyright (C) 2007 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 consists of the file ifplatform.dtx
+%% and the derived files ifplatform.pdf,
+%% ifplatform.sty, and
+%% ifplatform.ins.
+%%
+%% End of file `ifplatform.sty'.