summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrafa_99 <raroma09@gmail.com>2021-09-02 20:59:19 +0100
committerrafa_99 <raroma09@gmail.com>2021-09-02 20:59:19 +0100
commit10e79ffa42b622228d87b00dcf5addbb26d66ecd (patch)
treefed74f05792b7259de67f782a73e4c1a3859f6a6
parent265c603dff39615e379655ea230772853406bb5e (diff)
Started Working On Main Function
-rw-r--r--queryt.c57
1 files changed, 54 insertions, 3 deletions
diff --git a/queryt.c b/queryt.c
index 6f6db4e..546cf64 100644
--- a/queryt.c
+++ b/queryt.c
@@ -1,10 +1,61 @@
#include <stdio.h>
#include <stdlib.h>
-#include "video.h"
-#include "utils.h"
+#include <string.h>
+#include <getopt.h>
+#include "include/utils.h"
+#include "include/video.h"
+
+void errorMessage(int errorCode, char* message);
+void processOptions(int *options);
int main(int argc, char **argv)
{
- //ToDo
+ int o = 0, opts[] = { 0, 0, 0, 0, 0 };
+
+ static struct option long_options[] = {
+ {"format", required_argument, 0, 'f'},
+ {"help", no_argument, 0, 'h'},
+ {"max", required_argument, 0, 'm'},
+ {"search", required_argument, 0, 's'},
+ {"version", no_argument, 0, 'v'},
+ {0, 0, 0, 0}
+ };
+
+ while ((o = getopt_long(argc, argv, "f:hm:s:v", long_options, NULL)) != -1)
+ {
+ switch(o)
+ {
+ case 'f':
+ opts[0]++;
+ break;
+ case 'h':
+ opts[1]++;
+ break;
+ case 'm':
+ opts[2]++;
+ break;
+ case 's':
+ opts[3]++;
+ break;
+ case 'v':
+ opts[4]++;
+ break;
+ default:
+ errorMessage(1, "");
+ }
+ }
+
+ processOptions(opts);
return 0;
}
+
+void errorMessage(int errorCode, char* message)
+{
+ printf("%s", message);
+ exit(errorCode);
+}
+
+void processOptions(int *options)
+{
+ //ToDo
+}