Hello
I'm writing a program for managing accounts and groups in a linux system.
My problem is how to update the members of a group in the /etc/group file,if i have to add/remove those members.
total 3 variables for adding some new members to the group :
char **oldmembers=grp->gr_mem; //members before
char **newmembers; //new members to be added
char **totalmembers; //total members (new_old)
while *(oldmembers)
{
*totalmebers=*oldmembers;
totalmebers++
oldmembers++
}
I cant figure out how to continue using the totalmembers pointer from the point it stopped inside the while loop,to add the newmembers now
e.g
while *(newmembers)
{
*totalmebers=*newmembers;
totalmebers++
newmembers++
}
so i the end i could have the total memebrs in order to use the setgrnam(struct group *grp) to parse the updated group struct
any help would be appreciated (and any different approach too)
Thanks