8 #include <disktool_common.h>
11 int main(int argc, char *argv[])
14 for( int i = 1; i < argc; i ++ )
16 if( strcmp("mount", argv[i]) == 0 || strcmp("-i", argv[i]) == 0 ) {
19 fprintf(stderr, "mount takes 2 arguments (image and mountpoint)\n");
23 if( DiskTool_MountImage(argv[i+2], argv[i+1]) ) {
24 fprintf(stderr, "Unable to mount '%s' as '%s'\n", argv[i+1], argv[i+2]);
32 if( strcmp("mountlvm", argv[i]) == 0 || strcmp("lvm", argv[i]) == 0 ) {
35 fprintf(stderr, "lvm takes 2 arguments (iamge and ident)\n");
39 if( DiskTool_RegisterLVM(argv[i+2], argv[i+1]) ) {
40 fprintf(stderr, "Unable to register '%s' as LVM '%s'\n", argv[i+1], argv[i+2]);
48 if( strcmp("ls", argv[i]) == 0 ) {
50 fprintf(stderr, "ls takes 1 argument (path)\n");
54 DiskTool_ListDirectory(argv[i+1]);
59 if( strcmp("cp", argv[i]) == 0 ) {
62 fprintf(stderr, "cp takes 2 arguments (source and destination)\n");
66 DiskTool_Copy(argv[i+1], argv[i+2]);
72 if( strcmp("cat", argv[i]) == 0 ) {
75 fprintf(stderr, "cat takes 1 argument (path)\n");
79 DiskTool_Cat(argv[i+1]);
85 fprintf(stderr, "Unknown command '%s'\n", argv[i]);
93 // NOTE: This is in a native compiled file because it needs access to the real errno macro
94 int *Threads_GetErrno(void)
99 size_t _fwrite_stdout(size_t bytes, const void *data)
101 return fwrite(data, bytes, 1, stdout);