Imported Upstream version 14.45.0
[platform/upstream/libzypp.git] / zypp / target / rpm / RpmDb.cc
index 2c2839d..8b0cb55 100644 (file)
@@ -49,7 +49,7 @@ extern "C"
 #include "zypp/ZYppFactory.h"
 #include "zypp/ZConfig.h"
 
-using std::endl;
+using namespace std;
 using namespace zypp::filesystem;
 
 #define WARNINGMAILPATH                "/var/log/YaST2/"
@@ -75,11 +75,11 @@ const char* quoteInFilename_m = "\'\"";
 #else
 const char* quoteInFilename_m = " \t\'\"";
 #endif
-inline std::string rpmQuoteFilename( const Pathname & path_r )
+inline string rpmQuoteFilename( const Pathname & path_r )
 {
-  std::string path( path_r.asString() );
-  for ( std::string::size_type pos = path.find_first_of( quoteInFilename_m );
-        pos != std::string::npos;
+  string path( path_r.asString() );
+  for ( string::size_type pos = path.find_first_of( quoteInFilename_m );
+        pos != string::npos;
         pos = path.find_first_of( quoteInFilename_m, pos ) )
   {
     path.insert( pos, "\\" );
@@ -155,7 +155,7 @@ struct KeyRingSignalReceiver : callback::ReceiveReport<KeyRingSignals>
 
 static shared_ptr<KeyRingSignalReceiver> sKeyRingReceiver;
 
-unsigned diffFiles(const std::string file1, const std::string file2, std::string& out, int maxlines)
+unsigned diffFiles(const string file1, const string file2, string& out, int maxlines)
 {
   const char* argv[] =
     {
@@ -170,7 +170,7 @@ unsigned diffFiles(const std::string file1, const std::string file2, std::string
   //if(!prog)
   //return 2;
 
-  std::string line;
+  string line;
   int count = 0;
   for (line = prog.receiveLine(), count=0;
        !line.empty();
@@ -189,9 +189,9 @@ unsigned diffFiles(const std::string file1, const std::string file2, std::string
  **
  **
  **    FUNCTION NAME : stringPath
- **    FUNCTION TYPE : inline std::string
+ **    FUNCTION TYPE : inline string
 */
-inline std::string stringPath( const Pathname & root_r, const Pathname & sub_r )
+inline string stringPath( const Pathname & root_r, const Pathname & sub_r )
 {
   return librpmDb::stringPath( root_r, sub_r );
 }
@@ -200,9 +200,9 @@ inline std::string stringPath( const Pathname & root_r, const Pathname & sub_r )
  **
  **
  **    FUNCTION NAME : operator<<
- **    FUNCTION TYPE : std::ostream &
+ **    FUNCTION TYPE : ostream &
 */
-std::ostream & operator<<( std::ostream & str, const RpmDb::DbStateInfoBits & obj )
+ostream & operator<<( ostream & str, const RpmDb::DbStateInfoBits & obj )
 {
   if ( obj == RpmDb::DbSI_NO_INIT )
   {
@@ -295,9 +295,9 @@ Date RpmDb::timestamp() const
 //
 //
 //     METHOD NAME : RpmDb::dumpOn
-//     METHOD TYPE : std::ostream &
+//     METHOD TYPE : ostream &
 //
-std::ostream & RpmDb::dumpOn( std::ostream & str ) const
+ostream & RpmDb::dumpOn( ostream & str ) const
 {
   str << "RpmDb[";
 
@@ -816,8 +816,8 @@ void RpmDb::doRebuildDatabase(callback::SendReport<RebuildDBReport> & report)
                                                     process?process->getpid():0) )
                       + "Packages" );
 
-  std::string       line;
-  std::string       errmsg;
+  string       line;
+  string       errmsg;
 
   while ( systemReadLine( line ) )
   {
@@ -845,7 +845,8 @@ void RpmDb::doRebuildDatabase(callback::SendReport<RebuildDBReport> & report)
   if ( rpm_status != 0 )
   {
     //TranslatorExplanation after semicolon is error message
-    ZYPP_THROW(RpmSubprocessException(std::string(_("RPM failed: ")) + (errmsg.empty() ? error_message: errmsg) ) );
+    ZYPP_THROW(RpmSubprocessException(string(_("RPM failed: ") +
+               (errmsg.empty() ? error_message: errmsg))));
   }
   else
   {
@@ -981,12 +982,12 @@ void RpmDb::syncTrustedKeys( SyncTrustedKeyBits mode_r )
 
     TmpFile tmpfile( getZYpp()->tmpPath() );
     {
-      std::ofstream tmpos( tmpfile.path().c_str() );
+      ofstream tmpos( tmpfile.path().c_str() );
       for_( it, rpmKeys.begin(), rpmKeys.end() )
       {
        // we export the rpm key into a file
        RpmHeader::constPtr result;
-       getData( "gpg-pubkey", *it, result );
+       getData( string("gpg-pubkey"), *it, result );
        tmpos << result->tag_description() << endl;
       }
     }
@@ -1045,7 +1046,7 @@ void RpmDb::importPubkey( const PublicKey & pubkey_r )
 
   // check if the key is already in the rpm database
   Edition keyEd( pubkey_r.gpgPubkeyVersion(), pubkey_r.gpgPubkeyRelease() );
-  std::set<Edition> rpmKeys = pubkeyEditions();
+  set<Edition> rpmKeys = pubkeyEditions();
   bool hasOldkeys = false;
 
   for_( it, rpmKeys.begin(), rpmKeys.end() )
@@ -1085,7 +1086,7 @@ void RpmDb::importPubkey( const PublicKey & pubkey_r )
     // rpm3 database, if the current database is a temporary one.
     run_rpm( opts, ExternalProgram::Stderr_To_Stdout );
 
-    std::string line;
+    string line;
     while ( systemReadLine( line ) )
     {
       ( str::startsWith( line, "error:" ) ? WAR : DBG ) << line << endl;
@@ -1105,14 +1106,13 @@ void RpmDb::importPubkey( const PublicKey & pubkey_r )
   RpmArgVec opts;
   opts.push_back ( "--import" );
   opts.push_back ( "--" );
-  std::string pubkeypath( pubkey_r.path().asString() );
-  opts.push_back ( pubkeypath.c_str() );
+  opts.push_back ( pubkey_r.path().asString().c_str() );
 
   // don't call modifyDatabase because it would remove the old
   // rpm3 database, if the current database is a temporary one.
   run_rpm( opts, ExternalProgram::Stderr_To_Stdout );
 
-  std::string line;
+  string line;
   while ( systemReadLine( line ) )
   {
     ( str::startsWith( line, "error:" ) ? WAR : DBG ) << line << endl;
@@ -1143,8 +1143,8 @@ void RpmDb::removePubkey( const PublicKey & pubkey_r )
 
   // check if the key is in the rpm database and just
   // return if it does not.
-  std::set<Edition> rpm_keys = pubkeyEditions();
-  std::set<Edition>::const_iterator found_edition = rpm_keys.end();
+  set<Edition> rpm_keys = pubkeyEditions();
+  set<Edition>::const_iterator found_edition = rpm_keys.end();
   std::string pubkeyVersion( pubkey_r.gpgPubkeyVersion() );
 
   for_( it, rpm_keys.begin(), rpm_keys.end() )
@@ -1163,7 +1163,7 @@ void RpmDb::removePubkey( const PublicKey & pubkey_r )
       return;
   }
 
-  std::string rpm_name("gpg-pubkey-" + found_edition->asString());
+  string rpm_name("gpg-pubkey-" + found_edition->asString());
 
   RpmArgVec opts;
   opts.push_back ( "-e" );
@@ -1174,7 +1174,7 @@ void RpmDb::removePubkey( const PublicKey & pubkey_r )
   // rpm3 database, if the current database is a temporary one.
   run_rpm( opts, ExternalProgram::Stderr_To_Stdout );
 
-  std::string line;
+  string line;
   while ( systemReadLine( line ) )
   {
     if ( line.substr( 0, 6 ) == "error:" )
@@ -1206,23 +1206,23 @@ void RpmDb::removePubkey( const PublicKey & pubkey_r )
 //
 //
 //     METHOD NAME : RpmDb::pubkeys
-//     METHOD TYPE : std::set<Edition>
+//     METHOD TYPE : set<Edition>
 //
-std::list<PublicKey> RpmDb::pubkeys() const
+list<PublicKey> RpmDb::pubkeys() const
 {
-  std::list<PublicKey> ret;
+  list<PublicKey> ret;
 
   librpmDb::db_const_iterator it;
-  for ( it.findByName( "gpg-pubkey" ); *it; ++it )
+  for ( it.findByName( string( "gpg-pubkey" ) ); *it; ++it )
   {
     Edition edition = it->tag_edition();
     if (edition != Edition::noedition)
     {
       // we export the rpm key into a file
       RpmHeader::constPtr result;
-      getData( "gpg-pubkey", edition, result );
+      getData( string("gpg-pubkey"), edition, result );
       TmpFile file(getZYpp()->tmpPath());
-      std::ofstream os;
+      ofstream os;
       try
       {
         os.open(file.path().asString().c_str());
@@ -1236,7 +1236,7 @@ std::list<PublicKey> RpmDb::pubkeys() const
         PublicKey key(file);
         ret.push_back(key);
       }
-      catch ( std::exception & e )
+      catch (exception &e)
       {
         ERR << "Could not dump key " << edition.asString() << " in tmp file " << file.path() << endl;
         // just ignore the key
@@ -1246,12 +1246,12 @@ std::list<PublicKey> RpmDb::pubkeys() const
   return ret;
 }
 
-std::set<Edition> RpmDb::pubkeyEditions() const
+set<Edition> RpmDb::pubkeyEditions() const
   {
-    std::set<Edition> ret;
+    set<Edition> ret;
 
     librpmDb::db_const_iterator it;
-    for ( it.findByName( "gpg-pubkey" ); *it; ++it )
+    for ( it.findByName( string( "gpg-pubkey" ) ); *it; ++it )
     {
       Edition edition = it->tag_edition();
       if (edition != Edition::noedition)
@@ -1269,10 +1269,10 @@ std::set<Edition> RpmDb::pubkeyEditions() const
 //
 //     DESCRIPTION :
 //
-std::list<FileInfo>
-RpmDb::fileList( const std::string & name_r, const Edition & edition_r ) const
+list<FileInfo>
+RpmDb::fileList( const string & name_r, const Edition & edition_r ) const
 {
-  std::list<FileInfo> result;
+  list<FileInfo> result;
 
   librpmDb::db_const_iterator it;
   bool found;
@@ -1299,7 +1299,7 @@ RpmDb::fileList( const std::string & name_r, const Edition & edition_r ) const
 //
 //     DESCRIPTION :
 //
-bool RpmDb::hasFile( const std::string & file_r, const std::string & name_r ) const
+bool RpmDb::hasFile( const string & file_r, const string & name_r ) const
 {
   librpmDb::db_const_iterator it;
   bool res;
@@ -1321,11 +1321,11 @@ bool RpmDb::hasFile( const std::string & file_r, const std::string & name_r ) co
 //
 //
 //     METHOD NAME : RpmDb::whoOwnsFile
-//     METHOD TYPE : std::string
+//     METHOD TYPE : string
 //
 //     DESCRIPTION :
 //
-std::string RpmDb::whoOwnsFile( const std::string & file_r) const
+string RpmDb::whoOwnsFile( const string & file_r) const
 {
   librpmDb::db_const_iterator it;
   if (it.findByFile( file_r ))
@@ -1343,7 +1343,7 @@ std::string RpmDb::whoOwnsFile( const std::string & file_r) const
 //
 //     DESCRIPTION :
 //
-bool RpmDb::hasProvides( const std::string & tag_r ) const
+bool RpmDb::hasProvides( const string & tag_r ) const
 {
   librpmDb::db_const_iterator it;
   return it.findByProvides( tag_r );
@@ -1357,7 +1357,7 @@ bool RpmDb::hasProvides( const std::string & tag_r ) const
 //
 //     DESCRIPTION :
 //
-bool RpmDb::hasRequiredBy( const std::string & tag_r ) const
+bool RpmDb::hasRequiredBy( const string & tag_r ) const
 {
   librpmDb::db_const_iterator it;
   return it.findByRequiredBy( tag_r );
@@ -1371,7 +1371,7 @@ bool RpmDb::hasRequiredBy( const std::string & tag_r ) const
 //
 //     DESCRIPTION :
 //
-bool RpmDb::hasConflicts( const std::string & tag_r ) const
+bool RpmDb::hasConflicts( const string & tag_r ) const
 {
   librpmDb::db_const_iterator it;
   return it.findByConflicts( tag_r );
@@ -1385,7 +1385,7 @@ bool RpmDb::hasConflicts( const std::string & tag_r ) const
 //
 //     DESCRIPTION :
 //
-bool RpmDb::hasPackage( const std::string & name_r ) const
+bool RpmDb::hasPackage( const string & name_r ) const
 {
   librpmDb::db_const_iterator it;
   return it.findPackage( name_r );
@@ -1399,7 +1399,7 @@ bool RpmDb::hasPackage( const std::string & name_r ) const
 //
 //     DESCRIPTION :
 //
-bool RpmDb::hasPackage( const std::string & name_r, const Edition & ed_r ) const
+bool RpmDb::hasPackage( const string & name_r, const Edition & ed_r ) const
 {
   librpmDb::db_const_iterator it;
   return it.findPackage( name_r, ed_r );
@@ -1413,7 +1413,7 @@ bool RpmDb::hasPackage( const std::string & name_r, const Edition & ed_r ) const
 //
 //     DESCRIPTION :
 //
-void RpmDb::getData( const std::string & name_r,
+void RpmDb::getData( const string & name_r,
                      RpmHeader::constPtr & result_r ) const
 {
   librpmDb::db_const_iterator it;
@@ -1431,7 +1431,7 @@ void RpmDb::getData( const std::string & name_r,
 //
 //     DESCRIPTION :
 //
-void RpmDb::getData( const std::string & name_r, const Edition & ed_r,
+void RpmDb::getData( const string & name_r, const Edition & ed_r,
                      RpmHeader::constPtr & result_r ) const
 {
   librpmDb::db_const_iterator it;
@@ -1525,8 +1525,7 @@ RpmDb::CheckPackageResult RpmDb::checkPackage( const Pathname & path_r, CheckPac
 
   if ( res == 0 )
   {
-    // remove trailing NL!
-    detail_r.push_back( CheckPackageDetail::value_type( CHK_OK, str::rtrim( std::move(vresult) ) ) );
+    detail_r.push_back( CheckPackageDetail::value_type( CHK_OK, std::move(vresult) ) );
     return CHK_OK;
   }
 
@@ -1577,7 +1576,7 @@ RpmDb::CheckPackageResult RpmDb::checkPackage( const Pathname & path_r )
 
 // determine changed files of installed package
 bool
-RpmDb::queryChangedFiles(FileList & fileList, const std::string& packageName)
+RpmDb::queryChangedFiles(FileList & fileList, const string& packageName)
 {
   bool ok = true;
 
@@ -1610,7 +1609,7 @@ RpmDb::queryChangedFiles(FileList & fileList, const std::string& packageName)
    M      Mode (includes permissions and file type)
   */
 
-  std::string line;
+  string line;
   while (systemReadLine(line))
   {
     if (line.length() > 12 &&
@@ -1618,7 +1617,7 @@ RpmDb::queryChangedFiles(FileList & fileList, const std::string& packageName)
          (line[0] == '.' && line[7] == 'T')))
     {
       // file has been changed
-      std::string filename;
+      string filename;
 
       filename.assign(line, 11, line.length() - 11);
       fileList.insert(filename);
@@ -1689,7 +1688,7 @@ RpmDb::run_rpm (const RpmArgVec& opts,
 /*--------------------------------------------------------------*/
 /* Read a line from the rpm process                            */
 /*--------------------------------------------------------------*/
-bool RpmDb::systemReadLine( std::string & line )
+bool RpmDb::systemReadLine( string & line )
 {
   line.erase();
 
@@ -1738,7 +1737,7 @@ bool RpmDb::systemReadLine( std::string & line )
          {
            if ( linebuffer[nread-1] == '\n' )
              --nread;
-           line += std::string( linebuffer, nread );
+           line += string( linebuffer, nread );
          }
 
          if ( ! ::ferror( inputfile ) || ::feof( inputfile ) )
@@ -1793,19 +1792,19 @@ RpmDb::systemKill()
 
 
 // generate diff mails for config files
-void RpmDb::processConfigFiles(const std::string& line, const std::string& name, const char* typemsg, const char* difffailmsg, const char* diffgenmsg)
+void RpmDb::processConfigFiles(const string& line, const string& name, const char* typemsg, const char* difffailmsg, const char* diffgenmsg)
 {
-  std::string msg = line.substr(9);
-  std::string::size_type pos1 = std::string::npos;
-  std::string::size_type pos2 = std::string::npos;
-  std::string file1s, file2s;
+  string msg = line.substr(9);
+  string::size_type pos1 = string::npos;
+  string::size_type pos2 = string::npos;
+  string file1s, file2s;
   Pathname file1;
   Pathname file2;
 
   pos1 = msg.find (typemsg);
   for (;;)
   {
-    if ( pos1 == std::string::npos )
+    if ( pos1 == string::npos )
       break;
 
     pos2 = pos1 + strlen (typemsg);
@@ -1825,7 +1824,7 @@ void RpmDb::processConfigFiles(const std::string& line, const std::string& name,
       file2 = _root + file2;
     }
 
-    std::string out;
+    string out;
     int ret = diffFiles (file1.asString(), file2.asString(), out, 25);
     if (ret)
     {
@@ -1836,7 +1835,7 @@ void RpmDb::processConfigFiles(const std::string& line, const std::string& name,
         break;
       }
       file += Date(Date::now()).form("config_diff_%Y_%m_%d.log");
-      std::ofstream notify(file.asString().c_str(), std::ios::out|std::ios::app);
+      ofstream notify(file.asString().c_str(), ios::out|ios::app);
       if (!notify)
       {
         ERR << "Could not open " <<  file << endl;
@@ -1864,8 +1863,8 @@ void RpmDb::processConfigFiles(const std::string& line, const std::string& name,
           {
             out.replace(4, file1.asString().length(), file1s);
           }
-          std::string::size_type pos = out.find("\n+++ ");
-          if (pos != std::string::npos)
+          string::size_type pos = out.find("\n+++ ");
+          if (pos != string::npos)
           {
             out.replace(pos+5, file2.asString().length(), file2s);
           }
@@ -1978,15 +1977,15 @@ void RpmDb::doInstallPackage( const Pathname & filename, RpmInstFlags flags, cal
   opts.push_back("--");
 
   // rpm requires additional quoting of special chars:
-  std::string quotedFilename( rpmQuoteFilename( workaroundRpmPwdBug( filename ) ) );
+  string quotedFilename( rpmQuoteFilename( workaroundRpmPwdBug( filename ) ) );
   opts.push_back ( quotedFilename.c_str() );
 
   modifyDatabase(); // BEFORE run_rpm
   run_rpm( opts, ExternalProgram::Stderr_To_Stdout );
 
-  std::string line;
-  std::string rpmmsg;
-  std::vector<std::string> configwarnings;
+  string line;
+  string rpmmsg;
+  vector<string> configwarnings;
 
   unsigned linecnt = 0;
   while (systemReadLine(line))
@@ -2016,7 +2015,7 @@ void RpmDb::doInstallPackage( const Pathname & filename, RpmInstFlags flags, cal
   int rpm_status = systemStatus();
 
   // evaluate result
-  for (std::vector<std::string>::iterator it = configwarnings.begin();
+  for (vector<string>::iterator it = configwarnings.begin();
        it != configwarnings.end(); ++it)
   {
     processConfigFiles(*it, Pathname::basename(filename), " saved as ",
@@ -2036,18 +2035,19 @@ void RpmDb::doInstallPackage( const Pathname & filename, RpmInstFlags flags, cal
     historylog.comment(
         str::form("%s install failed", Pathname::basename(filename).c_str()),
         true /*timestamp*/);
-    std::ostringstream sstr;
+    ostringstream sstr;
     sstr << "rpm output:" << endl << rpmmsg << endl;
     historylog.comment(sstr.str());
     // TranslatorExplanation the colon is followed by an error message
-    ZYPP_THROW(RpmSubprocessException(_("RPM failed: ") + (rpmmsg.empty() ? error_message : rpmmsg) ));
+    ZYPP_THROW(RpmSubprocessException(string(_("RPM failed: ")) +
+               (rpmmsg.empty() ? error_message : rpmmsg)));
   }
   else if ( ! rpmmsg.empty() )
   {
     historylog.comment(
         str::form("%s installed ok", Pathname::basename(filename).c_str()),
         true /*timestamp*/);
-    std::ostringstream sstr;
+    ostringstream sstr;
     sstr << "Additional rpm output:" << endl << rpmmsg << endl;
     historylog.comment(sstr.str());
 
@@ -2078,7 +2078,7 @@ void RpmDb::removePackage( Package::constPtr package, RpmInstFlags flags )
 //     METHOD NAME : RpmDb::removePackage
 //     METHOD TYPE : PMError
 //
-void RpmDb::removePackage( const std::string & name_r, RpmInstFlags flags )
+void RpmDb::removePackage( const string & name_r, RpmInstFlags flags )
 {
   callback::SendReport<RpmRemoveReport> report;
 
@@ -2109,7 +2109,7 @@ void RpmDb::removePackage( const std::string & name_r, RpmInstFlags flags )
 }
 
 
-void RpmDb::doRemovePackage( const std::string & name_r, RpmInstFlags flags, callback::SendReport<RpmRemoveReport> & report )
+void RpmDb::doRemovePackage( const string & name_r, RpmInstFlags flags, callback::SendReport<RpmRemoveReport> & report )
 {
   FAILIFNOTINITIALIZED;
   HistoryLog historylog;
@@ -2156,8 +2156,8 @@ void RpmDb::doRemovePackage( const std::string & name_r, RpmInstFlags flags, cal
   modifyDatabase(); // BEFORE run_rpm
   run_rpm (opts, ExternalProgram::Stderr_To_Stdout);
 
-  std::string line;
-  std::string rpmmsg;
+  string line;
+  string rpmmsg;
 
   // got no progress from command, so we fake it:
   // 5  - command started
@@ -2182,18 +2182,19 @@ void RpmDb::doRemovePackage( const std::string & name_r, RpmInstFlags flags, cal
   {
     historylog.comment(
         str::form("%s remove failed", name_r.c_str()), true /*timestamp*/);
-    std::ostringstream sstr;
+    ostringstream sstr;
     sstr << "rpm output:" << endl << rpmmsg << endl;
     historylog.comment(sstr.str());
     // TranslatorExplanation the colon is followed by an error message
-    ZYPP_THROW(RpmSubprocessException(_("RPM failed: ") + (rpmmsg.empty() ? error_message: rpmmsg) ));
+    ZYPP_THROW(RpmSubprocessException(string(_("RPM failed: ")) +
+               (rpmmsg.empty() ? error_message: rpmmsg)));
   }
   else if ( ! rpmmsg.empty() )
   {
     historylog.comment(
         str::form("%s removed ok", name_r.c_str()), true /*timestamp*/);
 
-    std::ostringstream sstr;
+    ostringstream sstr;
     sstr << "Additional rpm output:" << endl << rpmmsg << endl;
     historylog.comment(sstr.str());
 
@@ -2224,7 +2225,7 @@ bool RpmDb::backupPackage( const Pathname & filename )
 //     METHOD NAME : RpmDb::backupPackage
 //     METHOD TYPE : bool
 //
-bool RpmDb::backupPackage(const std::string& packageName)
+bool RpmDb::backupPackage(const string& packageName)
 {
   HistoryLog progresslog;
   bool ret = true;
@@ -2282,7 +2283,7 @@ bool RpmDb::backupPackage(const std::string& packageName)
       return false;
     }
 
-    std::ofstream fp ( filestobackupfile.asString().c_str(), std::ios::out|std::ios::trunc );
+    ofstream fp ( filestobackupfile.asString().c_str(), ios::out|ios::trunc );
 
     if (!fp)
     {
@@ -2293,7 +2294,7 @@ bool RpmDb::backupPackage(const std::string& packageName)
     for (FileList::const_iterator cit = fileList.begin();
          cit != fileList.end(); ++cit)
     {
-      std::string name = *cit;
+      string name = *cit;
       if ( name[0] == '/' )
       {
         // remove slash, file must be relative to -C parameter of tar
@@ -2321,11 +2322,11 @@ bool RpmDb::backupPackage(const std::string& packageName)
     // execute tar in inst-sys (we dont know if there is a tar below _root !)
     ExternalProgram tar(argv, ExternalProgram::Stderr_To_Stdout, false, -1, true);
 
-    std::string tarmsg;
+    string tarmsg;
 
     // TODO: its probably possible to start tar with -v and watch it adding
     // files to report progress
-    for (std::string output = tar.receiveLine(); output.length() ;output = tar.receiveLine())
+    for (string output = tar.receiveLine(); output.length() ;output = tar.receiveLine())
     {
       tarmsg+=output;
     }