i=0; while(grpptr->gr_mem[i]){ if(strcmp(grpptr->gr_mem[i],username)==0) { printf("found one group! that is :%s\n",grpptr->gr_name); count++; break; } i++; }
grpptr=getgrent();
}
endgrent(); printf("Scan finished! this user is in %d groups totally.\n",count); return 0;