Increased the buffer size and added an error when a line too long is met.
[selector.git] / selector.cc
index 06456ab..f5b9d2d 100644 (file)
@@ -41,7 +41,7 @@ using namespace std;
 
 #define VERSION "1.0"
 
-const int buffer_size = 1024;
+const int buffer_size = 4096;
 
 // Yeah, global variables!
 
@@ -544,7 +544,13 @@ int main(int argc, char **argv) {
 
     file.getline(raw_line, buffer_size);
 
-    if(strcmp(raw_line, "") != 0) {
+    if(file.fail()) {
+      cerr << "Line too long." << endl;
+      cerr << raw_line << endl;
+      exit(1);
+    }
+
+    if(raw_line[0]) {
 
       char *s, *t;
       const char *u;