8 #include <disktool_common.h>
11 int main(int argc, char *argv[])
14 for( int i = 1; i < argc; i ++ )
16 if( strcmp("--image", argv[i]) == 0 || strcmp("-i", argv[i]) == 0 ) {
19 fprintf(stderr, "--image/-i takes 2 arguments (ident and path)\n");
23 if( DiskTool_MountImage(argv[i+1], argv[i+2]) ) {
24 fprintf(stderr, "Unable to mount '%s' as '%s'\n", argv[i+2], argv[i+1]);
34 // NOTE: This is in a native compiled file because it needs access to the real errno macro
35 int *Threads_GetErrno(void)
40 // TODO: Move into a helper lib?
41 void itoa(char *buf, uint64_t num, int base, int minLength, char pad)
43 char fmt[] = "%0ll*x";
46 case 8: fmt[5] = 'o'; break;
47 case 10: fmt[5] = 'd'; break;
48 case 16: fmt[5] = 'x'; break;
52 sprintf(buf, fmt+1, minLength, num);
55 sprintf(buf, fmt, minLength, num);
59 int strpos(const char *Str, char Ch)
61 const char *r = strchr(Str, Ch);
66 int strucmp(const char *s1, const char *s2)
68 return strcasecmp(s1, s2);
71 int64_t DivUp(int64_t value, int64_t divisor)
73 return (value + divisor - 1) / divisor;
76 int64_t timestamp(int sec, int min, int hr, int day, int month, int year)