// Socket.C -*- C++ -*-
-// Copyright (C) 2002 Clinton Ebadi
+// Copyright (C) 2002,2005 Clinton Ebadi
// Copyright (c) 1997, 1998 Etienne BERNARD
// This program is free software; you can redistribute it and/or modify
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
-// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+// 02110-1301, USA.
#include "Socket.H"
#include "Bot.H"
} while (r != '\n');
if (pos > 1 && buf[pos-2] == '\r')
- buf[pos-2] = '\0';
+ {
+ buf[pos-2] = '\0';
+ return String (buf.substr (0, pos - 2));
+ }
else
- buf[pos-1] = '\0';
-
- // c_str () is used because the String constructor for std::string
- // will copy the entire std::string into it when we only want it to
- // copy up to the first null.
- return String (buf.c_str ());
+ {
+ buf[pos-1] = '\0';
+ return String (buf.substr (0, pos - 1));
+ }
}
String