%%% access outer \input level

Imagine we need to grab the first param from some input {\tt file.tex}.
We are lucky, the following works fine:

\beginverbatim
\def\do#1{<do something with #1>}
\expandafter\do\input file.tex
\endverbatim

And what if we would like to execute \verb'\do' from the {\tt file.tex} level, catching the parameter that lays just
after the \verb'\input' command in the outer level document? Well, since \verb'\do' requires an argument,
it cannot occur at the very end of the input {\tt file.tex}. We may try this:

\beginverbatim
% outer document content:
\def\do#1{#1 indeed}
\input file.tex {crazy}?\end

% file.tex content:
Isn't that \expandafter\do\endinput
\endverbatim

But then \TeX\ complains:

\beginverbatim
! File ended while scanning use of \do
\endverbatim

So we don't expand \verb'\endinput', but the end of the file itself:

\beginverbatim
% outer document content the same as before,
% file.tex content:
Isn't that \expandafter\do
\endverbatim
\hskip 2em Isn't that crazy indeed?

\medskip
And then it works!
(The actual example is in my package {\tt makepattern}, file {\tt mkpatter.tex} in {\tt CTAN}.)

