Fix misprint in error message.

Populate rdeps function should complain about reverse deps not about
normal ones.
Fix analyse_elf() leaking file descriptors

This would cause pkg-check -Ba to hold a file open
for every non-elf file in the system due to not
calling elf_end()
Substitute ${ABI} in all repos.

For multi-repo world it is required to substitute ${ABI} variable
for all repos urls. This patch adds this functionality.

Reported by:	DragonSA
Issue number:	#492
Simplify logic.

Simplify recursive_autoremove by reusing remove_from_rdeps function.
Print unresolved dependencies during install.

While performing install or upgrade job it is generally a good idea
to inform user about dependencies of a package that cannot be resolved
(e.g. they are missing in a repository). However, we should also
think about possibility of package installation even with missed deps.
From my sense, -f flag is not permissive enough to use it for this
purpose.
pkg -N returns 0 on success >0 on not ready

This should not be copied to release-1.0 unless
-N support is also copied.
Allocate proper space for array.

Do not allocate MAXPATHLEN * len for an array of char * pointers.
Repo names vs. identifiers

Multiple repositories are listed by an identifying tag in pkg.conf(5)
However to prevent either deliberate or accidental collision with
reserved terms like 'main', 'temp', 'local' we generate a name for the
repo by prepending 'repo-' to that identifier.  So the filename the
repo DB is stored in for the repo identified as 'foo' is
/var/db/pkg/repo-foo.sqlite and the database is attached as 'repo-foo'
within sqlite.

Add accessor function:

pkg_repo_ident()

and search functions:

pkg_repo_find_name()
pkg_repo_find_ident()

and remove

pkg_repo_find()

Always use accessor functions when dealing with repo names or idents,
rather than dereferencing a struct pkg_repo directly.

Fixes #496

Various other small fixes noticed in passing.