i'm thinking that a valid group ID name must start with an alphabetical character or an underscore..if this is true you can simply check the first character....
(impromptu code..not tested)
Code:
struct ID
{
int nID;
char lpszID[10];
}id;
char token[400] = NULL;
token = strtok(gidlist, ",");
while(token)
{
if( isdigit(*token) )
{
id.nID = atoi(token);
id.lpszID = NULL;
}else{
//fake function below
id.nID = 0; // nID = lookUpLinuxGroupIdNumber(token)
strcpy(&id.lpszID, token);
}
printf("Group Name: %s; Group ID: %d\n", id.lpszID, id.nID);
token = strtok(NULL, ",");
}
there is probably some error checking needed to be done here...but it depends on what you're going to use this data for and the exact specs of group ID's and numbers.
by the way...use code tags when posting code