From 5a112810cfc0849c170c89f32b9f2192c8b37a96 Mon Sep 17 00:00:00 2001 From: ZoRo Date: Wed, 1 Aug 2018 22:29:59 +0100 Subject: Added argument definitions --- Makefile | 2 +- README.md | 4 ++-- __cpp.h | 10 +++++++++- notifylist.c | 37 ++++++++++++++++++++++++++++++++++++- 4 files changed, 48 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 267dca7..ec533e4 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ PROJECT=notifylist CC=gcc CXX=g++ -CFLAGS= +CFLAGS=-g3 LDFLAGS= SOURCES=$(wildcard *.c) OBJECTS=$(SOURCES:.c=.o) diff --git a/README.md b/README.md index afadc87..a410739 100644 --- a/README.md +++ b/README.md @@ -6,10 +6,10 @@ SUPPORTED COMMANDS -d add/new path to directory -e event to respond --i ini file with list of event --s extra info output or no -v command version -h small help menu +[FUTURE] -s extra info output or no +[FUTURE] -i ini file with list of event [FUTURE] -f filter path by pattern diff --git a/__cpp.h b/__cpp.h index ee23b68..38089df 100644 --- a/__cpp.h +++ b/__cpp.h @@ -13,8 +13,16 @@ extern "C" void emulate_cc_delete(void* p) { if (p != 0) free(p); } + +extern "C" void emulate_cc_delete2(void* p, unsigned long s) { + if (p != 0) + free(p); +} + void* operator new (unsigned long) __attribute__((alias("emulate_cc_new"))); void* operator new[](unsigned long) __attribute__((alias("emulate_cc_new"))); void operator delete (void* p) __attribute__((alias("emulate_cc_delete"))); void operator delete[](void* p) __attribute__((alias("emulate_cc_delete"))); -void* __cxa_pure_virtual = 0; \ No newline at end of file +void operator delete (void* p, unsigned long s) __attribute__((alias("emulate_cc_delete2"))); +void* __cxa_pure_virtual = 0; +void* __gxx_personality_v0 = 0; \ No newline at end of file diff --git a/notifylist.c b/notifylist.c index ef902a2..d19355b 100644 --- a/notifylist.c +++ b/notifylist.c @@ -13,8 +13,43 @@ public: }; -int main() +CmdArg arguments = CmdArg(); +CmdArgFlag *helpArg = new CmdArgFlag(); +CmdArgFlag *versionArg = new CmdArgFlag(); +CmdArgVal *pathArg = new CmdArgVal(); +CmdArgVal *eventArg = new CmdArgVal(); + +void define_all_arguments() { + CmdArgFlagConf *helpArgConf = new CmdArgFlagConf(); + CmdArgDefault *helpArgDefault = new CmdArgDefault((char *)"-h", helpArgConf, (char *)"help", helpArg); + + CmdArgFlagConf *versionArgConf = new CmdArgFlagConf(); + CmdArgDefault *versionArgDefault = new CmdArgDefault((char *)"-v", versionArgConf, (char *)"version", versionArg); + + CmdArgValConf *pathArgConf = new CmdArgValConf(); + CmdArgDefault *pathArgDefault = new CmdArgDefault((char *)"-d", pathArgConf, (char *)"path", pathArg); + + CmdArgValConf *eventArgConf = new CmdArgValConf(); + CmdArgDefault *eventArgDefault = new CmdArgDefault((char *)"-e", eventArgConf, (char *)"event", eventArg); + + + arguments.add(helpArgDefault); + arguments.add(versionArgDefault); + arguments.add(pathArgDefault); + arguments.add(eventArgDefault); +} + +int main(int argc, char **argv) +{ + + define_all_arguments(); + arguments.load(argc, argv); + + if (helpArg->isUsed()) + { + printf("Help\n"); + } return 0; } \ No newline at end of file -- cgit v1.2.3