aboutsummaryrefslogtreecommitdiff
path: root/toys/other/oneit.c
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2012-10-08 00:02:30 -0500
committerRob Landley <rob@landley.net>2012-10-08 00:02:30 -0500
commitc0e56edaf256adb6c60c5a052525a1ffbb927901 (patch)
treed6bcc5c181ca46910a12d4dece4b26d6c71be3e1 /toys/other/oneit.c
parentdc7a77d1940858495f76998f4d13cac9f73e0226 (diff)
downloadtoybox-c0e56edaf256adb6c60c5a052525a1ffbb927901.tar.gz
New build infrastructure to generate FLAG_ macros and TT alias, #define FOR_commandname before #including toys.h to trigger it. Rename DEFINE_GLOBALS() to just GLOBALS() (because I could never remember if it was DECLARE_GLOBALS). Convert existing commands to use new infrastructure, and replace optflag constants with FLAG_ macros where appropriate.
Diffstat (limited to 'toys/other/oneit.c')
-rw-r--r--toys/other/oneit.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/toys/other/oneit.c b/toys/other/oneit.c
index ff7aa914..8bb482da 100644
--- a/toys/other/oneit.c
+++ b/toys/other/oneit.c
@@ -24,15 +24,14 @@ config ONEIT
which point it reboots (or with -p, powers off) the system.
*/
+#define FOR_oneit
#include "toys.h"
#include <sys/reboot.h>
-DEFINE_GLOBALS(
+GLOBALS(
char *console;
)
-#define TT this.oneit
-
// The minimum amount of work necessary to get ctrl-c and such to work is:
//
// - Fork a child (PID 1 is special: can't exit, has various signals blocked).
@@ -59,7 +58,8 @@ void oneit_main(void)
// PID 1 can't call reboot() because it kills the task that calls it,
// which causes the kernel to panic before the actual reboot happens.
- if (!vfork()) reboot((toys.optflags&1) ? RB_POWER_OFF : RB_AUTOBOOT);
+ if (!vfork())
+ reboot((toys.optflags & FLAG_p) ? RB_POWER_OFF : RB_AUTOBOOT);
sleep(5);
_exit(1);
}