Revert "Update external/gptfdisk to 1.0.1" am: bdbab02f71 am: 165c596ac3
am: fa990d2e3b

Change-Id: I88a6501b6dbc6b6682ac414a1aa590a11bbd3306
diff --git a/Makefile b/Makefile
index 8c8f9fd..1ae018e 100644
--- a/Makefile
+++ b/Makefile
@@ -28,9 +28,6 @@
 fixparts: $(MBR_LIB_OBJS) fixparts.o
 	$(CXX) $(MBR_LIB_OBJS) fixparts.o $(LDFLAGS) -o fixparts
 
-test:
-	./gdisk_test.sh
-
 lint:	#no pre-reqs
 	lint $(SRCS)
 
diff --git a/Makefile.mac b/Makefile.mac
index ac5e773..e53e016 100644
--- a/Makefile.mac
+++ b/Makefile.mac
@@ -1,9 +1,8 @@
 CC=gcc
-CXX=clang++
-FATBINFLAGS=-arch x86_64 -arch i386 -mmacosx-version-min=10.4
-CFLAGS=$(FATBINFLAGS) -O2 -D_FILE_OFFSET_BITS=64 -g
-#CXXFLAGS=-O2 -Wall -D_FILE_OFFSET_BITS=64 -D USE_UTF16 -I/opt/local/include -I/usr/local/include -I/opt/local/include -g
-CXXFLAGS=$(FATBINFLAGS) -O2 -Wall -D_FILE_OFFSET_BITS=64 -I/opt/local/include -I /usr/local/include -I/opt/local/include -g
+CXX=g++
+CFLAGS=-O2 -D_FILE_OFFSET_BITS=64 -g
+#CXXFLAGS=-O2 -Wall -D_FILE_OFFSET_BITS=64 -D USE_UTF16 -I/sw/include -I/usr/local/include -I/opt/local/include -g
+CXXFLAGS=-O2 -Wall -D_FILE_OFFSET_BITS=64 -I/sw/include -I /usr/local/include -I/opt/local/include -g
 LIB_NAMES=crc32 support guid gptpart mbrpart basicmbr mbr gpt bsd parttypes attributes diskio diskio-unix
 MBR_LIBS=support diskio diskio-unix basicmbr mbrpart
 #LIB_SRCS=$(NAMES:=.cc)
@@ -15,20 +14,19 @@
 all:	gdisk sgdisk cgdisk fixparts
 
 gdisk:	$(LIB_OBJS) gpttext.o gdisk.o
-	$(CXX) $(LIB_OBJS) gpttext.o gdisk.o $(FATBINFLAGS) -o gdisk
+	$(CXX) $(LIB_OBJS) gpttext.o gdisk.o -o gdisk
 #	$(CXX) $(LIB_OBJS) -L/usr/lib -licucore gpttext.o gdisk.o -o gdisk
 
 cgdisk: $(LIB_OBJS) cgdisk.o gptcurses.o
-	$(CXX) $(LIB_OBJS) cgdisk.o gptcurses.o /opt/local/lib/libncurses.a $(LDFLAGS) $(FATBINFLAGS) -o cgdisk
+	$(CXX) $(LIB_OBJS) cgdisk.o gptcurses.o $(LDFLAGS) -lncurses -o cgdisk
 #	$(CXX) $(LIB_OBJS) cgdisk.o gptcurses.o $(LDFLAGS) -licucore -lncurses -o cgdisk
 
 sgdisk: $(LIB_OBJS) gptcl.o sgdisk.o
-#	$(CXX) $(LIB_OBJS) gptcl.o sgdisk.o /opt/local/lib/libiconv.a /opt/local/lib/libintl.a /opt/local/lib/libpopt.a $(FATBINFLAGS) -o sgdisk
-	$(CXX) $(LIB_OBJS) gptcl.o sgdisk.o -L/opt/local/lib -lpopt $(FATBINFLAGS) -o sgdisk
+	$(CXX) $(LIB_OBJS) gptcl.o sgdisk.o -L/sw/lib -lpopt -o sgdisk
 #	$(CXX) $(LIB_OBJS) gptcl.o sgdisk.o -L/sw/lib -licucore -lpopt -o sgdisk
 
 fixparts: $(MBR_LIB_OBJS) fixparts.o
-	$(CXX) $(MBR_LIB_OBJS) fixparts.o $(LDFLAGS) $(FATBINFLAGS) -o fixparts
+	$(CXX) $(MBR_LIB_OBJS) fixparts.o $(LDFLAGS) -o fixparts
 
 testguid:	$(LIB_OBJS) testguid.o
 	$(CXX) $(LIB_OBJS) testguid.o -o testguid
@@ -37,7 +35,7 @@
 	lint $(SRCS)
 
 clean:	#no pre-reqs
-	rm -f core *.o *~ gdisk sgdisk cgdisk fixparts
+	rm -f core *.o *~ gdisk sgdisk
 
 # what are the source dependencies
 depend: $(SRCS)
diff --git a/NEWS b/NEWS
index 8835391..96810c7 100644
--- a/NEWS
+++ b/NEWS
@@ -1,107 +1,6 @@
-1.0.1 (10/18/2015):
--------------------
-
-- Fixed bug that caused -N/--largest-new option to sgdisk to fail when
-  fed a "0" option.
-
-- Fixed bug that caused input glitches in EFI version of gdisk.
-
-- Fixed bug that caused sgdisk to not return an appropriate error code
-  when it encountered a write error when saving changes.
-
-- Fixed bug that caused cgdisk's "Info" display to under-report the
-  partition's size by one sector.
-
-- OS X 10.11 includes new security features that prevent GPT fdisk from
-  working unless these features are disabled. To do so, you must boot to a
-  Recovery HD system, open a Terminal, type "csrutil disable", and reboot
-  into the normal system. You can re-enable the security features by
-  repeating the process, but specify "enable" rather than "disable". I've
-  added a message pointing users to a Web page explaining how to disable
-  this feature when gdisk detects that it can't write to the disk under OS
-  X. If you know of a way around this (including code changes to gdisk),
-  please contact me.
-
-- I've updated the OS X installation location from the Unix-standard
-  /usr/sbin (and related locations for documentation) to /usr/local/bin
-  (and related locations for documentation). This is Just Plain Crazy from
-  a Unix point of view, but Apple has to be Apple and do things just a
-  little bit differently.
-
-- I've updated my OS X environment to OS X 10.11 and LLVM 7.0.0. This has
-  also meant installing fresh versions of popt and ncurses from MacPorts,
-  which may require upgrading popt to get sgdisk working on some systems.
-  (gdisk, cgdisk, and fixparts should continue to work normally on all
-  systems.) The OS X binaries are now "fat" (32- and 64-bit) versions,
-  which should have no noticeable effect unless you have a Mac with broken
-  32-bit support, in which case the binaries will now work.
-
-- Changed the default name of 0xab00 partitions from "Apple boot" to
-  "Recovery HD", since the latter is the name that Apple gives these
-  partitions. Also, I discovered through painful experience that OS X
-  flakes out and won't boot if the name is something other than "Recovery
-  HD", so it really has to have the right name!
-
-- Changed the OpenBSD type codes (0xa600 and 0xa601): 0xa600 is now
-  824CC7A0-36A8-11E3-890A-952519AD3F61 (OpenBSD disklabel) and 0xa601 is
-  now gone. Previously, 0xa600 was 516E7CB4-6ECF-11D6-8FF8-00022D09712B, a
-  duplicate of the FreeBSD disklabel, and 0xa601 was
-  824CC7A0-36A8-11E3-890A-952519AD3F61. OpenBSD is now officially
-  supporting 824CC7A0-36A8-11E3-890A-952519AD3F61 as a disklabel type,
-  though. It's unclear what, if anything, OpenBSD will use for
-  non-disklabel type codes at the moment.
-
-- Added GUID 0311FC50-01CA-4725-AD77-9ADBB20ACE98 (0xbc00) for
-  Acronis Secure Zone backup partitions.
-
-- Fixed bug that caused random crashes on ppc64el systems (and perhaps
-  others).
-
-- Added GUID C91818F9-8025-47AF-89D2-F030D7000C2C (0x3900) for Plan 9.
-
-- Added GUID 69DAD710-2CE4-4E3C-B16C-21A1D49ABED3 (0x8307) for 32-bit ARM
-  Linux root (/) partition, as per the Freedesktop.org Discoverable
-  Partition Spec
-  (http://www.freedesktop.org/wiki/Specifications/DiscoverablePartitionsSpec/).
-
-- Edited man pages to clarify that default alignment is to 1MiB boundaries;
-  this translates to 2048 sectors on disks with 512-byte sectors, but it
-  will be something else on disks with other sector sizes.
-
-- Changed behavior of -z/--zap and -Z/--zap-all options to sgdisk so that
-  if a subsequent command causes changes, they'll be written to disk.
-  Previously, doing something like "sgdisk --zap-all --clear /dev/sdd"
-  would wipe the disk but not create a partition table; to create a blank
-  table you'd need to do "sgdisk --zap-all --clear --mbrtogpt /dev/sdd",
-  which is a bit odd and counter-intuitive, to the point of arguably being
-  a bug.
-
-1.0.0 (3/16/2015):
+0.8.11 (?/?/2014):
 ------------------
 
-- I'm now building a binary package of gdisk_x64.efi, using the UEFI GPT
-  fdisk package.
-
-- Added partition type for OpenBSD data
-  (824CC7A0-36A8-11E3-890A-952519AD3F61/0xa601). Also mapped 0xa600 to the
-  FreeBSD disklabel type code (516E7CB4-6ECF-11D6-8FF8-00022D09712B). I'm
-  not sure that's 100% correct, but since I can't find references to an
-  OpenBSD disklabel GPT type code, it seems the best choice at the moment.
-
-- Added partition type for Windows Storage Spaces
-  (E75CAF8F-F680-4CEE-AFA3-B001E56EFC2D/0x4202)
-
-- Added -O/--print-mbr option to sgdisk, enabling easier display of MBR
-  data structures without invoking gdisk.
-
-- Updated warning message: "EBR describes a logical partition" now reads
-  "EBR points to an EBR," which is more technically correct.
-
-- Altered warning displayed when run from Windows on non-GPT disk, because
-  Windows on UEFI-based systems is becoming more common.
-
-- Fixed spurious "1" return value in gdisk.
-
 - Small code changes to support compilation as EFI application with the
   UEFI GPT fdisk library
   (http://sourceforge.net/projects/uefigptfdisk/?source=directory)
@@ -110,7 +9,7 @@
   (https://github.com/ceph/ceph/blob/9bcc42a3e6b08521694b5c0228b2c6ed7b3d312e/src/ceph-disk#L76-L81):
   4FBD7E29-9D25-41B8-AFD0-062C0CEFF05D/0xf800 (Ceph OSD),
   4FBD7E29-9D25-41B8-AFD0-5EC00CEFF05D/0xf801 (Ceph dm-crypt OSD),
-  45B0969E-9B03-4F30-B4C6-B4B80CEFF106/0xf802 (Ceph journal),
+  BFBFAFE7-A34F-448A-9A5B-6213EB736C22/0xf802 (Ceph journal),
   45B0969E-9B03-4F30-B4C6-5EC00CEFF106/0xf803 (Ceph dm-crypt journal),
   89C57F98-2FE5-4DC0-89C1-F3AD0CEFF2BE/0xf804 (Ceph disk in creation), and
   89C57F98-2FE5-4DC0-89C1-5EC00CEFF2BE/0xf805 (Ceph dm-crypt disk in
diff --git a/README b/README
index 8a612ac..a3c0e44 100644
--- a/README
+++ b/README
@@ -200,12 +200,11 @@
   (headers). Most Linux distributions install popt by default, but you may
   need to install a package called popt-dev, popt-devel, or something
   similar to obtain the header files. Mac OS users can find a version of
-  popt for Mac OS from Darwin Ports (http://popt.darwinports.com), MacPorts
-  (https://trac.macports.org/browser/trunk/dports/devel/popt/Portfile), or
-  Fink (http://www.finkproject.org);  however, you'll first need to install
-  DarwinPorts, MacPorts, or Fink (instructions exist on the relevant
-  projects' pages). Alternatively, you can compile gdisk and/or cgdisk
-  alone, without sgdisk; gdisk doesn't require popt.
+  popt for Mac OS from Darwin Ports (http://popt.darwinports.com) or Fink
+  (http://www.finkproject.org); however, you'll first need to install
+  DarwinPorts or Fink (instructions exist on the relevant projects' pages).
+  Alternatively, you can compile gdisk and/or cgdisk alone, without sgdisk;
+  gdisk doesn't require popt.
 
 When all the necessary development tools and libraries are installed, you
 can uncompress the package and type "make" at the command prompt in the
diff --git a/basicmbr.cc b/basicmbr.cc
index c3c0653..23f35b4 100644
--- a/basicmbr.cc
+++ b/basicmbr.cc
@@ -298,7 +298,7 @@
          // the logical partition when this is the case....
          ebrType = ebr.partitions[0].partitionType;
          if ((ebrType == 0x05) || (ebrType == 0x0f) || (ebrType == 0x85)) {
-            cout << "EBR points to an EBR!\n";
+            cout << "EBR describes a logical partition!\n";
             offset = extendedStart + ebr.partitions[0].firstLBA;
          } else {
             // Copy over the basic data....
diff --git a/cgdisk.8 b/cgdisk.8
index ac3da9b..53e0d4d 100644
--- a/cgdisk.8
+++ b/cgdisk.8
@@ -1,6 +1,6 @@
-.\" Copyright 2011-2015 Roderick W. Smith (rodsmith@rodsbooks.com)
+.\" Copyright 2011-2013 Roderick W. Smith (rodsmith@rodsbooks.com)
 .\" May be distributed under the GNU General Public License
-.TH "CGDISK" "8" "1.0.1" "Roderick W. Smith" "GPT fdisk Manual"
+.TH "CGDISK" "8" "0.8.10" "Roderick W. Smith" "GPT fdisk Manual"
 .SH "NAME"
 cgdisk \- Curses-based GUID partition table (GPT) manipulator
 .SH "SYNOPSIS"
@@ -181,13 +181,12 @@
 physical sectors (such as modern Advanced Format drives), some RAID
 configurations, and many SSD devices, can suffer performance problems if
 partitions are not aligned properly for their internal data structures. On
-new disks, GPT fdisk attempts to align partitions on 1MiB boundaries
-(2048\-sectors on disks with 512-byte sectors) by default, which optimizes
-performance for all of these disk types. On pre\-partitioned disks, GPT
-fdisk attempts to identify the alignment value used on that disk, but will
-set 8-sector alignment on disks larger than 300 GB even if lesser alignment
-values are detected. In either case, it can be changed by using this
-option.
+new disks, GPT fdisk attempts to align partitions on 2048\-sector (1MiB)
+boundaries by default, which optimizes performance for all of these disk
+types. On pre\-partitioned disks, GPT fdisk attempts to identify the
+alignment value used on that disk, but will set 8-sector alignment on disks
+larger than 300 GB even if lesser alignment values are detected. In either
+case, it can be changed by using this option.
 
 .TP 
 .B Backup
@@ -277,7 +276,10 @@
 
 .SH "BUGS"
 
-Known bugs and limitations include:
+As of March 2014 (version 0.8.10), \fBcgdisk\fR should be considered
+beta software. Although the underlying partition manipulation code is much
+older, the \fBcgdisk\fR ncurses user interface is brand new with GPT fdisk
+version 0.8.0. Known bugs and limitations include:
 
 .TP 
 .B *
@@ -365,7 +367,7 @@
 
 * Justin Maggard (justin.maggard@netgear.com)
 
-* Dwight Schauer (dschauer@gmail.com)
+* Dwight Schauer (dschauer@ti.com)
 
 * Florian Zumbiehl (florz@florz.de)
 
diff --git a/current.spec b/current.spec
index 1587732..af26193 100644
--- a/current.spec
+++ b/current.spec
@@ -1,12 +1,12 @@
 Summary: GPT partitioning and MBR repair software
 Name: gptfdisk
-Version: 1.0.1
+Version: 0.8.10
 
 Release: 1%{?dist}
 License: GPLv2
 URL: http://www.rodsbooks.com/gdisk
 Group: Applications/System
-Source: http://www.rodsbooks.com/gdisk/gptfdisk-1.0.1.tar.gz
+Source: http://www.rodsbooks.com/gdisk/gptfdisk-0.8.10.tar.gz
 BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
 
 %description
@@ -81,5 +81,5 @@
 
 
 %changelog
-* Sun Mar 2 2014 R Smith <rodsmith@rodsbooks.com> - 1.0.1
-- Created spec file for 1.0.1 release
+* Sun Mar 2 2014 R Smith <rodsmith@rodsbooks.com> - 0.8.10
+- Created spec file for 0.8.10 release
diff --git a/diskio-unix.cc b/diskio-unix.cc
index 75fad2e..fb463f9 100644
--- a/diskio-unix.cc
+++ b/diskio-unix.cc
@@ -76,8 +76,7 @@
          if (fstat64(fd, &st) == 0) {
             if (S_ISDIR(st.st_mode))
                cerr << "The specified path is a directory!\n";
-#if !(defined(__FreeBSD__) || defined(__FreeBSD_kernel__)) \
-                       && !defined(__APPLE__)
+#if !defined(__FreeBSD__) && !defined(__APPLE__)
             else if (S_ISCHR(st.st_mode))
                cerr << "The specified path is a character device!\n";
 #endif
@@ -256,8 +255,7 @@
       i = ioctl(fd, BLKRRPART);
       if (i) {
          cout << "Warning: The kernel is still using the old partition table.\n"
-              << "The new table will be used at the next reboot or after you\n"
-              << "run partprobe(8) or kpartx(8)\n";
+              << "The new table will be used at the next reboot.\n";
       } else {
          retval = 1;
       } // if/else
@@ -275,7 +273,7 @@
 // Note that seeking beyond the end of the file is NOT detected as a failure!
 int DiskIO::Seek(uint64_t sector) {
    int retval = 1;
-   off_t seekTo, sought;
+   off64_t seekTo, sought;
 
    // If disk isn't open, try to open it....
    if (!isOpen) {
diff --git a/fixparts.8 b/fixparts.8
index 9c4312f..d840df2 100644
--- a/fixparts.8
+++ b/fixparts.8
@@ -1,6 +1,6 @@
-.\" Copyright 2011-2015 Roderick W. Smith (rodsmith@rodsbooks.com)
+.\" Copyright 2011-2013 Roderick W. Smith (rodsmith@rodsbooks.com)
 .\" May be distributed under the GNU General Public License
-.TH "FIXPARTS" "8" "1.0.1" "Roderick W. Smith" "FixParts Manual"
+.TH "FIXPARTS" "8" "0.8.10" "Roderick W. Smith" "FixParts Manual"
 .SH "NAME"
 fixparts \- MBR partition table repair utility
 .SH "SYNOPSIS"
@@ -202,7 +202,8 @@
 .PP 
 
 .SH "BUGS"
-Known bugs and limitations include:
+As of March 2014 (version 0.8.10), \fBfixparts\fR
+should be considered beta software. Known bugs and limitations include:
 
 .TP 
 .B *
@@ -258,7 +259,7 @@
 
 * Justin Maggard (justin.maggard@netgear.com)
 
-* Dwight Schauer (dschauer@gmail.com)
+* Dwight Schauer (dschauer@ti.com)
 
 * Florian Zumbiehl (florz@florz.de)
 
diff --git a/gdisk.8 b/gdisk.8
index c33ca5f..5cbaef5 100644
--- a/gdisk.8
+++ b/gdisk.8
@@ -1,6 +1,6 @@
-.\" Copyright 2011-2015 Roderick W. Smith (rodsmith@rodsbooks.com)
+.\" Copyright 2011-2013 Roderick W. Smith (rodsmith@rodsbooks.com)
 .\" May be distributed under the GNU General Public License
-.TH "GDISK" "8" "1.0.1" "Roderick W. Smith" "GPT fdisk Manual"
+.TH "GDISK" "8" "0.8.10" "Roderick W. Smith" "GPT fdisk Manual"
 .SH "NAME"
 gdisk \- Interactive GUID partition table (GPT) manipulator
 .SH "SYNOPSIS"
@@ -212,8 +212,7 @@
 .B o
 Clear out all partition data. This includes GPT header data,
 all partition definitions, and the protective MBR. The sector alignment
-is reset to the default (1MB, or 2048 sectors on a disk with 512-byte
-sectors).
+is reset to the default (2048 sectors, or 1MB).
 
 .TP 
 .B p
@@ -471,13 +470,12 @@
 physical sectors (such as modern Advanced Format drives), some RAID
 configurations, and many SSD devices, can suffer performance problems if
 partitions are not aligned properly for their internal data structures. On
-new disks, GPT fdisk attempts to align partitions on 1MiB boundaries
-(2048\-sectors on disks with 512-byte sectors) by default, which optimizes
-performance for all of these disk types. On pre\-partitioned disks, GPT
-fdisk attempts to identify the alignment value used on that disk, but will
-set 8-sector alignment on disks larger than 300 GB even if lesser alignment
-values are detected. In either case, it can be changed by using this
-option.
+new disks, GPT fdisk attempts to align partitions on 2048\-sector (1MiB)
+boundaries by default, which optimizes performance for all of these disk
+types. On pre\-partitioned disks, GPT fdisk attempts to identify the
+alignment value used on that disk, but will set 8-sector alignment on disks
+larger than 300 GB even if lesser alignment values are detected. In either
+case, it can be changed by using this option.
 
 .TP 
 .B m
@@ -563,7 +561,8 @@
 usually bypasses the prompt entirely.
 
 .SH "BUGS"
-Known bugs and limitations include:
+As of March 2014 (version 0.8.10), \fBgdisk\fR
+should be considered beta software. Known bugs and limitations include:
 
 .TP 
 .B *
@@ -661,7 +660,7 @@
 
 * Justin Maggard (justin.maggard@netgear.com)
 
-* Dwight Schauer (dschauer@gmail.com)
+* Dwight Schauer (dschauer@ti.com)
 
 * Florian Zumbiehl (florz@florz.de)
 
diff --git a/gdisk_test.sh b/gdisk_test.sh
index 25e2651..8c5d800 100755
--- a/gdisk_test.sh
+++ b/gdisk_test.sh
@@ -115,23 +115,9 @@
 w
 Y
 EOF
-
-			ret=$?
-			if [ $ret -ne 0 ]
-			then
-				pretty_print "FAILED" "gdisk return $ret when creating partition table"
-				exit 1
-			fi
 		;;
 		sgdisk)
 			$SGDISK_BIN $TEMP_DISK -${OPT_CLEAR}
-
-			ret=$?
-			if [ $ret -ne 0 ]
-			then
-				pretty_print "FAILED" "sgdisk return $ret when creating partition table"
-				exit 1
-			fi
 		;;
 	esac
 
@@ -161,7 +147,7 @@
 		;;
 
 		sgdisk)
-			$SGDISK_BIN $TEMP_DISK -${OPT_NEW} 1 -${OPT_CHANGE_NAME} 1:"${TEST_PART_DEFAULT_NAME}" -${OPT_CHANGE_TYPE} 1:$TEST_PART_TYPE
+			$SGDISK_BIN $TEMP_DISK -${OPT_NEW} 1 -${OPT_CHANGE_NAME} 1:"${TEST_PART_DEFAULT_NAME}"
 		;;
 	esac
 
@@ -325,7 +311,6 @@
 		pretty_print "SUCCESS" "GUID of disk has been sucessfully changed"
 	else
 		pretty_print "FAILED" "GUID of disk is the same as the previous one"
-		exit 1
 	fi
 }
 
@@ -368,7 +353,7 @@
 ###################################
 
 # create a file to simulate a real device
-dd if=/dev/zero of=$TEMP_DISK bs=1024 count=$TEMP_DISK_SIZE > /dev/null 2>&1
+dd if=/dev/zero of=$TEMP_DISK bs=1024 count=$TEMP_DISK_SIZE
 
 if [ -s $TEMP_DISK ]
 then
diff --git a/gpt.cc b/gpt.cc
index 35a5b14..9ad769a 100644
--- a/gpt.cc
+++ b/gpt.cc
@@ -753,12 +753,7 @@
               << "'sysctl kern.geom.debugflags=16' at a shell prompt, and re-running this\n"
               << "program.\n";
 #endif
-#if defined (__APPLE__)
-         cout << "You may need to deactivate System Integrity Protection to use this program. See\n"
-              << "https://www.quora.com/How-do-I-turn-off-the-rootless-in-OS-X-El-Capitan-10-11\n"
-              << "for more information.\n";
-#endif
-              cout << "\n";
+         cout << "\n";
       } // if
       myDisk.Close(); // Close and re-open read-only in case of bugs
    } else allOK = 0; // if
diff --git a/gptcl.cc b/gptcl.cc
index a2dfbd6..9834788 100644
--- a/gptcl.cc
+++ b/gptcl.cc
@@ -23,7 +23,6 @@
 #include <iostream>
 #include <sstream>
 #include <errno.h>
-#include <popt.h>
 #include "gptcl.h"
 
 GPTDataCL::GPTDataCL(void) {
@@ -72,8 +71,7 @@
 
    struct poptOption theOptions[] =
    {
-      {"attributes", 'A', POPT_ARG_STRING, &attributeOperation, 'A', "operate on partition attributes",
-          "list|[partnum:show|or|nand|xor|=|set|clear|toggle|get[:bitnum|hexbitmask]]"},
+      {"attributes", 'A', POPT_ARG_STRING, &attributeOperation, 'A', "operate on partition attributes", "list|[partnum:show|or|nand|xor|=|set|clear|toggle|get[:bitnum|hexbitmask]]"},
       {"set-alignment", 'a', POPT_ARG_INT, &alignment, 'a', "set sector alignment", "value"},
       {"backup", 'b', POPT_ARG_STRING, &backupFile, 'b', "backup GPT to file", "file"},
       {"change-name", 'c', POPT_ARG_STRING, &partName, 'c', "change partition's name", "partnum:name"},
@@ -95,7 +93,6 @@
       {"new", 'n', POPT_ARG_STRING, &newPartInfo, 'n', "create new partition", "partnum:start:end"},
       {"largest-new", 'N', POPT_ARG_INT, &largestPartNum, 'N', "create largest possible new partition", "partnum"},
       {"clear", 'o', POPT_ARG_NONE, NULL, 'o', "clear partition table", ""},
-      {"print-mbr", 'O', POPT_ARG_NONE, NULL, 'O', "print MBR partition table", ""},
       {"print", 'p', POPT_ARG_NONE, NULL, 'p', "print partition table", ""},
       {"pretend", 'P', POPT_ARG_NONE, NULL, 'P', "make changes in memory, but don't write them", ""},
       {"transpose", 'r', POPT_ARG_STRING, &twoParts, 'r', "transpose two partitions", "partnum:partnum"},
@@ -311,8 +308,8 @@
                   startSector = FindFirstInLargest();
                   Align(&startSector);
                   endSector = FindLastInFree(startSector);
-                  if (largestPartNum <= 0)
-                     largestPartNum = FindFirstFreePart() + 1;
+                  if (largestPartNum < 0)
+                     largestPartNum = FindFirstFreePart();
                   if (CreatePartition(largestPartNum - 1, startSector, endSector)) {
                      saveData = 1;
                   } else {
@@ -326,9 +323,6 @@
                   ClearGPTData();
                   saveData = 1;
                   break;
-               case 'O':
-                   DisplayMBRData();
-                   break;
                case 'p':
                   DisplayGPTData();
                   break;
@@ -409,7 +403,7 @@
                   if (!pretend) {
                      DestroyGPT();
                   } // if
-                  saveNonGPT = 1;
+                  saveNonGPT = 0;
                   saveData = 0;
                   break;
                case 'Z':
@@ -417,7 +411,7 @@
                      DestroyGPT();
                      DestroyMBR();
                   } // if
-                  saveNonGPT = 1;
+                  saveNonGPT = 0;
                   saveData = 0;
                   break;
                default:
@@ -451,7 +445,7 @@
                   if (!pretend) {
                      DestroyGPT();
                   } // if
-                  saveNonGPT = 1;
+                  saveNonGPT = 0;
                   saveData = 0;
                   break;
                case 'Z':
@@ -459,7 +453,7 @@
                      DestroyGPT();
                      DestroyMBR();
                   } // if
-                  saveNonGPT = 1;
+                  saveNonGPT = 0;
                   saveData = 0;
                   break;
             } // switch
@@ -467,8 +461,7 @@
          retval = 2;
       } // if/else loaded OK
       if ((saveData) && (!neverSaveData) && (saveNonGPT) && (!pretend)) {
-         if (!SaveGPTData(1))
-            retval = 4;
+         SaveGPTData(1);
       }
       if (saveData && (!saveNonGPT)) {
          cout << "Non-GPT disk; not saving changes. Use -g to override.\n";
diff --git a/gptcurses.cc b/gptcurses.cc
index 0e18f8f..6002077 100644
--- a/gptcurses.cc
+++ b/gptcurses.cc
@@ -332,7 +332,7 @@
           BytesToIeee(partitions[partNum].GetFirstLBA(), blockSize).c_str());
    printw("Last sector: %lld (at %s)\n", partitions[partNum].GetLastLBA(),
           BytesToIeee(partitions[partNum].GetLastLBA(), blockSize).c_str());
-   size = partitions[partNum].GetLastLBA() - partitions[partNum].GetFirstLBA() + 1;
+   size = partitions[partNum].GetLastLBA() - partitions[partNum].GetFirstLBA();
    printw("Partition size: %lld sectors (%s)\n", size, BytesToIeee(size, blockSize).c_str());
    printw("Attribute flags: %016x\n", partitions[partNum].GetAttributes().GetAttributes());
    #ifdef USE_UTF16
diff --git a/mbr.cc b/mbr.cc
index d317f52..00aafc2 100644
--- a/mbr.cc
+++ b/mbr.cc
@@ -30,9 +30,6 @@
  *                                      *
  ****************************************/
 
-MBRData::~MBRData(void) {
-} // MBRData destructor
-
 /* // Assignment operator -- copy entire set of MBR data.
 MBRData & MBRData::operator=(const MBRData & orig) {
    BasicMBRData::operator=(orig);
diff --git a/mbr.h b/mbr.h
index bbb84ef..3cacf61 100644
--- a/mbr.h
+++ b/mbr.h
@@ -28,7 +28,6 @@
    MBRData(void) {}
    MBRData(string deviceFilename) : BasicMBRData(deviceFilename) {}
    MBRData & operator=(const BasicMBRData & orig);
-   ~MBRData(void);
 
    // Functions to create, delete, or change partitions
    // Pass EmptyMBR 1 to clear the boot loader code, 0 to leave it intact
diff --git a/parttypes.cc b/parttypes.cc
index 47c0f72..f5f4f6a 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-2014 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
@@ -99,16 +99,12 @@
    AddType(0x3000, "7412F7D5-A156-4B13-81DC-867174929325", "ONIE boot");
    AddType(0x3001, "D4E6E2CD-4469-46F3-B5CB-1BFF57AFC149", "ONIE config");
 
-   // Plan 9; see http://man.cat-v.org/9front/8/prep
-   AddType(0x3900, "C91818F9-8025-47AF-89D2-F030D7000C2C", "Plan 9");
-
    // PowerPC reference platform boot partition
    AddType(0x4100, "9E1A2D38-C612-4316-AA26-8B49521E5A8B", "PowerPC PReP boot");
 
    // Windows LDM ("dynamic disk") types
    AddType(0x4200, "AF9B60A0-1431-4F62-BC68-3311714A69AD", "Windows LDM data"); // Logical disk manager
    AddType(0x4201, "5808C8AA-7E8F-42E0-85D2-E1E90434CFB3", "Windows LDM metadata"); // Logical disk manager
-   AddType(0x4202, "E75CAF8F-F680-4CEE-AFA3-B001E56EFC2D", "Windows Storage Spaces"); // A newer LDM-type setup
 
    // An oddball IBM filesystem....
    AddType(0x7501, "37AFFC90-EF7D-4E96-91C3-2D7AE055B174", "IBM GPFS"); // General Parallel File System (GPFS)
@@ -134,7 +130,6 @@
    AddType(0x8304, "4F68BCE3-E8CD-4DB1-96E7-FBCAF984B709", "Linux x86-64 root (/)"); // Linux / on x86-64 (auto-mounted by systemd)
    AddType(0x8305, "B921B045-1DF0-41C3-AF44-4C6F280D3FAE", "Linux ARM64 root (/)"); // Linux / on 64-bit ARM (auto-mounted by systemd)
    AddType(0x8306, "3B8F8425-20E0-4F3B-907F-1A25A76F98E8", "Linux /srv"); // Linux /srv (auto-mounted by systemd)
-   AddType(0x8307, "69DAD710-2CE4-4E3C-B16C-21A1D49ABED3", "Linux ARM32 root (/)"); // Linux / on 32-bit ARM (auto-mounted by systemd)
 
    // Used by Intel Rapid Start technology
    AddType(0x8400, "D3BFE2DE-3DAF-11DF-BA40-E3A556D89593", "Intel Rapid Start");
@@ -160,9 +155,6 @@
    AddType(0xa584, "85D5E45D-237C-11E1-B4B3-E89A8F7FC3A7", "Midnight BSD ZFS");
    AddType(0xa585, "85D5E45C-237C-11E1-B4B3-E89A8F7FC3A7", "Midnight BSD Vinum");
 
-   // OpenBSD partition type....
-   AddType(0xa600, "824CC7A0-36A8-11E3-890A-952519AD3F61", "OpenBSD disklabel");
-
    // A MacOS partition type, separated from others by NetBSD partition types...
    AddType(0xa800, "55465300-0000-11AA-AA11-00306543ECAC", "Apple UFS"); // Mac OS X
 
@@ -177,7 +169,7 @@
    AddType(0xa906, "49F48DAA-B10E-11DC-B99B-0019D1879648", "NetBSD RAID");
 
    // Mac OS partition types (See also 0xa800, above)....
-   AddType(0xab00, "426F6F74-0000-11AA-AA11-00306543ECAC", "Recovery HD");
+   AddType(0xab00, "426F6F74-0000-11AA-AA11-00306543ECAC", "Apple boot");
    AddType(0xaf00, "48465300-0000-11AA-AA11-00306543ECAC", "Apple HFS/HFS+");
    AddType(0xaf01, "52414944-0000-11AA-AA11-00306543ECAC", "Apple RAID");
    AddType(0xaf02, "52414944-5F4F-11AA-AA11-00306543ECAC", "Apple RAID offline");
@@ -185,9 +177,6 @@
    AddType(0xaf04, "5265636F-7665-11AA-AA11-00306543ECAC", "AppleTV recovery");
    AddType(0xaf05, "53746F72-6167-11AA-AA11-00306543ECAC", "Apple Core Storage");
 
-   // Acronis Secure Zone
-   AddType(0xbc00, "0311FC50-01CA-4725-AD77-9ADBB20ACE98", "Acronis Secure Zone");
-
    // Solaris partition types (one of which is shared with MacOS)
    AddType(0xbe00, "6A82CB45-1DD2-11B2-99A6-080020736631", "Solaris boot");
    AddType(0xbf00, "6A85CF4D-1DD2-11B2-99A6-080020736631", "Solaris root");
@@ -226,7 +215,7 @@
    // Ceph type codes; see https://github.com/ceph/ceph/blob/9bcc42a3e6b08521694b5c0228b2c6ed7b3d312e/src/ceph-disk#L76-L81
    AddType(0xf800, "4FBD7E29-9D25-41B8-AFD0-062C0CEFF05D", "Ceph OSD"); // Ceph Object Storage Daemon
    AddType(0xf801, "4FBD7E29-9D25-41B8-AFD0-5EC00CEFF05D", "Ceph dm-crypt OSD"); // Ceph Object Storage Daemon (encrypted)
-   AddType(0xf802, "45B0969E-9B03-4F30-B4C6-B4B80CEFF106", "Ceph journal");
+   AddType(0xf802, "BFBFAFE7-A34F-448A-9A5B-6213EB736C22", "Ceph journal");
    AddType(0xf803, "45B0969E-9B03-4F30-B4C6-5EC00CEFF106", "Ceph dm-crypt journal");
    AddType(0xf804, "89C57F98-2FE5-4DC0-89C1-F3AD0CEFF2BE", "Ceph disk in creation");
    AddType(0xf805, "89C57F98-2FE5-4DC0-89C1-5EC00CEFF2BE", "Ceph dm-crypt disk in creation");
diff --git a/sgdisk.8 b/sgdisk.8
index 2c3fbfe..8bca538 100644
--- a/sgdisk.8
+++ b/sgdisk.8
@@ -1,6 +1,6 @@
-.\" Copyright 2011-2015 Roderick W. Smith (rodsmith@rodsbooks.com)
+.\" Copyright 2011-2013 Roderick W. Smith (rodsmith@rodsbooks.com)
 .\" May be distributed under the GNU General Public License
-.TH "SGDISK" "8" "1.0.1" "Roderick W. Smith" "GPT fdisk Manual"
+.TH "SGDISK" "8" "0.8.10" "Roderick W. Smith" "GPT fdisk Manual"
 .SH "NAME"
 sgdisk \- Command\-line GUID partition table (GPT) manipulator for Linux and Unix
 .SH "SYNOPSIS"
@@ -148,11 +148,11 @@
 .TP 
 .B \-a, \-\-set\-alignment=value
 Set the sector alignment multiple. GPT fdisk aligns the start of partitions
-to sectors that are multiples of this value, which defaults to 1MiB (2048
-on disks with 512-byte sectors) on freshly formatted disks. This alignment
-value is necessary to obtain optimum performance with Western Digital
-Advanced Format and similar drives with larger physical than logical sector
-sizes, with some types of RAID arrays, and with SSD devices.
+to sectors that are multiples of this value, which defaults to 2048 on
+freshly formatted disks. This alignment value is necessary to obtain optimum
+performance with Western Digital Advanced Format and similar drives with larger
+physical than logical sector sizes, with some types of RAID arrays, and
+with SSD devices.
 
 .TP
 .B \-A, \-\-attributes=list|[partnum:show|or|nand|xor|=|set|clear|toggle|get[:bitnum|hexbitmask]]
@@ -335,7 +335,10 @@
 .TP
 .B \-N, \-\-largest\-new=num
 Create a new partition that fills the largest available block of space on
-the disk. You can use the \fI\-a\fR (\fI\-\-set\-alignment\fR) option to
+the disk. Note that if used on a completely blank disk, this is likely to
+result in a sector-moved warning, since the first available sector
+(normally 34) doesn't fall on a 2048-sector boundary (the default for
+alignment). You can use the \fI\-a\fR (\fI\-\-set\-alignment\fR) option to
 adjust the alignment, if desired. A num value of 0 causes the program to
 use the first available partition number.
 
@@ -350,19 +353,11 @@
 same command line will be ignored.
 
 .TP 
-.B \-O, \-\-print\-mbr
-Display basic \fIMBR\fR partition summary data. This includes partition
-numbers, starting and ending sector numbers, partition sizes, MBR partition
-types codes, and partition names. This option is useful mainly for
-diagnosing partition table problems, particularly on disks with hybrid
-MBRs.
-
-.TP 
 .B \-p, \-\-print
-Display basic GPT partition summary data. This includes partition numbers,
-starting and ending sector numbers, partition sizes, \fBsgdisk\fR's
-partition types codes, and partition names. For additional information, use
-the \fI\-i\fR (\fI\-\-info\fR) option.
+Display basic partition summary data. This includes partition
+numbers, starting and ending sector numbers, partition sizes,
+\fBsgdisk\fR's partition types codes, and partition names. For
+additional information, use the \fI\-i\fR (\fI\-\-info\fR) option.
 
 .TP 
 .B \-P, \-\-pretend
@@ -480,8 +475,7 @@
 
 .TP 
 .B 3
-Non\-GPT disk detected and no \fI\-g\fR option, but operation requires a
-write action
+Non\-GPT disk detected and no \fI\-g\fR option
 
 .TP 
 .B 4
@@ -497,7 +491,8 @@
 Disk replication operation (-R) failed
 
 .SH "BUGS"
-Known bugs and limitations include:
+As of March 2014 (version 0.8.10), \fBsgdisk\fR
+should be considered beta software. Known bugs and limitations include:
 
 .TP 
 .B *
@@ -583,7 +578,7 @@
 
 * Justin Maggard (justin.maggard@netgear.com)
 
-* Dwight Schauer (dschauer@gmail.com)
+* Dwight Schauer (dschauer@ti.com)
 
 * Florian Zumbiehl (florz@florz.de)
 
diff --git a/support.cc b/support.cc
index a7242f6..14eb054 100644
--- a/support.cc
+++ b/support.cc
@@ -36,24 +36,6 @@
 // Reads a string from stdin, returning it as a C++-style string.
 // Note that the returned string will NOT include the carriage return
 // entered by the user.
-#ifdef EFI
-extern int __sscanf( const char * str , const char * format , ... ) ;
-string ReadString(void) {
-   string inString;
-   char efiString[256];
-   int stringLength;
-
-   if (fgets(efiString, 255, stdin) != NULL) {
-      stringLength = strlen(efiString);
-      if ((stringLength > 0) && (efiString[stringLength - 1] == '\n'))
-          efiString[stringLength - 1] = '\0';
-      inString = efiString;
-   } else {
-      inString = "";
-   }
-   return inString;
-} // ReadString()
-#else
 string ReadString(void) {
    string inString;
 
@@ -62,7 +44,6 @@
       exit(5);
    return inString;
 } // ReadString()
-#endif
 
 // Get a numeric value from the user, between low and high (inclusive).
 // Keeps looping until the user enters a value within that range.
@@ -153,7 +134,7 @@
 uint64_t IeeeToInt(string inValue, uint64_t sSize, uint64_t low, uint64_t high, uint64_t def) {
    uint64_t response = def, bytesPerUnit = 1, mult = 1, divide = 1;
    size_t foundAt = 0;
-   char suffix = ' ', plusFlag = ' ';
+   char suffix, plusFlag = ' ';
    string suffixes = "KMGTPE";
    int badInput = 0; // flag bad input; once this goes to 1, other values are irrelevant
 
@@ -246,7 +227,7 @@
    uint64_t sizeInIeee;
    uint64_t previousIeee;
    float decimalIeee;
-   uint64_t index = 0;
+   uint index = 0;
    string units, prefixes = " KMGTPEZ";
    ostringstream theValue;
 
diff --git a/support.h b/support.h
index b888d92..3e6fe08 100644
--- a/support.h
+++ b/support.h
@@ -8,7 +8,7 @@
 #ifndef __GPTSUPPORT
 #define __GPTSUPPORT
 
-#define GPTFDISK_VERSION "1.0.1"
+#define GPTFDISK_VERSION "0.8.10.2"
 
 #if defined (__FreeBSD__) || defined (__FreeBSD_kernel__) || defined (__APPLE__)
 // Darwin (Mac OS) & FreeBSD: disk IOCTLs are different, and there is no lseek64