aboutsummaryrefslogtreecommitdiff
path: root/src/chat/gnunet-chat.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-12-30 22:42:04 +0000
committerChristian Grothoff <christian@grothoff.org>2011-12-30 22:42:04 +0000
commit416c2f5a713b93ba689a8cd1e038682a53e6bc17 (patch)
tree987f51d9edfddc02afe1524df5e1156b920c71d4 /src/chat/gnunet-chat.c
parentfceec98e767bce7ad2c24dde73cdcf8837e04013 (diff)
downloadgnunet-416c2f5a713b93ba689a8cd1e038682a53e6bc17.tar.gz
gnunet-416c2f5a713b93ba689a8cd1e038682a53e6bc17.zip
-LRN: use FPRINTF -- #2051
Diffstat (limited to 'src/chat/gnunet-chat.c')
-rw-r--r--src/chat/gnunet-chat.c46
1 files changed, 23 insertions, 23 deletions
diff --git a/src/chat/gnunet-chat.c b/src/chat/gnunet-chat.c
index 53884a299..af4eb53f3 100644
--- a/src/chat/gnunet-chat.c
+++ b/src/chat/gnunet-chat.c
@@ -89,7 +89,7 @@ do_help (const char *args, const void *xtra);
89static int 89static int
90join_cb (void *cls) 90join_cb (void *cls)
91{ 91{
92 fprintf (stdout, _("Joined\n")); 92 FPRINTF (stdout, "%s", _("Joined\n"));
93 return GNUNET_OK; 93 return GNUNET_OK;
94} 94}
95 95
@@ -163,7 +163,7 @@ receive_cb (void *cls, struct GNUNET_CHAT_Room *room,
163 break; 163 break;
164 } 164 }
165 time = GNUNET_STRINGS_absolute_time_to_string (timestamp); 165 time = GNUNET_STRINGS_absolute_time_to_string (timestamp);
166 fprintf (stdout, fmt, time, nick, message); 166 FPRINTF (stdout, fmt, time, nick, message);
167 GNUNET_free (nick); 167 GNUNET_free (nick);
168 GNUNET_free (time); 168 GNUNET_free (time);
169 return GNUNET_OK; 169 return GNUNET_OK;
@@ -190,7 +190,7 @@ confirmation_cb (void *cls, struct GNUNET_CHAT_Room *room,
190 char *nick; 190 char *nick;
191 191
192 nick = GNUNET_PSEUDONYM_id_to_name (cfg, receiver); 192 nick = GNUNET_PSEUDONYM_id_to_name (cfg, receiver);
193 fprintf (stdout, _("'%s' acknowledged message #%d\n"), nick, orig_seq_number); 193 FPRINTF (stdout, _("'%s' acknowledged message #%d\n"), nick, orig_seq_number);
194 return GNUNET_OK; 194 return GNUNET_OK;
195} 195}
196 196
@@ -219,7 +219,7 @@ member_list_cb (void *cls, const struct GNUNET_CONTAINER_MetaData *member_info,
219 sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), 219 sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded),
220 &id); 220 &id);
221 nick = GNUNET_PSEUDONYM_id_to_name (cfg, &id); 221 nick = GNUNET_PSEUDONYM_id_to_name (cfg, &id);
222 fprintf (stdout, 222 FPRINTF (stdout,
223 member_info != 223 member_info !=
224 NULL ? _("`%s' entered the room\n") : _("`%s' left the room\n"), 224 NULL ? _("`%s' entered the room\n") : _("`%s' left the room\n"),
225 nick); 225 nick);
@@ -281,11 +281,11 @@ do_join (const char *arg, const void *xtra)
281 &confirmation_cb, NULL, &me); 281 &confirmation_cb, NULL, &me);
282 if (NULL == room) 282 if (NULL == room)
283 { 283 {
284 fprintf (stdout, _("Could not change username\n")); 284 FPRINTF (stdout, "%s", _("Could not change username\n"));
285 return GNUNET_SYSERR; 285 return GNUNET_SYSERR;
286 } 286 }
287 my_name = GNUNET_PSEUDONYM_id_to_name (cfg, &me); 287 my_name = GNUNET_PSEUDONYM_id_to_name (cfg, &me);
288 fprintf (stdout, _("Joining room `%s' as user `%s'...\n"), room_name, 288 FPRINTF (stdout, _("Joining room `%s' as user `%s'...\n"), room_name,
289 my_name); 289 my_name);
290 GNUNET_free (my_name); 290 GNUNET_free (my_name);
291 return GNUNET_OK; 291 return GNUNET_OK;
@@ -313,11 +313,11 @@ do_nick (const char *msg, const void *xtra)
313 &confirmation_cb, NULL, &me); 313 &confirmation_cb, NULL, &me);
314 if (NULL == room) 314 if (NULL == room)
315 { 315 {
316 fprintf (stdout, _("Could not change username\n")); 316 FPRINTF (stdout, "%s", _("Could not change username\n"));
317 return GNUNET_SYSERR; 317 return GNUNET_SYSERR;
318 } 318 }
319 my_name = GNUNET_PSEUDONYM_id_to_name (cfg, &me); 319 my_name = GNUNET_PSEUDONYM_id_to_name (cfg, &me);
320 fprintf (stdout, _("Changed username to `%s'\n"), my_name); 320 FPRINTF (stdout, _("Changed username to `%s'\n"), my_name);
321 GNUNET_free (my_name); 321 GNUNET_free (my_name);
322 return GNUNET_OK; 322 return GNUNET_OK;
323} 323}
@@ -330,7 +330,7 @@ do_names (const char *msg, const void *xtra)
330 struct UserList *pos; 330 struct UserList *pos;
331 GNUNET_HashCode pid; 331 GNUNET_HashCode pid;
332 332
333 fprintf (stdout, _("Users in room `%s': "), room_name); 333 FPRINTF (stdout, _("Users in room `%s': "), room_name);
334 pos = users; 334 pos = users;
335 while (NULL != pos) 335 while (NULL != pos)
336 { 336 {
@@ -338,11 +338,11 @@ do_names (const char *msg, const void *xtra)
338 sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), 338 sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded),
339 &pid); 339 &pid);
340 name = GNUNET_PSEUDONYM_id_to_name (cfg, &pid); 340 name = GNUNET_PSEUDONYM_id_to_name (cfg, &pid);
341 fprintf (stdout, "`%s' ", name); 341 FPRINTF (stdout, "`%s' ", name);
342 GNUNET_free (name); 342 GNUNET_free (name);
343 pos = pos->next; 343 pos = pos->next;
344 } 344 }
345 fprintf (stdout, "\n"); 345 FPRINTF (stdout, "%s", "\n");
346 return GNUNET_OK; 346 return GNUNET_OK;
347} 347}
348 348
@@ -368,7 +368,7 @@ do_send_pm (const char *msg, const void *xtra)
368 368
369 if (NULL == strstr (msg, " ")) 369 if (NULL == strstr (msg, " "))
370 { 370 {
371 fprintf (stderr, _("Syntax: /msg USERNAME MESSAGE")); 371 FPRINTF (stderr, "%s", _("Syntax: /msg USERNAME MESSAGE"));
372 return GNUNET_OK; 372 return GNUNET_OK;
373 } 373 }
374 user = GNUNET_strdup (msg); 374 user = GNUNET_strdup (msg);
@@ -376,7 +376,7 @@ do_send_pm (const char *msg, const void *xtra)
376 msg += strlen (user) + 1; 376 msg += strlen (user) + 1;
377 if (GNUNET_OK != GNUNET_PSEUDONYM_name_to_id (cfg, user, &uid)) 377 if (GNUNET_OK != GNUNET_PSEUDONYM_name_to_id (cfg, user, &uid))
378 { 378 {
379 fprintf (stderr, _("Unknown user `%s'\n"), user); 379 FPRINTF (stderr, _("Unknown user `%s'\n"), user);
380 GNUNET_free (user); 380 GNUNET_free (user);
381 return GNUNET_OK; 381 return GNUNET_OK;
382 } 382 }
@@ -392,7 +392,7 @@ do_send_pm (const char *msg, const void *xtra)
392 } 392 }
393 if (NULL == pos) 393 if (NULL == pos)
394 { 394 {
395 fprintf (stderr, _("User `%s' is currently not in the room!\n"), user); 395 FPRINTF (stderr, _("User `%s' is currently not in the room!\n"), user);
396 GNUNET_free (user); 396 GNUNET_free (user);
397 return GNUNET_OK; 397 return GNUNET_OK;
398 } 398 }
@@ -445,7 +445,7 @@ do_quit (const char *args, const void *xtra)
445static int 445static int
446do_unknown (const char *msg, const void *xtra) 446do_unknown (const char *msg, const void *xtra)
447{ 447{
448 fprintf (stderr, _("Unknown command `%s'\n"), msg); 448 FPRINTF (stderr, _("Unknown command `%s'\n"), msg);
449 return GNUNET_OK; 449 return GNUNET_OK;
450} 450}
451 451
@@ -510,20 +510,20 @@ do_help (const char *args, const void *xtra)
510 { 510 {
511 if (0 == strncasecmp (&args[1], &commands[i].command[1], strlen (args) - 1)) 511 if (0 == strncasecmp (&args[1], &commands[i].command[1], strlen (args) - 1))
512 { 512 {
513 fprintf (stdout, "%s\n", gettext (commands[i].helptext)); 513 FPRINTF (stdout, "%s\n", gettext (commands[i].helptext));
514 return GNUNET_OK; 514 return GNUNET_OK;
515 } 515 }
516 i++; 516 i++;
517 } 517 }
518 i = 0; 518 i = 0;
519 fprintf (stdout, "Available commands:"); 519 FPRINTF (stdout, "%s", "Available commands:");
520 while (commands[i].Action != &do_help) 520 while (commands[i].Action != &do_help)
521 { 521 {
522 fprintf (stdout, " %s", gettext (commands[i].command)); 522 FPRINTF (stdout, " %s", gettext (commands[i].command));
523 i++; 523 i++;
524 } 524 }
525 fprintf (stdout, "\n"); 525 FPRINTF (stdout, "%s", "\n");
526 fprintf (stdout, "%s\n", gettext (commands[i].helptext)); 526 FPRINTF (stdout, "%s\n", gettext (commands[i].helptext));
527 return GNUNET_OK; 527 return GNUNET_OK;
528} 528}
529 529
@@ -602,7 +602,7 @@ run (void *cls, char *const *args, const char *cfgfile,
602 /* check arguments */ 602 /* check arguments */
603 if (NULL == nickname) 603 if (NULL == nickname)
604 { 604 {
605 fprintf (stderr, _("You must specify a nickname\n")); 605 FPRINTF (stderr, "%s", _("You must specify a nickname\n"));
606 ret = -1; 606 ret = -1;
607 return; 607 return;
608 } 608 }
@@ -618,7 +618,7 @@ run (void *cls, char *const *args, const char *cfgfile,
618 &confirmation_cb, NULL, &me); 618 &confirmation_cb, NULL, &me);
619 if (NULL == room) 619 if (NULL == room)
620 { 620 {
621 fprintf (stderr, _("Failed to join room `%s'\n"), room_name); 621 FPRINTF (stderr, _("Failed to join room `%s'\n"), room_name);
622 GNUNET_free (room_name); 622 GNUNET_free (room_name);
623 GNUNET_free (nickname); 623 GNUNET_free (nickname);
624 GNUNET_CONTAINER_meta_data_destroy (meta); 624 GNUNET_CONTAINER_meta_data_destroy (meta);
@@ -626,7 +626,7 @@ run (void *cls, char *const *args, const char *cfgfile,
626 return; 626 return;
627 } 627 }
628 my_name = GNUNET_PSEUDONYM_id_to_name (cfg, &me); 628 my_name = GNUNET_PSEUDONYM_id_to_name (cfg, &me);
629 fprintf (stdout, _("Joining room `%s' as user `%s'...\n"), room_name, 629 FPRINTF (stdout, _("Joining room `%s' as user `%s'...\n"), room_name,
630 my_name); 630 my_name);
631 GNUNET_free (my_name); 631 GNUNET_free (my_name);
632 handle_cmd_task = 632 handle_cmd_task =