Match full word when commenting out in wordlist

Words that are subsets of each other, e.g. round vs. ground, did
trigger genhost to add a # in the middle of ground, i.e.
"g#round". Instead match the whole word when running sed, and
simplify the sed line by first matching, then inserting the #.

Signed-off-by: Jonas Eriksson <zqad@acc.umu.se>
Fix empty hostname bug

The read statement will evaulate the lines[n++] expression for
each line in the input wordlist that does not start with #. It
will however also evaluate the expression when it reads an EOF
from the stream. This means that n will equal the number of
entries in lines plus one, which in turn means that when rand
returns n-1 in r, the resulting line will be empty.

Signed-off-by: Jonas Eriksson <zqad@acc.umu.se>
Avoid the same hostname in one session

By adding a # in front of used words, genhost will not display
the same word in two subsequent runs. It is however possible to
display the same word within one run. When generating a large
number of hosts, it might be hard to notice the duplication.
This commit solves this issue by filtering the wordlist in each
iteration. The code for this is not very beautiful, since bash
arrays are essentially associative arrays.

Signed-off-by: Jonas Eriksson <zqad@acc.umu.se>
Alter techniques for the contributed bug fixes

This makes a few changes to the techiques used for the bug fixes
contributed by zqad:

1. Instead of blindly assuming the last element of the arry is null, we
   actually test for that and update the n variable accordingly.

2. The sed command was reverted to the older style, but kept the
   explicit beginning of and end of regex anchors. I was having trouble
   on OS X with the newer-style syntax.

3. The loop to remove the used word from the array was simplified.
Error out when no more available host names
Switch from echo to printf for portability