summaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/main.c b/src/main.c
index 3a9245d..9d6415a 100644
--- a/src/main.c
+++ b/src/main.c
@@ -22,14 +22,25 @@
#include "runconfig.h"
void usage() {
- fputs("Usage:\n react-tcp-down <host_ip> <port> <command>\n\n", stderr);
+ fputs(
+ "Usage:\n"
+ " react-tcp-down --ip <host_ip> --port <port> --cmd <command>\n\n"
+ "Arguments:\n"
+ " -i,--ip IP Address to check for port availability\n"
+ " -p,--port Port to check\n"
+ " -c,--cmd Command to run if port is down\n"
+ " -h,--help Print this help text\n"
+ , stderr);
}
int parse_args(struct runconfig* cfg, int argc, char* argv[]) {
int i = 0;
int status = 0;
while(i < argc) {
- if(strcmp(argv[i], "--ip") == 0 || strcmp(argv[i], "-i") == 0) {
+ if(strcmp(argv[i], "--help") == 0 || strcmp(argv[i], "-h") == 0) {
+ usage();
+ return 1;
+ } else if(strcmp(argv[i], "--ip") == 0 || strcmp(argv[i], "-i") == 0) {
i++;
strcpy(cfg->ip, argv[i]);

Generated by cgit