%% See file 'counttexruns.dtx' for copyright and licence.
\NeedsTeXFormat{LaTeX2e}[1998/12/01]
\ProvidesPackage{counttexruns}
    [2012/08/31 v1.00a Count compilations of a document]
%% ^^A \% is ignored ...
\newcounter{counttexruns}
\newwrite\@counttexrunsfile
\RequirePackage{kvoptions}
\DeclareStringOption[ctr]{extension}
\ProcessLocalKeyvalOptions*
\IfFileExists{\jobname.\counttexruns@extension}{
  \immediate\openin\@counttexrunsfile=\jobname.\counttexruns@extension
  \immediate\read\@counttexrunsfile to \@counttexruns
  \immediate\read\@counttexrunsfile to \@counttexruns
  \immediate\closein\@counttexrunsfile
  \setcounter{counttexruns}{\@counttexruns}
}{}
\stepcounter{counttexruns}
\immediate\openout\@counttexrunsfile=\jobname.\counttexruns@extension
\catcode`\%=11\relax
\immediate\write\@counttexrunsfile{%% This file
  '\jobname.\counttexruns@extension' was generated by the package counttexruns}
\catcode`\%=14\relax
\immediate\write\@counttexrunsfile{\arabic{counttexruns}}
\immediate\closeout\@counttexrunsfile
\endinput
%%
%% End of file `counttexruns.sty'.
