Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
If the length of the description is more than 76 characters replace it by the name...
[simgrid.git] / tools / tesh2 / src / unit.c
index 43ba352..afadd9b 100644 (file)
@@ -536,13 +536,23 @@ unit_summuarize(unit_t unit)
         return -1;\r
     }\r
        \r
-       if((unit->description) && strlen(unit->description) < 78)\r
+       if((unit->description) && strlen(unit->description) < 76)\r
                strcpy(title, unit->description);\r
        else\r
                sprintf(title, "file : %s",unit->fstream->name);\r
                \r
        if(unit->interrupted)\r
-               strcat(title, " (interrupted)");\r
+       {\r
+               if(strlen(title) + strlen(" (interrupted)") < 76)\r
+                       strcat(title, " (interrupted)");\r
+               else\r
+               {\r
+                       memset(title, 0, PATH_MAX + 1);\r
+                       sprintf(title, "file : %s",unit->fstream->name);\r
+                       strcat(title, " (interrupted)");\r
+\r
+               }\r
+       }\r
                \r
        print_title(title);\r
        \r