rs: Convert to C++ to convert elem to a std::vector<char *>.
This also updates various indices and counters from int to size_t to
pacify resulting -Wsign-compare warnings.
Reviewed by: brooks
Differential Revision: https://reviews.freebsd.org/D36833