mirror of
https://git.FreeBSD.org/ports.git
synced 2024-12-28 05:29:48 +00:00
8661561f12
It is composed in 2 parts: the application launcher itself and a good looking easy to use editor. PR: ports/59940 Submitted by: Volker Stolz <stolz@i2.informatik.rwth-aachen.de>
26 lines
465 B
C
26 lines
465 B
C
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <unistd.h>
|
|
|
|
int group_member(gid_t gid) {
|
|
gid_t *grouplist = NULL;
|
|
int res,i;
|
|
|
|
res = getgroups(0,NULL);
|
|
if (res >= 0) {
|
|
grouplist = calloc(sizeof(gid_t),res);
|
|
res = getgroups(res,grouplist);
|
|
if (res >=0) {
|
|
for(i=0;i<res;i++) {
|
|
if (grouplist[i] == gid) break;
|
|
}
|
|
}
|
|
}
|
|
if (res == -1) {
|
|
perror("Can't get number of groups!");
|
|
return -1;
|
|
} else {
|
|
return (i<res);
|
|
}
|
|
}
|