1
0
mirror of git://git.suckless.org/sbase synced 2024-12-25 08:22:44 +00:00

Factor out code printing information for the current process

This commit is contained in:
sin 2013-12-01 09:58:02 +00:00
parent f1f0fba630
commit 137ebef3ac

21
id.c
View File

@ -8,6 +8,8 @@
#include <limits.h>
#include "util.h"
static void curproc(void);
static void
usage(void)
{
@ -16,6 +18,19 @@ usage(void)
int
main(int argc, char *argv[])
{
ARGBEGIN {
default:
usage();
} ARGEND;
curproc();
return EXIT_SUCCESS;
}
static void
curproc(void)
{
struct passwd *pw;
struct group *gr;
@ -24,11 +39,6 @@ main(int argc, char *argv[])
int ngroups;
int i;
ARGBEGIN {
default:
usage();
} ARGEND;
/* Print uid/euid info */
uid = getuid();
printf("uid=%u", uid);
@ -67,5 +77,4 @@ main(int argc, char *argv[])
printf("(%s)", gr->gr_name);
}
putchar('\n');
return EXIT_SUCCESS;
}