From 27d3e7e014d7cf87a9f23c3eb66b9566143d4a72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Wed, 12 Dec 2012 19:09:50 +0100 Subject: [PATCH] Fix file pointers and add usage description. --- ath9k_caldata.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/ath9k_caldata.c b/ath9k_caldata.c index 78a00e6..153003c 100644 --- a/ath9k_caldata.c +++ b/ath9k_caldata.c @@ -6,11 +6,11 @@ #include "ath9k_caldata.h" int main(int argc, char** argv) { - char* in_caldata_name; - char* out_caldata_name; - int cmd_regd; + char* in_caldata_name = NULL; + char* out_caldata_name = NULL; + int cmd_regd = 0; int caldata_regd; - int cmd_caps; + int cmd_caps = 0; int caldata_caps; //Check arguments. @@ -90,10 +90,21 @@ int main(int argc, char** argv) { } } + if(in_caldata_name == NULL) { + arg_err = 1; + } + + if(out_caldata_name != NULL && !cmd_regd && !cmd_caps) { + printf("[ERROR] You must provide something to overwrite.\n"); + printf("\t-r \n"); + printf("\t-c \n"); + arg_err = 1; + } + //Check arguments if (arg_err) { //Invalid arguments - printf("Usage: %s\n", argv[0]); + printf("Usage: %s -i [-o {-r | -c }]\n", argv[0]); return ERROR_ARGS; } else {