\begingroup \catcode `|=0 \catcode `[= 1
\catcode`]=2 \catcode `\{=12 \catcode `\}=12
\catcode`\\=12 |gdef|@xframedverbatim#1\end{framedverbatim}[#1|end[framedverbatim]]
|gdef|@sxframedverbatim#1\end{framedverbatim*}[#1|end[framedverbatim*]]
|endgroup
\newdimen\@mcdheight 
\def\@sframedverbatim{\obeyspaces\@framedverbatim}
\def\@mcdrule{\@mcdheight=\baselineskip\advance\@mcdheight by-2pt
\setbox0=\hbox{\vrule height\@mcdheight depth 2pt width 1pt}%
\ht0=\@mcdheight\dp0=0pt\wd0=1pt\box0} 
\def\@mcdendrule{\@mcdheight=\baselineskip%
\setbox0=\hbox{\vrule height\@mcdheight depth 2pt width 1pt}%
\ht0=\@mcdheight\dp0=0pt\wd0=1pt\box0} 
\def\@framedverbatim{\trivlist \item[]
\parskip 0pt
\hrule height 1pt depth 0pt width\textwidth
\everypar{\global \@minipagefalse \global \@newlistfalse \if@inlabel%
\global \@inlabelfalse \hskip -\parindent \box \@labels \penalty \z@ \fi%
\hbox to 6pt{\rlap{\@mcdrule}\hskip\textwidth\llap{\@mcdrule}\hss}}
\if@minipage\else\vskip\parskip\fi 
\leftskip\@totalleftmargin\rightskip\z@
\parindent\z@\parfillskip\@flushglue\parskip\z@
\@tempswafalse \def\par{\if@tempswa\hbox{}\fi\@tempswatrue\@@par}
\obeylines \tt \catcode``=13 \@noligs \let\do\@makeother \dospecials}
 
\def\framedverbatim{\@framedverbatim \frenchspacing\@vobeyspaces \@xframedverbatim}
\def\endframedverbatim{\nointerlineskip%
{\everypar{}\baselineskip=4pt\vbox to 4pt{\par\noindent\hbox to 6pt{\rlap{\@mcdendrule}\hskip\textwidth\llap{\@mcdendrule}\hss}}%
\vskip1pt\hrule height 1pt depth 0pt width\textwidth}\endtrivlist}%
\@namedef{framedverbatim*}{\@framedverbatim\@sxframedverbatim}
\expandafter\let\csname endframedverbatim*\endcsname =\endtrivlist

