From 5f8140a81b5cadea014b305a54c070e1d9ca4e9e Mon Sep 17 00:00:00 2001 From: alex Date: Fri, 11 Sep 2020 08:02:02 +0100 Subject: [PATCH 1/1] initial project creation --- Dockerfile | 9 +++++++++ README.md | 3 +++ include/main.h | 11 +++++++++++ src/main.c | 40 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 63 insertions(+) create mode 100644 Dockerfile create mode 100644 README.md create mode 100644 include/main.h create mode 100644 src/main.c diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..8829d17 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,9 @@ +FROM debian:latest + +RUN apt-get update +RUN apt-get install -y autoconf automake gcc make + +WORKDIR /bugs + +COPY include include/ +COPY src src/ \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..6602990 --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# Bug Tracker + +Git-integrated bug tracker. \ No newline at end of file diff --git a/include/main.h b/include/main.h new file mode 100644 index 0000000..faa8bd0 --- /dev/null +++ b/include/main.h @@ -0,0 +1,11 @@ +#ifndef __MAIN_H_ + +#include +#include +#include + +extern int verbose_flag; + +int main(int,char**); + +#endif \ No newline at end of file diff --git a/src/main.c b/src/main.c new file mode 100644 index 0000000..f482170 --- /dev/null +++ b/src/main.c @@ -0,0 +1,40 @@ +#include + +int verbose_flag; + +static struct option long_options[] = { + {"verbose", no_argument, &verbose_flag, 1}, + {"quiet", no_argument, &verbose_flag, 0}, + {0,0,0,0} +}; + +int main(int argc, char **argv) { + int c; + + while(1) { + int option_index = 0; + + if((c = getopt_long(argc,argv,"vq",long_options,&option_index))==-1) { break; } + + switch(c) { + case 0: + if(long_options[option_index].flag!=0) { break; } + + printf("option %s",long_options[option_index].name); + if(optarg) { + printf(" with arg %s",optarg); + } + printf("\n"); + + break; + case '?': + break; + default: + return EXIT_FAILURE; + } + } + + printf("verbose flag set\n"); + + return EXIT_SUCCESS; +} \ No newline at end of file -- 2.30.2