added -u flag to id for easypack

This commit is contained in:
Ben Gras 2005-12-12 13:55:58 +00:00
parent d3ee328792
commit 0a4047a8fe

View file

@ -14,9 +14,7 @@
#include <stdio.h>
#include <limits.h>
_PROTOTYPE(int main, (void));
int main()
int main(int argc, char *argv[])
{
struct passwd *pwd;
struct group *grp;
@ -38,6 +36,7 @@ int main()
#endif
int g;
int isug;
int c, uopt = 0;
#if __minix_vmd
get6id(&ruid, &euid, &suid, &rgid, &egid, &sgid);
@ -53,6 +52,22 @@ int main()
ngroups = getgroups(NGROUPS_MAX, groups);
#endif
while((c = getopt(argc, argv, "u")) != EOF) {
switch(c) {
case 'u':
uopt = 1;
break;
default:
fprintf(stderr, "%s: unrecognized option\n", argv[0]);
return(1);
}
}
if(uopt) {
printf("%d\n", euid);
return 0;
}
if ((pwd = getpwuid(ruid)) == NULL)
printf("uid=%d", ruid);
else