ps: conditionally enable -T on non-DESKTOP build too
[oweals/busybox.git] / miscutils / runlevel.c
index 91d49fa5504e1111666602a32fe677a60fdab092..6e10d9cbb130c2485e04843818ca7108b0a49cce 100644 (file)
@@ -9,16 +9,14 @@
  *
  * Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
  *
- * initially busyboxified by Bernhard Fischer
+ * initially busyboxified by Bernhard Reutner-Fischer
  */
 
-#include "busybox.h"
-#include <stdio.h>
 #include <utmp.h>
-#include <time.h>
-#include <stdlib.h>
+#include "libbb.h"
 
-int runlevel_main(int argc, char *argv[])
+int runlevel_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
+int runlevel_main(int argc, char **argv)
 {
        struct utmp *ut;
        char prev;
@@ -31,12 +29,15 @@ int runlevel_main(int argc, char *argv[])
                        prev = ut->ut_pid / 256;
                        if (prev == 0) prev = 'N';
                        printf("%c %c\n", prev, ut->ut_pid % 256);
-                       endutent();
+                       if (ENABLE_FEATURE_CLEAN_UP)
+                               endutent();
                        return 0;
                }
        }
 
        puts("unknown");
-       endutent();
+
+       if (ENABLE_FEATURE_CLEAN_UP)
+               endutent();
        return 1;
 }