DiskTool - Now compiles (but does nothing)
[tpg/acess2.git] / Tools / DiskTool / src / main.c
1 /*
2  */
3 #include <stdlib.h>
4 #include <stdio.h>
5 #include <errno.h>
6 #include <stdint.h>
7 #include <string.h>
8
9 // === CODE ===
10 int main(int argc, char *argv[])
11 {
12         
13         return 0;
14 }
15
16 // NOTE: This is in a native compiled file because it needs access to the real errno macro
17 int *Threads_GetErrno(void)
18 {
19         return &errno;
20 }
21
22 // TODO: Move into a helper lib?
23 void itoa(char *buf, uint64_t num, int base, int minLength, char pad)
24 {
25         char fmt[] = "%0ll*x";
26         switch(base)
27         {
28         case  8:        fmt[5] = 'o';   break;
29         case 10:        fmt[5] = 'd';   break;
30         case 16:        fmt[5] = 'x';   break;
31         }
32         if(pad != '0') {
33                 fmt[1] = '%';
34                 sprintf(buf, fmt+1, minLength, num);
35         }
36         else {
37                 sprintf(buf, fmt, minLength, num);
38         }
39 }
40
41 int strpos(const char *Str, char Ch)
42 {
43         const char *r = strchr(Str, Ch);
44         if(!r)  return -1;
45         return r - Str;
46 }

UCC git Repository :: git.ucc.asn.au