New bitmap method SetRGBConversionFunction which can be used to
[tangerine.git] / workbench / c / Format / main.c
blob0b230b61aee4aa1c39afde8e86b9c06589563795
1 #include <proto/dos.h>
3 #include <exec/types.h>
4 #include <dos/dos.h>
6 #define SH_GLOBAL_DOSBASE TRUE
7 #include <aros/shcommands.h>
9 AROS_SH4
11 Format, 0.1,
12 AROS_SHA(STRPTR, , DRIVE, /K/A, NULL),
13 AROS_SHA(STRPTR, , NAME, /K/A, NULL),
14 AROS_SHA(BOOL, , FORCE, /S, FALSE),
15 AROS_SHA(BOOL, , QUIET, /S, FALSE)
18 AROS_SHCOMMAND_INIT
20 TEXT choice = 'N';
22 if (SHArg(QUIET) && !SHArg(FORCE))
24 PutStr("ERROR: Cannot specify QUIET without FORCE.\n");
25 return RETURN_FAIL;
28 if (!SHArg(FORCE))
30 Printf("About to format drive %s. ", SHArg(DRIVE));
31 Printf("This will destroy all data on the drive!\n");
32 Printf("Are you sure? (y/N)"); Flush(Output());
34 Read(Input(), &choice, 1);
36 else
38 choice = 'y';
41 if (choice == 'y' || choice == 'Y')
43 if (!SHArg(QUIET))
45 Printf("Formatting...");
46 Flush(Output());
49 if (Inhibit(SHArg(DRIVE), DOSTRUE))
51 if (Format(SHArg(DRIVE), SHArg(NAME), ID_FFS_DISK))
53 if (!SHArg(QUIET)) Printf("done\n");
55 else
57 goto error;
59 Inhibit(SHArg(DRIVE), DOSFALSE);
61 else
63 goto error;
67 return RETURN_OK;
69 error:
70 if (!SHArg(QUIET)) Printf("ERROR!\n");
72 return RETURN_FAIL;
74 AROS_SHCOMMAND_EXIT