Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 23 Jun 1997 02:01:04 -0400 (EDT)
From:      Chuck Robey <chuckr@glue.umd.edu>
To:        Annelise Anderson <andrsn@andrsn.stanford.edu>
Cc:        Brian Somers <brian@awfulhak.org>, "Jordan K. Hubbard" <jkh@time.cdrom.com>, kleon@bellsouth.net, freebsd-hackers@FreeBSD.ORG
Subject:   Re: Handbook - ascii form??
Message-ID:  <Pine.BSF.3.96.970623013356.265U-100000@Journey2.mat.net>
In-Reply-To: <Pine.BSF.3.96.970622233546.265Q-100000@Journey2.mat.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, 22 Jun 1997, Chuck Robey wrote:

> On Sun, 22 Jun 1997, Annelise Anderson wrote:
> 
> > 
> > 
> > On Sun, 22 Jun 1997, Brian Somers wrote:
> > 
> > > Sorry - handbook.ascii is already generated.  I was being
> > > stupid.  I can appreciate that some people have problems with
> > > latin - DOS/Win stuff won't grok the ^Hs.  I just didn't realize
> > > that .ascii is already there - despite being in that code only
> > > a few weeks ago.
> > 
> > Well, I'll try this once more.
> > 
> > I think what's happening is that whatever generates handbook.ascii
> > is broken.  It is indeed generated; it's put on the server; it gets
> > downloaded, and this is the result:
> > 
> >                                FFrreeeeBBSSDD HHaannddbbooookk

I posted an answer to this, but I'd better fill in some more, because
folks are getting confused.

The sample you see above is incorrect, there's really a hidden ^H in
there.  If you view the file with vi, you see it, but not if you view it
with 'less', because "less" knows about groff's attempts at ascii
emphasis, so that man pages can look good.  Here's a cut and paste from my
vi screen, when I view the same line above:

                               F^HFr^Hre^Hee^HeB^HBS^HSD^HD
H^HHa^Han^Hnd^Hdb^Hb
o^Hoo^Hok^Hk

What you see is the letter, then the ^H key telling a printer to backspace
over the character, then the same char again.  ^H (as most know) is the
backspace key on most (non-DEC) terminals.  This is the way that boldface
is faked.  Underline is faked in a very similar way:

_^H1_^H.  _^HI_^Hn_^Ht_^Hr_^Ho_^Hd_^Hu_^Hc_^Ht_^Hi_^Ho_^Hn

is from a page further in the handbook, and says:

1.  Introduction

with underlining.  This looks good on older printers, and pagers like
"less" know this also.  Notice that the emphasis is of the pattern [some
key][backspace key] is the same in both cases.

BTW, the source of the emphasis is the groff program, which generates the
ascii and postscript output.

OK, there's one problem with that.  I think that the ftp server is letting
folks download handbook.ascii as ascii text, which is eating the backspace
keys.  Gotta download this as binary!

Next probable misunderstanding is the sed script I mentioned.  It is
right, but not fully described.  Here it is again:

sed -e "s/.^v^H//g" < handbook.ascii.orig > handbook.ascii

The "^V^H" means control-V followed by control-H.  Most of you probably
know that, but don't know that control-V acts like a control character
prefix, so that the following control-H is not interpreted as an attempt
to immediately do a backspace, but instead to embed the backspace key into
the script.  When you hit the control-V, only the "^" will show up,
letting you know that the keyboard driver is now ready to accept one
control character as raw input, not processed.  Then when you hit
control-H, the H shows up, so you only see "^H", not "^V^H".  That's a way
to get control characters into scripts.  Works nicely in vi also.

The period you see is a wildcarding pattern that means any single
character.  The "g" at the end says not to stop scanning the input line
after finding the first match; instead, continue scanning each line to the
end of the line, no matter how many matches are found, and work on all of
them.

If you want to try this in vi, go ahead, use this:

:1,$s/.^V^H//g

----------------------------+-----------------------------------------------
Chuck Robey                 | Interests include any kind of voice or data 
chuckr@eng.umd.edu          | communications topic, C programming, and Unix.
213 Lakeside Drive Apt T-1  |
Greenbelt, MD 20770         | I run Journey2 and picnic, both FreeBSD
(301) 220-2114              | version 3.0 current -- and great FUN!
----------------------------+-----------------------------------------------






Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.96.970623013356.265U-100000>