Skip to content

Commit

Permalink
Allow to give parameters
Browse files Browse the repository at this point in the history
Fixes #2
  • Loading branch information
piranna committed Apr 5, 2016
1 parent e606934 commit c23ce46
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions init.c
Expand Up @@ -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)
Expand Down

0 comments on commit c23ce46

Please sign in to comment.