summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRod Smith <rodsmith@rodsbooks.com>2018-07-05 09:07:58 -0400
committerRod Smith <rodsmith@rodsbooks.com>2018-07-05 09:07:58 -0400
commit44cda477dfe10ced50fdd585252e396dc86501c3 (patch)
tree6fccffae89869e8ff8192dc2021c37c8f3c7f7b7
parent45f012b6f8d73a16b5e59891f5f9891fbfda0e54 (diff)
downloadsgdisk-44cda477dfe10ced50fdd585252e396dc86501c3.tar.gz
Added search/filter feature to "L" function to display partition type
codes.
-rw-r--r--NEWS8
-rw-r--r--cgdisk.88
-rw-r--r--fixparts.84
-rw-r--r--gdisk.819
-rw-r--r--gpt.cc2
-rw-r--r--gptcurses.cc2
-rw-r--r--gptcurses.h2
-rw-r--r--gptpart.cc2
-rw-r--r--gpttext.cc2
-rw-r--r--gpttext.h2
-rw-r--r--parttypes.cc30
-rw-r--r--parttypes.h2
-rw-r--r--sgdisk.84
-rw-r--r--support.cc2
-rw-r--r--support.h2
15 files changed, 59 insertions, 32 deletions
diff --git a/NEWS b/NEWS
index c37f47a..3c4ce82 100644
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,14 @@
1.0.4 (?/??/2018):
------------------
+- Added search feature to partition type list functions ("L" on main menu of
+ gdisk and "L" when entered in response to the "Hex code or GUID" prompt in
+ gdisk and sgdisk). This feature filters the partition type list to those
+ which include the search term in their GPT fdisk descriptions. For
+ instance, typing "Linux" shows only partitions with "Linux" in their
+ descriptions. Note that the search/filter is case-sensitive. If <Enter> is
+ pressed, no filter is applied.
+
- Change to Makefile.mac to use standard libncurses rather than a 3rd-party
version; should help with cgdisk compatibility.
diff --git a/cgdisk.8 b/cgdisk.8
index 1eb0453..ef982b4 100644
--- a/cgdisk.8
+++ b/cgdisk.8
@@ -1,6 +1,6 @@
-.\" Copyright 2011-2017 Roderick W. Smith (rodsmith@rodsbooks.com)
+.\" Copyright 2011-2018 Roderick W. Smith (rodsmith@rodsbooks.com)
.\" May be distributed under the GNU General Public License
-.TH "CGDISK" "8" "1.0.3" "Roderick W. Smith" "GPT fdisk Manual"
+.TH "CGDISK" "8" "1.0.4" "Roderick W. Smith" "GPT fdisk Manual"
.SH "NAME"
cgdisk \- Curses-based GUID partition table (GPT) manipulator
.SH "SYNOPSIS"
@@ -262,6 +262,10 @@ Change a single partition's type code. You enter the type code using a
two\-byte hexadecimal number. You may also enter a GUID directly, if you
have one and \fBcgdisk\fR doesn't know it. If you don't know the type code
for your partition, you can type \fBL\fR to see a list of known type codes.
+The type code list may optionally be filtered by a search string; for
+instance, entering \fI\fBLinux\fR\fR shows only partition type codes with
+descriptions that include the string \fILinux\fR. This search is performed
+case\-sensitively.
.TP
.B Verify
diff --git a/fixparts.8 b/fixparts.8
index de30b6a..163c247 100644
--- a/fixparts.8
+++ b/fixparts.8
@@ -1,6 +1,6 @@
-.\" Copyright 2011-2017 Roderick W. Smith (rodsmith@rodsbooks.com)
+.\" Copyright 2011-2018 Roderick W. Smith (rodsmith@rodsbooks.com)
.\" May be distributed under the GNU General Public License
-.TH "FIXPARTS" "8" "1.0.3" "Roderick W. Smith" "FixParts Manual"
+.TH "FIXPARTS" "8" "1.0.4" "Roderick W. Smith" "FixParts Manual"
.SH "NAME"
fixparts \- MBR partition table repair utility
.SH "SYNOPSIS"
diff --git a/gdisk.8 b/gdisk.8
index c2cf83d..fcd07e2 100644
--- a/gdisk.8
+++ b/gdisk.8
@@ -1,6 +1,6 @@
-.\" Copyright 2011-2017 Roderick W. Smith (rodsmith@rodsbooks.com)
+.\" Copyright 2011-2018 Roderick W. Smith (rodsmith@rodsbooks.com)
.\" May be distributed under the GNU General Public License
-.TH "GDISK" "8" "1.0.3" "Roderick W. Smith" "GPT fdisk Manual"
+.TH "GDISK" "8" "1.0.4" "Roderick W. Smith" "GPT fdisk Manual"
.SH "NAME"
gdisk \- Interactive GUID partition table (GPT) manipulator
.SH "SYNOPSIS"
@@ -185,12 +185,15 @@ related to their equivalent MBR codes. Specifically, the MBR code is
multiplied by hexadecimal 0x0100. For instance, the code for Linux swap
space in MBR is 0x82, and it's 0x8200 in \fBgdisk\fR. A one\-to\-one
correspondence is impossible, though. Most notably, the codes for all
-varieties of FAT and NTFS partition correspond to a single GPT code
-(entered as 0x0700 in \fBsgdisk\fR). Some OSes use a single MBR code but
-employ many more codes in GPT. For these, \fBgdisk\fR adds code numbers
-sequentially, such as 0xa500 for a FreeBSD disklabel, 0xa501 for FreeBSD
-boot, 0xa502 for FreeBSD swap, and so on. Note that these two\-byte codes
-are unique to \fBgdisk\fR.
+varieties of FAT and NTFS partition correspond to a single GPT code (entered
+as 0x0700 in \fBgdisk\fR). Some OSes use a single MBR code but employ many
+more codes in GPT. For these, \fBgdisk\fR adds code numbers sequentially,
+such as 0xa500 for a FreeBSD disklabel, 0xa501 for FreeBSD boot, 0xa502 for
+FreeBSD swap, and so on. Note that these two\-byte codes are unique to
+\fBgdisk\fR. The type code list may optionally be filtered by a search
+string; for instance, entering \fI\fBLinux\fR\fR shows only partition type
+codes with descriptions that include the string \fILinux\fR. This search is
+performed case\-sensitively.
.TP
.B n
diff --git a/gpt.cc b/gpt.cc
index 163e81e..c054460 100644
--- a/gpt.cc
+++ b/gpt.cc
@@ -3,7 +3,7 @@
/* By Rod Smith, initial coding January to February, 2009 */
-/* This program is copyright (c) 2009-2013 by Roderick W. Smith. It is distributed
+/* This program is copyright (c) 2009-2018 by Roderick W. Smith. It is distributed
under the terms of the GNU GPL version 2, as detailed in the COPYING file. */
#define __STDC_LIMIT_MACROS
diff --git a/gptcurses.cc b/gptcurses.cc
index 0e18f8f..a9f466c 100644
--- a/gptcurses.cc
+++ b/gptcurses.cc
@@ -1,7 +1,7 @@
/*
* Implementation of GPTData class derivative with curses-based text-mode
* interaction
- * Copyright (C) 2011-2013 Roderick W. Smith
+ * Copyright (C) 2011-2018 Roderick W. Smith
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/gptcurses.h b/gptcurses.h
index 9a14f7e..f153de2 100644
--- a/gptcurses.h
+++ b/gptcurses.h
@@ -1,7 +1,7 @@
/*
* Implementation of GPTData class derivative with curses-based text-mode
* interaction
- * Copyright (C) 2011-2013 Roderick W. Smith
+ * Copyright (C) 2011-2018 Roderick W. Smith
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/gptpart.cc b/gptpart.cc
index 17d6f15..40a90a3 100644
--- a/gptpart.cc
+++ b/gptpart.cc
@@ -4,7 +4,7 @@
// Description: Class to implement a SINGLE GPT partition
//
//
-// Author: Rod Smith <rodsmith@rodsbooks.com>, (C) 2009-2013
+// Author: Rod Smith <rodsmith@rodsbooks.com>, (C) 2009-2018
//
// Copyright: See COPYING file that comes with this distribution
//
diff --git a/gpttext.cc b/gpttext.cc
index 732d861..ea34444 100644
--- a/gpttext.cc
+++ b/gpttext.cc
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2010-2013 <Roderick W. Smith>
+ Copyright (C) 2010-2018 <Roderick W. Smith>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/gpttext.h b/gpttext.h
index 98e59af..afe4651 100644
--- a/gpttext.h
+++ b/gpttext.h
@@ -1,6 +1,6 @@
/*
Implementation of GPTData class derivative with basic text-mode interaction
- Copyright (C) 2010-2013 Roderick W. Smith
+ Copyright (C) 2010-2018 Roderick W. Smith
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/parttypes.cc b/parttypes.cc
index 1acb14c..f3ad9bc 100644
--- a/parttypes.cc
+++ b/parttypes.cc
@@ -2,7 +2,7 @@
// Class to manage partition type codes -- a slight variant on MBR type
// codes, GUID type codes, and associated names.
-/* This program is copyright (c) 2009-2015 by Roderick W. Smith. It is distributed
+/* This program is copyright (c) 2009-2018 by Roderick W. Smith. It is distributed
under the terms of the GNU GPL version 2, as detailed in the COPYING file. */
#define __STDC_LIMIT_MACROS
@@ -145,8 +145,8 @@ void PartType::AddAllTypes(void) {
// and my own Android devices' partition tables
AddType(0xa000, "2568845D-2332-4675-BC39-8FA5A4748D15", "Android bootloader");
AddType(0xa001, "114EAFFE-1552-4022-B26E-9B053604CF84", "Android bootloader 2");
- AddType(0xa002, "49A4D17F-93A3-45C1-A0DE-F50B2EBE2599", "Android boot");
- AddType(0xa003, "4177C722-9E92-4AAB-8644-43502BFD5506", "Android recovery");
+ AddType(0xa002, "49A4D17F-93A3-45C1-A0DE-F50B2EBE2599", "Android boot 1");
+ AddType(0xa003, "4177C722-9E92-4AAB-8644-43502BFD5506", "Android recovery 1");
AddType(0xa004, "EF32A33B-A409-486C-9141-9FFB711F6266", "Android misc");
AddType(0xa005, "20AC26BE-20B7-11E3-84C5-6CFDB94711E9", "Android metadata");
AddType(0xa006, "38F428E6-D326-425D-9140-6E0EA133647C", "Android system 1");
@@ -180,7 +180,7 @@ void PartType::AddAllTypes(void) {
AddType(0xa022, "E6E98DA2-E22A-4D12-AB33-169E7DEAA507", "Android APDP");
AddType(0xa023, "ED9E8101-05FA-46B7-82AA-8D58770D200B", "Android MSADP");
AddType(0xa024, "11406F35-1173-4869-807B-27DF71802812", "Android DPO");
- AddType(0xa025, "9D72D4E4-9958-42DA-AC26-BEA7A90B0434", "Android recovery");
+ AddType(0xa025, "9D72D4E4-9958-42DA-AC26-BEA7A90B0434", "Android recovery 2");
AddType(0xa026, "6C95E238-E343-4BA8-B489-8681ED22AD0B", "Android persist");
AddType(0xa027, "EBBEADAF-22C9-E33B-8F5D-0E81686A68CB", "Android modem ST1");
AddType(0xa028, "0A288B1F-22C9-E33B-8F5D-0E81686A68CB", "Android modem ST2");
@@ -197,18 +197,21 @@ void PartType::AddAllTypes(void) {
AddType(0xa033, "379D107E-229E-499D-AD4F-61F5BCF87BD4", "Android spare3");
AddType(0xa034, "0DEA65E5-A676-4CDF-823C-77568B577ED5", "Android spare4");
AddType(0xa035, "4627AE27-CFEF-48A1-88FE-99C3509ADE26", "Android raw resources");
- AddType(0xa036, "20117F86-E985-4357-B9EE-374BC1D8487D", "Android boot");
+ AddType(0xa036, "20117F86-E985-4357-B9EE-374BC1D8487D", "Android boot 2");
AddType(0xa037, "86A7CB80-84E1-408C-99AB-694F1A410FC7", "Android FOTA");
AddType(0xa038, "97D7B011-54DA-4835-B3C4-917AD6E73D74", "Android system 2");
AddType(0xa039, "5594C694-C871-4B5F-90B1-690A6F68E0F7", "Android cache");
AddType(0xa03a, "1B81E7E6-F50D-419B-A739-2AEEF8DA3335", "Android user data");
- AddType(0xa03b, "98523EC6-90FE-4C67-B50A-0FC59ED6F56D", "LG advanced flasher");
+ AddType(0xa03b, "98523EC6-90FE-4C67-B50A-0FC59ED6F56D", "LG (Android) advanced flasher");
AddType(0xa03c, "2644BCC0-F36A-4792-9533-1738BED53EE3", "Android PG1FS");
AddType(0xa03d, "DD7C91E9-38C9-45C5-8A12-4A80F7E14057", "Android PG2FS");
AddType(0xa03e, "7696D5B6-43FD-4664-A228-C563C4A1E8CC", "Android board info");
AddType(0xa03f, "0D802D54-058D-4A20-AD2D-C7A362CEACD4", "Android MFG");
AddType(0xa040, "10A0C19C-516A-5444-5CE3-664C3226A794", "Android limits");
+ // Atari TOS partition type
+ AddType(0xa200, "734E5AFE-F61A-11E6-BC64-92361F002671", "Atari TOS basic data");
+
// FreeBSD partition types....
// Note: Rather than extract FreeBSD disklabel data, convert FreeBSD
// partitions in-place, and let FreeBSD sort out the details....
@@ -471,16 +474,25 @@ uint16_t PartType::GetHexType() const {
// it stops at under 80 columns; on narrower displays, lines will wrap
// in an ugly way. The maxLines value is the maximum number of lines
// to display before prompting to continue, or 0 (or a negative value)
-// for no limit.
+// for no limit. If (maxLines > 0), this function will prompt for a
+// substring to search for in the partition type description, so it's
+// imperative that maxLines be set to 0 in non-interactive contexts
+// (namely, sgdisk).
void PartType::ShowAllTypes(int maxLines) const {
int colCount = 1, lineCount = 1;
size_t i;
AType* thisType = allTypes;
- string line;
+ string line, matchString = "";
+ size_t found;
cout.unsetf(ios::uppercase);
+ if (maxLines > 0) {
+ cout << "Type search string, or <Enter> to show all codes: ";
+ matchString = ReadString();
+ } // if
while (thisType != NULL) {
- if (thisType->display == 1) { // show it
+ found = thisType->name.find(matchString);
+ if ((thisType->display == 1) && (found != string::npos)) { // show it
cout.fill('0');
cout.width(4);
cout << hex << thisType->MBRType << " ";
diff --git a/parttypes.h b/parttypes.h
index dd23e94..c108a17 100644
--- a/parttypes.h
+++ b/parttypes.h
@@ -1,4 +1,4 @@
-/* This program is copyright (c) 2009-2013 by Roderick W. Smith. It is distributed
+/* This program is copyright (c) 2009-2018 by Roderick W. Smith. It is distributed
under the terms of the GNU GPL version 2, as detailed in the COPYING file. */
#include <stdint.h>
diff --git a/sgdisk.8 b/sgdisk.8
index 2cb18b9..0d281d3 100644
--- a/sgdisk.8
+++ b/sgdisk.8
@@ -1,6 +1,6 @@
-.\" Copyright 2011-2017 Roderick W. Smith (rodsmith@rodsbooks.com)
+.\" Copyright 2011-2018 Roderick W. Smith (rodsmith@rodsbooks.com)
.\" May be distributed under the GNU General Public License
-.TH "SGDISK" "8" "1.0.3" "Roderick W. Smith" "GPT fdisk Manual"
+.TH "SGDISK" "8" "1.0.4" "Roderick W. Smith" "GPT fdisk Manual"
.SH "NAME"
sgdisk \- Command\-line GUID partition table (GPT) manipulator for Linux and Unix
.SH "SYNOPSIS"
diff --git a/support.cc b/support.cc
index bc91c6e..d47965a 100644
--- a/support.cc
+++ b/support.cc
@@ -3,7 +3,7 @@
// Primarily by Rod Smith, February 2009, but with a few functions
// copied from other sources (see attributions below).
-/* This program is copyright (c) 2009-2013 by Roderick W. Smith. It is distributed
+/* This program is copyright (c) 2009-2018 by Roderick W. Smith. It is distributed
under the terms of the GNU GPL version 2, as detailed in the COPYING file. */
#define __STDC_LIMIT_MACROS
diff --git a/support.h b/support.h
index 85324f6..d0a5145 100644
--- a/support.h
+++ b/support.h
@@ -1,4 +1,4 @@
-/* This program is copyright (c) 2009-2013 by Roderick W. Smith. It is distributed
+/* This program is copyright (c) 2009-2018 by Roderick W. Smith. It is distributed
under the terms of the GNU GPL version 2, as detailed in the COPYING file. */
#include <stdint.h>