]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Renamed sendline to sendlines with some comment removal.
authorRuben d'Arco <cyclops@prof-x.net>
Mon, 30 Apr 2012 06:24:29 +0000 (08:24 +0200)
committerRuben d'Arco <cyclops@prof-x.net>
Tue, 7 May 2013 20:28:32 +0000 (22:28 +0200)
pdns/dynlistener.cc
pdns/dynlistener.hh [changed mode: 0644->0755]
pdns/win32_dynlistener.cc [changed mode: 0644->0755]

index 2b4929b11877872bcd68831c8b912df3775922db..fb820c742218775aa7780158c3144bb11c9ed7fe 100755 (executable)
@@ -251,7 +251,7 @@ string DynListener::getLine()
   return &mesg[0];
 }
 
-void DynListener::sendLine(const string &l)
+void DynListener::sendlines(const string &l)
 {
   if(d_nonlocal) {
     unsigned int sent=0;
@@ -268,14 +268,13 @@ void DynListener::sendLine(const string &l)
     close(d_client);
   }
   else {
-    string line=l;
-    if(!line.empty() && line[line.length()-1]!='\n')
-      line.append("\n");
-    line.append(1, '\0');
-    line.append(1, '\n');
-    if((unsigned int)write(1,line.c_str(),line.length()) != line.length())
+    string lines=l;
+    if(!lines.empty() && lines[lines.length()-1] != '\n')
+      lines.append("\n");
+    lines.append(1, '\0');
+    lines.append(1, '\n');
+    if((unsigned int)write(1, lines.c_str(), lines.length()) != lines.length())
       L<<Logger::Error<<"Error sending data to console: "<<stringerror()<<endl;
-      
   }
 }
 
@@ -302,21 +301,19 @@ void DynListener::theListener()
       vector<string>parts;
       stringtok(parts,line," ");
       if(parts.empty()) {
-        sendLine("Empty line");
+        sendlines("Empty line");
         continue;
       }
 
       parts[0] = toUpper( parts[0] );
-      if(s_funcdb.count(parts[0])) {
-        cerr<<parts[0]<<" found in s_funcdb"<<endl;
-        sendLine((*(s_funcdb[parts[0]].func))(parts,d_ppid));
-      } else if (parts[0] == "HELP") {
-        sendLine(getHelp());
-      }else if(s_restfunc) {
-        cerr<<"Calling restfunction."<<endl;
-        sendLine((*s_restfunc)(parts,d_ppid));
-      } else
-        sendLine("Unknown command: '"+parts[0]+"'");
+      if(s_funcdb.count(parts[0])) 
+        sendlines((*(s_funcdb[parts[0]].func))(parts,d_ppid));
+      else if (parts[0] == "HELP")
+        sendlines(getHelp());
+      else if(s_restfunc)
+        sendlines((*s_restfunc)(parts,d_ppid));
+      else
+        sendlines("Unknown command: '"+parts[0]+"'");
     }
   }
   catch(AhuException &AE)
old mode 100644 (file)
new mode 100755 (executable)
index 769aa47..c349f18
@@ -57,7 +57,7 @@ public:
   static void registerRestFunc(g_funk_t *gf);
   static g_funk_t* getFunc(const string& fname) { return s_funcdb[fname].func; } 
 private:
-  void sendLine(const string &line);
+  void sendlines(const string &lines);
   string getHelp();
   string getLine();
 
old mode 100644 (file)
new mode 100755 (executable)
index 4222f03..5d1d4a0
@@ -109,7 +109,7 @@ string DynListener::getLine()
   return mesg;
 }
 
-void DynListener::sendLine(const string &l)
+void DynListener::sendlines(const string &l)
 {
   unsigned long bytesWritten;
 
@@ -145,19 +145,19 @@ void DynListener::theListener()
       vector<string>parts;
       stringtok(parts,line," ");
       if(parts.empty()) {
-        sendLine("Empty line");
+        sendlines("Empty line");
         continue;
       }
       parts[0] = toUpper( parts[0] ); 
       if(!d_funcdb[parts[0]]) {
         if(d_restfunc) 
-          sendLine((*d_restfunc)(parts,d_ppid));
+          sendlines((*d_restfunc)(parts,d_ppid));
         else
-          sendLine("Unknown command: '"+parts[0]+"'");
+          sendlines("Unknown command: '"+parts[0]+"'");
         continue;
       }
 
-      sendLine((*d_funcdb[parts[0]])(parts,d_ppid));
+      sendlines((*d_funcdb[parts[0]])(parts,d_ppid));
     }
   }
   catch(AhuException &AE)