diff options
Diffstat (limited to 'src/command.c')
-rw-r--r-- | src/command.c | 40 |
1 files changed, 30 insertions, 10 deletions
diff --git a/src/command.c b/src/command.c index b82498d..5f47126 100644 --- a/src/command.c +++ b/src/command.c @@ -28,14 +28,18 @@ static void ReleaseCommands(CommandNode **commands); static void AddCommand(CommandNode **commands, const char *command); /** Initialize the command lists. */ -void InitializeCommands() { +void +InitializeCommands() +{ startupCommands = NULL; shutdownCommands = NULL; restartCommands = NULL; } /** Process startup/restart commands. */ -void StartupCommands() { +void +StartupCommands() +{ if(isRestarting) { RunCommands(restartCommands); @@ -46,7 +50,9 @@ void StartupCommands() { } /** Process shutdown commands. */ -void ShutdownCommands() { +void +ShutdownCommands() +{ if(!shouldRestart) { RunCommands(shutdownCommands); @@ -55,14 +61,18 @@ void ShutdownCommands() { } /** Destroy the command lists. */ -void DestroyCommands() { +void +DestroyCommands() +{ ReleaseCommands(&startupCommands); ReleaseCommands(&shutdownCommands); ReleaseCommands(&restartCommands); } /** Run the commands in a command list. */ -void RunCommands(CommandNode *commands) { +void +RunCommands(CommandNode *commands) +{ CommandNode *cp; @@ -73,7 +83,9 @@ void RunCommands(CommandNode *commands) { } /** Release a command list. */ -void ReleaseCommands(CommandNode **commands) { +void +ReleaseCommands(CommandNode **commands) +{ CommandNode *cp; @@ -89,7 +101,9 @@ void ReleaseCommands(CommandNode **commands) { } /** Add a command to a command list. */ -void AddCommand(CommandNode **commands, const char *command) { +void +AddCommand(CommandNode **commands, const char *command) +{ CommandNode *cp; @@ -108,17 +122,23 @@ void AddCommand(CommandNode **commands, const char *command) { } /** Add a startup command. */ -void AddStartupCommand(const char *command) { +void +AddStartupCommand(const char *command) +{ AddCommand(&startupCommands, command); } /** Add a shutdown command. */ -void AddShutdownCommand(const char *command) { +void +AddShutdownCommand(const char *command) +{ AddCommand(&shutdownCommands, command); } /** Add a restart command. */ -void AddRestartCommand(const char *command) { +void +AddRestartCommand(const char *command) +{ AddCommand(&restartCommands, command); } |