From 7068c16897efb1fda90b756ad8697c3a57c23867 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ale=C5=A1=20K=C5=99enek?= Date: Mon, 9 Mar 2009 17:45:32 +0000 Subject: [PATCH] - really escape \t, \n in output - do so also for JDL fields --- org.glite.lb.client/src/stat_fields.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/org.glite.lb.client/src/stat_fields.cpp b/org.glite.lb.client/src/stat_fields.cpp index 2add445..347fc19 100644 --- a/org.glite.lb.client/src/stat_fields.cpp +++ b/org.glite.lb.client/src/stat_fields.cpp @@ -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; -- 1.8.2.3