Permalink
Browse files

Allow to give parameters

Fixes #2
  • Loading branch information...
piranna committed Apr 5, 2016
1 parent e606934 commit c23ce46be2ada9e1899b9129a4a162507c43ff55
Showing with 6 additions and 5 deletions.
  1. +6 −5 init.c
View
11 init.c
@@ -28,19 +28,20 @@ static bool sigreap(void);
static void terminate(tTermination termination);
static char* initcmd[] = { "/sbin/init", NULL };
const char* initcmd = "/sbin/init";
// By default, when there are no more processes running, shutdown the machine
static tTermination termination = &poweroff;
char** getCommand(int argc, char* argv[])
{
// No arguments, use default command
if(argc == 1) return initcmd;
// Use init given by arguments
return &argv[1];
if(argc > 1 && argv[1][0] == '/') return &argv[1];
// No arguments or not given a command, use default one
argv[0] = initcmd;
return argv;
}
static int poweroff(void)

0 comments on commit c23ce46

Please sign in to comment.