shithub: mc

Download patch

ref: e2ca5299d6dbc0da053609361789274c02e3a6aa
parent: 8804ceff06b5562451c8d44c639bb88dd6990d3b
author: Ori Bernstein <[email protected]>
date: Fri Jan 25 13:20:48 EST 2013

Improve errors with malformed use file name.

--- a/myrbuild/myrbuild.c
+++ b/myrbuild/myrbuild.c
@@ -65,11 +65,15 @@
     return path[0] == '"' && path[strlen(path) - 1] == '"';
 }
 
-char *fromuse(char *path)
+char *usetomyr(char *path)
 {
     char buf[1024];
     /* skip initial quote */
     path++;
+    if (!hassuffix(path, ".use\"")) {
+        fprintf(stderr, "\"%s, should end with \".use\"\n", path);
+        exit(1);
+    }
     swapsuffix(buf, 1024, path, ".use\"", ".myr");
     return strdup(buf);
 }
@@ -185,7 +189,7 @@
         getdeps(file, deps, 512, &ndeps);
         for (i = 0; i < ndeps; i++) {
             if (isquoted(deps[i])) {
-                localdep = fromuse(deps[i]);
+                localdep = usetomyr(deps[i]);
                 compile(localdep);
                 free(localdep);
             } else {