GSoC/GCI Archive
Google Code-in 2012 The NetBSD Project

Fix bug bin/41049: usermod -g =uid testuser does not create group as indicated by man page

completed by: Philip Hayes

mentors: blymn, Julian Coleman, Julian Fagir

The description of "usermod -g" in the manpage does not accord to its real behaviour. Actually, this has not been implemented, so you have the rather difficult task to write the implementation for this.
You can use code from the other tools which deal with user and group modification, maybe you will find a place where nearly the same work has already been done.