]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[2428] Placeholder for origin handling
authorMichal 'vorner' Vaner <michal.vaner@nic.cz>
Tue, 11 Dec 2012 18:54:12 +0000 (19:54 +0100)
committerMichal 'vorner' Vaner <michal.vaner@nic.cz>
Tue, 11 Dec 2012 18:54:12 +0000 (19:54 +0100)
The $INCLUDE can contain a name meaning origin. We don't handle origin
yet, that's #2427, but we at least mark the place where it should be
linked.

src/lib/dns/master_loader.cc

index e73ccee61573f3bd9019c3654a1a9f3885980b08..1f7b7d67d189537894e2f6b5ceff092a129fe2ec 100644 (file)
@@ -117,15 +117,29 @@ public:
     void doInclude() {
         // First, get the filename to include
         const MasterToken::StringRegion
-            filename(lexer_.getNextToken(MasterToken::QSTRING).
-                     getStringRegion());
-
-        // TODO: Handle Origin
+            filename_tok(lexer_.getNextToken(MasterToken::QSTRING).
+                         getStringRegion());
 
         // Push the filename. We abuse the fact that filename
         // may not contain '\0' anywhere in it, so we can
         // freely use the filename.beg directly.
-        pushSource(filename.beg);
+        string filename(filename_tok.beg);
+
+        // There could be an origin (or maybe not). So try looking
+        const MasterToken name_tok(lexer_.getNextToken(MasterToken::QSTRING,
+                                                       true));
+
+        if (name_tok.getType() == MasterToken::QSTRING ||
+            name_tok.getType() == MasterToken::STRING) {
+            // TODO: Handle the origin. Once we complete #2427.
+        } else {
+            // We return the newline there. This is because after we pop
+            // the source, we want to call eatUntilEOL and this would
+            // eat to the next one.
+            lexer_.ungetToken();
+        }
+
+        pushSource(filename);
     }
 
     void handleDirective(const char* directive, size_t length) {