"Kim Emax" <newsgroup@remove-emax.dk> writes:
> soren wrote:
>
> > fra id's man-side:
> >
> > id [OPTION]... [USERNAME]
> >
> > dvs. brug 'id' med brugernavne
.
>
> Doh! Det virkede så oplagt at id skulle bruge et id
Heps,
-- nid.c --
#include <pwd.h>
#include <sys/types.h>
int main(int argc, char *argv[]) {
struct passwd *pw;
if (argc < 2) {
printf("%s <uid>\n", argv[0]);
return 1;
}
pw = getpwuid(atoi(argv[1]));
if (!pw) {
printf("%s: %s not found\n", argv[0], argv[1]);
return 2;
}
printf("uid=%d(%s) gid=%d\n", pw->pw_uid, pw->pw_name, pw->pw_gid);
}
--
gcc -o nid nid.c
id soren
uid=1000(soren) gid=100(users)
../nid 1000
uid=1000(soren) gid=100
Mvh,
--
school.soren.davidsenATturtleDOTmathDOTklteDOThu//math-institute/uni-debrecen
other..sorenATtaneshaDOTnet//oesterbro/denmark/
www.tanesha.net