\documentclass{article}
\usepackage{amsmath}
\newcommand*\SRC{}
\def\SRC/{\leavevmode\special{src:\the\inputlineno\space\jobname.tex}}

\begin{document}
\section*{\SRC/This is a test file for src specials in xdvi(k)}
\SRC/Of course, for realistic applications, the specials wouldn't
\SRC/be inserted `by hand' such as here (by just inserting
\SRC/\texttt{\char`\\ SRC/} at every newline),
\SRC/but automatically, using some style file or maybe a modified
\SRC/\TeX\ program.

\SRC/We might have some displayed equations:

\[ \SRC/ 1 + 1 = 1 \]

\SRC/and also an itemized list:
\begin{itemize}
\item \SRC/dummy item 1
\item \SRC/dummy item 2
\end{itemize}
\SRC/This is the end of the list.

\SRC/This is the end of this little example document.
\end{document}

