8 #include <disktool_common.h>
15 " disktool <commands...>\n"
18 " lvm <image> <ident>\n"
19 " - Register an image with LVM\n"
21 " `lvm ../AcessHDD.img HDD`\n"
22 " mount <image> <mountname>\n"
23 " - Bind an image to a name.\n"
25 " `mount ../AcessFDD.img FDD`\n"
26 " `mount :HDD/0 hda1`\n"
28 " - List a directory\n"
36 int main(int argc, char *argv[])
39 for( int i = 1; i < argc; i ++ )
41 if( strcmp("mount", argv[i]) == 0 || strcmp("-i", argv[i]) == 0 ) {
44 fprintf(stderr, "mount takes 2 arguments (image and mountpoint)\n");
49 if( DiskTool_MountImage(argv[i+2], argv[i+1]) ) {
50 fprintf(stderr, "Unable to mount '%s' as '%s'\n", argv[i+1], argv[i+2]);
58 if( strcmp("mountlvm", argv[i]) == 0 || strcmp("lvm", argv[i]) == 0 ) {
61 fprintf(stderr, "lvm takes 2 arguments (iamge and ident)\n");
66 if( DiskTool_RegisterLVM(argv[i+2], argv[i+1]) ) {
67 fprintf(stderr, "Unable to register '%s' as LVM '%s'\n", argv[i+1], argv[i+2]);
75 if( strcmp("ls", argv[i]) == 0 ) {
77 fprintf(stderr, "ls takes 1 argument (path)\n");
82 DiskTool_ListDirectory(argv[i+1]);
87 if( strcmp("cp", argv[i]) == 0 ) {
90 fprintf(stderr, "cp takes 2 arguments (source and destination)\n");
95 DiskTool_Copy(argv[i+1], argv[i+2]);
101 if( strcmp("cat", argv[i]) == 0 ) {
104 fprintf(stderr, "cat takes 1 argument (path)\n");
109 DiskTool_Cat(argv[i+1]);
115 fprintf(stderr, "Unknown command '%s'\n", argv[i]);
124 // NOTE: This is in a native compiled file because it needs access to the real errno macro
125 int *Threads_GetErrno(void)
130 size_t _fwrite_stdout(size_t bytes, const void *data)
132 return fwrite(data, bytes, 1, stdout);