[hackers] [sbase] Factor out code printing information for the current process || sin

From: <git_AT_suckless.org>
Date: Sun, 01 Dec 2013 11:43:53 +0100

commit 137ebef3aca354e79d259553c3a0756cda0af9cc
Author: sin <sin_AT_2f30.org>
Date: Sun Dec 1 09:58:02 2013 +0000

    Factor out code printing information for the current process

diff --git a/id.c b/id.c
index 09253cc..00068a3 100644
--- a/id.c
+++ b/id.c
_AT_@ -8,6 +8,8 @@
 #include <limits.h>
 #include "util.h"
 
+static void curproc(void);
+
 static void
 usage(void)
 {
_AT_@ -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;
_AT_@ -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);
_AT_@ -67,5 +77,4 @@ main(int argc, char *argv[])
                 printf("(%s)", gr->gr_name);
         }
         putchar('
');
- return EXIT_SUCCESS;
 }
Received on Sun Dec 01 2013 - 11:43:53 CET

This archive was generated by hypermail 2.3.0 : Sun Dec 01 2013 - 11:48:11 CET