make pkg query returns EX_UNAVAILABLE when no package could be found.

pkg query exists 0 regardless if any package could be found. This patch
ensure to return a non-zero status (EX_UNAVAILABLE) when no package
could be found.
Merge branch 'master' of https://github.com/pkgng/pkgng
Clean up some error messages.

pkg_config_string() and pkg_config_bool() both emitted error
messages about pkg_config_int64. Fix this so they refer to
the correct functions.
Merge remote-tracking branch 'upstream/master'
check for the pattern length after parsing the full argument in pkg info.

Checking the pattern length before parsing it resulted in passing an
empty string to the pkgdb_query() function in some corner cases,
triggering an assert.
Removed an noop codepath.

the `pkgversion' is already initialized to NULL when declared, the
useless else branch was confusing.
Improve consistancy of the "Pattern must not be empty" message.

The same message was used in both search and info but with different
punctuation. While the search message version was more enthusiastic it
seems very unfair for good ol' info.
Merge pull request #458 from kAworu/master

Various fixes and improvements
Add pkg_try_installed()

Like pkg_is_installed(), but "returns" the package if any is found.

The need comes from pkg_is_installed() not able to "return" in any way
the package found. pkg_try_installed() extends pkg_is_installed()
making possible to test and query to package in one function call.
pkg_is_installed() is a now simple wrapper around pkg_try_installed().
Fix panic triggered when pkg add'ing a package already installed.

The `pkg_inst' pointer in pkg_add() was initialized to NULL on
declaration and never changed, triggering an assert in pkg_get2().
Merge pull request #461 from dannomac/clean-error

Clean up some error messages.
Merge pull request #460 from dannomac/master

Add fetch timeout, same as on release-1.0 branch.
Add pkg_try_installed()

Like pkg_is_installed(), but "returns" the package if any is found.

The need comes from pkg_is_installed() not able to "return" in any way
the package found. pkg_try_installed() extends pkg_is_installed()
making possible to test and query to package in one function call.
pkg_is_installed() is a now simple wrapper around pkg_try_installed().
Fix panic triggered when pkg add'ing a package already installed.

The `pkg_inst' pointer in pkg_add() was initialized to NULL on
declaration and never changed, triggering an assert in pkg_get2().
Merge branch 'master' of github.com:kAworu/pkgng
Fix attempt to parse trailing junk on a line as a valid option, by
checking for characters we know will be in any valid options string.

Fix attempt to free() a pointer not allocated by malloc()

This runs OK now, but generates a lot of 'duplicate option' messages,
which are pretty pointless as the way the metadata is generated and
parsed means that every option is going to be duplicated.
Merge pull request #462 from kAworu/master

Fix a panic when pkg add'ing a package already installed.