Update OsMoThread.java

This commit is contained in:
vshcherb 2014-05-29 14:06:33 +02:00
parent 738c37b8cf
commit 5aa8512ee2

View file

@ -403,28 +403,16 @@ public class OsMoThread {
} }
private StringBuilder prepareCommand(String l) { private StringBuilder prepareCommand(String l) {
boolean addNL = true; StringBuilder res = new StringBuilder(l.length());
StringBuilder res = new StringBuilder(); for(int i = 0; i < l.length(); i++) {
int i = 0; char c = l.charAt(i);
while (true) { if(c == '\n' || c == '=' || c == '\\') {
int ni = l.indexOf('\n'); res.append('\\')
if (ni == l.length() - 1) {
res.append(l.substring(i));
addNL = false;
break;
} else if (ni == -1) {
res.append(l.substring(i));
break;
} else {
res.append(l.substring(i, ni));
res.append("\\").append("n");
} }
i = ni + 1; res.append(c);
} }
if (addNL) {
l += "\n"; return res.toString().trim() +"=\n"
}
return res;
} }
public long getLastCommandTime() { public long getLastCommandTime() {