#include <iostream>
#include <my++/auth.h>

using namespace std;

int main (int argc, char **argv) {
	if (argc < 2) {
		cout << "Usage: groupinfo [ group_name ]" << endl;
		return 1;
	}

	my::auth::groupinfo gi (argv[1]);

	if (!gi.valid()) {
		cout << "Group does not exist." << endl;
		return 2;
	}

	cout << "Group name: " << gi.name() << endl;
	cout << "Group GID : " << gi.gid() << endl;
	cout << "Members   : " << gi.members() << endl;
	for (my::auth::groupinfo::iterator i = gi.begin(); i != gi.end(); ++i) {
		cout << "\t+ " << *i << endl;
	}

	return 0;
}
