Handle CTRL-C

Replxx uses errno to signify, that the user aborted the line. I have no
idea why they use errno, but it's like this even in their examples, so
it is supposed be used like this.

Change-Id: I4f2319c6f2d2e44d81374e222c74891b86f38aba
diff --git a/src/main.cpp b/src/main.cpp
index f702cb8..ec1b45c 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -62,7 +62,14 @@
     while (true) {
         auto line = lineEditor.input(parser.currentNode() + "> ");
         if (!line) {
-            break;
+            // If user pressed CTRL-C to abort the line, errno gets set to EAGAIN.
+            // If user pressed CTRL-D (for EOF), errno doesn't get set to EAGAIN, so we exit the program.
+            // I have no idea why replxx uses errno for this.
+            if (errno == EAGAIN) {
+                continue;
+            } else {
+                break;
+            }
         }
 
         std::locale C_locale("C");