diff options
author | Roderick W. Smith <rodsmith@rodsbooks.com> | 2013-07-06 22:52:58 -0400 |
---|---|---|
committer | Roderick W. Smith <rodsmith@rodsbooks.com> | 2013-07-06 22:52:58 -0400 |
commit | 1eea9b0b51367472ce12efb59b0018c0ac96a463 (patch) | |
tree | 88c2eacf1fbcb909a24b60fab44151ea137d5965 /cgdisk.cc | |
parent | f5dfbfa418675ca862408e4fb2240b21dd07d558 (diff) | |
download | sgdisk-1eea9b0b51367472ce12efb59b0018c0ac96a463.tar.gz |
New partition type codes & "-a" option for cgdisk
Diffstat (limited to 'cgdisk.cc')
-rw-r--r-- | cgdisk.cc | 19 |
1 files changed, 16 insertions, 3 deletions
@@ -20,7 +20,7 @@ /* This class implements an interactive curses-based interface atop the GPTData class */ -#include <string> +#include <string.h> #include "gptcurses.h" using namespace std; @@ -29,6 +29,7 @@ using namespace std; int main(int argc, char *argv[]) { string device = ""; + int displayType = USE_CURSES; if (!SizesOK()) exit(1); @@ -41,16 +42,28 @@ int main(int argc, char *argv[]) { exit(0); break; case 2: // basic usage - device = argv[1]; + device = (string) argv[1]; + break; + case 3: // "-a" usage or illegal + if (strcmp(argv[1], "-a") == 0) { + device = (string) argv[2]; + } else if (strcmp(argv[2], "-a") == 0) { + device = (string) argv[1]; + } else { + cerr << "Usage: " << argv[0] << " [-a] device_file\n"; + exit(1); + } // if/elseif/else + displayType = USE_ARROW; break; default: - cerr << "Usage: " << argv[0] << " device_file\n"; + cerr << "Usage: " << argv[0] << " [-a] device_file\n"; exit(1); break; } // switch GPTDataCurses theGPT; + theGPT.SetDisplayType(displayType); if (theGPT.LoadPartitions(device)) { if (theGPT.GetState() != use_gpt) { Report("Warning! Non-GPT or damaged disk detected! This program will attempt to\n" |