Preliminary UTF-16LE support for GPT descriptions
This commit is contained in:
402
Makefile
402
Makefile
@@ -14,10 +14,10 @@ DEPEND= makedepend $(CXXFLAGS)
|
|||||||
all: gdisk sgdisk fixparts
|
all: gdisk sgdisk fixparts
|
||||||
|
|
||||||
gdisk: $(LIB_OBJS) gdisk.o gpttext.o
|
gdisk: $(LIB_OBJS) gdisk.o gpttext.o
|
||||||
$(CXX) $(LIB_OBJS) gdisk.o gpttext.o $(LDFLAGS) -luuid -o gdisk
|
$(CXX) $(LIB_OBJS) gdisk.o gpttext.o $(LDFLAGS) -licui18n -licuio -luuid -o gdisk
|
||||||
|
|
||||||
sgdisk: $(LIB_OBJS) sgdisk.o
|
sgdisk: $(LIB_OBJS) sgdisk.o
|
||||||
$(CXX) $(LIB_OBJS) sgdisk.o $(LDFLAGS) -luuid -lpopt -o sgdisk
|
$(CXX) $(LIB_OBJS) sgdisk.o $(LDFLAGS) -licui18n -licuio -luuid -lpopt -o sgdisk
|
||||||
|
|
||||||
fixparts: $(MBR_LIB_OBJS) fixparts.o
|
fixparts: $(MBR_LIB_OBJS) fixparts.o
|
||||||
$(CXX) $(MBR_LIB_OBJS) fixparts.o $(LDFLAGS) -o fixparts
|
$(CXX) $(MBR_LIB_OBJS) fixparts.o $(LDFLAGS) -o fixparts
|
||||||
@@ -36,401 +36,3 @@ $(OBJS):
|
|||||||
$(CRITICAL_CXX_FLAGS)
|
$(CRITICAL_CXX_FLAGS)
|
||||||
|
|
||||||
# DO NOT DELETE
|
# DO NOT DELETE
|
||||||
|
|
||||||
attributes.o: /usr/include/stdint.h /usr/include/features.h
|
|
||||||
attributes.o: /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h
|
|
||||||
attributes.o: /usr/include/gnu/stubs.h /usr/include/gnu/stubs-64.h
|
|
||||||
attributes.o: /usr/include/bits/wchar.h /usr/include/stdio.h
|
|
||||||
attributes.o: /usr/include/bits/types.h /usr/include/bits/typesizes.h
|
|
||||||
attributes.o: /usr/include/libio.h /usr/include/_G_config.h
|
|
||||||
attributes.o: /usr/include/wchar.h /usr/include/bits/stdio_lim.h
|
|
||||||
attributes.o: /usr/include/bits/sys_errlist.h attributes.h support.h
|
|
||||||
attributes.o: /usr/include/stdlib.h /usr/include/sys/types.h
|
|
||||||
attributes.o: /usr/include/time.h /usr/include/endian.h
|
|
||||||
attributes.o: /usr/include/bits/endian.h /usr/include/bits/byteswap.h
|
|
||||||
attributes.o: /usr/include/sys/select.h /usr/include/bits/select.h
|
|
||||||
attributes.o: /usr/include/bits/sigset.h /usr/include/bits/time.h
|
|
||||||
attributes.o: /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h
|
|
||||||
attributes.o: /usr/include/alloca.h
|
|
||||||
basicmbr.o: /usr/include/stdio.h /usr/include/features.h
|
|
||||||
basicmbr.o: /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h
|
|
||||||
basicmbr.o: /usr/include/gnu/stubs.h /usr/include/gnu/stubs-64.h
|
|
||||||
basicmbr.o: /usr/include/bits/types.h /usr/include/bits/typesizes.h
|
|
||||||
basicmbr.o: /usr/include/libio.h /usr/include/_G_config.h
|
|
||||||
basicmbr.o: /usr/include/wchar.h /usr/include/bits/stdio_lim.h
|
|
||||||
basicmbr.o: /usr/include/bits/sys_errlist.h /usr/include/stdlib.h
|
|
||||||
basicmbr.o: /usr/include/sys/types.h /usr/include/time.h
|
|
||||||
basicmbr.o: /usr/include/endian.h /usr/include/bits/endian.h
|
|
||||||
basicmbr.o: /usr/include/bits/byteswap.h /usr/include/sys/select.h
|
|
||||||
basicmbr.o: /usr/include/bits/select.h /usr/include/bits/sigset.h
|
|
||||||
basicmbr.o: /usr/include/bits/time.h /usr/include/sys/sysmacros.h
|
|
||||||
basicmbr.o: /usr/include/bits/pthreadtypes.h /usr/include/alloca.h
|
|
||||||
basicmbr.o: /usr/include/stdint.h /usr/include/bits/wchar.h
|
|
||||||
basicmbr.o: /usr/include/fcntl.h /usr/include/bits/fcntl.h
|
|
||||||
basicmbr.o: /usr/include/string.h /usr/include/xlocale.h
|
|
||||||
basicmbr.o: /usr/include/sys/stat.h /usr/include/bits/stat.h
|
|
||||||
basicmbr.o: /usr/include/errno.h /usr/include/bits/errno.h
|
|
||||||
basicmbr.o: /usr/include/linux/errno.h /usr/include/asm/errno.h
|
|
||||||
basicmbr.o: /usr/include/asm-generic/errno.h
|
|
||||||
basicmbr.o: /usr/include/asm-generic/errno-base.h mbr.h gptpart.h support.h
|
|
||||||
basicmbr.o: parttypes.h guid.h /usr/include/uuid/uuid.h
|
|
||||||
basicmbr.o: /usr/include/sys/time.h attributes.h diskio.h
|
|
||||||
basicmbr.o: /usr/include/sys/ioctl.h /usr/include/bits/ioctls.h
|
|
||||||
basicmbr.o: /usr/include/asm/ioctls.h /usr/include/asm-generic/ioctls.h
|
|
||||||
basicmbr.o: /usr/include/linux/ioctl.h /usr/include/asm/ioctl.h
|
|
||||||
basicmbr.o: /usr/include/asm-generic/ioctl.h /usr/include/bits/ioctl-types.h
|
|
||||||
basicmbr.o: /usr/include/sys/ttydefaults.h basicmbr.h mbrpart.h
|
|
||||||
bsd.o: /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h
|
|
||||||
bsd.o: /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h
|
|
||||||
bsd.o: /usr/include/gnu/stubs-64.h /usr/include/bits/types.h
|
|
||||||
bsd.o: /usr/include/bits/typesizes.h /usr/include/libio.h
|
|
||||||
bsd.o: /usr/include/_G_config.h /usr/include/wchar.h
|
|
||||||
bsd.o: /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h
|
|
||||||
bsd.o: /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h
|
|
||||||
bsd.o: /usr/include/endian.h /usr/include/bits/endian.h
|
|
||||||
bsd.o: /usr/include/bits/byteswap.h /usr/include/sys/select.h
|
|
||||||
bsd.o: /usr/include/bits/select.h /usr/include/bits/sigset.h
|
|
||||||
bsd.o: /usr/include/bits/time.h /usr/include/sys/sysmacros.h
|
|
||||||
bsd.o: /usr/include/bits/pthreadtypes.h /usr/include/alloca.h
|
|
||||||
bsd.o: /usr/include/stdint.h /usr/include/bits/wchar.h /usr/include/fcntl.h
|
|
||||||
bsd.o: /usr/include/bits/fcntl.h /usr/include/sys/stat.h
|
|
||||||
bsd.o: /usr/include/bits/stat.h /usr/include/errno.h
|
|
||||||
bsd.o: /usr/include/bits/errno.h /usr/include/linux/errno.h
|
|
||||||
bsd.o: /usr/include/asm/errno.h /usr/include/asm-generic/errno.h
|
|
||||||
bsd.o: /usr/include/asm-generic/errno-base.h support.h bsd.h gptpart.h
|
|
||||||
bsd.o: parttypes.h guid.h /usr/include/uuid/uuid.h /usr/include/sys/time.h
|
|
||||||
bsd.o: attributes.h diskio.h /usr/include/sys/ioctl.h
|
|
||||||
bsd.o: /usr/include/bits/ioctls.h /usr/include/asm/ioctls.h
|
|
||||||
bsd.o: /usr/include/asm-generic/ioctls.h /usr/include/linux/ioctl.h
|
|
||||||
bsd.o: /usr/include/asm/ioctl.h /usr/include/asm-generic/ioctl.h
|
|
||||||
bsd.o: /usr/include/bits/ioctl-types.h /usr/include/sys/ttydefaults.h
|
|
||||||
crc32.o: /usr/include/stdio.h /usr/include/features.h
|
|
||||||
crc32.o: /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h
|
|
||||||
crc32.o: /usr/include/gnu/stubs.h /usr/include/gnu/stubs-64.h
|
|
||||||
crc32.o: /usr/include/bits/types.h /usr/include/bits/typesizes.h
|
|
||||||
crc32.o: /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h
|
|
||||||
crc32.o: /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h
|
|
||||||
crc32.o: /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h
|
|
||||||
crc32.o: /usr/include/endian.h /usr/include/bits/endian.h
|
|
||||||
crc32.o: /usr/include/bits/byteswap.h /usr/include/sys/select.h
|
|
||||||
crc32.o: /usr/include/bits/select.h /usr/include/bits/sigset.h
|
|
||||||
crc32.o: /usr/include/bits/time.h /usr/include/sys/sysmacros.h
|
|
||||||
crc32.o: /usr/include/bits/pthreadtypes.h /usr/include/alloca.h crc32.h
|
|
||||||
crc32.o: /usr/include/stdint.h /usr/include/bits/wchar.h
|
|
||||||
diskio.o: /usr/include/sys/ioctl.h /usr/include/features.h
|
|
||||||
diskio.o: /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h
|
|
||||||
diskio.o: /usr/include/gnu/stubs.h /usr/include/gnu/stubs-64.h
|
|
||||||
diskio.o: /usr/include/bits/ioctls.h /usr/include/asm/ioctls.h
|
|
||||||
diskio.o: /usr/include/asm-generic/ioctls.h /usr/include/linux/ioctl.h
|
|
||||||
diskio.o: /usr/include/asm/ioctl.h /usr/include/asm-generic/ioctl.h
|
|
||||||
diskio.o: /usr/include/bits/ioctl-types.h /usr/include/sys/ttydefaults.h
|
|
||||||
diskio.o: /usr/include/stdint.h /usr/include/bits/wchar.h
|
|
||||||
diskio.o: /usr/include/errno.h /usr/include/bits/errno.h
|
|
||||||
diskio.o: /usr/include/linux/errno.h /usr/include/asm/errno.h
|
|
||||||
diskio.o: /usr/include/asm-generic/errno.h
|
|
||||||
diskio.o: /usr/include/asm-generic/errno-base.h /usr/include/fcntl.h
|
|
||||||
diskio.o: /usr/include/bits/fcntl.h /usr/include/sys/types.h
|
|
||||||
diskio.o: /usr/include/bits/types.h /usr/include/bits/typesizes.h
|
|
||||||
diskio.o: /usr/include/time.h /usr/include/endian.h
|
|
||||||
diskio.o: /usr/include/bits/endian.h /usr/include/bits/byteswap.h
|
|
||||||
diskio.o: /usr/include/sys/select.h /usr/include/bits/select.h
|
|
||||||
diskio.o: /usr/include/bits/sigset.h /usr/include/bits/time.h
|
|
||||||
diskio.o: /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h
|
|
||||||
diskio.o: /usr/include/sys/stat.h /usr/include/bits/stat.h support.h
|
|
||||||
diskio.o: /usr/include/stdlib.h /usr/include/alloca.h diskio.h
|
|
||||||
diskio-unix.o: /usr/include/sys/ioctl.h /usr/include/features.h
|
|
||||||
diskio-unix.o: /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h
|
|
||||||
diskio-unix.o: /usr/include/gnu/stubs.h /usr/include/gnu/stubs-64.h
|
|
||||||
diskio-unix.o: /usr/include/bits/ioctls.h /usr/include/asm/ioctls.h
|
|
||||||
diskio-unix.o: /usr/include/asm-generic/ioctls.h /usr/include/linux/ioctl.h
|
|
||||||
diskio-unix.o: /usr/include/asm/ioctl.h /usr/include/asm-generic/ioctl.h
|
|
||||||
diskio-unix.o: /usr/include/bits/ioctl-types.h /usr/include/sys/ttydefaults.h
|
|
||||||
diskio-unix.o: /usr/include/string.h /usr/include/xlocale.h
|
|
||||||
diskio-unix.o: /usr/include/stdint.h /usr/include/bits/wchar.h
|
|
||||||
diskio-unix.o: /usr/include/errno.h /usr/include/bits/errno.h
|
|
||||||
diskio-unix.o: /usr/include/linux/errno.h /usr/include/asm/errno.h
|
|
||||||
diskio-unix.o: /usr/include/asm-generic/errno.h
|
|
||||||
diskio-unix.o: /usr/include/asm-generic/errno-base.h /usr/include/fcntl.h
|
|
||||||
diskio-unix.o: /usr/include/bits/fcntl.h /usr/include/sys/types.h
|
|
||||||
diskio-unix.o: /usr/include/bits/types.h /usr/include/bits/typesizes.h
|
|
||||||
diskio-unix.o: /usr/include/time.h /usr/include/endian.h
|
|
||||||
diskio-unix.o: /usr/include/bits/endian.h /usr/include/bits/byteswap.h
|
|
||||||
diskio-unix.o: /usr/include/sys/select.h /usr/include/bits/select.h
|
|
||||||
diskio-unix.o: /usr/include/bits/sigset.h /usr/include/bits/time.h
|
|
||||||
diskio-unix.o: /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h
|
|
||||||
diskio-unix.o: /usr/include/sys/stat.h /usr/include/bits/stat.h diskio.h
|
|
||||||
diskio-unix.o: support.h /usr/include/stdlib.h /usr/include/alloca.h
|
|
||||||
diskio-windows.o: /usr/include/stdio.h /usr/include/features.h
|
|
||||||
diskio-windows.o: /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h
|
|
||||||
diskio-windows.o: /usr/include/gnu/stubs.h /usr/include/gnu/stubs-64.h
|
|
||||||
diskio-windows.o: /usr/include/bits/types.h /usr/include/bits/typesizes.h
|
|
||||||
diskio-windows.o: /usr/include/libio.h /usr/include/_G_config.h
|
|
||||||
diskio-windows.o: /usr/include/wchar.h /usr/include/bits/stdio_lim.h
|
|
||||||
diskio-windows.o: /usr/include/bits/sys_errlist.h /usr/include/stdint.h
|
|
||||||
diskio-windows.o: /usr/include/bits/wchar.h /usr/include/errno.h
|
|
||||||
diskio-windows.o: /usr/include/bits/errno.h /usr/include/linux/errno.h
|
|
||||||
diskio-windows.o: /usr/include/asm/errno.h /usr/include/asm-generic/errno.h
|
|
||||||
diskio-windows.o: /usr/include/asm-generic/errno-base.h /usr/include/fcntl.h
|
|
||||||
diskio-windows.o: /usr/include/bits/fcntl.h /usr/include/sys/types.h
|
|
||||||
diskio-windows.o: /usr/include/time.h /usr/include/endian.h
|
|
||||||
diskio-windows.o: /usr/include/bits/endian.h /usr/include/bits/byteswap.h
|
|
||||||
diskio-windows.o: /usr/include/sys/select.h /usr/include/bits/select.h
|
|
||||||
diskio-windows.o: /usr/include/bits/sigset.h /usr/include/bits/time.h
|
|
||||||
diskio-windows.o: /usr/include/sys/sysmacros.h
|
|
||||||
diskio-windows.o: /usr/include/bits/pthreadtypes.h /usr/include/sys/stat.h
|
|
||||||
diskio-windows.o: /usr/include/bits/stat.h support.h /usr/include/stdlib.h
|
|
||||||
diskio-windows.o: /usr/include/alloca.h diskio.h /usr/include/sys/ioctl.h
|
|
||||||
diskio-windows.o: /usr/include/bits/ioctls.h /usr/include/asm/ioctls.h
|
|
||||||
diskio-windows.o: /usr/include/asm-generic/ioctls.h
|
|
||||||
diskio-windows.o: /usr/include/linux/ioctl.h /usr/include/asm/ioctl.h
|
|
||||||
diskio-windows.o: /usr/include/asm-generic/ioctl.h
|
|
||||||
diskio-windows.o: /usr/include/bits/ioctl-types.h
|
|
||||||
diskio-windows.o: /usr/include/sys/ttydefaults.h
|
|
||||||
fixparts.o: /usr/include/stdio.h /usr/include/features.h
|
|
||||||
fixparts.o: /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h
|
|
||||||
fixparts.o: /usr/include/gnu/stubs.h /usr/include/gnu/stubs-64.h
|
|
||||||
fixparts.o: /usr/include/bits/types.h /usr/include/bits/typesizes.h
|
|
||||||
fixparts.o: /usr/include/libio.h /usr/include/_G_config.h
|
|
||||||
fixparts.o: /usr/include/wchar.h /usr/include/bits/stdio_lim.h
|
|
||||||
fixparts.o: /usr/include/bits/sys_errlist.h /usr/include/string.h
|
|
||||||
fixparts.o: /usr/include/xlocale.h basicmbr.h /usr/include/stdint.h
|
|
||||||
fixparts.o: /usr/include/bits/wchar.h /usr/include/sys/types.h
|
|
||||||
fixparts.o: /usr/include/time.h /usr/include/endian.h
|
|
||||||
fixparts.o: /usr/include/bits/endian.h /usr/include/bits/byteswap.h
|
|
||||||
fixparts.o: /usr/include/sys/select.h /usr/include/bits/select.h
|
|
||||||
fixparts.o: /usr/include/bits/sigset.h /usr/include/bits/time.h
|
|
||||||
fixparts.o: /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h
|
|
||||||
fixparts.o: diskio.h /usr/include/sys/ioctl.h /usr/include/bits/ioctls.h
|
|
||||||
fixparts.o: /usr/include/asm/ioctls.h /usr/include/asm-generic/ioctls.h
|
|
||||||
fixparts.o: /usr/include/linux/ioctl.h /usr/include/asm/ioctl.h
|
|
||||||
fixparts.o: /usr/include/asm-generic/ioctl.h /usr/include/bits/ioctl-types.h
|
|
||||||
fixparts.o: /usr/include/sys/ttydefaults.h support.h /usr/include/stdlib.h
|
|
||||||
fixparts.o: /usr/include/alloca.h mbrpart.h
|
|
||||||
gdisk.o: /usr/include/stdio.h /usr/include/features.h
|
|
||||||
gdisk.o: /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h
|
|
||||||
gdisk.o: /usr/include/gnu/stubs.h /usr/include/gnu/stubs-64.h
|
|
||||||
gdisk.o: /usr/include/bits/types.h /usr/include/bits/typesizes.h
|
|
||||||
gdisk.o: /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h
|
|
||||||
gdisk.o: /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h
|
|
||||||
gdisk.o: /usr/include/string.h /usr/include/xlocale.h mbr.h
|
|
||||||
gdisk.o: /usr/include/stdint.h /usr/include/bits/wchar.h
|
|
||||||
gdisk.o: /usr/include/sys/types.h /usr/include/time.h /usr/include/endian.h
|
|
||||||
gdisk.o: /usr/include/bits/endian.h /usr/include/bits/byteswap.h
|
|
||||||
gdisk.o: /usr/include/sys/select.h /usr/include/bits/select.h
|
|
||||||
gdisk.o: /usr/include/bits/sigset.h /usr/include/bits/time.h
|
|
||||||
gdisk.o: /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h
|
|
||||||
gdisk.o: gptpart.h support.h /usr/include/stdlib.h /usr/include/alloca.h
|
|
||||||
gdisk.o: parttypes.h guid.h /usr/include/uuid/uuid.h /usr/include/sys/time.h
|
|
||||||
gdisk.o: attributes.h diskio.h /usr/include/sys/ioctl.h
|
|
||||||
gdisk.o: /usr/include/bits/ioctls.h /usr/include/asm/ioctls.h
|
|
||||||
gdisk.o: /usr/include/asm-generic/ioctls.h /usr/include/linux/ioctl.h
|
|
||||||
gdisk.o: /usr/include/asm/ioctl.h /usr/include/asm-generic/ioctl.h
|
|
||||||
gdisk.o: /usr/include/bits/ioctl-types.h /usr/include/sys/ttydefaults.h
|
|
||||||
gdisk.o: basicmbr.h mbrpart.h gpttext.h gpt.h bsd.h
|
|
||||||
gpt.o: /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h
|
|
||||||
gpt.o: /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h
|
|
||||||
gpt.o: /usr/include/gnu/stubs-64.h /usr/include/bits/types.h
|
|
||||||
gpt.o: /usr/include/bits/typesizes.h /usr/include/libio.h
|
|
||||||
gpt.o: /usr/include/_G_config.h /usr/include/wchar.h
|
|
||||||
gpt.o: /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h
|
|
||||||
gpt.o: /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h
|
|
||||||
gpt.o: /usr/include/endian.h /usr/include/bits/endian.h
|
|
||||||
gpt.o: /usr/include/bits/byteswap.h /usr/include/sys/select.h
|
|
||||||
gpt.o: /usr/include/bits/select.h /usr/include/bits/sigset.h
|
|
||||||
gpt.o: /usr/include/bits/time.h /usr/include/sys/sysmacros.h
|
|
||||||
gpt.o: /usr/include/bits/pthreadtypes.h /usr/include/alloca.h
|
|
||||||
gpt.o: /usr/include/stdint.h /usr/include/bits/wchar.h /usr/include/fcntl.h
|
|
||||||
gpt.o: /usr/include/bits/fcntl.h /usr/include/string.h /usr/include/xlocale.h
|
|
||||||
gpt.o: /usr/include/math.h /usr/include/bits/huge_val.h
|
|
||||||
gpt.o: /usr/include/bits/huge_valf.h /usr/include/bits/huge_vall.h
|
|
||||||
gpt.o: /usr/include/bits/inf.h /usr/include/bits/nan.h
|
|
||||||
gpt.o: /usr/include/bits/mathdef.h /usr/include/bits/mathcalls.h
|
|
||||||
gpt.o: /usr/include/sys/stat.h /usr/include/bits/stat.h /usr/include/errno.h
|
|
||||||
gpt.o: /usr/include/bits/errno.h /usr/include/linux/errno.h
|
|
||||||
gpt.o: /usr/include/asm/errno.h /usr/include/asm-generic/errno.h
|
|
||||||
gpt.o: /usr/include/asm-generic/errno-base.h crc32.h gpt.h gptpart.h
|
|
||||||
gpt.o: support.h parttypes.h guid.h /usr/include/uuid/uuid.h
|
|
||||||
gpt.o: /usr/include/sys/time.h attributes.h mbr.h diskio.h
|
|
||||||
gpt.o: /usr/include/sys/ioctl.h /usr/include/bits/ioctls.h
|
|
||||||
gpt.o: /usr/include/asm/ioctls.h /usr/include/asm-generic/ioctls.h
|
|
||||||
gpt.o: /usr/include/linux/ioctl.h /usr/include/asm/ioctl.h
|
|
||||||
gpt.o: /usr/include/asm-generic/ioctl.h /usr/include/bits/ioctl-types.h
|
|
||||||
gpt.o: /usr/include/sys/ttydefaults.h basicmbr.h mbrpart.h bsd.h
|
|
||||||
gptpart.o: /usr/include/string.h /usr/include/features.h
|
|
||||||
gptpart.o: /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h
|
|
||||||
gptpart.o: /usr/include/gnu/stubs.h /usr/include/gnu/stubs-64.h
|
|
||||||
gptpart.o: /usr/include/xlocale.h /usr/include/stdio.h
|
|
||||||
gptpart.o: /usr/include/bits/types.h /usr/include/bits/typesizes.h
|
|
||||||
gptpart.o: /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h
|
|
||||||
gptpart.o: /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h
|
|
||||||
gptpart.o: gptpart.h /usr/include/stdint.h /usr/include/bits/wchar.h
|
|
||||||
gptpart.o: /usr/include/sys/types.h /usr/include/time.h /usr/include/endian.h
|
|
||||||
gptpart.o: /usr/include/bits/endian.h /usr/include/bits/byteswap.h
|
|
||||||
gptpart.o: /usr/include/sys/select.h /usr/include/bits/select.h
|
|
||||||
gptpart.o: /usr/include/bits/sigset.h /usr/include/bits/time.h
|
|
||||||
gptpart.o: /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h
|
|
||||||
gptpart.o: support.h /usr/include/stdlib.h /usr/include/alloca.h parttypes.h
|
|
||||||
gptpart.o: guid.h /usr/include/uuid/uuid.h /usr/include/sys/time.h
|
|
||||||
gptpart.o: attributes.h
|
|
||||||
gpttext.o: /usr/include/string.h /usr/include/features.h
|
|
||||||
gpttext.o: /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h
|
|
||||||
gpttext.o: /usr/include/gnu/stubs.h /usr/include/gnu/stubs-64.h
|
|
||||||
gpttext.o: /usr/include/xlocale.h /usr/include/errno.h
|
|
||||||
gpttext.o: /usr/include/bits/errno.h /usr/include/linux/errno.h
|
|
||||||
gpttext.o: /usr/include/asm/errno.h /usr/include/asm-generic/errno.h
|
|
||||||
gpttext.o: /usr/include/asm-generic/errno-base.h /usr/include/stdint.h
|
|
||||||
gpttext.o: /usr/include/bits/wchar.h /usr/include/limits.h
|
|
||||||
gpttext.o: /usr/include/bits/posix1_lim.h /usr/include/bits/local_lim.h
|
|
||||||
gpttext.o: /usr/include/linux/limits.h /usr/include/bits/posix2_lim.h
|
|
||||||
gpttext.o: attributes.h gpttext.h gpt.h /usr/include/sys/types.h
|
|
||||||
gpttext.o: /usr/include/bits/types.h /usr/include/bits/typesizes.h
|
|
||||||
gpttext.o: /usr/include/time.h /usr/include/endian.h
|
|
||||||
gpttext.o: /usr/include/bits/endian.h /usr/include/bits/byteswap.h
|
|
||||||
gpttext.o: /usr/include/sys/select.h /usr/include/bits/select.h
|
|
||||||
gpttext.o: /usr/include/bits/sigset.h /usr/include/bits/time.h
|
|
||||||
gpttext.o: /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h
|
|
||||||
gpttext.o: gptpart.h support.h /usr/include/stdlib.h /usr/include/alloca.h
|
|
||||||
gpttext.o: parttypes.h guid.h /usr/include/uuid/uuid.h
|
|
||||||
gpttext.o: /usr/include/sys/time.h mbr.h diskio.h /usr/include/sys/ioctl.h
|
|
||||||
gpttext.o: /usr/include/bits/ioctls.h /usr/include/asm/ioctls.h
|
|
||||||
gpttext.o: /usr/include/asm-generic/ioctls.h /usr/include/linux/ioctl.h
|
|
||||||
gpttext.o: /usr/include/asm/ioctl.h /usr/include/asm-generic/ioctl.h
|
|
||||||
gpttext.o: /usr/include/bits/ioctl-types.h /usr/include/sys/ttydefaults.h
|
|
||||||
gpttext.o: basicmbr.h mbrpart.h bsd.h
|
|
||||||
guid.o: /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h
|
|
||||||
guid.o: /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h
|
|
||||||
guid.o: /usr/include/gnu/stubs-64.h /usr/include/bits/types.h
|
|
||||||
guid.o: /usr/include/bits/typesizes.h /usr/include/libio.h
|
|
||||||
guid.o: /usr/include/_G_config.h /usr/include/wchar.h
|
|
||||||
guid.o: /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h
|
|
||||||
guid.o: /usr/include/time.h /usr/include/string.h /usr/include/xlocale.h
|
|
||||||
guid.o: guid.h /usr/include/stdint.h /usr/include/bits/wchar.h
|
|
||||||
guid.o: /usr/include/uuid/uuid.h /usr/include/sys/types.h
|
|
||||||
guid.o: /usr/include/endian.h /usr/include/bits/endian.h
|
|
||||||
guid.o: /usr/include/bits/byteswap.h /usr/include/sys/select.h
|
|
||||||
guid.o: /usr/include/bits/select.h /usr/include/bits/sigset.h
|
|
||||||
guid.o: /usr/include/bits/time.h /usr/include/sys/sysmacros.h
|
|
||||||
guid.o: /usr/include/bits/pthreadtypes.h /usr/include/sys/time.h support.h
|
|
||||||
guid.o: /usr/include/stdlib.h /usr/include/alloca.h
|
|
||||||
mbr.o: /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h
|
|
||||||
mbr.o: /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h
|
|
||||||
mbr.o: /usr/include/gnu/stubs-64.h /usr/include/bits/types.h
|
|
||||||
mbr.o: /usr/include/bits/typesizes.h /usr/include/libio.h
|
|
||||||
mbr.o: /usr/include/_G_config.h /usr/include/wchar.h
|
|
||||||
mbr.o: /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h
|
|
||||||
mbr.o: /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h
|
|
||||||
mbr.o: /usr/include/endian.h /usr/include/bits/endian.h
|
|
||||||
mbr.o: /usr/include/bits/byteswap.h /usr/include/sys/select.h
|
|
||||||
mbr.o: /usr/include/bits/select.h /usr/include/bits/sigset.h
|
|
||||||
mbr.o: /usr/include/bits/time.h /usr/include/sys/sysmacros.h
|
|
||||||
mbr.o: /usr/include/bits/pthreadtypes.h /usr/include/alloca.h
|
|
||||||
mbr.o: /usr/include/stdint.h /usr/include/bits/wchar.h /usr/include/fcntl.h
|
|
||||||
mbr.o: /usr/include/bits/fcntl.h /usr/include/string.h /usr/include/xlocale.h
|
|
||||||
mbr.o: /usr/include/sys/stat.h /usr/include/bits/stat.h /usr/include/errno.h
|
|
||||||
mbr.o: /usr/include/bits/errno.h /usr/include/linux/errno.h
|
|
||||||
mbr.o: /usr/include/asm/errno.h /usr/include/asm-generic/errno.h
|
|
||||||
mbr.o: /usr/include/asm-generic/errno-base.h mbr.h gptpart.h support.h
|
|
||||||
mbr.o: parttypes.h guid.h /usr/include/uuid/uuid.h /usr/include/sys/time.h
|
|
||||||
mbr.o: attributes.h diskio.h /usr/include/sys/ioctl.h
|
|
||||||
mbr.o: /usr/include/bits/ioctls.h /usr/include/asm/ioctls.h
|
|
||||||
mbr.o: /usr/include/asm-generic/ioctls.h /usr/include/linux/ioctl.h
|
|
||||||
mbr.o: /usr/include/asm/ioctl.h /usr/include/asm-generic/ioctl.h
|
|
||||||
mbr.o: /usr/include/bits/ioctl-types.h /usr/include/sys/ttydefaults.h
|
|
||||||
mbr.o: basicmbr.h mbrpart.h
|
|
||||||
mbrpart.o: /usr/include/stdint.h /usr/include/features.h
|
|
||||||
mbrpart.o: /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h
|
|
||||||
mbrpart.o: /usr/include/gnu/stubs.h /usr/include/gnu/stubs-64.h
|
|
||||||
mbrpart.o: /usr/include/bits/wchar.h support.h /usr/include/stdlib.h
|
|
||||||
mbrpart.o: /usr/include/sys/types.h /usr/include/bits/types.h
|
|
||||||
mbrpart.o: /usr/include/bits/typesizes.h /usr/include/time.h
|
|
||||||
mbrpart.o: /usr/include/endian.h /usr/include/bits/endian.h
|
|
||||||
mbrpart.o: /usr/include/bits/byteswap.h /usr/include/sys/select.h
|
|
||||||
mbrpart.o: /usr/include/bits/select.h /usr/include/bits/sigset.h
|
|
||||||
mbrpart.o: /usr/include/bits/time.h /usr/include/sys/sysmacros.h
|
|
||||||
mbrpart.o: /usr/include/bits/pthreadtypes.h /usr/include/alloca.h mbrpart.h
|
|
||||||
parttypes.o: /usr/include/string.h /usr/include/features.h
|
|
||||||
parttypes.o: /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h
|
|
||||||
parttypes.o: /usr/include/gnu/stubs.h /usr/include/gnu/stubs-64.h
|
|
||||||
parttypes.o: /usr/include/xlocale.h /usr/include/stdint.h
|
|
||||||
parttypes.o: /usr/include/bits/wchar.h /usr/include/stdio.h
|
|
||||||
parttypes.o: /usr/include/bits/types.h /usr/include/bits/typesizes.h
|
|
||||||
parttypes.o: /usr/include/libio.h /usr/include/_G_config.h
|
|
||||||
parttypes.o: /usr/include/wchar.h /usr/include/bits/stdio_lim.h
|
|
||||||
parttypes.o: /usr/include/bits/sys_errlist.h parttypes.h
|
|
||||||
parttypes.o: /usr/include/stdlib.h /usr/include/sys/types.h
|
|
||||||
parttypes.o: /usr/include/time.h /usr/include/endian.h
|
|
||||||
parttypes.o: /usr/include/bits/endian.h /usr/include/bits/byteswap.h
|
|
||||||
parttypes.o: /usr/include/sys/select.h /usr/include/bits/select.h
|
|
||||||
parttypes.o: /usr/include/bits/sigset.h /usr/include/bits/time.h
|
|
||||||
parttypes.o: /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h
|
|
||||||
parttypes.o: /usr/include/alloca.h support.h guid.h /usr/include/uuid/uuid.h
|
|
||||||
parttypes.o: /usr/include/sys/time.h
|
|
||||||
sgdisk.o: /usr/include/stdio.h /usr/include/features.h
|
|
||||||
sgdisk.o: /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h
|
|
||||||
sgdisk.o: /usr/include/gnu/stubs.h /usr/include/gnu/stubs-64.h
|
|
||||||
sgdisk.o: /usr/include/bits/types.h /usr/include/bits/typesizes.h
|
|
||||||
sgdisk.o: /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h
|
|
||||||
sgdisk.o: /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h
|
|
||||||
sgdisk.o: /usr/include/popt.h /usr/include/errno.h /usr/include/bits/errno.h
|
|
||||||
sgdisk.o: /usr/include/linux/errno.h /usr/include/asm/errno.h
|
|
||||||
sgdisk.o: /usr/include/asm-generic/errno.h
|
|
||||||
sgdisk.o: /usr/include/asm-generic/errno-base.h /usr/include/stdint.h
|
|
||||||
sgdisk.o: /usr/include/bits/wchar.h mbr.h /usr/include/sys/types.h
|
|
||||||
sgdisk.o: /usr/include/time.h /usr/include/endian.h
|
|
||||||
sgdisk.o: /usr/include/bits/endian.h /usr/include/bits/byteswap.h
|
|
||||||
sgdisk.o: /usr/include/sys/select.h /usr/include/bits/select.h
|
|
||||||
sgdisk.o: /usr/include/bits/sigset.h /usr/include/bits/time.h
|
|
||||||
sgdisk.o: /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h
|
|
||||||
sgdisk.o: gptpart.h support.h /usr/include/stdlib.h /usr/include/alloca.h
|
|
||||||
sgdisk.o: parttypes.h guid.h /usr/include/uuid/uuid.h /usr/include/sys/time.h
|
|
||||||
sgdisk.o: attributes.h diskio.h /usr/include/sys/ioctl.h
|
|
||||||
sgdisk.o: /usr/include/bits/ioctls.h /usr/include/asm/ioctls.h
|
|
||||||
sgdisk.o: /usr/include/asm-generic/ioctls.h /usr/include/linux/ioctl.h
|
|
||||||
sgdisk.o: /usr/include/asm/ioctl.h /usr/include/asm-generic/ioctl.h
|
|
||||||
sgdisk.o: /usr/include/bits/ioctl-types.h /usr/include/sys/ttydefaults.h
|
|
||||||
sgdisk.o: basicmbr.h mbrpart.h gpt.h bsd.h
|
|
||||||
support.o: /usr/include/stdio.h /usr/include/features.h
|
|
||||||
support.o: /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h
|
|
||||||
support.o: /usr/include/gnu/stubs.h /usr/include/gnu/stubs-64.h
|
|
||||||
support.o: /usr/include/bits/types.h /usr/include/bits/typesizes.h
|
|
||||||
support.o: /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h
|
|
||||||
support.o: /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h
|
|
||||||
support.o: /usr/include/stdint.h /usr/include/bits/wchar.h
|
|
||||||
support.o: /usr/include/errno.h /usr/include/bits/errno.h
|
|
||||||
support.o: /usr/include/linux/errno.h /usr/include/asm/errno.h
|
|
||||||
support.o: /usr/include/asm-generic/errno.h
|
|
||||||
support.o: /usr/include/asm-generic/errno-base.h /usr/include/fcntl.h
|
|
||||||
support.o: /usr/include/bits/fcntl.h /usr/include/sys/types.h
|
|
||||||
support.o: /usr/include/time.h /usr/include/endian.h
|
|
||||||
support.o: /usr/include/bits/endian.h /usr/include/bits/byteswap.h
|
|
||||||
support.o: /usr/include/sys/select.h /usr/include/bits/select.h
|
|
||||||
support.o: /usr/include/bits/sigset.h /usr/include/bits/time.h
|
|
||||||
support.o: /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h
|
|
||||||
support.o: /usr/include/string.h /usr/include/xlocale.h
|
|
||||||
support.o: /usr/include/sys/stat.h /usr/include/bits/stat.h support.h
|
|
||||||
support.o: /usr/include/stdlib.h /usr/include/alloca.h
|
|
||||||
test.o: /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h
|
|
||||||
test.o: /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h
|
|
||||||
test.o: /usr/include/gnu/stubs-64.h /usr/include/bits/types.h
|
|
||||||
test.o: /usr/include/bits/typesizes.h /usr/include/libio.h
|
|
||||||
test.o: /usr/include/_G_config.h /usr/include/wchar.h
|
|
||||||
test.o: /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h
|
|
||||||
test.o: support.h /usr/include/stdint.h /usr/include/bits/wchar.h
|
|
||||||
test.o: /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h
|
|
||||||
test.o: /usr/include/endian.h /usr/include/bits/endian.h
|
|
||||||
test.o: /usr/include/bits/byteswap.h /usr/include/sys/select.h
|
|
||||||
test.o: /usr/include/bits/select.h /usr/include/bits/sigset.h
|
|
||||||
test.o: /usr/include/bits/time.h /usr/include/sys/sysmacros.h
|
|
||||||
test.o: /usr/include/bits/pthreadtypes.h /usr/include/alloca.h
|
|
||||||
testguid.o: guid.h /usr/include/stdint.h /usr/include/features.h
|
|
||||||
testguid.o: /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h
|
|
||||||
testguid.o: /usr/include/gnu/stubs.h /usr/include/gnu/stubs-64.h
|
|
||||||
testguid.o: /usr/include/bits/wchar.h /usr/include/uuid/uuid.h
|
|
||||||
testguid.o: /usr/include/sys/types.h /usr/include/bits/types.h
|
|
||||||
testguid.o: /usr/include/bits/typesizes.h /usr/include/time.h
|
|
||||||
testguid.o: /usr/include/endian.h /usr/include/bits/endian.h
|
|
||||||
testguid.o: /usr/include/bits/byteswap.h /usr/include/sys/select.h
|
|
||||||
testguid.o: /usr/include/bits/select.h /usr/include/bits/sigset.h
|
|
||||||
testguid.o: /usr/include/bits/time.h /usr/include/sys/sysmacros.h
|
|
||||||
testguid.o: /usr/include/bits/pthreadtypes.h /usr/include/sys/time.h
|
|
||||||
testguid.o: parttypes.h /usr/include/stdlib.h /usr/include/alloca.h support.h
|
|
||||||
|
|||||||
4
NEWS
4
NEWS
@@ -1,6 +1,10 @@
|
|||||||
0.7.1 (?/?/2011):
|
0.7.1 (?/?/2011):
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
|
- Fixed bug that caused second protective MBR partition, when created
|
||||||
|
as part of a hybrid MBR, to always be of type 0xEE, even when the
|
||||||
|
user specified something else.
|
||||||
|
|
||||||
- Integrated a number of code cleanups contributed by Florian Zumbiehl.
|
- Integrated a number of code cleanups contributed by Florian Zumbiehl.
|
||||||
|
|
||||||
0.7.0 (3/11/2011):
|
0.7.0 (3/11/2011):
|
||||||
|
|||||||
4
README
4
README
@@ -161,6 +161,10 @@ used.) In addition, note these requirements:
|
|||||||
called uuid-dev or something similar to get the headers. On FreeBSD, the
|
called uuid-dev or something similar to get the headers. On FreeBSD, the
|
||||||
e2fsprogs-libuuid port must be installed.
|
e2fsprogs-libuuid port must be installed.
|
||||||
|
|
||||||
|
* The ICU library (http://site.icu-project.org) is required on all
|
||||||
|
platforms. This library is normally installed in Linux, but you may need
|
||||||
|
to install the development headers (libicu-dev or something similar).
|
||||||
|
|
||||||
* The sgdisk program also requires the popt library and its development
|
* The sgdisk program also requires the popt library and its development
|
||||||
files (headers). Most Linux distributions install popt by default, but
|
files (headers). Most Linux distributions install popt by default, but
|
||||||
you may need to install a package called popt-dev, popt-devel, or
|
you may need to install a package called popt-dev, popt-devel, or
|
||||||
|
|||||||
12
basicmbr.cc
12
basicmbr.cc
@@ -1544,15 +1544,13 @@ MBRPart* BasicMBRData::GetPartition(int i) {
|
|||||||
// user selected the 'q' option. (Thus, the caller should save data
|
// user selected the 'q' option. (Thus, the caller should save data
|
||||||
// if the return value is >0, or possibly >=0 depending on intentions.)
|
// if the return value is >0, or possibly >=0 depending on intentions.)
|
||||||
int BasicMBRData::DoMenu(const string& prompt) {
|
int BasicMBRData::DoMenu(const string& prompt) {
|
||||||
char line[255];
|
|
||||||
int goOn = 1, quitting = 0, retval, num, haveShownInfo = 0;
|
int goOn = 1, quitting = 0, retval, num, haveShownInfo = 0;
|
||||||
unsigned int hexCode = 0x00;
|
unsigned int hexCode = 0x00;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
cout << prompt;
|
cout << prompt;
|
||||||
ReadCString(line, sizeof(line));
|
switch (ReadString()[0]) {
|
||||||
switch (*line) {
|
case '\0':
|
||||||
case '\n':
|
|
||||||
break;
|
break;
|
||||||
case 'a': case 'A':
|
case 'a': case 'A':
|
||||||
num = GetNumber(1, MAX_MBR_PARTS, 1, "Toggle active flag for partition: ") - 1;
|
num = GetNumber(1, MAX_MBR_PARTS, 1, "Toggle active flag for partition: ") - 1;
|
||||||
@@ -1598,13 +1596,9 @@ int BasicMBRData::DoMenu(const string& prompt) {
|
|||||||
case 't': case 'T':
|
case 't': case 'T':
|
||||||
num = GetNumber(1, MAX_MBR_PARTS, 1, "Partition to change type code: ") - 1;
|
num = GetNumber(1, MAX_MBR_PARTS, 1, "Partition to change type code: ") - 1;
|
||||||
if (partitions[num].GetLengthLBA() > 0) {
|
if (partitions[num].GetLengthLBA() > 0) {
|
||||||
hexCode = 0;
|
|
||||||
while ((hexCode <= 0) || (hexCode > 255)) {
|
while ((hexCode <= 0) || (hexCode > 255)) {
|
||||||
cout << "Enter an MBR hex code: ";
|
cout << "Enter an MBR hex code: ";
|
||||||
ReadCString(line, sizeof(line));
|
hexCode = StrToHex(ReadString(), 0);
|
||||||
sscanf(line, "%x", &hexCode);
|
|
||||||
if (line[0] == '\n')
|
|
||||||
hexCode = 0x00;
|
|
||||||
} // while
|
} // while
|
||||||
partitions[num].SetType(hexCode);
|
partitions[num].SetType(hexCode);
|
||||||
} // if
|
} // if
|
||||||
|
|||||||
79
fixparts.cc
79
fixparts.cc
@@ -22,21 +22,18 @@ using namespace std;
|
|||||||
|
|
||||||
int main(int argc, char* argv[]) {
|
int main(int argc, char* argv[]) {
|
||||||
BasicMBRData mbrTable;
|
BasicMBRData mbrTable;
|
||||||
char *device = NULL;
|
string device;
|
||||||
int i, doItAgain;
|
int doItAgain;
|
||||||
|
|
||||||
switch (argc) {
|
switch (argc) {
|
||||||
case 1:
|
case 1:
|
||||||
cout << "Type device filename, or press <Enter> to exit: ";
|
cout << "Type device filename, or press <Enter> to exit: ";
|
||||||
device = new char[255];
|
device = ReadString();
|
||||||
ReadCString(device, 255);
|
if (device.length() == 0)
|
||||||
i = strlen(device);
|
exit(0);
|
||||||
if (i && device[i - 1] == '\n')
|
|
||||||
device[i - 1] = '\0';
|
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
device = new char[strlen(argv[1]) + 1];
|
device = argv[1];
|
||||||
strcpy(device, argv[1]);
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
cerr << "Usage: " << argv[0] << " device_filename\n";
|
cerr << "Usage: " << argv[0] << " device_filename\n";
|
||||||
@@ -45,39 +42,39 @@ int main(int argc, char* argv[]) {
|
|||||||
|
|
||||||
cout << "FixParts " << GPTFDISK_VERSION << "\n";
|
cout << "FixParts " << GPTFDISK_VERSION << "\n";
|
||||||
cout << "\nLoading MBR data from " << device << "\n";
|
cout << "\nLoading MBR data from " << device << "\n";
|
||||||
mbrTable.ReadMBRData(device);
|
if (mbrTable.ReadMBRData(device)) {
|
||||||
if (mbrTable.CheckForGPT() > 0) {
|
if (mbrTable.CheckForGPT() > 0) {
|
||||||
if ((mbrTable.GetValidity() == hybrid) || (mbrTable.GetValidity() == gpt)) {
|
if ((mbrTable.GetValidity() == hybrid) || (mbrTable.GetValidity() == gpt)) {
|
||||||
cerr << "\nThis disk appears to be a GPT disk. Use GNU Parted or GPT fdisk on it!\n";
|
cerr << "\nThis disk appears to be a GPT disk. Use GNU Parted or GPT fdisk on it!\n";
|
||||||
cerr << "Exiting!\n\n";
|
cerr << "Exiting!\n\n";
|
||||||
exit(1);
|
exit(1);
|
||||||
} else {
|
|
||||||
cout << "\nNOTICE: GPT signatures detected on the disk, but no 0xEE protective "
|
|
||||||
<< "partition!\nThe GPT signatures are probably left over from a previous "
|
|
||||||
<< "partition table.\nDo you want to delete them (if you answer 'Y', this "
|
|
||||||
<< "will happen\nimmediately)? ";
|
|
||||||
if (GetYN() == 'Y') {
|
|
||||||
cout << "Erasing GPT data!\n";
|
|
||||||
if (mbrTable.BlankGPTData() != 1)
|
|
||||||
cerr << "GPT signature erasure failed!\n";
|
|
||||||
} // if
|
|
||||||
} // if/else
|
|
||||||
} // if
|
|
||||||
mbrTable.MakeItLegal();
|
|
||||||
do {
|
|
||||||
doItAgain = 0;
|
|
||||||
if (mbrTable.DoMenu() > 0) {
|
|
||||||
cout << "\nFinal checks complete. About to write MBR data. THIS WILL OVERWRITE EXISTING\n"
|
|
||||||
<< "PARTITIONS!!\n\nDo you want to proceed? ";
|
|
||||||
if (GetYN() == 'Y') {
|
|
||||||
mbrTable.WriteMBRData();
|
|
||||||
mbrTable.DiskSync();
|
|
||||||
doItAgain = 0;
|
|
||||||
} else {
|
} else {
|
||||||
doItAgain = 1;
|
cout << "\nNOTICE: GPT signatures detected on the disk, but no 0xEE protective "
|
||||||
} // else
|
<< "partition!\nThe GPT signatures are probably left over from a previous "
|
||||||
|
<< "partition table.\nDo you want to delete them (if you answer 'Y', this "
|
||||||
|
<< "will happen\nimmediately)? ";
|
||||||
|
if (GetYN() == 'Y') {
|
||||||
|
cout << "Erasing GPT data!\n";
|
||||||
|
if (mbrTable.BlankGPTData() != 1)
|
||||||
|
cerr << "GPT signature erasure failed!\n";
|
||||||
|
} // if
|
||||||
|
} // if/else
|
||||||
} // if
|
} // if
|
||||||
} while (doItAgain);
|
mbrTable.MakeItLegal();
|
||||||
delete[] device;
|
do {
|
||||||
|
doItAgain = 0;
|
||||||
|
if (mbrTable.DoMenu() > 0) {
|
||||||
|
cout << "\nFinal checks complete. About to write MBR data. THIS WILL OVERWRITE EXISTING\n"
|
||||||
|
<< "PARTITIONS!!\n\nDo you want to proceed? ";
|
||||||
|
if (GetYN() == 'Y') {
|
||||||
|
mbrTable.WriteMBRData();
|
||||||
|
mbrTable.DiskSync();
|
||||||
|
doItAgain = 0;
|
||||||
|
} else {
|
||||||
|
doItAgain = 1;
|
||||||
|
} // else
|
||||||
|
} // if
|
||||||
|
} while (doItAgain);
|
||||||
|
} // if read OK
|
||||||
return 0;
|
return 0;
|
||||||
} // main()
|
} // main()
|
||||||
|
|||||||
73
gdisk.cc
73
gdisk.cc
@@ -28,8 +28,8 @@ void WinWarning(void);
|
|||||||
|
|
||||||
int main(int argc, char* argv[]) {
|
int main(int argc, char* argv[]) {
|
||||||
GPTDataTextUI theGPT;
|
GPTDataTextUI theGPT;
|
||||||
size_t i;
|
string device = "";
|
||||||
char *device = NULL;
|
UnicodeString uString;
|
||||||
|
|
||||||
cout << "GPT fdisk (gdisk) version " << GPTFDISK_VERSION << "\n\n";
|
cout << "GPT fdisk (gdisk) version " << GPTFDISK_VERSION << "\n\n";
|
||||||
|
|
||||||
@@ -40,14 +40,12 @@ int main(int argc, char* argv[]) {
|
|||||||
case 1:
|
case 1:
|
||||||
WinWarning();
|
WinWarning();
|
||||||
cout << "Type device filename, or press <Enter> to exit: ";
|
cout << "Type device filename, or press <Enter> to exit: ";
|
||||||
device = new char[255];
|
device = ReadString();
|
||||||
ReadCString(device, 255);
|
if (device.length() == 0)
|
||||||
i = strlen(device);
|
exit(0);
|
||||||
if (i && device[i - 1] == '\n')
|
else if (theGPT.LoadPartitions(device)) {
|
||||||
device[i - 1] = '\0';
|
|
||||||
if (*device && theGPT.LoadPartitions(device))
|
|
||||||
MainMenu(device, &theGPT);
|
MainMenu(device, &theGPT);
|
||||||
delete[] device;
|
} // if/elseif
|
||||||
break;
|
break;
|
||||||
case 2: // basic usage
|
case 2: // basic usage
|
||||||
WinWarning();
|
WinWarning();
|
||||||
@@ -56,15 +54,15 @@ int main(int argc, char* argv[]) {
|
|||||||
break;
|
break;
|
||||||
case 3: // usage with "-l" option
|
case 3: // usage with "-l" option
|
||||||
if (strcmp(argv[1], "-l") == 0) {
|
if (strcmp(argv[1], "-l") == 0) {
|
||||||
device = argv[2];
|
device = (string) argv[2];
|
||||||
} else if (strcmp(argv[2], "-l") == 0) {
|
} else if (strcmp(argv[2], "-l") == 0) {
|
||||||
device = argv[1];
|
device = (string) argv[1];
|
||||||
} else { // 3 arguments, but none is "-l"
|
} else { // 3 arguments, but none is "-l"
|
||||||
cerr << "Usage: " << argv[0] << " [-l] device_file\n";
|
cerr << "Usage: " << argv[0] << " [-l] device_file\n";
|
||||||
} // if/elseif/else
|
} // if/elseif/else
|
||||||
if (device != NULL) {
|
if (device != "") {
|
||||||
theGPT.JustLooking();
|
theGPT.JustLooking();
|
||||||
if (theGPT.LoadPartitions((string) device))
|
if (theGPT.LoadPartitions(device))
|
||||||
theGPT.DisplayGPTData();
|
theGPT.DisplayGPTData();
|
||||||
} // if
|
} // if
|
||||||
break;
|
break;
|
||||||
@@ -77,22 +75,18 @@ int main(int argc, char* argv[]) {
|
|||||||
// Accept a command and execute it. Returns only when the user
|
// Accept a command and execute it. Returns only when the user
|
||||||
// wants to exit (such as after a 'w' or 'q' command).
|
// wants to exit (such as after a 'w' or 'q' command).
|
||||||
void MainMenu(string filename, GPTDataTextUI* theGPT) {
|
void MainMenu(string filename, GPTDataTextUI* theGPT) {
|
||||||
char line[255], buFile[255];
|
|
||||||
int goOn = 1;
|
int goOn = 1;
|
||||||
PartType typeHelper;
|
PartType typeHelper;
|
||||||
uint32_t temp1, temp2;
|
uint32_t temp1, temp2;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
cout << "\nCommand (? for help): ";
|
cout << "\nCommand (? for help): ";
|
||||||
ReadCString(line, sizeof(line));
|
switch (ReadString()[0]) {
|
||||||
switch (*line) {
|
case '\0':
|
||||||
case '\n':
|
|
||||||
break;
|
break;
|
||||||
case 'b': case 'B':
|
case 'b': case 'B':
|
||||||
cout << "Enter backup filename to save: ";
|
cout << "Enter backup filename to save: ";
|
||||||
ReadCString(line, sizeof(line));
|
theGPT->SaveGPTBackup(ReadString());
|
||||||
sscanf(line, "%s", buFile);
|
|
||||||
theGPT->SaveGPTBackup(buFile);
|
|
||||||
break;
|
break;
|
||||||
case 'c': case 'C':
|
case 'c': case 'C':
|
||||||
if (theGPT->GetPartRange(&temp1, &temp2) > 0)
|
if (theGPT->GetPartRange(&temp1, &temp2) > 0)
|
||||||
@@ -177,15 +171,13 @@ void ShowCommands(void) {
|
|||||||
// Accept a recovery & transformation menu command. Returns only when the user
|
// Accept a recovery & transformation menu command. Returns only when the user
|
||||||
// issues an exit command, such as 'w' or 'q'.
|
// issues an exit command, such as 'w' or 'q'.
|
||||||
void RecoveryMenu(string filename, GPTDataTextUI* theGPT) {
|
void RecoveryMenu(string filename, GPTDataTextUI* theGPT) {
|
||||||
char line[255], buFile[255];
|
|
||||||
uint32_t numParts;
|
uint32_t numParts;
|
||||||
int goOn = 1, temp1;
|
int goOn = 1, temp1;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
cout << "\nRecovery/transformation command (? for help): ";
|
cout << "\nRecovery/transformation command (? for help): ";
|
||||||
ReadCString(line, sizeof(line));
|
switch (ReadString()[0]) {
|
||||||
switch (*line) {
|
case '\0':
|
||||||
case '\n':
|
|
||||||
break;
|
break;
|
||||||
case 'b': case 'B':
|
case 'b': case 'B':
|
||||||
theGPT->RebuildMainHeader();
|
theGPT->RebuildMainHeader();
|
||||||
@@ -239,9 +231,7 @@ void RecoveryMenu(string filename, GPTDataTextUI* theGPT) {
|
|||||||
break;
|
break;
|
||||||
case 'l': case 'L':
|
case 'l': case 'L':
|
||||||
cout << "Enter backup filename to load: ";
|
cout << "Enter backup filename to load: ";
|
||||||
ReadCString(line, sizeof(line));
|
theGPT->LoadGPTBackup(ReadString());
|
||||||
sscanf(line, "%s", buFile);
|
|
||||||
theGPT->LoadGPTBackup(buFile);
|
|
||||||
break;
|
break;
|
||||||
case 'm': case 'M':
|
case 'm': case 'M':
|
||||||
MainMenu(filename, theGPT);
|
MainMenu(filename, theGPT);
|
||||||
@@ -303,19 +293,16 @@ void ShowRecoveryCommands(void) {
|
|||||||
// selects an exit command, such as 'w' or 'q'.
|
// selects an exit command, such as 'w' or 'q'.
|
||||||
void ExpertsMenu(string filename, GPTDataTextUI* theGPT) {
|
void ExpertsMenu(string filename, GPTDataTextUI* theGPT) {
|
||||||
GPTData secondDevice;
|
GPTData secondDevice;
|
||||||
char line[255], *device;
|
|
||||||
uint32_t pn, temp1, temp2;
|
uint32_t pn, temp1, temp2;
|
||||||
int goOn = 1;
|
int goOn = 1;
|
||||||
size_t i;
|
string guidStr, device;
|
||||||
char guidStr[255];
|
|
||||||
GUIDData aGUID;
|
GUIDData aGUID;
|
||||||
ostringstream prompt;
|
ostringstream prompt;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
cout << "\nExpert command (? for help): ";
|
cout << "\nExpert command (? for help): ";
|
||||||
ReadCString(line, sizeof(line));
|
switch (ReadString()[0]) {
|
||||||
switch (*line) {
|
case '\0':
|
||||||
case '\n':
|
|
||||||
break;
|
break;
|
||||||
case 'a': case 'A':
|
case 'a': case 'A':
|
||||||
if (theGPT->GetPartRange(&temp1, &temp2) > 0)
|
if (theGPT->GetPartRange(&temp1, &temp2) > 0)
|
||||||
@@ -327,8 +314,8 @@ void ExpertsMenu(string filename, GPTDataTextUI* theGPT) {
|
|||||||
if (theGPT->GetPartRange(&temp1, &temp2) > 0) {
|
if (theGPT->GetPartRange(&temp1, &temp2) > 0) {
|
||||||
pn = theGPT->GetPartNum();
|
pn = theGPT->GetPartNum();
|
||||||
cout << "Enter the partition's new unique GUID ('R' to randomize): ";
|
cout << "Enter the partition's new unique GUID ('R' to randomize): ";
|
||||||
ReadCString(guidStr, sizeof(guidStr));
|
guidStr = ReadString();
|
||||||
if ((strlen(guidStr) >= 33) || (guidStr[0] == 'R') || (guidStr[0] == 'r')) {
|
if ((guidStr.length() >= 32) || (guidStr[0] == 'R') || (guidStr[0] == 'r')) {
|
||||||
theGPT->SetPartitionGUID(pn, (GUIDData) guidStr);
|
theGPT->SetPartitionGUID(pn, (GUIDData) guidStr);
|
||||||
cout << "New GUID is " << theGPT->operator[](pn).GetUniqueGUID() << "\n";
|
cout << "New GUID is " << theGPT->operator[](pn).GetUniqueGUID() << "\n";
|
||||||
} else {
|
} else {
|
||||||
@@ -349,12 +336,13 @@ void ExpertsMenu(string filename, GPTDataTextUI* theGPT) {
|
|||||||
break;
|
break;
|
||||||
case 'g': case 'G':
|
case 'g': case 'G':
|
||||||
cout << "Enter the disk's unique GUID ('R' to randomize): ";
|
cout << "Enter the disk's unique GUID ('R' to randomize): ";
|
||||||
ReadCString(guidStr, sizeof(guidStr));
|
guidStr = ReadString();
|
||||||
if ((strlen(guidStr) >= 33) || (guidStr[0] == 'R') || (guidStr[0] == 'r')) {
|
if ((guidStr.length() >= 32) || (guidStr[0] == 'R') || (guidStr[0] == 'r')) {
|
||||||
theGPT->SetDiskGUID((GUIDData) guidStr);
|
theGPT->SetDiskGUID((GUIDData) guidStr);
|
||||||
cout << "The new disk GUID is " << theGPT->GetDiskGUID() << "\n";
|
cout << "The new disk GUID is " << theGPT->GetDiskGUID() << "\n";
|
||||||
} else
|
} else {
|
||||||
cout << "GUID is too short!\n";
|
cout << "GUID is too short!\n";
|
||||||
|
} // if/else
|
||||||
break;
|
break;
|
||||||
case 'h': case 'H':
|
case 'h': case 'H':
|
||||||
theGPT->RecomputeCHS();
|
theGPT->RecomputeCHS();
|
||||||
@@ -397,17 +385,12 @@ void ExpertsMenu(string filename, GPTDataTextUI* theGPT) {
|
|||||||
break;
|
break;
|
||||||
case 'u': case 'U':
|
case 'u': case 'U':
|
||||||
cout << "Type device filename, or press <Enter> to exit: ";
|
cout << "Type device filename, or press <Enter> to exit: ";
|
||||||
device = new char[255];
|
device = ReadString();
|
||||||
ReadCString(device, 255);
|
if (device.length() > 0) {
|
||||||
i = strlen(device);
|
|
||||||
if (i && device[i - 1] == '\n')
|
|
||||||
device[i - 1] = '\0';
|
|
||||||
if (*device) {
|
|
||||||
secondDevice = *theGPT;
|
secondDevice = *theGPT;
|
||||||
secondDevice.SetDisk(device);
|
secondDevice.SetDisk(device);
|
||||||
secondDevice.SaveGPTData(0);
|
secondDevice.SaveGPTData(0);
|
||||||
} // if
|
} // if
|
||||||
delete[] device;
|
|
||||||
break;
|
break;
|
||||||
case 'v': case 'V':
|
case 'v': case 'V':
|
||||||
theGPT->Verify();
|
theGPT->Verify();
|
||||||
|
|||||||
10
gpt.cc
10
gpt.cc
@@ -1028,7 +1028,7 @@ int GPTData::SaveGPTData(int quiet) {
|
|||||||
|
|
||||||
myDisk.Close();
|
myDisk.Close();
|
||||||
} else {
|
} else {
|
||||||
cerr << "Unable to open device " << myDisk.GetName() << " for writing! Errno is "
|
cerr << "Unable to open device '" << myDisk.GetName() << "' for writing! Errno is "
|
||||||
<< errno << "! Aborting write!\n";
|
<< errno << "! Aborting write!\n";
|
||||||
allOK = 0;
|
allOK = 0;
|
||||||
} // if/else
|
} // if/else
|
||||||
@@ -1078,7 +1078,7 @@ int GPTData::SaveGPTBackup(const string & filename) {
|
|||||||
} // if/else
|
} // if/else
|
||||||
backupFile.Close();
|
backupFile.Close();
|
||||||
} else {
|
} else {
|
||||||
cerr << "Unable to open file " << filename << " for writing! Aborting!\n";
|
cerr << "Unable to open file '" << filename << "' for writing! Aborting!\n";
|
||||||
allOK = 0;
|
allOK = 0;
|
||||||
} // if/else
|
} // if/else
|
||||||
return allOK;
|
return allOK;
|
||||||
@@ -1190,7 +1190,7 @@ int GPTData::LoadGPTBackup(const string & filename) {
|
|||||||
} // if
|
} // if
|
||||||
} else {
|
} else {
|
||||||
allOK = 0;
|
allOK = 0;
|
||||||
cerr << "Unable to open file " << filename << " for reading! Aborting!\n";
|
cerr << "Unable to open file '" << filename << "' for reading! Aborting!\n";
|
||||||
} // if/else
|
} // if/else
|
||||||
|
|
||||||
return allOK;
|
return allOK;
|
||||||
@@ -1253,7 +1253,7 @@ int GPTData::DestroyGPT(void) {
|
|||||||
<< "other utilities.\n";
|
<< "other utilities.\n";
|
||||||
delete[] emptyTable;
|
delete[] emptyTable;
|
||||||
} else {
|
} else {
|
||||||
cerr << "Problem opening " << device << " for writing! Program will now terminate.\n";
|
cerr << "Problem opening '" << device << "' for writing! Program will now terminate.\n";
|
||||||
} // if/else (fd != -1)
|
} // if/else (fd != -1)
|
||||||
return (allOK);
|
return (allOK);
|
||||||
} // GPTDataTextUI::DestroyGPT()
|
} // GPTDataTextUI::DestroyGPT()
|
||||||
@@ -1766,7 +1766,7 @@ void GPTData::MoveSecondHeaderToEnd() {
|
|||||||
secondHeader.partitionEntriesLBA = secondHeader.lastUsableLBA + UINT64_C(1);
|
secondHeader.partitionEntriesLBA = secondHeader.lastUsableLBA + UINT64_C(1);
|
||||||
} // GPTData::FixSecondHeaderLocation()
|
} // GPTData::FixSecondHeaderLocation()
|
||||||
|
|
||||||
int GPTData::SetName(uint32_t partNum, const string & theName) {
|
int GPTData::SetName(uint32_t partNum, const UnicodeString & theName) {
|
||||||
int retval = 1;
|
int retval = 1;
|
||||||
|
|
||||||
if (!IsFreePartNum(partNum)) {
|
if (!IsFreePartNum(partNum)) {
|
||||||
|
|||||||
2
gpt.h
2
gpt.h
@@ -151,7 +151,7 @@ public:
|
|||||||
int SwapPartitions(uint32_t partNum1, uint32_t partNum2);
|
int SwapPartitions(uint32_t partNum1, uint32_t partNum2);
|
||||||
int ClearGPTData(void);
|
int ClearGPTData(void);
|
||||||
void MoveSecondHeaderToEnd();
|
void MoveSecondHeaderToEnd();
|
||||||
int SetName(uint32_t partNum, const string & theName = "");
|
int SetName(uint32_t partNum, const UnicodeString & theName = "");
|
||||||
void SetDiskGUID(GUIDData newGUID);
|
void SetDiskGUID(GUIDData newGUID);
|
||||||
int SetPartitionGUID(uint32_t pn, GUIDData theGUID);
|
int SetPartitionGUID(uint32_t pn, GUIDData theGUID);
|
||||||
void RandomizeGUIDs(void);
|
void RandomizeGUIDs(void);
|
||||||
|
|||||||
92
gptpart.cc
92
gptpart.cc
@@ -17,6 +17,7 @@
|
|||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <unicode/ustdio.h>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include "gptpart.h"
|
#include "gptpart.h"
|
||||||
#include "attributes.h"
|
#include "attributes.h"
|
||||||
@@ -46,6 +47,16 @@ string GPTPart::GetTypeName(void) {
|
|||||||
return partitionType.TypeName();
|
return partitionType.TypeName();
|
||||||
} // GPTPart::GetNameType()
|
} // GPTPart::GetNameType()
|
||||||
|
|
||||||
|
// Return a Unicode description of the partition type (e.g., "Linux/Windows
|
||||||
|
// data" or "Linux swap").
|
||||||
|
UnicodeString GPTPart::GetUTypeName(void) {
|
||||||
|
return partitionType.UTypeName();
|
||||||
|
/* UnicodeString temp;
|
||||||
|
|
||||||
|
temp = temp.fromUTF8(partitionType.TypeName());
|
||||||
|
return temp; */
|
||||||
|
} // GPTPart::GetNameType()
|
||||||
|
|
||||||
// Compute and return the partition's length (or 0 if the end is incorrectly
|
// Compute and return the partition's length (or 0 if the end is incorrectly
|
||||||
// set before the beginning).
|
// set before the beginning).
|
||||||
uint64_t GPTPart::GetLengthLBA(void) const {
|
uint64_t GPTPart::GetLengthLBA(void) const {
|
||||||
@@ -56,7 +67,7 @@ uint64_t GPTPart::GetLengthLBA(void) const {
|
|||||||
return length;
|
return length;
|
||||||
} // GPTPart::GetLengthLBA()
|
} // GPTPart::GetLengthLBA()
|
||||||
|
|
||||||
// Return partition's name field, converted to a C++ ASCII string
|
/* // Return partition's name field, converted to a C++ ASCII string
|
||||||
string GPTPart::GetDescription(void) {
|
string GPTPart::GetDescription(void) {
|
||||||
string theName;
|
string theName;
|
||||||
int i;
|
int i;
|
||||||
@@ -67,6 +78,20 @@ string GPTPart::GetDescription(void) {
|
|||||||
theName += name[i];
|
theName += name[i];
|
||||||
} // for
|
} // for
|
||||||
return theName;
|
return theName;
|
||||||
|
} // GPTPart::GetDescription() */
|
||||||
|
|
||||||
|
UnicodeString GPTPart::GetDescription(void) {
|
||||||
|
UnicodeString theName;
|
||||||
|
UChar *temp;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
theName = "";
|
||||||
|
temp = (UChar*) name;
|
||||||
|
for (i = 0; i < NAME_SIZE / 2; i++) {
|
||||||
|
if (temp[i] != '\0')
|
||||||
|
theName += temp[i];
|
||||||
|
} // for
|
||||||
|
return theName;
|
||||||
} // GPTPart::GetDescription()
|
} // GPTPart::GetDescription()
|
||||||
|
|
||||||
// Return 1 if the partition is in use
|
// Return 1 if the partition is in use
|
||||||
@@ -78,41 +103,38 @@ int GPTPart::IsUsed(void) {
|
|||||||
// name *IF* the current name is the generic one for the current partition
|
// name *IF* the current name is the generic one for the current partition
|
||||||
// type.
|
// type.
|
||||||
void GPTPart::SetType(PartType t) {
|
void GPTPart::SetType(PartType t) {
|
||||||
if (GetDescription() == partitionType.TypeName()) {
|
if (GetDescription() == partitionType.UTypeName()) {
|
||||||
SetName(t.TypeName());
|
SetName(t.TypeName());
|
||||||
} // if
|
} // if
|
||||||
partitionType = t;
|
partitionType = t;
|
||||||
} // GPTPart::SetType()
|
} // GPTPart::SetType()
|
||||||
|
|
||||||
// Set the name for a partition to theName, or prompt for a name if
|
// Set the name for a partition to theName, or prompt for a name if
|
||||||
// theName is empty. Note that theName is a standard C++-style ASCII
|
// theName is empty, using a C++-style string as input.
|
||||||
// string, although the GUID partition definition requires a UTF-16LE
|
void GPTPart::SetName(string theName) {
|
||||||
// string. This function creates a simple-minded copy for this.
|
UnicodeString uString;
|
||||||
void GPTPart::SetName(const string & theName) {
|
|
||||||
char newName[NAME_SIZE];
|
|
||||||
size_t i;
|
|
||||||
|
|
||||||
// Blank out new name string, so that it will terminate in a null
|
uString = theName.c_str();
|
||||||
// when data are copied to it....
|
SetName(uString);
|
||||||
memset(newName, 0, NAME_SIZE);
|
} // GPTPart::SetName()
|
||||||
|
|
||||||
|
// Set the name for a partition to theName, or prompt for a name
|
||||||
|
// if theName is empty, using a Unicode string as input.
|
||||||
|
void GPTPart::SetName(UnicodeString theName) {
|
||||||
|
int i;
|
||||||
|
UChar temp[NAME_SIZE / 2];
|
||||||
|
|
||||||
if (theName == "") { // No name specified, so get one from the user
|
if (theName == "") { // No name specified, so get one from the user
|
||||||
cout << "Enter name: ";
|
cout << "Enter name: ";
|
||||||
ReadCString(newName, NAME_SIZE / 2 + 1);
|
theName = ReadUString();
|
||||||
|
|
||||||
// Input is likely to include a newline, so remove it....
|
|
||||||
i = strlen(newName);
|
|
||||||
if (i && newName[i - 1] == '\n')
|
|
||||||
newName[i - 1] = '\0';
|
|
||||||
} else {
|
|
||||||
strcpy(newName, theName.substr(0, NAME_SIZE / 2).c_str());
|
|
||||||
} // if
|
} // if
|
||||||
|
|
||||||
// Copy the C-style ASCII string from newName into a form that the GPT
|
// Copy the C++-style string from newName into a form that the GPT
|
||||||
// table will accept....
|
// table will accept....
|
||||||
memset(name, 0, NAME_SIZE);
|
memset(temp, 0, NAME_SIZE);
|
||||||
for (i = 0; i < NAME_SIZE / 2; i++)
|
for (i = 0; i < theName.length(); i++)
|
||||||
name[i * 2] = newName[i];
|
temp[i] = theName[i];
|
||||||
|
memcpy(name, temp, NAME_SIZE);
|
||||||
} // GPTPart::SetName()
|
} // GPTPart::SetName()
|
||||||
|
|
||||||
// Set the name for the partition based on the current GUID partition type
|
// Set the name for the partition based on the current GUID partition type
|
||||||
@@ -146,6 +168,7 @@ bool GPTPart::operator<(const GPTPart &other) const {
|
|||||||
// Display summary information; does nothing if the partition is empty.
|
// Display summary information; does nothing if the partition is empty.
|
||||||
void GPTPart::ShowSummary(int partNum, uint32_t blockSize) {
|
void GPTPart::ShowSummary(int partNum, uint32_t blockSize) {
|
||||||
string sizeInIeee;
|
string sizeInIeee;
|
||||||
|
UnicodeString description;
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
if (firstLBA != 0) {
|
if (firstLBA != 0) {
|
||||||
@@ -166,7 +189,13 @@ void GPTPart::ShowSummary(int partNum, uint32_t blockSize) {
|
|||||||
cout.setf(ios::uppercase);
|
cout.setf(ios::uppercase);
|
||||||
cout << hex << partitionType.GetHexType() << " " << dec;
|
cout << hex << partitionType.GetHexType() << " " << dec;
|
||||||
cout.fill(' ');
|
cout.fill(' ');
|
||||||
cout << GetDescription().substr(0, 23) << "\n";
|
// description = GetDescription();
|
||||||
|
GetDescription().extractBetween(0, 24, description);
|
||||||
|
cout << description << "\n";
|
||||||
|
// for (i = 0; i < 23; i++)
|
||||||
|
// cout << (char) description.;
|
||||||
|
// cout << GetDescription().tempSubString(0, 23) << "\n";
|
||||||
|
// cout << GetDescription().substr(0, 23) << "\n";
|
||||||
cout.fill(' ');
|
cout.fill(' ');
|
||||||
} // if
|
} // if
|
||||||
} // GPTPart::ShowSummary()
|
} // GPTPart::ShowSummary()
|
||||||
@@ -217,11 +246,16 @@ int GPTPart::DoTheyOverlap(const GPTPart & other) {
|
|||||||
(firstLBA <= other.lastLBA) != (lastLBA < other.firstLBA);
|
(firstLBA <= other.lastLBA) != (lastLBA < other.firstLBA);
|
||||||
} // GPTPart::DoTheyOverlap()
|
} // GPTPart::DoTheyOverlap()
|
||||||
|
|
||||||
// Reverse the bytes of integral data types; used on big-endian systems.
|
// Reverse the bytes of integral data types and of the UTF-16LE name;
|
||||||
|
// used on big-endian systems.
|
||||||
void GPTPart::ReversePartBytes(void) {
|
void GPTPart::ReversePartBytes(void) {
|
||||||
|
int i;
|
||||||
|
|
||||||
ReverseBytes(&firstLBA, 8);
|
ReverseBytes(&firstLBA, 8);
|
||||||
ReverseBytes(&lastLBA, 8);
|
ReverseBytes(&lastLBA, 8);
|
||||||
ReverseBytes(&attributes, 8);
|
ReverseBytes(&attributes, 8);
|
||||||
|
for (i = 0; i < NAME_SIZE; i += 2)
|
||||||
|
ReverseBytes(name + i, 2);
|
||||||
} // GPTPart::ReverseBytes()
|
} // GPTPart::ReverseBytes()
|
||||||
|
|
||||||
/****************************************
|
/****************************************
|
||||||
@@ -231,20 +265,20 @@ void GPTPart::ReversePartBytes(void) {
|
|||||||
// Change the type code on the partition. Also changes the name if the original
|
// Change the type code on the partition. Also changes the name if the original
|
||||||
// name is the generic one for the partition type.
|
// name is the generic one for the partition type.
|
||||||
void GPTPart::ChangeType(void) {
|
void GPTPart::ChangeType(void) {
|
||||||
char line[255];
|
string line;
|
||||||
int changeName;
|
int changeName;
|
||||||
PartType tempType = (GUIDData) "00000000-0000-0000-0000-000000000000";
|
PartType tempType = (GUIDData) "00000000-0000-0000-0000-000000000000";
|
||||||
|
|
||||||
changeName = (GetDescription() == GetTypeName());
|
changeName = (GetDescription() == GetUTypeName());
|
||||||
|
|
||||||
cout << "Current type is '" << GetTypeName() << "'\n";
|
cout << "Current type is '" << GetTypeName() << "'\n";
|
||||||
do {
|
do {
|
||||||
cout << "Hex code or GUID (L to show codes, Enter = 0700): ";
|
cout << "Hex code or GUID (L to show codes, Enter = 0700): ";
|
||||||
ReadCString(line, sizeof(line));
|
line = ReadString();
|
||||||
if ((line[0] == 'L') || (line[0] == 'l')) {
|
if ((line[0] == 'L') || (line[0] == 'l')) {
|
||||||
partitionType.ShowAllTypes();
|
partitionType.ShowAllTypes();
|
||||||
} else {
|
} else {
|
||||||
if (strlen(line) == 1)
|
if (line.length() == 0)
|
||||||
tempType = 0x0700;
|
tempType = 0x0700;
|
||||||
else
|
else
|
||||||
tempType = line;
|
tempType = line;
|
||||||
|
|||||||
@@ -54,13 +54,15 @@ class GPTPart {
|
|||||||
PartType & GetType(void) {return partitionType;}
|
PartType & GetType(void) {return partitionType;}
|
||||||
uint16_t GetHexType(void) const;
|
uint16_t GetHexType(void) const;
|
||||||
string GetTypeName(void);
|
string GetTypeName(void);
|
||||||
|
UnicodeString GetUTypeName(void);
|
||||||
const GUIDData GetUniqueGUID(void) const {return uniqueGUID;}
|
const GUIDData GetUniqueGUID(void) const {return uniqueGUID;}
|
||||||
uint64_t GetFirstLBA(void) const {return firstLBA;}
|
uint64_t GetFirstLBA(void) const {return firstLBA;}
|
||||||
uint64_t GetLastLBA(void) const {return lastLBA;}
|
uint64_t GetLastLBA(void) const {return lastLBA;}
|
||||||
uint64_t GetLengthLBA(void) const;
|
uint64_t GetLengthLBA(void) const;
|
||||||
Attributes GetAttributes(void) {return attributes;}
|
Attributes GetAttributes(void) {return attributes;}
|
||||||
void ShowAttributes(uint32_t partNum) {attributes.ShowAttributes(partNum);}
|
void ShowAttributes(uint32_t partNum) {attributes.ShowAttributes(partNum);}
|
||||||
string GetDescription(void);
|
// string GetDescription(void);
|
||||||
|
UnicodeString GetDescription(void);
|
||||||
int IsUsed(void);
|
int IsUsed(void);
|
||||||
|
|
||||||
// Simple data assignment:
|
// Simple data assignment:
|
||||||
@@ -72,7 +74,9 @@ class GPTPart {
|
|||||||
void SetLastLBA(uint64_t l) {lastLBA = l;}
|
void SetLastLBA(uint64_t l) {lastLBA = l;}
|
||||||
void SetAttributes(uint64_t a) {attributes = a;}
|
void SetAttributes(uint64_t a) {attributes = a;}
|
||||||
void SetAttributes(void) {attributes.ChangeAttributes();}
|
void SetAttributes(void) {attributes.ChangeAttributes();}
|
||||||
void SetName(const string & n);
|
void SetName(string theName);
|
||||||
|
void SetName(UnicodeString theName);
|
||||||
|
// void SetName(UChar *theName);
|
||||||
void SetDefaultDescription(void);
|
void SetDefaultDescription(void);
|
||||||
|
|
||||||
// Additional functions
|
// Additional functions
|
||||||
|
|||||||
29
gpttext.cc
29
gpttext.cc
@@ -355,7 +355,7 @@ void GPTDataTextUI::ShowDetails(void) {
|
|||||||
// OSes that don't understand GPT.
|
// OSes that don't understand GPT.
|
||||||
void GPTDataTextUI::MakeHybrid(void) {
|
void GPTDataTextUI::MakeHybrid(void) {
|
||||||
uint32_t partNums[3];
|
uint32_t partNums[3];
|
||||||
char line[255];
|
string line;
|
||||||
int numPartsToCvt, i, j, mbrNum = 0;
|
int numPartsToCvt, i, j, mbrNum = 0;
|
||||||
unsigned int hexCode = 0;
|
unsigned int hexCode = 0;
|
||||||
MBRPart hybridPart;
|
MBRPart hybridPart;
|
||||||
@@ -371,8 +371,8 @@ void GPTDataTextUI::MakeHybrid(void) {
|
|||||||
// hybrid MBR....
|
// hybrid MBR....
|
||||||
cout << "Type from one to three GPT partition numbers, separated by spaces, to be\n"
|
cout << "Type from one to three GPT partition numbers, separated by spaces, to be\n"
|
||||||
<< "added to the hybrid MBR, in sequence: ";
|
<< "added to the hybrid MBR, in sequence: ";
|
||||||
ReadCString(line, sizeof(line));
|
line = ReadString();
|
||||||
numPartsToCvt = sscanf(line, "%d %d %d", &partNums[0], &partNums[1], &partNums[2]);
|
numPartsToCvt = sscanf(line.c_str(), "%d %d %d", &partNums[0], &partNums[1], &partNums[2]);
|
||||||
|
|
||||||
if (numPartsToCvt > 0) {
|
if (numPartsToCvt > 0) {
|
||||||
cout << "Place EFI GPT (0xEE) partition first in MBR (good for GRUB)? ";
|
cout << "Place EFI GPT (0xEE) partition first in MBR (good for GRUB)? ";
|
||||||
@@ -422,16 +422,11 @@ void GPTDataTextUI::MakeHybrid(void) {
|
|||||||
if (hybridMBR.CountParts() < 4) { // unused entry....
|
if (hybridMBR.CountParts() < 4) { // unused entry....
|
||||||
cout << "\nUnused partition space(s) found. Use one to protect more partitions? ";
|
cout << "\nUnused partition space(s) found. Use one to protect more partitions? ";
|
||||||
if (GetYN() == 'Y') {
|
if (GetYN() == 'Y') {
|
||||||
while ((hexCode <= 0) || (hexCode > 255)) {
|
cout << "Note: Default is 0xEE, but this may confuse Mac OS X.\n";
|
||||||
cout << "Enter an MBR hex code (EE is EFI GPT, but may confuse MacOS): ";
|
// Comment on above: Mac OS treats disks with more than one
|
||||||
// Comment on above: Mac OS treats disks with more than one
|
// 0xEE MBR partition as MBR disks, not as GPT disks.
|
||||||
// 0xEE MBR partition as MBR disks, not as GPT disks.
|
hexCode = GetMBRTypeCode(0xEE);
|
||||||
ReadCString(line, sizeof(line));
|
hybridMBR.MakeBiggestPart(3, hexCode);
|
||||||
sscanf(line, "%x", &hexCode);
|
|
||||||
if (line[0] == '\n')
|
|
||||||
hexCode = 0x00;
|
|
||||||
} // while
|
|
||||||
hybridMBR.MakeBiggestPart(3, 0xEE);
|
|
||||||
} // if (GetYN() == 'Y')
|
} // if (GetYN() == 'Y')
|
||||||
} // if unused entry
|
} // if unused entry
|
||||||
protectiveMBR = hybridMBR;
|
protectiveMBR = hybridMBR;
|
||||||
@@ -471,7 +466,7 @@ int GPTDataTextUI::XFormToMBR(void) {
|
|||||||
|
|
||||||
// Get an MBR type code from the user and return it
|
// Get an MBR type code from the user and return it
|
||||||
int GetMBRTypeCode(int defType) {
|
int GetMBRTypeCode(int defType) {
|
||||||
char line[255];
|
string line;
|
||||||
int typeCode;
|
int typeCode;
|
||||||
|
|
||||||
cout.setf(ios::uppercase);
|
cout.setf(ios::uppercase);
|
||||||
@@ -480,11 +475,11 @@ int GetMBRTypeCode(int defType) {
|
|||||||
cout << "Enter an MBR hex code (default " << hex;
|
cout << "Enter an MBR hex code (default " << hex;
|
||||||
cout.width(2);
|
cout.width(2);
|
||||||
cout << defType << "): " << dec;
|
cout << defType << "): " << dec;
|
||||||
ReadCString(line, sizeof(line));
|
line = ReadString();
|
||||||
if (line[0] == '\n')
|
if (line[0] == '\0')
|
||||||
typeCode = defType;
|
typeCode = defType;
|
||||||
else
|
else
|
||||||
sscanf(line, "%x", &typeCode);
|
typeCode = StrToHex(line, 0);
|
||||||
} while ((typeCode <= 0) || (typeCode > 255));
|
} while ((typeCode <= 0) || (typeCode > 255));
|
||||||
cout.fill(' ');
|
cout.fill(' ');
|
||||||
return typeCode;
|
return typeCode;
|
||||||
|
|||||||
4
guid.cc
4
guid.cc
@@ -33,6 +33,10 @@ GUIDData::GUIDData(const GUIDData & orig) {
|
|||||||
memcpy(uuidData, orig.uuidData, sizeof(uuidData));
|
memcpy(uuidData, orig.uuidData, sizeof(uuidData));
|
||||||
} // copy constructor
|
} // copy constructor
|
||||||
|
|
||||||
|
GUIDData::GUIDData(const string & orig) {
|
||||||
|
operator=(orig);
|
||||||
|
} // copy (from string) constructor
|
||||||
|
|
||||||
GUIDData::GUIDData(const char * orig) {
|
GUIDData::GUIDData(const char * orig) {
|
||||||
operator=(orig);
|
operator=(orig);
|
||||||
} // copy (from char*) constructor
|
} // copy (from char*) constructor
|
||||||
|
|||||||
1
guid.h
1
guid.h
@@ -37,6 +37,7 @@ class GUIDData {
|
|||||||
public:
|
public:
|
||||||
GUIDData(void);
|
GUIDData(void);
|
||||||
GUIDData(const GUIDData & orig);
|
GUIDData(const GUIDData & orig);
|
||||||
|
GUIDData(const string & orig);
|
||||||
GUIDData(const char * orig);
|
GUIDData(const char * orig);
|
||||||
~GUIDData(void);
|
~GUIDData(void);
|
||||||
|
|
||||||
|
|||||||
46
parttypes.cc
46
parttypes.cc
@@ -270,6 +270,26 @@ string PartType::TypeName(void) const {
|
|||||||
return typeName;
|
return typeName;
|
||||||
} // PartType::TypeName()
|
} // PartType::TypeName()
|
||||||
|
|
||||||
|
// Return the Unicode description of the partition type (e.g., "Linux/Windows data")
|
||||||
|
UnicodeString PartType::UTypeName(void) const {
|
||||||
|
AType* theItem = allTypes;
|
||||||
|
int found = 0;
|
||||||
|
UnicodeString typeName;
|
||||||
|
|
||||||
|
while ((theItem != NULL) && (!found)) {
|
||||||
|
if (theItem->GUIDType == *this) { // found it!
|
||||||
|
typeName = theItem->name.c_str();
|
||||||
|
found = 1;
|
||||||
|
} else {
|
||||||
|
theItem = theItem->next;
|
||||||
|
} // if/else
|
||||||
|
} // while
|
||||||
|
if (!found) {
|
||||||
|
typeName = "Unknown";
|
||||||
|
} // if (!found)
|
||||||
|
return typeName;
|
||||||
|
} // PartType::TypeName()
|
||||||
|
|
||||||
// Return the custom GPT fdisk 2-byte (16-bit) hex code for this GUID partition type
|
// Return the custom GPT fdisk 2-byte (16-bit) hex code for this GUID partition type
|
||||||
// Note that this function ignores entries for which the display variable
|
// Note that this function ignores entries for which the display variable
|
||||||
// is set to 0. This enables control of which values get returned when
|
// is set to 0. This enables control of which values get returned when
|
||||||
@@ -337,3 +357,29 @@ int PartType::Valid(uint16_t code) const {
|
|||||||
} // while
|
} // while
|
||||||
return found;
|
return found;
|
||||||
} // PartType::Valid()
|
} // PartType::Valid()
|
||||||
|
|
||||||
|
/********************************
|
||||||
|
* *
|
||||||
|
* Non-class support functions. *
|
||||||
|
* *
|
||||||
|
********************************/
|
||||||
|
|
||||||
|
// Note: ReadUString() is here rather than in support.cc so that the ICU
|
||||||
|
// libraries need not be linked to fixparts.
|
||||||
|
|
||||||
|
// Reads a Unicode string from stdin, returning it as a ICU-style string.
|
||||||
|
// Note that the returned string will NOT include the carriage return
|
||||||
|
// entered by the user.
|
||||||
|
UnicodeString ReadUString(void) {
|
||||||
|
UnicodeString inString = "", oneWord;
|
||||||
|
|
||||||
|
do {
|
||||||
|
cin >> oneWord;
|
||||||
|
if (inString.length() > 0)
|
||||||
|
inString += " ";
|
||||||
|
inString += oneWord;
|
||||||
|
} while (cin.peek() != '\n');
|
||||||
|
cin.get(); // discard CR
|
||||||
|
return inString;
|
||||||
|
} // ReadUString()
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,8 @@
|
|||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <unicode/unistr.h>
|
||||||
|
#include <unicode/ustream.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "support.h"
|
#include "support.h"
|
||||||
#include "guid.h"
|
#include "guid.h"
|
||||||
@@ -51,6 +53,7 @@ public:
|
|||||||
|
|
||||||
// Retrieve transformed GUID data based on type code matches
|
// Retrieve transformed GUID data based on type code matches
|
||||||
string TypeName(void) const;
|
string TypeName(void) const;
|
||||||
|
UnicodeString UTypeName(void) const;
|
||||||
uint16_t GetHexType() const;
|
uint16_t GetHexType() const;
|
||||||
|
|
||||||
// Information relating to all type data
|
// Information relating to all type data
|
||||||
@@ -58,4 +61,6 @@ public:
|
|||||||
int Valid(uint16_t code) const;
|
int Valid(uint16_t code) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
UnicodeString ReadUString(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
43
sgdisk.cc
43
sgdisk.cc
@@ -30,6 +30,11 @@ using namespace std;
|
|||||||
int BuildMBR(GPTData& theGPT, char* argument, int isHybrid);
|
int BuildMBR(GPTData& theGPT, char* argument, int isHybrid);
|
||||||
int CountColons(char* argument);
|
int CountColons(char* argument);
|
||||||
|
|
||||||
|
// Extract colon-separated fields from a string....
|
||||||
|
uint64_t GetInt(const string & argument, int itemNum);
|
||||||
|
string GetString(string argument, int itemNum);
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
GPTData theGPT, secondDevice;
|
GPTData theGPT, secondDevice;
|
||||||
uint32_t sSize;
|
uint32_t sSize;
|
||||||
@@ -173,7 +178,7 @@ int main(int argc, char *argv[]) {
|
|||||||
case 'c':
|
case 'c':
|
||||||
theGPT.JustLooking(0);
|
theGPT.JustLooking(0);
|
||||||
partNum = (int) GetInt(partName, 1) - 1;
|
partNum = (int) GetInt(partName, 1) - 1;
|
||||||
if (theGPT.SetName(partNum, GetString(partName, 2))) {
|
if (theGPT.SetName(partNum, (UnicodeString) GetString(partName, 2).c_str())) {
|
||||||
saveData = 1;
|
saveData = 1;
|
||||||
} else {
|
} else {
|
||||||
cerr << "Unable to set partition " << partNum + 1
|
cerr << "Unable to set partition " << partNum + 1
|
||||||
@@ -473,3 +478,39 @@ int CountColons(char* argument) {
|
|||||||
|
|
||||||
return num;
|
return num;
|
||||||
} // CountColons()
|
} // CountColons()
|
||||||
|
|
||||||
|
// Extract integer data from argument string, which should be colon-delimited
|
||||||
|
uint64_t GetInt(const string & argument, int itemNum) {
|
||||||
|
uint64_t retval;
|
||||||
|
|
||||||
|
istringstream inString(GetString(argument, itemNum));
|
||||||
|
inString >> retval;
|
||||||
|
return retval;
|
||||||
|
} // GetInt()
|
||||||
|
|
||||||
|
// Extract string data from argument string, which should be colon-delimited
|
||||||
|
// If string begins with a colon, that colon is skipped in the counting. If an
|
||||||
|
// invalid itemNum is specified, returns an empty string.
|
||||||
|
string GetString(string argument, int itemNum) {
|
||||||
|
size_t startPos = 0, endPos = 0;
|
||||||
|
string retVal = "";
|
||||||
|
int foundLast = 0;
|
||||||
|
int numFound = 0;
|
||||||
|
|
||||||
|
if (argument[0] == ':')
|
||||||
|
argument.erase(0, 1);
|
||||||
|
while ((numFound < itemNum) && (!foundLast)) {
|
||||||
|
endPos = argument.find(':', startPos);
|
||||||
|
numFound++;
|
||||||
|
if (endPos == string::npos) {
|
||||||
|
foundLast = 1;
|
||||||
|
endPos = argument.length();
|
||||||
|
} else if (numFound < itemNum) {
|
||||||
|
startPos = endPos + 1;
|
||||||
|
} // if/elseif
|
||||||
|
} // while
|
||||||
|
if ((numFound == itemNum) && (numFound > 0))
|
||||||
|
retVal = argument.substr(startPos, endPos - startPos);
|
||||||
|
|
||||||
|
return retVal;
|
||||||
|
} // GetString()
|
||||||
|
|||||||
61
support.cc
61
support.cc
@@ -15,6 +15,7 @@
|
|||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
#include <unicode/ustdio.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
@@ -31,13 +32,15 @@
|
|||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
void ReadCString(char *inStr, int numchars) {
|
// Reads a string from stdin, returning it as a C++-style string.
|
||||||
if (!fgets(inStr, numchars, stdin)) {
|
// Note that the returned string will NOT include the carriage return
|
||||||
cerr << "Error! Failed fgets() in ReadCString()\n";
|
// entered by the user.
|
||||||
if ((numchars > 0) && (inStr != NULL))
|
string ReadString(void) {
|
||||||
inStr[0] = '\0';
|
string inString;
|
||||||
} // if
|
|
||||||
} // ReadCString()
|
getline(cin, inString);
|
||||||
|
return inString;
|
||||||
|
} // ReadString()
|
||||||
|
|
||||||
// Get a numeric value from the user, between low and high (inclusive).
|
// Get a numeric value from the user, between low and high (inclusive).
|
||||||
// Keeps looping until the user enters a value within that range.
|
// Keeps looping until the user enters a value within that range.
|
||||||
@@ -69,12 +72,12 @@ int GetNumber(int low, int high, int def, const string & prompt) {
|
|||||||
|
|
||||||
// Gets a Y/N response (and converts lowercase to uppercase)
|
// Gets a Y/N response (and converts lowercase to uppercase)
|
||||||
char GetYN(void) {
|
char GetYN(void) {
|
||||||
char line[255];
|
|
||||||
char response;
|
char response;
|
||||||
|
string line;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
cout << "(Y/N): ";
|
cout << "(Y/N): ";
|
||||||
ReadCString(line, sizeof(line));
|
line = ReadString();
|
||||||
response = toupper(line[0]);
|
response = toupper(line[0]);
|
||||||
} while ((response != 'Y') && (response != 'N'));
|
} while ((response != 'Y') && (response != 'N'));
|
||||||
return response;
|
return response;
|
||||||
@@ -180,7 +183,7 @@ uint64_t IeeeToInt(string inValue, uint64_t sSize, uint64_t low, uint64_t high,
|
|||||||
// (sectorSize defaults to 1).
|
// (sectorSize defaults to 1).
|
||||||
string BytesToIeee(uint64_t size, uint32_t sectorSize) {
|
string BytesToIeee(uint64_t size, uint32_t sectorSize) {
|
||||||
float sizeInIeee;
|
float sizeInIeee;
|
||||||
uint index = 0;
|
unsigned int index = 0;
|
||||||
string units, prefixes = " KMGTPE";
|
string units, prefixes = " KMGTPE";
|
||||||
ostringstream theValue;
|
ostringstream theValue;
|
||||||
|
|
||||||
@@ -209,7 +212,7 @@ unsigned char StrToHex(const string & input, unsigned int position) {
|
|||||||
unsigned char retval = 0x00;
|
unsigned char retval = 0x00;
|
||||||
unsigned int temp;
|
unsigned int temp;
|
||||||
|
|
||||||
if (input.length() >= (position + 2)) {
|
if (input.length() > position) {
|
||||||
sscanf(input.substr(position, 2).c_str(), "%x", &temp);
|
sscanf(input.substr(position, 2).c_str(), "%x", &temp);
|
||||||
retval = (unsigned char) temp;
|
retval = (unsigned char) temp;
|
||||||
} // if
|
} // if
|
||||||
@@ -267,39 +270,3 @@ void ReverseBytes(void* theValue, int numBytes) {
|
|||||||
delete[] tempValue;
|
delete[] tempValue;
|
||||||
} // if
|
} // if
|
||||||
} // ReverseBytes()
|
} // ReverseBytes()
|
||||||
|
|
||||||
// Extract integer data from argument string, which should be colon-delimited
|
|
||||||
uint64_t GetInt(const string & argument, int itemNum) {
|
|
||||||
uint64_t retval;
|
|
||||||
|
|
||||||
istringstream inString(GetString(argument, itemNum));
|
|
||||||
inString >> retval;
|
|
||||||
return retval;
|
|
||||||
} // GetInt()
|
|
||||||
|
|
||||||
// Extract string data from argument string, which should be colon-delimited
|
|
||||||
// If string begins with a colon, that colon is skipped in the counting. If an
|
|
||||||
// invalid itemNum is specified, returns an empty string.
|
|
||||||
string GetString(string argument, int itemNum) {
|
|
||||||
size_t startPos = 0, endPos = 0;
|
|
||||||
string retVal = "";
|
|
||||||
int foundLast = 0;
|
|
||||||
int numFound = 0;
|
|
||||||
|
|
||||||
if (argument[0] == ':')
|
|
||||||
argument.erase(0, 1);
|
|
||||||
while ((numFound < itemNum) && (!foundLast)) {
|
|
||||||
endPos = argument.find(':', startPos);
|
|
||||||
numFound++;
|
|
||||||
if (endPos == string::npos) {
|
|
||||||
foundLast = 1;
|
|
||||||
endPos = argument.length();
|
|
||||||
} else if (numFound < itemNum) {
|
|
||||||
startPos = endPos + 1;
|
|
||||||
} // if/elseif
|
|
||||||
} // while
|
|
||||||
if ((numFound == itemNum) && (numFound > 0))
|
|
||||||
retVal = argument.substr(startPos, endPos - startPos);
|
|
||||||
|
|
||||||
return retVal;
|
|
||||||
} // GetString()
|
|
||||||
|
|||||||
12
support.h
12
support.h
@@ -8,7 +8,7 @@
|
|||||||
#ifndef __GPTSUPPORT
|
#ifndef __GPTSUPPORT
|
||||||
#define __GPTSUPPORT
|
#define __GPTSUPPORT
|
||||||
|
|
||||||
#define GPTFDISK_VERSION "0.7.1-pre1"
|
#define GPTFDISK_VERSION "0.7.1-pre2"
|
||||||
|
|
||||||
#if defined (__FreeBSD__) || defined (__FreeBSD_kernel__) || defined (__APPLE__)
|
#if defined (__FreeBSD__) || defined (__FreeBSD_kernel__) || defined (__APPLE__)
|
||||||
// Darwin (Mac OS) only: disk IOCTLs are different, and there is no lseek64
|
// Darwin (Mac OS) only: disk IOCTLs are different, and there is no lseek64
|
||||||
@@ -38,8 +38,8 @@
|
|||||||
#define APM_SIGNATURE1 UINT64_C(0x00004D5000000000)
|
#define APM_SIGNATURE1 UINT64_C(0x00004D5000000000)
|
||||||
#define APM_SIGNATURE2 UINT64_C(0x0000535400000000)
|
#define APM_SIGNATURE2 UINT64_C(0x0000535400000000)
|
||||||
|
|
||||||
// Maximum line length ignored on some input functions
|
// Maximum line length on some input functions
|
||||||
#define MAX_IGNORED 999
|
#define MAX_LINE_LENGTH 255
|
||||||
|
|
||||||
/**************************
|
/**************************
|
||||||
* Some GPT constants.... *
|
* Some GPT constants.... *
|
||||||
@@ -56,7 +56,7 @@
|
|||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
void ReadCString(char *inStr, int numchars);
|
string ReadString(void);
|
||||||
int GetNumber(int low, int high, int def, const string & prompt);
|
int GetNumber(int low, int high, int def, const string & prompt);
|
||||||
char GetYN(void);
|
char GetYN(void);
|
||||||
uint64_t GetSectorNum(uint64_t low, uint64_t high, uint64_t def, uint64_t sSize, const std::string& prompt);
|
uint64_t GetSectorNum(uint64_t low, uint64_t high, uint64_t def, uint64_t sSize, const std::string& prompt);
|
||||||
@@ -67,8 +67,4 @@ int IsHex(const string & input); // Returns 1 if input can be hexadecimal number
|
|||||||
int IsLittleEndian(void); // Returns 1 if CPU is little-endian, 0 if it's big-endian
|
int IsLittleEndian(void); // Returns 1 if CPU is little-endian, 0 if it's big-endian
|
||||||
void ReverseBytes(void* theValue, int numBytes); // Reverses byte-order of theValue
|
void ReverseBytes(void* theValue, int numBytes); // Reverses byte-order of theValue
|
||||||
|
|
||||||
// Extract colon-separated fields from a string....
|
|
||||||
uint64_t GetInt(const string & argument, int itemNum);
|
|
||||||
string GetString(string argument, int itemNum);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user