diff options
author | Carlo von lynX <lynX@time.to.get.psyced.org> | 2016-05-03 20:39:58 +0000 |
---|---|---|
committer | Carlo von lynX <lynX@time.to.get.psyced.org> | 2016-05-03 20:39:58 +0000 |
commit | 1628c242527c3c370d6debf533fd5941db5c22fe (patch) | |
tree | 66fde0773d193332e4ead7a04a4f294668422476 /src | |
parent | 4b7fe4b4a5a456cfb6d85021326cb2c1b2665a08 (diff) | |
download | gnunet-1628c242527c3c370d6debf533fd5941db5c22fe.tar.gz gnunet-1628c242527c3c370d6debf533fd5941db5c22fe.zip |
parsing parameters for gnunet-social.c a bit
Diffstat (limited to 'src')
-rw-r--r-- | src/social/gnunet-social.c | 113 |
1 files changed, 94 insertions, 19 deletions
diff --git a/src/social/gnunet-social.c b/src/social/gnunet-social.c index e9a5a13b7..51896af12 100644 --- a/src/social/gnunet-social.c +++ b/src/social/gnunet-social.c | |||
@@ -30,6 +30,9 @@ | |||
30 | #include "gnunet_util_lib.h" | 30 | #include "gnunet_util_lib.h" |
31 | #include "gnunet_social_service.h" | 31 | #include "gnunet_social_service.h" |
32 | 32 | ||
33 | /** shell return code */ | ||
34 | static int ret = 0; | ||
35 | |||
33 | /* operations corresponding to API calls */ | 36 | /* operations corresponding to API calls */ |
34 | 37 | ||
35 | /** --host-enter */ | 38 | /** --host-enter */ |
@@ -56,6 +59,8 @@ static char *op_history_replay; | |||
56 | /** --history-replay-latest */ | 59 | /** --history-replay-latest */ |
57 | static char *op_history_replay_latest; | 60 | static char *op_history_replay_latest; |
58 | 61 | ||
62 | // FIXME: look-at and look-for | ||
63 | |||
59 | /* options */ | 64 | /* options */ |
60 | 65 | ||
61 | /** --place */ | 66 | /** --place */ |
@@ -68,7 +73,7 @@ static int flag_listen; | |||
68 | static char *method; | 73 | static char *method; |
69 | 74 | ||
70 | /** --data */ | 75 | /** --data */ |
71 | static char *data; | 76 | static char *data; // should come from stdin instead, FIXME |
72 | 77 | ||
73 | /** --prefix */ | 78 | /** --prefix */ |
74 | static char *prefix; | 79 | static char *prefix; |
@@ -95,6 +100,56 @@ static void | |||
95 | run (void *cls, char *const *args, const char *cfgfile, | 100 | run (void *cls, char *const *args, const char *cfgfile, |
96 | const struct GNUNET_CONFIGURATION_Handle *cfg) | 101 | const struct GNUNET_CONFIGURATION_Handle *cfg) |
97 | { | 102 | { |
103 | if (op_host_enter) { | ||
104 | FPRINTF (stderr, | ||
105 | _("FIXME -C\n")); | ||
106 | if (flag_listen) { | ||
107 | FPRINTF (stderr, | ||
108 | _("Yes, yes!\n")); | ||
109 | } | ||
110 | return; | ||
111 | } | ||
112 | if (NULL == place) { | ||
113 | FPRINTF (stderr, | ||
114 | _("You did not provide me with a place to talk to.\n")); | ||
115 | ret = 1; | ||
116 | return; | ||
117 | } | ||
118 | if (op_guest_enter) { | ||
119 | FPRINTF (stderr, | ||
120 | _("FIXME -E\n")); | ||
121 | if (flag_listen) { | ||
122 | FPRINTF (stderr, | ||
123 | _("Yes, yes!\n")); | ||
124 | } | ||
125 | return; | ||
126 | } | ||
127 | if (flag_listen) { | ||
128 | FPRINTF (stderr, | ||
129 | _("The --listen flag is not defined for this operation.\n")); | ||
130 | ret = 1; | ||
131 | return; | ||
132 | } | ||
133 | if (op_host_leave) { | ||
134 | FPRINTF (stderr, | ||
135 | _("FIXME HARDER -D\n")); | ||
136 | return; | ||
137 | } | ||
138 | if (op_guest_leave) { | ||
139 | FPRINTF (stderr, | ||
140 | _("FIXME HARDER -L\n")); | ||
141 | return; | ||
142 | } | ||
143 | if (op_host_announce) { | ||
144 | FPRINTF (stderr, | ||
145 | _("FIXME -P\n")); | ||
146 | return; | ||
147 | } | ||
148 | if (op_guest_talk) { | ||
149 | FPRINTF (stderr, | ||
150 | _("FIXME -T\n")); | ||
151 | return; | ||
152 | } | ||
98 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "TODO\n"); | 153 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "TODO\n"); |
99 | } | 154 | } |
100 | 155 | ||
@@ -116,8 +171,8 @@ main (int argc, char *const *argv) | |||
116 | GNUNET_YES, &GNUNET_GETOPT_set_string, &place}, | 171 | GNUNET_YES, &GNUNET_GETOPT_set_string, &place}, |
117 | 172 | ||
118 | {'l', "listen", NULL, | 173 | {'l', "listen", NULL, |
119 | gettext_noop ("listen for incoming messages"), | 174 | gettext_noop ("listen for incoming messages"), |
120 | GNUNET_NO, &GNUNET_GETOPT_set_one, &flag_listen}, | 175 | GNUNET_NO, &GNUNET_GETOPT_set_one, &flag_listen}, |
121 | 176 | ||
122 | {'m', "method", "METHOD_NAME", | 177 | {'m', "method", "METHOD_NAME", |
123 | gettext_noop ("method name to transmit"), | 178 | gettext_noop ("method name to transmit"), |
@@ -132,28 +187,48 @@ main (int argc, char *const *argv) | |||
132 | GNUNET_YES, &GNUNET_GETOPT_set_string, &prefix}, | 187 | GNUNET_YES, &GNUNET_GETOPT_set_string, &prefix}, |
133 | 188 | ||
134 | {'s', "start", NULL, | 189 | {'s', "start", NULL, |
135 | gettext_noop ("start message ID for history replay"), | 190 | gettext_noop ("start message ID for history replay"), |
136 | GNUNET_NO, &GNUNET_GETOPT_set_ulong, &start}, | 191 | GNUNET_NO, &GNUNET_GETOPT_set_ulong, &start}, |
137 | 192 | ||
138 | {'e', "end", NULL, | 193 | {'e', "end", NULL, |
139 | gettext_noop ("end message ID for history replay"), | 194 | gettext_noop ("end message ID for history replay"), |
140 | GNUNET_NO, &GNUNET_GETOPT_set_ulong, &end}, | 195 | GNUNET_NO, &GNUNET_GETOPT_set_ulong, &end}, |
141 | 196 | ||
142 | {'n', "limit", NULL, | 197 | {'n', "limit", NULL, |
143 | gettext_noop ("number of messages to replay from history"), | 198 | gettext_noop ("number of messages to replay from history"), |
144 | GNUNET_NO, &GNUNET_GETOPT_set_ulong, &limit}, | 199 | GNUNET_NO, &GNUNET_GETOPT_set_ulong, &limit}, |
145 | 200 | ||
146 | {'C', "host-enter", NULL, | 201 | {'C', "host-enter", NULL, |
147 | gettext_noop ("create a place for nyms to join"), | 202 | gettext_noop ("create a place for nyms to join"), |
148 | GNUNET_NO, &GNUNET_GETOPT_set_one, &op_host_enter}, | 203 | GNUNET_NO, &GNUNET_GETOPT_set_one, &op_host_enter}, |
149 | 204 | ||
150 | /** --host-leave */ | 205 | {'D', "host-leave", NULL, |
151 | /** --host-announce */ | 206 | gettext_noop ("destroy a place we were hosting"), |
152 | /** --guest-enter */ | 207 | GNUNET_NO, &GNUNET_GETOPT_set_one, &op_host_leave}, |
153 | /** --guest-leave */ | 208 | |
154 | /** --guest-talk */ | 209 | {'P', "host-announce", NULL, |
155 | /** --history-replay */ | 210 | gettext_noop ("publish something to a place we are hosting"), |
156 | /** --history-replay-latest */ | 211 | GNUNET_NO, &GNUNET_GETOPT_set_one, &op_host_announce}, |
212 | |||
213 | {'E', "guest-enter", NULL, | ||
214 | gettext_noop ("join somebody else's place"), | ||
215 | GNUNET_NO, &GNUNET_GETOPT_set_one, &op_guest_enter}, | ||
216 | |||
217 | {'L', "guest-leave", NULL, | ||
218 | gettext_noop ("leave somebody else's place"), | ||
219 | GNUNET_NO, &GNUNET_GETOPT_set_one, &op_guest_leave}, | ||
220 | |||
221 | {'T', "guest-talk", NULL, | ||
222 | gettext_noop ("submit something to somebody's place"), | ||
223 | GNUNET_NO, &GNUNET_GETOPT_set_one, &op_guest_talk}, | ||
224 | |||
225 | {'R', "history-replay", NULL, | ||
226 | gettext_noop ("FIXME"), | ||
227 | GNUNET_NO, &GNUNET_GETOPT_set_one, &op_history_replay}, | ||
228 | |||
229 | {'H', "history-replay-latest", NULL, | ||
230 | gettext_noop ("FIXME"), | ||
231 | GNUNET_NO, &GNUNET_GETOPT_set_one, &op_history_replay_latest}, | ||
157 | 232 | ||
158 | GNUNET_GETOPT_OPTION_END | 233 | GNUNET_GETOPT_OPTION_END |
159 | }; | 234 | }; |
@@ -185,7 +260,7 @@ main (int argc, char *const *argv) | |||
185 | GNUNET_free ((void *) argv); | 260 | GNUNET_free ((void *) argv); |
186 | 261 | ||
187 | if (GNUNET_OK == res) | 262 | if (GNUNET_OK == res) |
188 | return 0; | 263 | return ret; |
189 | else | 264 | else |
190 | return 1; | 265 | return 1; |
191 | } | 266 | } |