diff options
Diffstat (limited to 'src/conversation/gnunet-conversation-test.c')
-rw-r--r-- | src/conversation/gnunet-conversation-test.c | 47 |
1 files changed, 29 insertions, 18 deletions
diff --git a/src/conversation/gnunet-conversation-test.c b/src/conversation/gnunet-conversation-test.c index 804df4c88..2c9ed715b 100644 --- a/src/conversation/gnunet-conversation-test.c +++ b/src/conversation/gnunet-conversation-test.c | |||
@@ -2,20 +2,18 @@ | |||
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2013 GNUnet e.V. | 3 | Copyright (C) 2013 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | it under the terms of the GNU General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
7 | by the Free Software Foundation; either version 3, or (at your | 7 | by the Free Software Foundation, either version 3 of the License, |
8 | option) any later version. | 8 | or (at your option) any later version. |
9 | 9 | ||
10 | GNUnet is distributed in the hope that it will be useful, but | 10 | GNUnet is distributed in the hope that it will be useful, but |
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with GNUnet; see the file COPYING. If not, write to the | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | 17 | */ |
20 | 18 | ||
21 | /** | 19 | /** |
@@ -102,6 +100,7 @@ do_shutdown (void *cls) | |||
102 | { | 100 | { |
103 | struct Recording *rec; | 101 | struct Recording *rec; |
104 | 102 | ||
103 | (void) cls; | ||
105 | if (NULL != switch_task) | 104 | if (NULL != switch_task) |
106 | GNUNET_SCHEDULER_cancel (switch_task); | 105 | GNUNET_SCHEDULER_cancel (switch_task); |
107 | if (NULL != microphone) | 106 | if (NULL != microphone) |
@@ -128,8 +127,7 @@ do_shutdown (void *cls) | |||
128 | static void | 127 | static void |
129 | switch_to_speaker (void *cls) | 128 | switch_to_speaker (void *cls) |
130 | { | 129 | { |
131 | struct Recording *rec; | 130 | (void) cls; |
132 | |||
133 | switch_task = NULL; | 131 | switch_task = NULL; |
134 | microphone->disable_microphone (microphone->cls); | 132 | microphone->disable_microphone (microphone->cls); |
135 | if (GNUNET_OK != | 133 | if (GNUNET_OK != |
@@ -143,7 +141,7 @@ switch_to_speaker (void *cls) | |||
143 | } | 141 | } |
144 | fprintf (stderr, | 142 | fprintf (stderr, |
145 | _("\nWe are now playing your recording back. If you can hear it, your audio settings are working...")); | 143 | _("\nWe are now playing your recording back. If you can hear it, your audio settings are working...")); |
146 | for (rec=rec_head; NULL != rec; rec = rec->next) | 144 | for (struct Recording *rec=rec_head; NULL != rec; rec = rec->next) |
147 | { | 145 | { |
148 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 146 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
149 | "Replaying %u bytes\n", | 147 | "Replaying %u bytes\n", |
@@ -173,6 +171,7 @@ record (void *cls, | |||
173 | { | 171 | { |
174 | struct Recording *rec; | 172 | struct Recording *rec; |
175 | 173 | ||
174 | (void) cls; | ||
176 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 175 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
177 | "Recorded %u bytes\n", | 176 | "Recorded %u bytes\n", |
178 | (unsigned int) data_size); | 177 | (unsigned int) data_size); |
@@ -194,9 +193,14 @@ record (void *cls, | |||
194 | * @param cfg configuration | 193 | * @param cfg configuration |
195 | */ | 194 | */ |
196 | static void | 195 | static void |
197 | run (void *cls, char *const *args, const char *cfgfile, | 196 | run (void *cls, |
197 | char *const *args, | ||
198 | const char *cfgfile, | ||
198 | const struct GNUNET_CONFIGURATION_Handle *cfg) | 199 | const struct GNUNET_CONFIGURATION_Handle *cfg) |
199 | { | 200 | { |
201 | (void) cls; | ||
202 | (void) args; | ||
203 | (void) cfgfile; | ||
200 | microphone = GNUNET_MICROPHONE_create_from_hardware (cfg); | 204 | microphone = GNUNET_MICROPHONE_create_from_hardware (cfg); |
201 | GNUNET_assert (NULL != microphone); | 205 | GNUNET_assert (NULL != microphone); |
202 | speaker = GNUNET_SPEAKER_create_from_hardware (cfg); | 206 | speaker = GNUNET_SPEAKER_create_from_hardware (cfg); |
@@ -230,17 +234,24 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
230 | * @return 0 ok, 1 on error | 234 | * @return 0 ok, 1 on error |
231 | */ | 235 | */ |
232 | int | 236 | int |
233 | main (int argc, char *const *argv) | 237 | main (int argc, |
238 | char *const *argv) | ||
234 | { | 239 | { |
235 | static const struct GNUNET_GETOPT_CommandLineOption options[] = { | 240 | static const struct GNUNET_GETOPT_CommandLineOption options[] = { |
236 | GNUNET_GETOPT_OPTION_END | 241 | GNUNET_GETOPT_OPTION_END |
237 | }; | 242 | }; |
238 | if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv)) | 243 | |
244 | if (GNUNET_OK != | ||
245 | GNUNET_STRINGS_get_utf8_args (argc, argv, | ||
246 | &argc, &argv)) | ||
239 | return 2; | 247 | return 2; |
240 | 248 | ||
241 | ret = (GNUNET_OK == | 249 | ret = (GNUNET_OK == |
242 | GNUNET_PROGRAM_run (argc, argv, "gnunet-conversation-test", | 250 | GNUNET_PROGRAM_run (argc, argv, |
243 | gettext_noop ("help text"), options, &run, | 251 | "gnunet-conversation-test", |
252 | gettext_noop ("help text"), | ||
253 | options, | ||
254 | &run, | ||
244 | NULL)) ? ret : 1; | 255 | NULL)) ? ret : 1; |
245 | GNUNET_free ((void*) argv); | 256 | GNUNET_free ((void*) argv); |
246 | return ret; | 257 | return ret; |