Complete rewrite of pkg_chk and pkg_rolling-replace in C++
