- really escape \t, \n in output
authorAleš Křenek <ljocha@ics.muni.cz>
Mon, 9 Mar 2009 17:45:32 +0000 (17:45 +0000)
committerAleš Křenek <ljocha@ics.muni.cz>
Mon, 9 Mar 2009 17:45:32 +0000 (17:45 +0000)
- do so also for JDL fields

org.glite.lb.client/src/stat_fields.cpp

index 2add445..347fc19 100644 (file)
@@ -40,8 +40,9 @@ static std::string & escape(std::string &s)
 {
        for (std::string::iterator p = s.begin(); p < s.end(); p++) switch (*p) {
                case '\n':
+                       s.insert(p-s.begin(),"\\"); *(++p) = 'n';
                case '\t':
-                       s.insert(p-s.begin(),"\\"); p++;
+                       s.insert(p-s.begin(),"\\"); *(++p) = 't';
                        break;
                default: break;
        }
@@ -98,7 +99,9 @@ void glite_lb_print_stat_fields(void **ff,edg_wll_JobStat *s)
                                        else {
                                                 val = f->second;
                                                 jdl_param = edg_wll_JDLField(s, val.c_str());
-                                                std::cout << (jdl_param ? jdl_param : "(null)") << '\t'; 
+                                               std::string     s_param(jdl_param);
+                                               
+                                                std::cout << (jdl_param ? escape(s_param) : "(null)") << '\t'; 
                                                 free(jdl_param); jdl_param = NULL;
                                        }
                                        break;