Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
convert all xml files to the new DTD v4
[simgrid.git] / examples / msg / icomms / peer.c
index d36b412..1e322b4 100644 (file)
@@ -34,12 +34,12 @@ msg_error_t test_all(const char *platform_file,
 /** Sender function  */
 int sender(int argc, char *argv[])
 {
-  long number_of_tasks = atol(argv[1]);
-  double task_comp_size = atof(argv[2]);
-  double task_comm_size = atof(argv[3]);
-  long receivers_count = atol(argv[4]);
-  double sleep_start_time = atof(argv[5]);
-  double sleep_test_time = atof(argv[6]);
+  long number_of_tasks = xbt_str_parse_int(argv[1], "Invalid amount of tasks: %s");
+  double task_comp_size = xbt_str_parse_double(argv[2], "Invalid compute size: %s");
+  double task_comm_size = xbt_str_parse_double(argv[3], "Invalid communication size: %s");
+  long receivers_count = xbt_str_parse_int(argv[4], "Invalid amount of receivers: %s");
+  double sleep_start_time = xbt_str_parse_double(argv[5], "Invalid sleep start time: %s");
+  double sleep_test_time = xbt_str_parse_double(argv[6], "Invalid test time: %s");
 
   XBT_INFO("sleep_start_time : %f , sleep_test_time : %f", sleep_start_time,
         sleep_test_time);
@@ -101,8 +101,8 @@ int receiver(int argc, char *argv[])
   int id = -1;
   char mailbox[80];
   msg_comm_t res_irecv;
-  double sleep_start_time = atof(argv[2]);
-  double sleep_test_time = atof(argv[3]);
+  double sleep_start_time = xbt_str_parse_double(argv[2], "Invalid sleep start parameter: %s");
+  double sleep_test_time = xbt_str_parse_double(argv[3], "Invalid sleep test parameter: %s");
   XBT_INFO("sleep_start_time : %f , sleep_test_time : %f", sleep_start_time,
         sleep_test_time);
 
@@ -172,8 +172,8 @@ int main(int argc, char *argv[])
 
   MSG_init(&argc, argv);
   xbt_assert(argc > 2, "Usage: %s platform_file deployment_file\n"
-                "\tExample: %s msg_platform.xml msg_deployment.xml\n", 
-                argv[0], argv[0]);
+           "\tExample: %s msg_platform.xml msg_deployment.xml\n", 
+           argv[0], argv[0]);
 
   res = test_all(argv[1], argv[2]);