shithub: mc

Download patch

ref: 43149c34053a8ba8320d2b021ca6d6ba86601985
parent: 6af02a3600c74a974bfdcec12ead515a611a0234
author: Ori Bernstein <[email protected]>
date: Thu Oct 18 23:04:44 EDT 2012

Search default system include path last.

    We used to search the system include path before any
    user specified ones. This doesn't allow us to override the
    system libraries.

    Fix the search order.

--- a/6/main.c
+++ b/6/main.c
@@ -58,7 +58,6 @@
     Stab *globls;
     char buf[1024];
 
-    lappend(&incpaths, &nincpaths, Instroot "/lib/myr");
     while ((opt = getopt(argc, argv, "d::hSo:I:")) != -1) {
         switch (opt) {
             case 'o':
@@ -86,6 +85,7 @@
         }
     }
 
+    lappend(&incpaths, &nincpaths, Instroot "/lib/myr");
     for (i = optind; i < argc; i++) {
         globls = mkstab();
         tyinit(globls);
--- a/libstd/Makefile
+++ b/libstd/Makefile
@@ -46,7 +46,6 @@
 	rm -f $(JUNKASM) test.s
 	rm -f lib$(MYRLIB).a
 
-
 install:
 	mkdir -p  $(INST_ROOT)/lib/myr
 	install libstd.a $(INST_ROOT)/lib/myr
--- a/libstd/fmt.myr
+++ b/libstd/fmt.myr
@@ -32,6 +32,7 @@
 	var i_val : int32
 	var l_val : int64
 	var p_val : byte*
+        var c_val : char
 
 	n = 0
 	while fmt.len
@@ -64,6 +65,9 @@
 				(p_val, ap) = vanext(ap)
 				n += intfmt(buf[n:], p_val castto(int64), 16)
 				;;
+                        'c':    (c_val, ap) = vanext(ap)
+                                n += encode(buf[n:], c)
+                                ;;
                         _:
                                 die("Unknown format specifier")
                                 ;;
--- a/libstd/test.myr
+++ b/libstd/test.myr
@@ -4,11 +4,20 @@
 	var x : byte*[1024]
 	var sz
 	var i
+        var opt
+        var o
 
 	std.put("args.len = %i\n", args.len)
 	for i = 0; i < args.len; i++
 		std.put("args[%i] = %s\n", i, args[i])
 	;;
+
+        opt = std.optinit("asdf:", args)
+        while (o = std.optnext(opt)) != std.Badchar
+        	std.put("option %c\n", o)
+        ;;
+
+        
 	/* try the byte allocator for large variety of sizes. */
 	for sz = 1; sz < 65536; sz *= 2
 		for i = 0; i < 1024; i++
--- a/muse/muse.c
+++ b/muse/muse.c
@@ -89,7 +89,6 @@
     int opt;
     int i;
 
-    lappend(&incpaths, &nincpaths, Instroot "/lib/myr");
     while ((opt = getopt(argc, argv, "d::hmo:I:")) != -1) {
         switch (opt) {
             case 'h':
@@ -117,6 +116,7 @@
         }
     }
 
+    lappend(&incpaths, &nincpaths, Instroot "/lib/myr");
     if (merge) {
         if (!outfile) {
             fprintf(stderr, "Output file needed when merging usefiles.");