#include <errno.h>
#include <stdint.h>
#include <string.h>
+#include <disktool_common.h>
// === CODE ===
int main(int argc, char *argv[])
{
+ // Setup
+
+ // Parse arguments
+ for( int i = 1; i < argc; i ++ )
+ {
+ if( strcmp("--image", argv[i]) == 0 || strcmp("-i", argv[i]) == 0 ) {
+ // Mount an image
+ if( argc - i < 3 ) {
+ fprintf(stderr, "--image/-i takes 2 arguments (ident and path)\n");
+ exit(-1);
+ }
+
+ if( DiskTool_MountImage(argv[i+1], argv[i+2]) ) {
+ fprintf(stderr, "Unable to mount '%s' as '%s'\n", argv[i+2], argv[i+1]);
+ exit(-1);
+ }
+
+ i += 2;
+ }
+ }
return 0;
}
+// NOTE: This is in a native compiled file because it needs access to the real errno macro
int *Threads_GetErrno(void)
{
return &errno;
}
// TODO: Move into a helper lib?
-extern void itoa(char *buf, uint64_t num, int base, int minLength, char pad)
+void itoa(char *buf, uint64_t num, int base, int minLength, char pad)
{
char fmt[] = "%0ll*x";
switch(base)