return EXIT_SUCCESS;
}
+static int _sleep(int argc, char* argv[]) {
+ if (argc < 1) {
+ fprintf(stderr, "No timeout given\n");
+ return EXIT_FAILURE;
+ }
+
+ // Fetch timeout
+ unsigned int timeout = strtoul(argv[0], NULL, 10);
+
+ printf("Sleeping for %u second(s)\n", timeout);
+
+ // Sleep for given timeout
+ sleep(timeout);
+
+ return EXIT_SUCCESS;
+}
+
int main(int argc, char* argv[]) {
if (argc < 2) {
fprintf(stderr, "No command given\n");
else if (strcmp(command, "send-signal") == 0)
callback = send_signal;
+ // Sleep
+ else if (strcmp(command, "sleep") == 0)
+ callback = _sleep;
+
// Exit if no callback has been set
if (!callback) {
fprintf(stderr, "Unknown command: %s\n", command);