Fix crash when providing bad command line argument
[clinton/bobotpp.git] / source / UserList.C
index 471dc83..afd49fa 100644 (file)
 
 // 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 <cstdlib>
 #include <fstream>
 #include <iostream>
 
@@ -37,7 +39,7 @@ UserList::~UserList()
 void
 UserList::read()
 {
-  std::ifstream file(listFilename);
+  std::ifstream file(listFilename.c_str ());
   String temp, empty = "";
   int line = 1;
 
@@ -73,9 +75,9 @@ UserList::read()
          password = "";
        }
       
-      l.push_back(new UserListItem(mask, maskChannel, atoi(level),
-                                  atoi(prot), atoi(aop),
-                                  atol(expiration), password));
+      l.push_back(new UserListItem(mask, maskChannel, std::atoi(level.c_str ()),
+                                  std::atoi(prot.c_str ()), std::atoi(aop.c_str ()),
+                                  std::atol(expiration.c_str ()), password));
       line++;
     }
 
@@ -86,7 +88,7 @@ void
 UserList::save()
 {
   std::list<UserListItem *>::iterator it = l.begin();
-  std::ofstream file(listFilename);
+  std::ofstream file(listFilename.c_str ());
   
   if (!file)
     return;