]> Cypherpunks repositories - gostls13.git/commitdiff
put center dot into main_main
authorRob Pike <r@golang.org>
Wed, 25 Jun 2008 00:58:18 +0000 (17:58 -0700)
committerRob Pike <r@golang.org>
Wed, 25 Jun 2008 00:58:18 +0000 (17:58 -0700)
restore smashed arg code, lost in incorrect resolve

SVN=124432

src/runtime/rt0_amd64_darwin.s
src/runtime/runtime.c

index e2794183bfcf4309349b867334254fa0302a0ccc..031cc059df5811b1f12fc318c229412d95e0fa48 100644 (file)
@@ -30,7 +30,7 @@ done:
        CALL    args(SB)
        ADDQ    $16, SP
        CALL    check(SB)
-       CALL    main_main(SB)
+       CALL    main·main(SB)
        CALL    sys·exit(SB)
        CALL    notok(SB)
        POPQ    AX
index c15316351829ea72626a5b70a264ddfce5675266..c0ad2cce8939cbc949f39a356c86f2883c45c291 100644 (file)
@@ -750,6 +750,82 @@ sys·modf(float64 din, float64 dou1, float64 dou2)
        FLUSH(&dou2);
 }
 
+static int32   argc;
+static uint8** argv;
+static int32   envc;
+static uint8** envv;
+
+
+void
+args(int32 c, uint8 **v)
+{
+       argc = c;
+       argv = v;
+       envv = v + argc + 1;  // skip 0 at end of argv
+       for (envc = 0; envv[envc] != 0; envc++)
+               ;
+}
+
+//func argc() int32;  // return number of arguments
+void
+sys_argc(int32 v)
+{
+       v = argc;
+       FLUSH(&v);
+}
+
+//func envc() int32;  // return number of environment variables
+void
+sys_envc(int32 v)
+{
+       v = envc;
+       FLUSH(&v);
+}
+
+//func argv(i) string;  // return argument i
+void
+sys_argv(int32 i, string s)
+{
+       uint8* str;
+       int32 l;
+
+       if(i < 0 || i >= argc) {
+               s = emptystring;
+               goto out;
+       }
+
+       str = argv[i];
+       l = findnull((int8*)str);
+       s = mal(sizeof(s->len)+l);
+       s->len = l;
+       mcpy(s->str, str, l);
+
+out:
+       FLUSH(&s);
+}
+
+//func envv(i) string;  // return argument i
+void
+sys_envv(int32 i, string s)
+{
+       uint8* str;
+       int32 l;
+
+       if(i < 0 || i >= envc) {
+               s = emptystring;
+               goto out;
+       }
+
+       str = envv[i];
+       l = findnull((int8*)str);
+       s = mal(sizeof(s->len)+l);
+       s->len = l;
+       mcpy(s->str, str, l);
+
+out:
+       FLUSH(&s);
+}
+
 check(void)
 {
        int8 a;