diff options
author | TheJackiMonster <thejackimonster@gmail.com> | 2021-09-19 16:59:05 +0200 |
---|---|---|
committer | TheJackiMonster <thejackimonster@gmail.com> | 2022-03-01 17:09:53 +0100 |
commit | fff4901b230b314e34e738f26809ba7d675f45a5 (patch) | |
tree | d858b0fe19ec4c511d7be561c6037eb29d11b87b | |
parent | 8bd17292e898cfbd4dc2a75da3866887f35ff9e4 (diff) | |
download | messenger-cli-fff4901b230b314e34e738f26809ba7d675f45a5.tar.gz messenger-cli-fff4901b230b314e34e738f26809ba7d675f45a5.zip |
Added initial code required for a GNUnet application
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | src/messenger_cli.c | 43 |
2 files changed, 41 insertions, 4 deletions
@@ -6,7 +6,7 @@ BINARY = messenger-cli | |||
6 | SOURCES = messenger_cli.c | 6 | SOURCES = messenger_cli.c |
7 | HEADERS = | 7 | HEADERS = |
8 | 8 | ||
9 | LIBRARIES = gnunetchat | 9 | LIBRARIES = gnunetchat gnunetutil |
10 | 10 | ||
11 | CC ?= gcc | 11 | CC ?= gcc |
12 | LD ?= gcc | 12 | LD ?= gcc |
diff --git a/src/messenger_cli.c b/src/messenger_cli.c index cee3020..253a1ae 100644 --- a/src/messenger_cli.c +++ b/src/messenger_cli.c | |||
@@ -22,9 +22,46 @@ | |||
22 | * @file messenger_cli.c | 22 | * @file messenger_cli.c |
23 | */ | 23 | */ |
24 | 24 | ||
25 | #include <gnunet/platform.h> | ||
25 | #include <gnunet/gnunet_chat_lib.h> | 26 | #include <gnunet/gnunet_chat_lib.h> |
27 | #include <gnunet/gnunet_util_lib.h> | ||
26 | 28 | ||
27 | int main(int argc, const char** argv) { | 29 | static void |
28 | GNUNET_CHAT_test("Hello world"); | 30 | run (void *cls, char* const* args, |
29 | return 0; | 31 | const char *cfgfile, |
32 | const struct GNUNET_CONFIGURATION_Handle *cfg) | ||
33 | { | ||
34 | struct GNUNET_CHAT_Handle *handle = GNUNET_CHAT_start( | ||
35 | cfg, | ||
36 | "appdir", | ||
37 | "username", | ||
38 | NULL, NULL, | ||
39 | NULL, NULL | ||
40 | ); | ||
41 | |||
42 | // | ||
43 | |||
44 | GNUNET_CHAT_stop(handle); | ||
45 | } | ||
46 | |||
47 | int | ||
48 | main (int argc, char* const* argv) | ||
49 | { | ||
50 | struct GNUNET_GETOPT_CommandLineOption options[] = { | ||
51 | GNUNET_GETOPT_OPTION_END | ||
52 | }; | ||
53 | |||
54 | int result = GNUNET_PROGRAM_run( | ||
55 | argc, argv, | ||
56 | "messenger_cli", | ||
57 | gettext_noop("A CLI for the Messenger service of GNUnet."), | ||
58 | options, | ||
59 | &run, | ||
60 | NULL | ||
61 | ); | ||
62 | |||
63 | if (result != GNUNET_OK) | ||
64 | return EXIT_FAILURE; | ||
65 | else | ||
66 | return EXIT_SUCCESS; | ||
30 | } | 67 | } |