sbase

suckless unix tools
git clone git://git.2f30.org/sbase.git
Log | Files | Refs | README | LICENSE

commit 137ebef3aca354e79d259553c3a0756cda0af9cc
parent f1f0fba630155704558c6aecff7ca100b5970be5
Author: sin <sin@2f30.org>
Date:   Sun Dec  1 09:58:02 +0000

Factor out code printing information for the current process

Diffstat:
id.c | 21+++++++++++++++------
1 file changed, 15 insertions(+), 6 deletions(-)
diff --git a/id.c b/id.c @@ -8,6 +8,8 @@ #include <limits.h> #include "util.h" +static void curproc(void); + static void usage(void) { @@ -17,6 +19,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; uid_t uid, euid; @@ -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; }