about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/fix.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/fix.cc b/src/fix.cc
index eb77a494229c..0797362fd0ee 100644
--- a/src/fix.cc
+++ b/src/fix.cc
@@ -208,6 +208,14 @@ static Expr evalExpr(Expr e)
         return ATmake("Include(<str>)", ((string) eHash).c_str());
     }
 
+    /* BaseName primitive function. */
+    if (ATmatch(e, "BaseName(<term>)", &e1)) {
+        e1 = evalExpr(e1);
+        if (!ATmatch(e1, "<str>", &s1)) 
+            throw badTerm("string expected", e1);
+        return ATmake("<str>", baseNameOf(s1).c_str());
+    }
+
     /* Barf. */
     throw badTerm("invalid expression", e);
 }