hello.c - vx32 - Local 9vx git repository for patches.
(HTM) git clone git://r-36.net/vx32
(DIR) Log
(DIR) Files
(DIR) Refs
---
hello.c (647B)
---
1 #include <stdio.h>
2 #include <unistd.h>
3 #include <stdlib.h>
4 #include <string.h>
5
6 int
7 main(int argc, char **argv)
8 {
9 int i;
10 unsigned long a, b, c;
11
12 printf("argc %d argv %p\n", argc, argv);
13 a = 1;
14 b = 2;
15 c = 3;
16 write(1, "hello\n", 6);
17 printf("%8ld %8ld %8ld\n", a, b, c);
18
19 double d;
20 sscanf("30.0", "%lf", &d);
21 printf("%g\n", d);
22 printf("%g\n", strtod("30.0", NULL));
23
24 printf("%d args\n", argc);
25 for(i=0; i<argc; i++){
26 printf("arg%d: %s\n", i, argv[i]);
27 }
28 extern char **environ;
29 for(i=0; environ[i]; i++){
30 printf("env%d: %s\n", i, environ[i]);
31 }
32
33 int x;
34 __asm("fnstcw %0" : "=m" (x));
35 printf("float %x\n", x);
36 return 0;
37 }
38