summaryrefslogtreecommitdiff
path: root/cgdisk.cc
diff options
context:
space:
mode:
authorRoderick W. Smith <rodsmith@rodsbooks.com>2013-07-06 22:52:58 -0400
committerRoderick W. Smith <rodsmith@rodsbooks.com>2013-07-06 22:52:58 -0400
commit1eea9b0b51367472ce12efb59b0018c0ac96a463 (patch)
tree88c2eacf1fbcb909a24b60fab44151ea137d5965 /cgdisk.cc
parentf5dfbfa418675ca862408e4fb2240b21dd07d558 (diff)
downloadsgdisk-1eea9b0b51367472ce12efb59b0018c0ac96a463.tar.gz
New partition type codes & "-a" option for cgdisk
Diffstat (limited to 'cgdisk.cc')
-rw-r--r--cgdisk.cc19
1 files changed, 16 insertions, 3 deletions
diff --git a/cgdisk.cc b/cgdisk.cc
index 1d52ee2..7e967cc 100644
--- a/cgdisk.cc
+++ b/cgdisk.cc
@@ -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"