X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/79e2f5a416481f26ee8ee98d701d78c4997f9c22..bc119eb270df8328bf939c25c3bd198101a8be94:/examples/msg/network-ns3/network-ns3.c diff --git a/examples/msg/network-ns3/network-ns3.c b/examples/msg/network-ns3/network-ns3.c index 74ae8bbede..c422f5c502 100644 --- a/examples/msg/network-ns3/network-ns3.c +++ b/examples/msg/network-ns3/network-ns3.c @@ -1,5 +1,4 @@ -/* Copyright (c) 2007-2015. The SimGrid Team. - * All rights reserved. */ +/* Copyright (c) 2007-2016. The SimGrid Team. All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ @@ -8,20 +7,6 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test, "Messages specific for this msg example"); -/** @addtogroup MSG_examples - * - * @section MSG_ex_models Models-related examples - * - * @subsection MSG_ex_PLS Packet level simulators - * - * This example demonstrates how to use the bindings to a classical Packet-Level Simulators (PLS), as explained in - * \ref pls. The most interesting is probably not the C files since they are unchanged from the other simulations, - * but the associated files, such as the platform file to see how to declare a platform to be used with the PLS - * bindings of SimGrid and the tesh file to see how to actually start a simulation in these settings. - * - * - ns-3: network-ns3/network-ns3.c. Simple ping-pong using ns-3 instead of the SimGrid network models. - */ - int timer_start; //set as 1 in the master process //keep a pointer to all surf running tasks. @@ -51,7 +36,8 @@ static int master(int argc, char *argv[]) /* worker name */ char *workername = argv[2]; int id = xbt_str_parse_int(argv[3], "Invalid ID as argument 3: %s"); //unique id to control statistics - char *id_alias = bprintf("flow_%d", id); + char *id_alias = xbt_malloc(20*sizeof(char)); + snprintf(id_alias, 20, "flow_%d", id); workernames[id] = workername; TRACE_category(id_alias); @@ -71,7 +57,7 @@ static int master(int argc, char *argv[]) timer_start = 1 ; /* time measurement */ - sprintf(id_alias, "%d", id); + snprintf(id_alias,20,"%d", id); start_time = MSG_get_clock(); MSG_task_send(todo, id_alias); end_time = MSG_get_clock(); @@ -116,7 +102,7 @@ static int worker(int argc, char *argv[]) XBT_DEBUG ("Worker started"); int id = xbt_str_parse_int(argv[1], "Invalid id: %s"); - sprintf(id_alias, "%d", id); + snprintf(id_alias,10, "%d", id); msg_error_t a = MSG_task_receive(&(task), id_alias);