summaryrefslogtreecommitdiffstats
path: root/parted
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 19:16:34 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 19:16:34 +0000
commita398d2c2b5fd6ab0545d8bb019f9a970b2309404 (patch)
tree272fc7ab226258d7ceddee12c8c682c8e711c2b0 /parted
parentInitial commit. (diff)
downloadparted-a398d2c2b5fd6ab0545d8bb019f9a970b2309404.tar.xz
parted-a398d2c2b5fd6ab0545d8bb019f9a970b2309404.zip
Adding upstream version 3.6.upstream/3.6upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'parted')
-rw-r--r--parted/Makefile.am55
-rw-r--r--parted/Makefile.in2085
-rw-r--r--parted/command.c143
-rw-r--r--parted/command.h48
-rw-r--r--parted/jsonwrt.c225
-rw-r--r--parted/jsonwrt.h46
-rw-r--r--parted/parted.c2699
-rw-r--r--parted/strlist.c582
-rw-r--r--parted/strlist.h66
-rw-r--r--parted/table.c245
-rw-r--r--parted/table.h52
-rw-r--r--parted/ui.c1702
-rw-r--r--parted/ui.h98
13 files changed, 8046 insertions, 0 deletions
diff --git a/parted/Makefile.am b/parted/Makefile.am
new file mode 100644
index 0000000..e5f3288
--- /dev/null
+++ b/parted/Makefile.am
@@ -0,0 +1,55 @@
+BUILT_SOURCES =
+
+sbin_PROGRAMS = parted
+
+AM_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS)
+partedincludedir = \
+ -I$(top_srcdir)/lib -I$(top_builddir)/include -I$(top_srcdir)/include
+
+parted_SOURCES = command.c \
+ command.h \
+ parted.c \
+ strlist.c \
+ strlist.h \
+ ui.c \
+ ui.h \
+ jsonwrt.c \
+ jsonwrt.h \
+ table.c \
+ table.h
+
+noinst_LIBRARIES = libver.a
+nodist_libver_a_SOURCES = version.c version.h
+
+BUILT_SOURCES += version.c
+version.c: Makefile
+ $(AM_V_GEN)rm -f $@
+ $(AM_V_at)printf '#include <config.h>\n' > $@t
+ $(AM_V_at)printf 'char const *Version = "$(PACKAGE_VERSION)";\n' >> $@t
+ $(AM_V_at)chmod a-w $@t
+ $(AM_V_at)mv $@t $@
+
+BUILT_SOURCES += version.h
+version.h: Makefile
+ $(AM_V_GEN)rm -f $@
+ $(AM_V_at)printf 'extern char const *Version;\n' > $@t
+ $(AM_V_at)chmod a-w $@t
+ $(AM_V_at)mv $@t $@
+
+DISTCLEANFILES = version.c version.h
+MAINTAINERCLEANFILES = $(BUILT_SOURCES)
+
+parted_LDADD = \
+ libver.a \
+ $(top_builddir)/libparted/libparted.la \
+ $(INTLLIBS) $(LIBS) \
+ $(PARTED_LIBS)
+
+parted_LDFLAGS = $(PARTEDLDFLAGS)
+
+# Tell the linker to omit references to unused shared libraries.
+parted_LDFLAGS += $(IGNORE_UNUSED_LIBRARIES_CFLAGS)
+
+AM_CPPFLAGS = $(partedincludedir) $(INTLINCS)
+
+MAINTAINERCLEANFILES += Makefile.in
diff --git a/parted/Makefile.in b/parted/Makefile.in
new file mode 100644
index 0000000..8faf73b
--- /dev/null
+++ b/parted/Makefile.in
@@ -0,0 +1,2085 @@
+# Makefile.in generated by automake 1.16.5 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994-2021 Free Software Foundation, Inc.
+
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+
+VPATH = @srcdir@
+am__is_gnu_make = { \
+ if test -z '$(MAKELEVEL)'; then \
+ false; \
+ elif test -n '$(MAKE_HOST)'; then \
+ true; \
+ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
+ true; \
+ else \
+ false; \
+ fi; \
+}
+am__make_running_with_option = \
+ case $${target_option-} in \
+ ?) ;; \
+ *) echo "am__make_running_with_option: internal error: invalid" \
+ "target option '$${target_option-}' specified" >&2; \
+ exit 1;; \
+ esac; \
+ has_opt=no; \
+ sane_makeflags=$$MAKEFLAGS; \
+ if $(am__is_gnu_make); then \
+ sane_makeflags=$$MFLAGS; \
+ else \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ bs=\\; \
+ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
+ esac; \
+ fi; \
+ skip_next=no; \
+ strip_trailopt () \
+ { \
+ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+ }; \
+ for flg in $$sane_makeflags; do \
+ test $$skip_next = yes && { skip_next=no; continue; }; \
+ case $$flg in \
+ *=*|--*) continue;; \
+ -*I) strip_trailopt 'I'; skip_next=yes;; \
+ -*I?*) strip_trailopt 'I';; \
+ -*O) strip_trailopt 'O'; skip_next=yes;; \
+ -*O?*) strip_trailopt 'O';; \
+ -*l) strip_trailopt 'l'; skip_next=yes;; \
+ -*l?*) strip_trailopt 'l';; \
+ -[dEDm]) skip_next=yes;; \
+ -[JT]) skip_next=yes;; \
+ esac; \
+ case $$flg in \
+ *$$target_option*) has_opt=yes; break;; \
+ esac; \
+ done; \
+ test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+sbin_PROGRAMS = parted$(EXEEXT)
+subdir = parted
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/00gnulib.m4 \
+ $(top_srcdir)/m4/__inline.m4 \
+ $(top_srcdir)/m4/absolute-header.m4 $(top_srcdir)/m4/alloca.m4 \
+ $(top_srcdir)/m4/arpa_inet_h.m4 $(top_srcdir)/m4/assert.m4 \
+ $(top_srcdir)/m4/assert_h.m4 $(top_srcdir)/m4/btowc.m4 \
+ $(top_srcdir)/m4/build-to-host.m4 \
+ $(top_srcdir)/m4/builtin-expect.m4 $(top_srcdir)/m4/c-bool.m4 \
+ $(top_srcdir)/m4/calloc.m4 $(top_srcdir)/m4/canonicalize.m4 \
+ $(top_srcdir)/m4/clock_time.m4 $(top_srcdir)/m4/close.m4 \
+ $(top_srcdir)/m4/codeset.m4 $(top_srcdir)/m4/config-h.m4 \
+ $(top_srcdir)/m4/configmake.m4 $(top_srcdir)/m4/ctype_h.m4 \
+ $(top_srcdir)/m4/double-slash-root.m4 $(top_srcdir)/m4/dup2.m4 \
+ $(top_srcdir)/m4/eealloc.m4 $(top_srcdir)/m4/environ.m4 \
+ $(top_srcdir)/m4/errno_h.m4 $(top_srcdir)/m4/error.m4 \
+ $(top_srcdir)/m4/error_h.m4 $(top_srcdir)/m4/extensions.m4 \
+ $(top_srcdir)/m4/extern-inline.m4 $(top_srcdir)/m4/fcntl-o.m4 \
+ $(top_srcdir)/m4/fcntl.m4 $(top_srcdir)/m4/fcntl_h.m4 \
+ $(top_srcdir)/m4/fdopen.m4 $(top_srcdir)/m4/flexmember.m4 \
+ $(top_srcdir)/m4/fpending.m4 $(top_srcdir)/m4/free.m4 \
+ $(top_srcdir)/m4/fstat.m4 $(top_srcdir)/m4/fsync.m4 \
+ $(top_srcdir)/m4/ftruncate.m4 $(top_srcdir)/m4/getcwd.m4 \
+ $(top_srcdir)/m4/getdtablesize.m4 $(top_srcdir)/m4/getopt.m4 \
+ $(top_srcdir)/m4/getpagesize.m4 \
+ $(top_srcdir)/m4/getprogname.m4 $(top_srcdir)/m4/getrandom.m4 \
+ $(top_srcdir)/m4/gettext.m4 $(top_srcdir)/m4/gettimeofday.m4 \
+ $(top_srcdir)/m4/gnulib-common.m4 \
+ $(top_srcdir)/m4/gnulib-comp.m4 $(top_srcdir)/m4/iconv.m4 \
+ $(top_srcdir)/m4/include_next.m4 $(top_srcdir)/m4/inet_pton.m4 \
+ $(top_srcdir)/m4/intl-thread-locale.m4 \
+ $(top_srcdir)/m4/intlmacosx.m4 $(top_srcdir)/m4/inttypes.m4 \
+ $(top_srcdir)/m4/ioctl.m4 $(top_srcdir)/m4/isblank.m4 \
+ $(top_srcdir)/m4/langinfo_h.m4 $(top_srcdir)/m4/largefile.m4 \
+ $(top_srcdir)/m4/lcmessage.m4 $(top_srcdir)/m4/lib-ignore.m4 \
+ $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
+ $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \
+ $(top_srcdir)/m4/limits-h.m4 $(top_srcdir)/m4/localcharset.m4 \
+ $(top_srcdir)/m4/locale-fr.m4 $(top_srcdir)/m4/locale-ja.m4 \
+ $(top_srcdir)/m4/locale-tr.m4 $(top_srcdir)/m4/locale-zh.m4 \
+ $(top_srcdir)/m4/locale_h.m4 $(top_srcdir)/m4/localeconv.m4 \
+ $(top_srcdir)/m4/localename.m4 $(top_srcdir)/m4/lock.m4 \
+ $(top_srcdir)/m4/lseek.m4 $(top_srcdir)/m4/lstat.m4 \
+ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
+ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
+ $(top_srcdir)/m4/malloc.m4 $(top_srcdir)/m4/malloca.m4 \
+ $(top_srcdir)/m4/manywarnings.m4 $(top_srcdir)/m4/mbrtowc.m4 \
+ $(top_srcdir)/m4/mbsinit.m4 $(top_srcdir)/m4/mbstate_t.m4 \
+ $(top_srcdir)/m4/mbtowc.m4 $(top_srcdir)/m4/memchr.m4 \
+ $(top_srcdir)/m4/mempcpy.m4 $(top_srcdir)/m4/minmax.m4 \
+ $(top_srcdir)/m4/mkdir.m4 $(top_srcdir)/m4/mkstemp.m4 \
+ $(top_srcdir)/m4/mmap-anon.m4 $(top_srcdir)/m4/mode_t.m4 \
+ $(top_srcdir)/m4/msvc-inval.m4 \
+ $(top_srcdir)/m4/msvc-nothrow.m4 $(top_srcdir)/m4/multiarch.m4 \
+ $(top_srcdir)/m4/musl.m4 $(top_srcdir)/m4/nanosleep.m4 \
+ $(top_srcdir)/m4/netinet_in_h.m4 \
+ $(top_srcdir)/m4/nl_langinfo.m4 $(top_srcdir)/m4/nls.m4 \
+ $(top_srcdir)/m4/nocrash.m4 $(top_srcdir)/m4/o-direct.m4 \
+ $(top_srcdir)/m4/off_t.m4 $(top_srcdir)/m4/open-cloexec.m4 \
+ $(top_srcdir)/m4/open-slash.m4 $(top_srcdir)/m4/open.m4 \
+ $(top_srcdir)/m4/pathmax.m4 $(top_srcdir)/m4/perror.m4 \
+ $(top_srcdir)/m4/pipe.m4 $(top_srcdir)/m4/po.m4 \
+ $(top_srcdir)/m4/priv-set.m4 $(top_srcdir)/m4/progtest.m4 \
+ $(top_srcdir)/m4/pselect.m4 $(top_srcdir)/m4/pthread-thread.m4 \
+ $(top_srcdir)/m4/pthread_h.m4 \
+ $(top_srcdir)/m4/pthread_rwlock_rdlock.m4 \
+ $(top_srcdir)/m4/pthread_sigmask.m4 $(top_srcdir)/m4/putenv.m4 \
+ $(top_srcdir)/m4/quote.m4 $(top_srcdir)/m4/quotearg.m4 \
+ $(top_srcdir)/m4/raise.m4 $(top_srcdir)/m4/rawmemchr.m4 \
+ $(top_srcdir)/m4/read.m4 $(top_srcdir)/m4/readlink.m4 \
+ $(top_srcdir)/m4/realloc.m4 $(top_srcdir)/m4/reallocarray.m4 \
+ $(top_srcdir)/m4/regex.m4 $(top_srcdir)/m4/rpmatch.m4 \
+ $(top_srcdir)/m4/safe-read.m4 $(top_srcdir)/m4/sched_h.m4 \
+ $(top_srcdir)/m4/sched_yield.m4 $(top_srcdir)/m4/select.m4 \
+ $(top_srcdir)/m4/semaphore.m4 $(top_srcdir)/m4/setenv.m4 \
+ $(top_srcdir)/m4/setlocale.m4 \
+ $(top_srcdir)/m4/setlocale_null.m4 \
+ $(top_srcdir)/m4/signal_h.m4 \
+ $(top_srcdir)/m4/signalblocking.m4 $(top_srcdir)/m4/sleep.m4 \
+ $(top_srcdir)/m4/socketlib.m4 $(top_srcdir)/m4/sockets.m4 \
+ $(top_srcdir)/m4/socklen.m4 $(top_srcdir)/m4/sockpfaf.m4 \
+ $(top_srcdir)/m4/ssize_t.m4 $(top_srcdir)/m4/stat-time.m4 \
+ $(top_srcdir)/m4/stat.m4 $(top_srcdir)/m4/stdalign.m4 \
+ $(top_srcdir)/m4/stdarg.m4 $(top_srcdir)/m4/stddef_h.m4 \
+ $(top_srcdir)/m4/stdint.m4 $(top_srcdir)/m4/stdio_h.m4 \
+ $(top_srcdir)/m4/stdlib_h.m4 $(top_srcdir)/m4/strdup.m4 \
+ $(top_srcdir)/m4/strerror.m4 $(top_srcdir)/m4/strerror_r.m4 \
+ $(top_srcdir)/m4/string_h.m4 $(top_srcdir)/m4/strtoll.m4 \
+ $(top_srcdir)/m4/strtoull.m4 $(top_srcdir)/m4/symlink.m4 \
+ $(top_srcdir)/m4/sys_ioctl_h.m4 \
+ $(top_srcdir)/m4/sys_random_h.m4 \
+ $(top_srcdir)/m4/sys_select_h.m4 \
+ $(top_srcdir)/m4/sys_socket_h.m4 \
+ $(top_srcdir)/m4/sys_stat_h.m4 $(top_srcdir)/m4/sys_time_h.m4 \
+ $(top_srcdir)/m4/sys_types_h.m4 $(top_srcdir)/m4/sys_uio_h.m4 \
+ $(top_srcdir)/m4/tempname.m4 $(top_srcdir)/m4/thread.m4 \
+ $(top_srcdir)/m4/threadlib.m4 $(top_srcdir)/m4/time.m4 \
+ $(top_srcdir)/m4/time_h.m4 $(top_srcdir)/m4/unistd_h.m4 \
+ $(top_srcdir)/m4/unlink.m4 $(top_srcdir)/m4/unlinkdir.m4 \
+ $(top_srcdir)/m4/usleep.m4 $(top_srcdir)/m4/version-etc.m4 \
+ $(top_srcdir)/m4/visibility.m4 $(top_srcdir)/m4/warn-on-use.m4 \
+ $(top_srcdir)/m4/warnings.m4 $(top_srcdir)/m4/wchar_h.m4 \
+ $(top_srcdir)/m4/wchar_t.m4 $(top_srcdir)/m4/wcrtomb.m4 \
+ $(top_srcdir)/m4/wctob.m4 $(top_srcdir)/m4/wctomb.m4 \
+ $(top_srcdir)/m4/wctype_h.m4 $(top_srcdir)/m4/wint_t.m4 \
+ $(top_srcdir)/m4/xalloc.m4 $(top_srcdir)/m4/xstrtol.m4 \
+ $(top_srcdir)/m4/yield.m4 $(top_srcdir)/m4/zzgnulib.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/lib/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+am__installdirs = "$(DESTDIR)$(sbindir)"
+PROGRAMS = $(sbin_PROGRAMS)
+LIBRARIES = $(noinst_LIBRARIES)
+AM_V_AR = $(am__v_AR_@AM_V@)
+am__v_AR_ = $(am__v_AR_@AM_DEFAULT_V@)
+am__v_AR_0 = @echo " AR " $@;
+am__v_AR_1 =
+libver_a_AR = $(AR) $(ARFLAGS)
+libver_a_LIBADD =
+nodist_libver_a_OBJECTS = version.$(OBJEXT)
+libver_a_OBJECTS = $(nodist_libver_a_OBJECTS)
+am_parted_OBJECTS = command.$(OBJEXT) parted.$(OBJEXT) \
+ strlist.$(OBJEXT) ui.$(OBJEXT) jsonwrt.$(OBJEXT) \
+ table.$(OBJEXT)
+parted_OBJECTS = $(am_parted_OBJECTS)
+am__DEPENDENCIES_1 =
+parted_DEPENDENCIES = libver.a $(top_builddir)/libparted/libparted.la \
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1)
+AM_V_lt = $(am__v_lt_@AM_V@)
+am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
+am__v_lt_0 = --silent
+am__v_lt_1 =
+parted_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(parted_LDFLAGS) $(LDFLAGS) -o $@
+AM_V_P = $(am__v_P_@AM_V@)
+am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
+am__v_P_0 = false
+am__v_P_1 = :
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
+am__v_GEN_0 = @echo " GEN " $@;
+am__v_GEN_1 =
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
+am__v_at_0 = @
+am__v_at_1 =
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/lib
+depcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp
+am__maybe_remake_depfiles = depfiles
+am__depfiles_remade = ./$(DEPDIR)/command.Po ./$(DEPDIR)/jsonwrt.Po \
+ ./$(DEPDIR)/parted.Po ./$(DEPDIR)/strlist.Po \
+ ./$(DEPDIR)/table.Po ./$(DEPDIR)/ui.Po ./$(DEPDIR)/version.Po
+am__mv = mv -f
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
+AM_V_CC = $(am__v_CC_@AM_V@)
+am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
+am__v_CC_0 = @echo " CC " $@;
+am__v_CC_1 =
+CCLD = $(CC)
+LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+AM_V_CCLD = $(am__v_CCLD_@AM_V@)
+am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
+am__v_CCLD_0 = @echo " CCLD " $@;
+am__v_CCLD_1 =
+SOURCES = $(nodist_libver_a_SOURCES) $(parted_SOURCES)
+DIST_SOURCES = $(parted_SOURCES)
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
+# Read a list of newline-separated strings from the standard input,
+# and print each of them once, without duplicates. Input order is
+# *not* preserved.
+am__uniquify_input = $(AWK) '\
+ BEGIN { nonempty = 0; } \
+ { items[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in items) print i; }; } \
+'
+# Make sure the list of sources is unique. This is necessary because,
+# e.g., the same source file might be shared among _SOURCES variables
+# for different programs/libraries.
+am__define_uniq_tagged_files = \
+ list='$(am__tagged_files)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | $(am__uniquify_input)`
+am__DIST_COMMON = $(srcdir)/Makefile.in \
+ $(top_srcdir)/build-aux/depcomp
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+pkgdatadir = @pkgdatadir@
+pkgincludedir = @pkgincludedir@
+pkglibdir = @pkglibdir@
+pkglibexecdir = @pkglibexecdir@
+ACLOCAL = @ACLOCAL@
+ALLOCA = @ALLOCA@
+ALLOCA_H = @ALLOCA_H@
+AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+APPLE_UNIVERSAL_BUILD = @APPLE_UNIVERSAL_BUILD@
+AR = @AR@
+ARFLAGS = @ARFLAGS@
+ASSERT_H = @ASSERT_H@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BITSIZEOF_PTRDIFF_T = @BITSIZEOF_PTRDIFF_T@
+BITSIZEOF_SIG_ATOMIC_T = @BITSIZEOF_SIG_ATOMIC_T@
+BITSIZEOF_SIZE_T = @BITSIZEOF_SIZE_T@
+BITSIZEOF_WCHAR_T = @BITSIZEOF_WCHAR_T@
+BITSIZEOF_WINT_T = @BITSIZEOF_WINT_T@
+BUILDINFO = @BUILDINFO@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CFLAG_VISIBILITY = @CFLAG_VISIBILITY@
+CHECK_CFLAGS = @CHECK_CFLAGS@
+CHECK_LIBS = @CHECK_LIBS@
+CLOCK_TIME_LIB = @CLOCK_TIME_LIB@
+CONFIG_INCLUDE = @CONFIG_INCLUDE@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CSCOPE = @CSCOPE@
+CTAGS = @CTAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DM_LIBS = @DM_LIBS@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EMULTIHOP_HIDDEN = @EMULTIHOP_HIDDEN@
+EMULTIHOP_VALUE = @EMULTIHOP_VALUE@
+ENABLE_DEVICE_MAPPER = @ENABLE_DEVICE_MAPPER@
+ENOLINK_HIDDEN = @ENOLINK_HIDDEN@
+ENOLINK_VALUE = @ENOLINK_VALUE@
+EOVERFLOW_HIDDEN = @EOVERFLOW_HIDDEN@
+EOVERFLOW_VALUE = @EOVERFLOW_VALUE@
+ERRNO_H = @ERRNO_H@
+ERROR_H = @ERROR_H@
+ETAGS = @ETAGS@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+FILECMD = @FILECMD@
+GETOPT_CDEFS_H = @GETOPT_CDEFS_H@
+GETOPT_H = @GETOPT_H@
+GETRANDOM_LIB = @GETRANDOM_LIB@
+GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
+GL_CFLAG_ALLOW_WARNINGS = @GL_CFLAG_ALLOW_WARNINGS@
+GL_CFLAG_GNULIB_WARNINGS = @GL_CFLAG_GNULIB_WARNINGS@
+GL_CXXFLAG_ALLOW_WARNINGS = @GL_CXXFLAG_ALLOW_WARNINGS@
+GL_GNULIB_ACCEPT = @GL_GNULIB_ACCEPT@
+GL_GNULIB_ACCEPT4 = @GL_GNULIB_ACCEPT4@
+GL_GNULIB_ACCESS = @GL_GNULIB_ACCESS@
+GL_GNULIB_ALIGNED_ALLOC = @GL_GNULIB_ALIGNED_ALLOC@
+GL_GNULIB_ATOLL = @GL_GNULIB_ATOLL@
+GL_GNULIB_BIND = @GL_GNULIB_BIND@
+GL_GNULIB_BTOWC = @GL_GNULIB_BTOWC@
+GL_GNULIB_CALLOC_GNU = @GL_GNULIB_CALLOC_GNU@
+GL_GNULIB_CALLOC_POSIX = @GL_GNULIB_CALLOC_POSIX@
+GL_GNULIB_CANONICALIZE_FILE_NAME = @GL_GNULIB_CANONICALIZE_FILE_NAME@
+GL_GNULIB_CHDIR = @GL_GNULIB_CHDIR@
+GL_GNULIB_CHMOD = @GL_GNULIB_CHMOD@
+GL_GNULIB_CHOWN = @GL_GNULIB_CHOWN@
+GL_GNULIB_CLOSE = @GL_GNULIB_CLOSE@
+GL_GNULIB_CONNECT = @GL_GNULIB_CONNECT@
+GL_GNULIB_COPY_FILE_RANGE = @GL_GNULIB_COPY_FILE_RANGE@
+GL_GNULIB_CREAT = @GL_GNULIB_CREAT@
+GL_GNULIB_CTIME = @GL_GNULIB_CTIME@
+GL_GNULIB_DPRINTF = @GL_GNULIB_DPRINTF@
+GL_GNULIB_DUP = @GL_GNULIB_DUP@
+GL_GNULIB_DUP2 = @GL_GNULIB_DUP2@
+GL_GNULIB_DUP3 = @GL_GNULIB_DUP3@
+GL_GNULIB_DUPLOCALE = @GL_GNULIB_DUPLOCALE@
+GL_GNULIB_ENVIRON = @GL_GNULIB_ENVIRON@
+GL_GNULIB_EUIDACCESS = @GL_GNULIB_EUIDACCESS@
+GL_GNULIB_EXECL = @GL_GNULIB_EXECL@
+GL_GNULIB_EXECLE = @GL_GNULIB_EXECLE@
+GL_GNULIB_EXECLP = @GL_GNULIB_EXECLP@
+GL_GNULIB_EXECV = @GL_GNULIB_EXECV@
+GL_GNULIB_EXECVE = @GL_GNULIB_EXECVE@
+GL_GNULIB_EXECVP = @GL_GNULIB_EXECVP@
+GL_GNULIB_EXECVPE = @GL_GNULIB_EXECVPE@
+GL_GNULIB_EXPLICIT_BZERO = @GL_GNULIB_EXPLICIT_BZERO@
+GL_GNULIB_FACCESSAT = @GL_GNULIB_FACCESSAT@
+GL_GNULIB_FCHDIR = @GL_GNULIB_FCHDIR@
+GL_GNULIB_FCHMODAT = @GL_GNULIB_FCHMODAT@
+GL_GNULIB_FCHOWNAT = @GL_GNULIB_FCHOWNAT@
+GL_GNULIB_FCLOSE = @GL_GNULIB_FCLOSE@
+GL_GNULIB_FCNTL = @GL_GNULIB_FCNTL@
+GL_GNULIB_FDATASYNC = @GL_GNULIB_FDATASYNC@
+GL_GNULIB_FDOPEN = @GL_GNULIB_FDOPEN@
+GL_GNULIB_FFLUSH = @GL_GNULIB_FFLUSH@
+GL_GNULIB_FFSL = @GL_GNULIB_FFSL@
+GL_GNULIB_FFSLL = @GL_GNULIB_FFSLL@
+GL_GNULIB_FGETC = @GL_GNULIB_FGETC@
+GL_GNULIB_FGETS = @GL_GNULIB_FGETS@
+GL_GNULIB_FOPEN = @GL_GNULIB_FOPEN@
+GL_GNULIB_FOPEN_GNU = @GL_GNULIB_FOPEN_GNU@
+GL_GNULIB_FPRINTF = @GL_GNULIB_FPRINTF@
+GL_GNULIB_FPRINTF_POSIX = @GL_GNULIB_FPRINTF_POSIX@
+GL_GNULIB_FPURGE = @GL_GNULIB_FPURGE@
+GL_GNULIB_FPUTC = @GL_GNULIB_FPUTC@
+GL_GNULIB_FPUTS = @GL_GNULIB_FPUTS@
+GL_GNULIB_FREAD = @GL_GNULIB_FREAD@
+GL_GNULIB_FREE_POSIX = @GL_GNULIB_FREE_POSIX@
+GL_GNULIB_FREOPEN = @GL_GNULIB_FREOPEN@
+GL_GNULIB_FSCANF = @GL_GNULIB_FSCANF@
+GL_GNULIB_FSEEK = @GL_GNULIB_FSEEK@
+GL_GNULIB_FSEEKO = @GL_GNULIB_FSEEKO@
+GL_GNULIB_FSTAT = @GL_GNULIB_FSTAT@
+GL_GNULIB_FSTATAT = @GL_GNULIB_FSTATAT@
+GL_GNULIB_FSYNC = @GL_GNULIB_FSYNC@
+GL_GNULIB_FTELL = @GL_GNULIB_FTELL@
+GL_GNULIB_FTELLO = @GL_GNULIB_FTELLO@
+GL_GNULIB_FTRUNCATE = @GL_GNULIB_FTRUNCATE@
+GL_GNULIB_FUTIMENS = @GL_GNULIB_FUTIMENS@
+GL_GNULIB_FWRITE = @GL_GNULIB_FWRITE@
+GL_GNULIB_GETC = @GL_GNULIB_GETC@
+GL_GNULIB_GETCHAR = @GL_GNULIB_GETCHAR@
+GL_GNULIB_GETCWD = @GL_GNULIB_GETCWD@
+GL_GNULIB_GETDELIM = @GL_GNULIB_GETDELIM@
+GL_GNULIB_GETDOMAINNAME = @GL_GNULIB_GETDOMAINNAME@
+GL_GNULIB_GETDTABLESIZE = @GL_GNULIB_GETDTABLESIZE@
+GL_GNULIB_GETENTROPY = @GL_GNULIB_GETENTROPY@
+GL_GNULIB_GETGROUPS = @GL_GNULIB_GETGROUPS@
+GL_GNULIB_GETHOSTNAME = @GL_GNULIB_GETHOSTNAME@
+GL_GNULIB_GETLINE = @GL_GNULIB_GETLINE@
+GL_GNULIB_GETLOADAVG = @GL_GNULIB_GETLOADAVG@
+GL_GNULIB_GETLOGIN = @GL_GNULIB_GETLOGIN@
+GL_GNULIB_GETLOGIN_R = @GL_GNULIB_GETLOGIN_R@
+GL_GNULIB_GETOPT_POSIX = @GL_GNULIB_GETOPT_POSIX@
+GL_GNULIB_GETPAGESIZE = @GL_GNULIB_GETPAGESIZE@
+GL_GNULIB_GETPASS = @GL_GNULIB_GETPASS@
+GL_GNULIB_GETPASS_GNU = @GL_GNULIB_GETPASS_GNU@
+GL_GNULIB_GETPEERNAME = @GL_GNULIB_GETPEERNAME@
+GL_GNULIB_GETPROGNAME = @GL_GNULIB_GETPROGNAME@
+GL_GNULIB_GETRANDOM = @GL_GNULIB_GETRANDOM@
+GL_GNULIB_GETSOCKNAME = @GL_GNULIB_GETSOCKNAME@
+GL_GNULIB_GETSOCKOPT = @GL_GNULIB_GETSOCKOPT@
+GL_GNULIB_GETSUBOPT = @GL_GNULIB_GETSUBOPT@
+GL_GNULIB_GETTIMEOFDAY = @GL_GNULIB_GETTIMEOFDAY@
+GL_GNULIB_GETUMASK = @GL_GNULIB_GETUMASK@
+GL_GNULIB_GETUSERSHELL = @GL_GNULIB_GETUSERSHELL@
+GL_GNULIB_GRANTPT = @GL_GNULIB_GRANTPT@
+GL_GNULIB_GROUP_MEMBER = @GL_GNULIB_GROUP_MEMBER@
+GL_GNULIB_IMAXABS = @GL_GNULIB_IMAXABS@
+GL_GNULIB_IMAXDIV = @GL_GNULIB_IMAXDIV@
+GL_GNULIB_INET_NTOP = @GL_GNULIB_INET_NTOP@
+GL_GNULIB_INET_PTON = @GL_GNULIB_INET_PTON@
+GL_GNULIB_IOCTL = @GL_GNULIB_IOCTL@
+GL_GNULIB_ISATTY = @GL_GNULIB_ISATTY@
+GL_GNULIB_ISBLANK = @GL_GNULIB_ISBLANK@
+GL_GNULIB_ISWBLANK = @GL_GNULIB_ISWBLANK@
+GL_GNULIB_ISWCTYPE = @GL_GNULIB_ISWCTYPE@
+GL_GNULIB_ISWDIGIT = @GL_GNULIB_ISWDIGIT@
+GL_GNULIB_ISWXDIGIT = @GL_GNULIB_ISWXDIGIT@
+GL_GNULIB_LCHMOD = @GL_GNULIB_LCHMOD@
+GL_GNULIB_LCHOWN = @GL_GNULIB_LCHOWN@
+GL_GNULIB_LINK = @GL_GNULIB_LINK@
+GL_GNULIB_LINKAT = @GL_GNULIB_LINKAT@
+GL_GNULIB_LISTEN = @GL_GNULIB_LISTEN@
+GL_GNULIB_LOCALECONV = @GL_GNULIB_LOCALECONV@
+GL_GNULIB_LOCALENAME = @GL_GNULIB_LOCALENAME@
+GL_GNULIB_LOCALTIME = @GL_GNULIB_LOCALTIME@
+GL_GNULIB_LSEEK = @GL_GNULIB_LSEEK@
+GL_GNULIB_LSTAT = @GL_GNULIB_LSTAT@
+GL_GNULIB_MALLOC_GNU = @GL_GNULIB_MALLOC_GNU@
+GL_GNULIB_MALLOC_POSIX = @GL_GNULIB_MALLOC_POSIX@
+GL_GNULIB_MBRLEN = @GL_GNULIB_MBRLEN@
+GL_GNULIB_MBRTOWC = @GL_GNULIB_MBRTOWC@
+GL_GNULIB_MBSCASECMP = @GL_GNULIB_MBSCASECMP@
+GL_GNULIB_MBSCASESTR = @GL_GNULIB_MBSCASESTR@
+GL_GNULIB_MBSCHR = @GL_GNULIB_MBSCHR@
+GL_GNULIB_MBSCSPN = @GL_GNULIB_MBSCSPN@
+GL_GNULIB_MBSINIT = @GL_GNULIB_MBSINIT@
+GL_GNULIB_MBSLEN = @GL_GNULIB_MBSLEN@
+GL_GNULIB_MBSNCASECMP = @GL_GNULIB_MBSNCASECMP@
+GL_GNULIB_MBSNLEN = @GL_GNULIB_MBSNLEN@
+GL_GNULIB_MBSNRTOWCS = @GL_GNULIB_MBSNRTOWCS@
+GL_GNULIB_MBSPBRK = @GL_GNULIB_MBSPBRK@
+GL_GNULIB_MBSPCASECMP = @GL_GNULIB_MBSPCASECMP@
+GL_GNULIB_MBSRCHR = @GL_GNULIB_MBSRCHR@
+GL_GNULIB_MBSRTOWCS = @GL_GNULIB_MBSRTOWCS@
+GL_GNULIB_MBSSEP = @GL_GNULIB_MBSSEP@
+GL_GNULIB_MBSSPN = @GL_GNULIB_MBSSPN@
+GL_GNULIB_MBSSTR = @GL_GNULIB_MBSSTR@
+GL_GNULIB_MBSTOK_R = @GL_GNULIB_MBSTOK_R@
+GL_GNULIB_MBTOWC = @GL_GNULIB_MBTOWC@
+GL_GNULIB_MDA_ACCESS = @GL_GNULIB_MDA_ACCESS@
+GL_GNULIB_MDA_CHDIR = @GL_GNULIB_MDA_CHDIR@
+GL_GNULIB_MDA_CHMOD = @GL_GNULIB_MDA_CHMOD@
+GL_GNULIB_MDA_CLOSE = @GL_GNULIB_MDA_CLOSE@
+GL_GNULIB_MDA_CREAT = @GL_GNULIB_MDA_CREAT@
+GL_GNULIB_MDA_DUP = @GL_GNULIB_MDA_DUP@
+GL_GNULIB_MDA_DUP2 = @GL_GNULIB_MDA_DUP2@
+GL_GNULIB_MDA_ECVT = @GL_GNULIB_MDA_ECVT@
+GL_GNULIB_MDA_EXECL = @GL_GNULIB_MDA_EXECL@
+GL_GNULIB_MDA_EXECLE = @GL_GNULIB_MDA_EXECLE@
+GL_GNULIB_MDA_EXECLP = @GL_GNULIB_MDA_EXECLP@
+GL_GNULIB_MDA_EXECV = @GL_GNULIB_MDA_EXECV@
+GL_GNULIB_MDA_EXECVE = @GL_GNULIB_MDA_EXECVE@
+GL_GNULIB_MDA_EXECVP = @GL_GNULIB_MDA_EXECVP@
+GL_GNULIB_MDA_EXECVPE = @GL_GNULIB_MDA_EXECVPE@
+GL_GNULIB_MDA_FCLOSEALL = @GL_GNULIB_MDA_FCLOSEALL@
+GL_GNULIB_MDA_FCVT = @GL_GNULIB_MDA_FCVT@
+GL_GNULIB_MDA_FDOPEN = @GL_GNULIB_MDA_FDOPEN@
+GL_GNULIB_MDA_FILENO = @GL_GNULIB_MDA_FILENO@
+GL_GNULIB_MDA_GCVT = @GL_GNULIB_MDA_GCVT@
+GL_GNULIB_MDA_GETCWD = @GL_GNULIB_MDA_GETCWD@
+GL_GNULIB_MDA_GETPID = @GL_GNULIB_MDA_GETPID@
+GL_GNULIB_MDA_GETW = @GL_GNULIB_MDA_GETW@
+GL_GNULIB_MDA_ISATTY = @GL_GNULIB_MDA_ISATTY@
+GL_GNULIB_MDA_LSEEK = @GL_GNULIB_MDA_LSEEK@
+GL_GNULIB_MDA_MEMCCPY = @GL_GNULIB_MDA_MEMCCPY@
+GL_GNULIB_MDA_MKDIR = @GL_GNULIB_MDA_MKDIR@
+GL_GNULIB_MDA_MKTEMP = @GL_GNULIB_MDA_MKTEMP@
+GL_GNULIB_MDA_OPEN = @GL_GNULIB_MDA_OPEN@
+GL_GNULIB_MDA_PUTENV = @GL_GNULIB_MDA_PUTENV@
+GL_GNULIB_MDA_PUTW = @GL_GNULIB_MDA_PUTW@
+GL_GNULIB_MDA_READ = @GL_GNULIB_MDA_READ@
+GL_GNULIB_MDA_RMDIR = @GL_GNULIB_MDA_RMDIR@
+GL_GNULIB_MDA_STRDUP = @GL_GNULIB_MDA_STRDUP@
+GL_GNULIB_MDA_SWAB = @GL_GNULIB_MDA_SWAB@
+GL_GNULIB_MDA_TEMPNAM = @GL_GNULIB_MDA_TEMPNAM@
+GL_GNULIB_MDA_TZSET = @GL_GNULIB_MDA_TZSET@
+GL_GNULIB_MDA_UMASK = @GL_GNULIB_MDA_UMASK@
+GL_GNULIB_MDA_UNLINK = @GL_GNULIB_MDA_UNLINK@
+GL_GNULIB_MDA_WCSDUP = @GL_GNULIB_MDA_WCSDUP@
+GL_GNULIB_MDA_WRITE = @GL_GNULIB_MDA_WRITE@
+GL_GNULIB_MEMCHR = @GL_GNULIB_MEMCHR@
+GL_GNULIB_MEMMEM = @GL_GNULIB_MEMMEM@
+GL_GNULIB_MEMPCPY = @GL_GNULIB_MEMPCPY@
+GL_GNULIB_MEMRCHR = @GL_GNULIB_MEMRCHR@
+GL_GNULIB_MEMSET_EXPLICIT = @GL_GNULIB_MEMSET_EXPLICIT@
+GL_GNULIB_MKDIR = @GL_GNULIB_MKDIR@
+GL_GNULIB_MKDIRAT = @GL_GNULIB_MKDIRAT@
+GL_GNULIB_MKDTEMP = @GL_GNULIB_MKDTEMP@
+GL_GNULIB_MKFIFO = @GL_GNULIB_MKFIFO@
+GL_GNULIB_MKFIFOAT = @GL_GNULIB_MKFIFOAT@
+GL_GNULIB_MKNOD = @GL_GNULIB_MKNOD@
+GL_GNULIB_MKNODAT = @GL_GNULIB_MKNODAT@
+GL_GNULIB_MKOSTEMP = @GL_GNULIB_MKOSTEMP@
+GL_GNULIB_MKOSTEMPS = @GL_GNULIB_MKOSTEMPS@
+GL_GNULIB_MKSTEMP = @GL_GNULIB_MKSTEMP@
+GL_GNULIB_MKSTEMPS = @GL_GNULIB_MKSTEMPS@
+GL_GNULIB_MKTIME = @GL_GNULIB_MKTIME@
+GL_GNULIB_NANOSLEEP = @GL_GNULIB_NANOSLEEP@
+GL_GNULIB_NL_LANGINFO = @GL_GNULIB_NL_LANGINFO@
+GL_GNULIB_NONBLOCKING = @GL_GNULIB_NONBLOCKING@
+GL_GNULIB_OBSTACK_PRINTF = @GL_GNULIB_OBSTACK_PRINTF@
+GL_GNULIB_OBSTACK_PRINTF_POSIX = @GL_GNULIB_OBSTACK_PRINTF_POSIX@
+GL_GNULIB_OPEN = @GL_GNULIB_OPEN@
+GL_GNULIB_OPENAT = @GL_GNULIB_OPENAT@
+GL_GNULIB_OVERRIDES_STRUCT_STAT = @GL_GNULIB_OVERRIDES_STRUCT_STAT@
+GL_GNULIB_PCLOSE = @GL_GNULIB_PCLOSE@
+GL_GNULIB_PERROR = @GL_GNULIB_PERROR@
+GL_GNULIB_PIPE = @GL_GNULIB_PIPE@
+GL_GNULIB_PIPE2 = @GL_GNULIB_PIPE2@
+GL_GNULIB_POPEN = @GL_GNULIB_POPEN@
+GL_GNULIB_POSIX_MEMALIGN = @GL_GNULIB_POSIX_MEMALIGN@
+GL_GNULIB_POSIX_OPENPT = @GL_GNULIB_POSIX_OPENPT@
+GL_GNULIB_PREAD = @GL_GNULIB_PREAD@
+GL_GNULIB_PRINTF = @GL_GNULIB_PRINTF@
+GL_GNULIB_PRINTF_POSIX = @GL_GNULIB_PRINTF_POSIX@
+GL_GNULIB_PSELECT = @GL_GNULIB_PSELECT@
+GL_GNULIB_PTHREAD_COND = @GL_GNULIB_PTHREAD_COND@
+GL_GNULIB_PTHREAD_MUTEX = @GL_GNULIB_PTHREAD_MUTEX@
+GL_GNULIB_PTHREAD_MUTEX_TIMEDLOCK = @GL_GNULIB_PTHREAD_MUTEX_TIMEDLOCK@
+GL_GNULIB_PTHREAD_ONCE = @GL_GNULIB_PTHREAD_ONCE@
+GL_GNULIB_PTHREAD_RWLOCK = @GL_GNULIB_PTHREAD_RWLOCK@
+GL_GNULIB_PTHREAD_SIGMASK = @GL_GNULIB_PTHREAD_SIGMASK@
+GL_GNULIB_PTHREAD_SPIN = @GL_GNULIB_PTHREAD_SPIN@
+GL_GNULIB_PTHREAD_THREAD = @GL_GNULIB_PTHREAD_THREAD@
+GL_GNULIB_PTHREAD_TSS = @GL_GNULIB_PTHREAD_TSS@
+GL_GNULIB_PTSNAME = @GL_GNULIB_PTSNAME@
+GL_GNULIB_PTSNAME_R = @GL_GNULIB_PTSNAME_R@
+GL_GNULIB_PUTC = @GL_GNULIB_PUTC@
+GL_GNULIB_PUTCHAR = @GL_GNULIB_PUTCHAR@
+GL_GNULIB_PUTENV = @GL_GNULIB_PUTENV@
+GL_GNULIB_PUTS = @GL_GNULIB_PUTS@
+GL_GNULIB_PWRITE = @GL_GNULIB_PWRITE@
+GL_GNULIB_QSORT_R = @GL_GNULIB_QSORT_R@
+GL_GNULIB_RAISE = @GL_GNULIB_RAISE@
+GL_GNULIB_RANDOM = @GL_GNULIB_RANDOM@
+GL_GNULIB_RANDOM_R = @GL_GNULIB_RANDOM_R@
+GL_GNULIB_RAWMEMCHR = @GL_GNULIB_RAWMEMCHR@
+GL_GNULIB_READ = @GL_GNULIB_READ@
+GL_GNULIB_READLINK = @GL_GNULIB_READLINK@
+GL_GNULIB_READLINKAT = @GL_GNULIB_READLINKAT@
+GL_GNULIB_REALLOCARRAY = @GL_GNULIB_REALLOCARRAY@
+GL_GNULIB_REALLOC_GNU = @GL_GNULIB_REALLOC_GNU@
+GL_GNULIB_REALLOC_POSIX = @GL_GNULIB_REALLOC_POSIX@
+GL_GNULIB_REALPATH = @GL_GNULIB_REALPATH@
+GL_GNULIB_RECV = @GL_GNULIB_RECV@
+GL_GNULIB_RECVFROM = @GL_GNULIB_RECVFROM@
+GL_GNULIB_REMOVE = @GL_GNULIB_REMOVE@
+GL_GNULIB_RENAME = @GL_GNULIB_RENAME@
+GL_GNULIB_RENAMEAT = @GL_GNULIB_RENAMEAT@
+GL_GNULIB_RMDIR = @GL_GNULIB_RMDIR@
+GL_GNULIB_RPMATCH = @GL_GNULIB_RPMATCH@
+GL_GNULIB_SCANF = @GL_GNULIB_SCANF@
+GL_GNULIB_SCHED_YIELD = @GL_GNULIB_SCHED_YIELD@
+GL_GNULIB_SECURE_GETENV = @GL_GNULIB_SECURE_GETENV@
+GL_GNULIB_SELECT = @GL_GNULIB_SELECT@
+GL_GNULIB_SEND = @GL_GNULIB_SEND@
+GL_GNULIB_SENDTO = @GL_GNULIB_SENDTO@
+GL_GNULIB_SETENV = @GL_GNULIB_SETENV@
+GL_GNULIB_SETHOSTNAME = @GL_GNULIB_SETHOSTNAME@
+GL_GNULIB_SETLOCALE = @GL_GNULIB_SETLOCALE@
+GL_GNULIB_SETLOCALE_NULL = @GL_GNULIB_SETLOCALE_NULL@
+GL_GNULIB_SETSOCKOPT = @GL_GNULIB_SETSOCKOPT@
+GL_GNULIB_SHUTDOWN = @GL_GNULIB_SHUTDOWN@
+GL_GNULIB_SIGABBREV_NP = @GL_GNULIB_SIGABBREV_NP@
+GL_GNULIB_SIGACTION = @GL_GNULIB_SIGACTION@
+GL_GNULIB_SIGDESCR_NP = @GL_GNULIB_SIGDESCR_NP@
+GL_GNULIB_SIGNAL_H_SIGPIPE = @GL_GNULIB_SIGNAL_H_SIGPIPE@
+GL_GNULIB_SIGPROCMASK = @GL_GNULIB_SIGPROCMASK@
+GL_GNULIB_SLEEP = @GL_GNULIB_SLEEP@
+GL_GNULIB_SNPRINTF = @GL_GNULIB_SNPRINTF@
+GL_GNULIB_SOCKET = @GL_GNULIB_SOCKET@
+GL_GNULIB_SPRINTF_POSIX = @GL_GNULIB_SPRINTF_POSIX@
+GL_GNULIB_STAT = @GL_GNULIB_STAT@
+GL_GNULIB_STDIO_H_NONBLOCKING = @GL_GNULIB_STDIO_H_NONBLOCKING@
+GL_GNULIB_STDIO_H_SIGPIPE = @GL_GNULIB_STDIO_H_SIGPIPE@
+GL_GNULIB_STPCPY = @GL_GNULIB_STPCPY@
+GL_GNULIB_STPNCPY = @GL_GNULIB_STPNCPY@
+GL_GNULIB_STRCASESTR = @GL_GNULIB_STRCASESTR@
+GL_GNULIB_STRCHRNUL = @GL_GNULIB_STRCHRNUL@
+GL_GNULIB_STRDUP = @GL_GNULIB_STRDUP@
+GL_GNULIB_STRERROR = @GL_GNULIB_STRERROR@
+GL_GNULIB_STRERRORNAME_NP = @GL_GNULIB_STRERRORNAME_NP@
+GL_GNULIB_STRERROR_R = @GL_GNULIB_STRERROR_R@
+GL_GNULIB_STRFTIME = @GL_GNULIB_STRFTIME@
+GL_GNULIB_STRNCAT = @GL_GNULIB_STRNCAT@
+GL_GNULIB_STRNDUP = @GL_GNULIB_STRNDUP@
+GL_GNULIB_STRNLEN = @GL_GNULIB_STRNLEN@
+GL_GNULIB_STRPBRK = @GL_GNULIB_STRPBRK@
+GL_GNULIB_STRPTIME = @GL_GNULIB_STRPTIME@
+GL_GNULIB_STRSEP = @GL_GNULIB_STRSEP@
+GL_GNULIB_STRSIGNAL = @GL_GNULIB_STRSIGNAL@
+GL_GNULIB_STRSTR = @GL_GNULIB_STRSTR@
+GL_GNULIB_STRTOD = @GL_GNULIB_STRTOD@
+GL_GNULIB_STRTOIMAX = @GL_GNULIB_STRTOIMAX@
+GL_GNULIB_STRTOK_R = @GL_GNULIB_STRTOK_R@
+GL_GNULIB_STRTOL = @GL_GNULIB_STRTOL@
+GL_GNULIB_STRTOLD = @GL_GNULIB_STRTOLD@
+GL_GNULIB_STRTOLL = @GL_GNULIB_STRTOLL@
+GL_GNULIB_STRTOUL = @GL_GNULIB_STRTOUL@
+GL_GNULIB_STRTOULL = @GL_GNULIB_STRTOULL@
+GL_GNULIB_STRTOUMAX = @GL_GNULIB_STRTOUMAX@
+GL_GNULIB_STRVERSCMP = @GL_GNULIB_STRVERSCMP@
+GL_GNULIB_SYMLINK = @GL_GNULIB_SYMLINK@
+GL_GNULIB_SYMLINKAT = @GL_GNULIB_SYMLINKAT@
+GL_GNULIB_SYSTEM_POSIX = @GL_GNULIB_SYSTEM_POSIX@
+GL_GNULIB_TIME = @GL_GNULIB_TIME@
+GL_GNULIB_TIMEGM = @GL_GNULIB_TIMEGM@
+GL_GNULIB_TIMESPEC_GET = @GL_GNULIB_TIMESPEC_GET@
+GL_GNULIB_TIMESPEC_GETRES = @GL_GNULIB_TIMESPEC_GETRES@
+GL_GNULIB_TIME_R = @GL_GNULIB_TIME_R@
+GL_GNULIB_TIME_RZ = @GL_GNULIB_TIME_RZ@
+GL_GNULIB_TMPFILE = @GL_GNULIB_TMPFILE@
+GL_GNULIB_TOWCTRANS = @GL_GNULIB_TOWCTRANS@
+GL_GNULIB_TRUNCATE = @GL_GNULIB_TRUNCATE@
+GL_GNULIB_TTYNAME_R = @GL_GNULIB_TTYNAME_R@
+GL_GNULIB_TZSET = @GL_GNULIB_TZSET@
+GL_GNULIB_UNISTD_H_GETOPT = @GL_GNULIB_UNISTD_H_GETOPT@
+GL_GNULIB_UNISTD_H_NONBLOCKING = @GL_GNULIB_UNISTD_H_NONBLOCKING@
+GL_GNULIB_UNISTD_H_SIGPIPE = @GL_GNULIB_UNISTD_H_SIGPIPE@
+GL_GNULIB_UNLINK = @GL_GNULIB_UNLINK@
+GL_GNULIB_UNLINKAT = @GL_GNULIB_UNLINKAT@
+GL_GNULIB_UNLOCKPT = @GL_GNULIB_UNLOCKPT@
+GL_GNULIB_UNSETENV = @GL_GNULIB_UNSETENV@
+GL_GNULIB_USLEEP = @GL_GNULIB_USLEEP@
+GL_GNULIB_UTIMENSAT = @GL_GNULIB_UTIMENSAT@
+GL_GNULIB_VASPRINTF = @GL_GNULIB_VASPRINTF@
+GL_GNULIB_VDPRINTF = @GL_GNULIB_VDPRINTF@
+GL_GNULIB_VFPRINTF = @GL_GNULIB_VFPRINTF@
+GL_GNULIB_VFPRINTF_POSIX = @GL_GNULIB_VFPRINTF_POSIX@
+GL_GNULIB_VFSCANF = @GL_GNULIB_VFSCANF@
+GL_GNULIB_VPRINTF = @GL_GNULIB_VPRINTF@
+GL_GNULIB_VPRINTF_POSIX = @GL_GNULIB_VPRINTF_POSIX@
+GL_GNULIB_VSCANF = @GL_GNULIB_VSCANF@
+GL_GNULIB_VSNPRINTF = @GL_GNULIB_VSNPRINTF@
+GL_GNULIB_VSPRINTF_POSIX = @GL_GNULIB_VSPRINTF_POSIX@
+GL_GNULIB_WCPCPY = @GL_GNULIB_WCPCPY@
+GL_GNULIB_WCPNCPY = @GL_GNULIB_WCPNCPY@
+GL_GNULIB_WCRTOMB = @GL_GNULIB_WCRTOMB@
+GL_GNULIB_WCSCASECMP = @GL_GNULIB_WCSCASECMP@
+GL_GNULIB_WCSCAT = @GL_GNULIB_WCSCAT@
+GL_GNULIB_WCSCHR = @GL_GNULIB_WCSCHR@
+GL_GNULIB_WCSCMP = @GL_GNULIB_WCSCMP@
+GL_GNULIB_WCSCOLL = @GL_GNULIB_WCSCOLL@
+GL_GNULIB_WCSCPY = @GL_GNULIB_WCSCPY@
+GL_GNULIB_WCSCSPN = @GL_GNULIB_WCSCSPN@
+GL_GNULIB_WCSDUP = @GL_GNULIB_WCSDUP@
+GL_GNULIB_WCSFTIME = @GL_GNULIB_WCSFTIME@
+GL_GNULIB_WCSLEN = @GL_GNULIB_WCSLEN@
+GL_GNULIB_WCSNCASECMP = @GL_GNULIB_WCSNCASECMP@
+GL_GNULIB_WCSNCAT = @GL_GNULIB_WCSNCAT@
+GL_GNULIB_WCSNCMP = @GL_GNULIB_WCSNCMP@
+GL_GNULIB_WCSNCPY = @GL_GNULIB_WCSNCPY@
+GL_GNULIB_WCSNLEN = @GL_GNULIB_WCSNLEN@
+GL_GNULIB_WCSNRTOMBS = @GL_GNULIB_WCSNRTOMBS@
+GL_GNULIB_WCSPBRK = @GL_GNULIB_WCSPBRK@
+GL_GNULIB_WCSRCHR = @GL_GNULIB_WCSRCHR@
+GL_GNULIB_WCSRTOMBS = @GL_GNULIB_WCSRTOMBS@
+GL_GNULIB_WCSSPN = @GL_GNULIB_WCSSPN@
+GL_GNULIB_WCSSTR = @GL_GNULIB_WCSSTR@
+GL_GNULIB_WCSTOK = @GL_GNULIB_WCSTOK@
+GL_GNULIB_WCSWIDTH = @GL_GNULIB_WCSWIDTH@
+GL_GNULIB_WCSXFRM = @GL_GNULIB_WCSXFRM@
+GL_GNULIB_WCTOB = @GL_GNULIB_WCTOB@
+GL_GNULIB_WCTOMB = @GL_GNULIB_WCTOMB@
+GL_GNULIB_WCTRANS = @GL_GNULIB_WCTRANS@
+GL_GNULIB_WCTYPE = @GL_GNULIB_WCTYPE@
+GL_GNULIB_WCWIDTH = @GL_GNULIB_WCWIDTH@
+GL_GNULIB_WMEMCHR = @GL_GNULIB_WMEMCHR@
+GL_GNULIB_WMEMCMP = @GL_GNULIB_WMEMCMP@
+GL_GNULIB_WMEMCPY = @GL_GNULIB_WMEMCPY@
+GL_GNULIB_WMEMMOVE = @GL_GNULIB_WMEMMOVE@
+GL_GNULIB_WMEMPCPY = @GL_GNULIB_WMEMPCPY@
+GL_GNULIB_WMEMSET = @GL_GNULIB_WMEMSET@
+GL_GNULIB_WRITE = @GL_GNULIB_WRITE@
+GL_GNULIB__EXIT = @GL_GNULIB__EXIT@
+GMSGFMT = @GMSGFMT@
+GMSGFMT_015 = @GMSGFMT_015@
+GNULIBHEADERS_OVERRIDE_WINT_T = @GNULIBHEADERS_OVERRIDE_WINT_T@
+GNULIB_GETTIMEOFDAY = @GNULIB_GETTIMEOFDAY@
+GREP = @GREP@
+HARD_LOCALE_LIB = @HARD_LOCALE_LIB@
+HAVE_ACCEPT4 = @HAVE_ACCEPT4@
+HAVE_ALIGNED_ALLOC = @HAVE_ALIGNED_ALLOC@
+HAVE_ALLOCA_H = @HAVE_ALLOCA_H@
+HAVE_ARPA_INET_H = @HAVE_ARPA_INET_H@
+HAVE_ATOLL = @HAVE_ATOLL@
+HAVE_BTOWC = @HAVE_BTOWC@
+HAVE_C99_STDINT_H = @HAVE_C99_STDINT_H@
+HAVE_CANONICALIZE_FILE_NAME = @HAVE_CANONICALIZE_FILE_NAME@
+HAVE_CHOWN = @HAVE_CHOWN@
+HAVE_COPY_FILE_RANGE = @HAVE_COPY_FILE_RANGE@
+HAVE_CRTDEFS_H = @HAVE_CRTDEFS_H@
+HAVE_DECL_ECVT = @HAVE_DECL_ECVT@
+HAVE_DECL_ENVIRON = @HAVE_DECL_ENVIRON@
+HAVE_DECL_EXECVPE = @HAVE_DECL_EXECVPE@
+HAVE_DECL_FCHDIR = @HAVE_DECL_FCHDIR@
+HAVE_DECL_FCLOSEALL = @HAVE_DECL_FCLOSEALL@
+HAVE_DECL_FCVT = @HAVE_DECL_FCVT@
+HAVE_DECL_FDATASYNC = @HAVE_DECL_FDATASYNC@
+HAVE_DECL_FPURGE = @HAVE_DECL_FPURGE@
+HAVE_DECL_FSEEKO = @HAVE_DECL_FSEEKO@
+HAVE_DECL_FTELLO = @HAVE_DECL_FTELLO@
+HAVE_DECL_GCVT = @HAVE_DECL_GCVT@
+HAVE_DECL_GETDELIM = @HAVE_DECL_GETDELIM@
+HAVE_DECL_GETDOMAINNAME = @HAVE_DECL_GETDOMAINNAME@
+HAVE_DECL_GETLINE = @HAVE_DECL_GETLINE@
+HAVE_DECL_GETLOADAVG = @HAVE_DECL_GETLOADAVG@
+HAVE_DECL_GETLOGIN = @HAVE_DECL_GETLOGIN@
+HAVE_DECL_GETLOGIN_R = @HAVE_DECL_GETLOGIN_R@
+HAVE_DECL_GETPAGESIZE = @HAVE_DECL_GETPAGESIZE@
+HAVE_DECL_GETUSERSHELL = @HAVE_DECL_GETUSERSHELL@
+HAVE_DECL_GETW = @HAVE_DECL_GETW@
+HAVE_DECL_IMAXABS = @HAVE_DECL_IMAXABS@
+HAVE_DECL_IMAXDIV = @HAVE_DECL_IMAXDIV@
+HAVE_DECL_INET_NTOP = @HAVE_DECL_INET_NTOP@
+HAVE_DECL_INET_PTON = @HAVE_DECL_INET_PTON@
+HAVE_DECL_INITSTATE = @HAVE_DECL_INITSTATE@
+HAVE_DECL_LOCALTIME_R = @HAVE_DECL_LOCALTIME_R@
+HAVE_DECL_MEMMEM = @HAVE_DECL_MEMMEM@
+HAVE_DECL_MEMRCHR = @HAVE_DECL_MEMRCHR@
+HAVE_DECL_OBSTACK_PRINTF = @HAVE_DECL_OBSTACK_PRINTF@
+HAVE_DECL_PUTW = @HAVE_DECL_PUTW@
+HAVE_DECL_SETENV = @HAVE_DECL_SETENV@
+HAVE_DECL_SETHOSTNAME = @HAVE_DECL_SETHOSTNAME@
+HAVE_DECL_SETSTATE = @HAVE_DECL_SETSTATE@
+HAVE_DECL_SNPRINTF = @HAVE_DECL_SNPRINTF@
+HAVE_DECL_STRDUP = @HAVE_DECL_STRDUP@
+HAVE_DECL_STRERROR_R = @HAVE_DECL_STRERROR_R@
+HAVE_DECL_STRNDUP = @HAVE_DECL_STRNDUP@
+HAVE_DECL_STRNLEN = @HAVE_DECL_STRNLEN@
+HAVE_DECL_STRSIGNAL = @HAVE_DECL_STRSIGNAL@
+HAVE_DECL_STRTOIMAX = @HAVE_DECL_STRTOIMAX@
+HAVE_DECL_STRTOK_R = @HAVE_DECL_STRTOK_R@
+HAVE_DECL_STRTOUMAX = @HAVE_DECL_STRTOUMAX@
+HAVE_DECL_TRUNCATE = @HAVE_DECL_TRUNCATE@
+HAVE_DECL_TTYNAME_R = @HAVE_DECL_TTYNAME_R@
+HAVE_DECL_UNSETENV = @HAVE_DECL_UNSETENV@
+HAVE_DECL_VSNPRINTF = @HAVE_DECL_VSNPRINTF@
+HAVE_DECL_WCSDUP = @HAVE_DECL_WCSDUP@
+HAVE_DECL_WCTOB = @HAVE_DECL_WCTOB@
+HAVE_DECL_WCWIDTH = @HAVE_DECL_WCWIDTH@
+HAVE_DPRINTF = @HAVE_DPRINTF@
+HAVE_DUP3 = @HAVE_DUP3@
+HAVE_DUPLOCALE = @HAVE_DUPLOCALE@
+HAVE_ERROR = @HAVE_ERROR@
+HAVE_ERROR_AT_LINE = @HAVE_ERROR_AT_LINE@
+HAVE_ERROR_H = @HAVE_ERROR_H@
+HAVE_EUIDACCESS = @HAVE_EUIDACCESS@
+HAVE_EXECVPE = @HAVE_EXECVPE@
+HAVE_EXPLICIT_BZERO = @HAVE_EXPLICIT_BZERO@
+HAVE_FACCESSAT = @HAVE_FACCESSAT@
+HAVE_FCHDIR = @HAVE_FCHDIR@
+HAVE_FCHMODAT = @HAVE_FCHMODAT@
+HAVE_FCHOWNAT = @HAVE_FCHOWNAT@
+HAVE_FCNTL = @HAVE_FCNTL@
+HAVE_FDATASYNC = @HAVE_FDATASYNC@
+HAVE_FEATURES_H = @HAVE_FEATURES_H@
+HAVE_FFSL = @HAVE_FFSL@
+HAVE_FFSLL = @HAVE_FFSLL@
+HAVE_FREELOCALE = @HAVE_FREELOCALE@
+HAVE_FSEEKO = @HAVE_FSEEKO@
+HAVE_FSTATAT = @HAVE_FSTATAT@
+HAVE_FSYNC = @HAVE_FSYNC@
+HAVE_FTELLO = @HAVE_FTELLO@
+HAVE_FTRUNCATE = @HAVE_FTRUNCATE@
+HAVE_FUTIMENS = @HAVE_FUTIMENS@
+HAVE_GETDTABLESIZE = @HAVE_GETDTABLESIZE@
+HAVE_GETENTROPY = @HAVE_GETENTROPY@
+HAVE_GETGROUPS = @HAVE_GETGROUPS@
+HAVE_GETHOSTNAME = @HAVE_GETHOSTNAME@
+HAVE_GETLOGIN = @HAVE_GETLOGIN@
+HAVE_GETOPT_H = @HAVE_GETOPT_H@
+HAVE_GETPAGESIZE = @HAVE_GETPAGESIZE@
+HAVE_GETPASS = @HAVE_GETPASS@
+HAVE_GETPROGNAME = @HAVE_GETPROGNAME@
+HAVE_GETRANDOM = @HAVE_GETRANDOM@
+HAVE_GETSUBOPT = @HAVE_GETSUBOPT@
+HAVE_GETTIMEOFDAY = @HAVE_GETTIMEOFDAY@
+HAVE_GETUMASK = @HAVE_GETUMASK@
+HAVE_GRANTPT = @HAVE_GRANTPT@
+HAVE_GROUP_MEMBER = @HAVE_GROUP_MEMBER@
+HAVE_IMAXABS = @HAVE_IMAXABS@
+HAVE_IMAXDIV = @HAVE_IMAXDIV@
+HAVE_IMAXDIV_T = @HAVE_IMAXDIV_T@
+HAVE_INITSTATE = @HAVE_INITSTATE@
+HAVE_INTTYPES_H = @HAVE_INTTYPES_H@
+HAVE_ISBLANK = @HAVE_ISBLANK@
+HAVE_ISWBLANK = @HAVE_ISWBLANK@
+HAVE_ISWCNTRL = @HAVE_ISWCNTRL@
+HAVE_LANGINFO_ALTMON = @HAVE_LANGINFO_ALTMON@
+HAVE_LANGINFO_CODESET = @HAVE_LANGINFO_CODESET@
+HAVE_LANGINFO_ERA = @HAVE_LANGINFO_ERA@
+HAVE_LANGINFO_H = @HAVE_LANGINFO_H@
+HAVE_LANGINFO_T_FMT_AMPM = @HAVE_LANGINFO_T_FMT_AMPM@
+HAVE_LANGINFO_YESEXPR = @HAVE_LANGINFO_YESEXPR@
+HAVE_LCHMOD = @HAVE_LCHMOD@
+HAVE_LCHOWN = @HAVE_LCHOWN@
+HAVE_LINK = @HAVE_LINK@
+HAVE_LINKAT = @HAVE_LINKAT@
+HAVE_LSTAT = @HAVE_LSTAT@
+HAVE_MAX_ALIGN_T = @HAVE_MAX_ALIGN_T@
+HAVE_MBRLEN = @HAVE_MBRLEN@
+HAVE_MBRTOWC = @HAVE_MBRTOWC@
+HAVE_MBSINIT = @HAVE_MBSINIT@
+HAVE_MBSLEN = @HAVE_MBSLEN@
+HAVE_MBSNRTOWCS = @HAVE_MBSNRTOWCS@
+HAVE_MBSRTOWCS = @HAVE_MBSRTOWCS@
+HAVE_MBTOWC = @HAVE_MBTOWC@
+HAVE_MEMPCPY = @HAVE_MEMPCPY@
+HAVE_MEMSET_EXPLICIT = @HAVE_MEMSET_EXPLICIT@
+HAVE_MKDIRAT = @HAVE_MKDIRAT@
+HAVE_MKDTEMP = @HAVE_MKDTEMP@
+HAVE_MKFIFO = @HAVE_MKFIFO@
+HAVE_MKFIFOAT = @HAVE_MKFIFOAT@
+HAVE_MKNOD = @HAVE_MKNOD@
+HAVE_MKNODAT = @HAVE_MKNODAT@
+HAVE_MKOSTEMP = @HAVE_MKOSTEMP@
+HAVE_MKOSTEMPS = @HAVE_MKOSTEMPS@
+HAVE_MKSTEMP = @HAVE_MKSTEMP@
+HAVE_MKSTEMPS = @HAVE_MKSTEMPS@
+HAVE_MSVC_INVALID_PARAMETER_HANDLER = @HAVE_MSVC_INVALID_PARAMETER_HANDLER@
+HAVE_NANOSLEEP = @HAVE_NANOSLEEP@
+HAVE_NETINET_IN_H = @HAVE_NETINET_IN_H@
+HAVE_NEWLOCALE = @HAVE_NEWLOCALE@
+HAVE_NL_LANGINFO = @HAVE_NL_LANGINFO@
+HAVE_OPENAT = @HAVE_OPENAT@
+HAVE_OS_H = @HAVE_OS_H@
+HAVE_PCLOSE = @HAVE_PCLOSE@
+HAVE_PIPE = @HAVE_PIPE@
+HAVE_PIPE2 = @HAVE_PIPE2@
+HAVE_POPEN = @HAVE_POPEN@
+HAVE_POSIX_MEMALIGN = @HAVE_POSIX_MEMALIGN@
+HAVE_POSIX_OPENPT = @HAVE_POSIX_OPENPT@
+HAVE_POSIX_SIGNALBLOCKING = @HAVE_POSIX_SIGNALBLOCKING@
+HAVE_PREAD = @HAVE_PREAD@
+HAVE_PSELECT = @HAVE_PSELECT@
+HAVE_PTHREAD_ATTR_DESTROY = @HAVE_PTHREAD_ATTR_DESTROY@
+HAVE_PTHREAD_ATTR_GETDETACHSTATE = @HAVE_PTHREAD_ATTR_GETDETACHSTATE@
+HAVE_PTHREAD_ATTR_INIT = @HAVE_PTHREAD_ATTR_INIT@
+HAVE_PTHREAD_ATTR_SETDETACHSTATE = @HAVE_PTHREAD_ATTR_SETDETACHSTATE@
+HAVE_PTHREAD_CONDATTR_DESTROY = @HAVE_PTHREAD_CONDATTR_DESTROY@
+HAVE_PTHREAD_CONDATTR_INIT = @HAVE_PTHREAD_CONDATTR_INIT@
+HAVE_PTHREAD_COND_BROADCAST = @HAVE_PTHREAD_COND_BROADCAST@
+HAVE_PTHREAD_COND_DESTROY = @HAVE_PTHREAD_COND_DESTROY@
+HAVE_PTHREAD_COND_INIT = @HAVE_PTHREAD_COND_INIT@
+HAVE_PTHREAD_COND_SIGNAL = @HAVE_PTHREAD_COND_SIGNAL@
+HAVE_PTHREAD_COND_TIMEDWAIT = @HAVE_PTHREAD_COND_TIMEDWAIT@
+HAVE_PTHREAD_COND_WAIT = @HAVE_PTHREAD_COND_WAIT@
+HAVE_PTHREAD_CREATE = @HAVE_PTHREAD_CREATE@
+HAVE_PTHREAD_CREATE_DETACHED = @HAVE_PTHREAD_CREATE_DETACHED@
+HAVE_PTHREAD_DETACH = @HAVE_PTHREAD_DETACH@
+HAVE_PTHREAD_EQUAL = @HAVE_PTHREAD_EQUAL@
+HAVE_PTHREAD_EXIT = @HAVE_PTHREAD_EXIT@
+HAVE_PTHREAD_GETSPECIFIC = @HAVE_PTHREAD_GETSPECIFIC@
+HAVE_PTHREAD_H = @HAVE_PTHREAD_H@
+HAVE_PTHREAD_JOIN = @HAVE_PTHREAD_JOIN@
+HAVE_PTHREAD_KEY_CREATE = @HAVE_PTHREAD_KEY_CREATE@
+HAVE_PTHREAD_KEY_DELETE = @HAVE_PTHREAD_KEY_DELETE@
+HAVE_PTHREAD_MUTEXATTR_DESTROY = @HAVE_PTHREAD_MUTEXATTR_DESTROY@
+HAVE_PTHREAD_MUTEXATTR_GETROBUST = @HAVE_PTHREAD_MUTEXATTR_GETROBUST@
+HAVE_PTHREAD_MUTEXATTR_GETTYPE = @HAVE_PTHREAD_MUTEXATTR_GETTYPE@
+HAVE_PTHREAD_MUTEXATTR_INIT = @HAVE_PTHREAD_MUTEXATTR_INIT@
+HAVE_PTHREAD_MUTEXATTR_SETROBUST = @HAVE_PTHREAD_MUTEXATTR_SETROBUST@
+HAVE_PTHREAD_MUTEXATTR_SETTYPE = @HAVE_PTHREAD_MUTEXATTR_SETTYPE@
+HAVE_PTHREAD_MUTEX_DESTROY = @HAVE_PTHREAD_MUTEX_DESTROY@
+HAVE_PTHREAD_MUTEX_INIT = @HAVE_PTHREAD_MUTEX_INIT@
+HAVE_PTHREAD_MUTEX_LOCK = @HAVE_PTHREAD_MUTEX_LOCK@
+HAVE_PTHREAD_MUTEX_RECURSIVE = @HAVE_PTHREAD_MUTEX_RECURSIVE@
+HAVE_PTHREAD_MUTEX_ROBUST = @HAVE_PTHREAD_MUTEX_ROBUST@
+HAVE_PTHREAD_MUTEX_TIMEDLOCK = @HAVE_PTHREAD_MUTEX_TIMEDLOCK@
+HAVE_PTHREAD_MUTEX_TRYLOCK = @HAVE_PTHREAD_MUTEX_TRYLOCK@
+HAVE_PTHREAD_MUTEX_UNLOCK = @HAVE_PTHREAD_MUTEX_UNLOCK@
+HAVE_PTHREAD_ONCE = @HAVE_PTHREAD_ONCE@
+HAVE_PTHREAD_PROCESS_SHARED = @HAVE_PTHREAD_PROCESS_SHARED@
+HAVE_PTHREAD_RWLOCKATTR_DESTROY = @HAVE_PTHREAD_RWLOCKATTR_DESTROY@
+HAVE_PTHREAD_RWLOCKATTR_INIT = @HAVE_PTHREAD_RWLOCKATTR_INIT@
+HAVE_PTHREAD_RWLOCK_DESTROY = @HAVE_PTHREAD_RWLOCK_DESTROY@
+HAVE_PTHREAD_RWLOCK_INIT = @HAVE_PTHREAD_RWLOCK_INIT@
+HAVE_PTHREAD_RWLOCK_RDLOCK = @HAVE_PTHREAD_RWLOCK_RDLOCK@
+HAVE_PTHREAD_RWLOCK_TIMEDRDLOCK = @HAVE_PTHREAD_RWLOCK_TIMEDRDLOCK@
+HAVE_PTHREAD_RWLOCK_TIMEDWRLOCK = @HAVE_PTHREAD_RWLOCK_TIMEDWRLOCK@
+HAVE_PTHREAD_RWLOCK_TRYRDLOCK = @HAVE_PTHREAD_RWLOCK_TRYRDLOCK@
+HAVE_PTHREAD_RWLOCK_TRYWRLOCK = @HAVE_PTHREAD_RWLOCK_TRYWRLOCK@
+HAVE_PTHREAD_RWLOCK_UNLOCK = @HAVE_PTHREAD_RWLOCK_UNLOCK@
+HAVE_PTHREAD_RWLOCK_WRLOCK = @HAVE_PTHREAD_RWLOCK_WRLOCK@
+HAVE_PTHREAD_SELF = @HAVE_PTHREAD_SELF@
+HAVE_PTHREAD_SETSPECIFIC = @HAVE_PTHREAD_SETSPECIFIC@
+HAVE_PTHREAD_SIGMASK = @HAVE_PTHREAD_SIGMASK@
+HAVE_PTHREAD_SPINLOCK_T = @HAVE_PTHREAD_SPINLOCK_T@
+HAVE_PTHREAD_SPIN_DESTROY = @HAVE_PTHREAD_SPIN_DESTROY@
+HAVE_PTHREAD_SPIN_INIT = @HAVE_PTHREAD_SPIN_INIT@
+HAVE_PTHREAD_SPIN_LOCK = @HAVE_PTHREAD_SPIN_LOCK@
+HAVE_PTHREAD_SPIN_TRYLOCK = @HAVE_PTHREAD_SPIN_TRYLOCK@
+HAVE_PTHREAD_SPIN_UNLOCK = @HAVE_PTHREAD_SPIN_UNLOCK@
+HAVE_PTHREAD_T = @HAVE_PTHREAD_T@
+HAVE_PTSNAME = @HAVE_PTSNAME@
+HAVE_PTSNAME_R = @HAVE_PTSNAME_R@
+HAVE_PWRITE = @HAVE_PWRITE@
+HAVE_QSORT_R = @HAVE_QSORT_R@
+HAVE_RAISE = @HAVE_RAISE@
+HAVE_RANDOM = @HAVE_RANDOM@
+HAVE_RANDOM_H = @HAVE_RANDOM_H@
+HAVE_RANDOM_R = @HAVE_RANDOM_R@
+HAVE_RAWMEMCHR = @HAVE_RAWMEMCHR@
+HAVE_READLINK = @HAVE_READLINK@
+HAVE_READLINKAT = @HAVE_READLINKAT@
+HAVE_REALLOCARRAY = @HAVE_REALLOCARRAY@
+HAVE_REALPATH = @HAVE_REALPATH@
+HAVE_RENAMEAT = @HAVE_RENAMEAT@
+HAVE_RPMATCH = @HAVE_RPMATCH@
+HAVE_SA_FAMILY_T = @HAVE_SA_FAMILY_T@
+HAVE_SCHED_H = @HAVE_SCHED_H@
+HAVE_SCHED_YIELD = @HAVE_SCHED_YIELD@
+HAVE_SECURE_GETENV = @HAVE_SECURE_GETENV@
+HAVE_SETENV = @HAVE_SETENV@
+HAVE_SETHOSTNAME = @HAVE_SETHOSTNAME@
+HAVE_SETSTATE = @HAVE_SETSTATE@
+HAVE_SIGABBREV_NP = @HAVE_SIGABBREV_NP@
+HAVE_SIGACTION = @HAVE_SIGACTION@
+HAVE_SIGDESCR_NP = @HAVE_SIGDESCR_NP@
+HAVE_SIGHANDLER_T = @HAVE_SIGHANDLER_T@
+HAVE_SIGINFO_T = @HAVE_SIGINFO_T@
+HAVE_SIGNED_SIG_ATOMIC_T = @HAVE_SIGNED_SIG_ATOMIC_T@
+HAVE_SIGNED_WCHAR_T = @HAVE_SIGNED_WCHAR_T@
+HAVE_SIGNED_WINT_T = @HAVE_SIGNED_WINT_T@
+HAVE_SIGSET_T = @HAVE_SIGSET_T@
+HAVE_SLEEP = @HAVE_SLEEP@
+HAVE_STDINT_H = @HAVE_STDINT_H@
+HAVE_STPCPY = @HAVE_STPCPY@
+HAVE_STPNCPY = @HAVE_STPNCPY@
+HAVE_STRCASESTR = @HAVE_STRCASESTR@
+HAVE_STRCHRNUL = @HAVE_STRCHRNUL@
+HAVE_STRERRORNAME_NP = @HAVE_STRERRORNAME_NP@
+HAVE_STRPBRK = @HAVE_STRPBRK@
+HAVE_STRPTIME = @HAVE_STRPTIME@
+HAVE_STRSEP = @HAVE_STRSEP@
+HAVE_STRTOD = @HAVE_STRTOD@
+HAVE_STRTOL = @HAVE_STRTOL@
+HAVE_STRTOLD = @HAVE_STRTOLD@
+HAVE_STRTOLL = @HAVE_STRTOLL@
+HAVE_STRTOUL = @HAVE_STRTOUL@
+HAVE_STRTOULL = @HAVE_STRTOULL@
+HAVE_STRUCT_RANDOM_DATA = @HAVE_STRUCT_RANDOM_DATA@
+HAVE_STRUCT_SCHED_PARAM = @HAVE_STRUCT_SCHED_PARAM@
+HAVE_STRUCT_SIGACTION_SA_SIGACTION = @HAVE_STRUCT_SIGACTION_SA_SIGACTION@
+HAVE_STRUCT_SOCKADDR_STORAGE = @HAVE_STRUCT_SOCKADDR_STORAGE@
+HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY = @HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY@
+HAVE_STRUCT_TIMEVAL = @HAVE_STRUCT_TIMEVAL@
+HAVE_STRVERSCMP = @HAVE_STRVERSCMP@
+HAVE_SYMLINK = @HAVE_SYMLINK@
+HAVE_SYMLINKAT = @HAVE_SYMLINKAT@
+HAVE_SYS_BITYPES_H = @HAVE_SYS_BITYPES_H@
+HAVE_SYS_CDEFS_H = @HAVE_SYS_CDEFS_H@
+HAVE_SYS_INTTYPES_H = @HAVE_SYS_INTTYPES_H@
+HAVE_SYS_IOCTL_H = @HAVE_SYS_IOCTL_H@
+HAVE_SYS_LOADAVG_H = @HAVE_SYS_LOADAVG_H@
+HAVE_SYS_PARAM_H = @HAVE_SYS_PARAM_H@
+HAVE_SYS_RANDOM_H = @HAVE_SYS_RANDOM_H@
+HAVE_SYS_SELECT_H = @HAVE_SYS_SELECT_H@
+HAVE_SYS_SOCKET_H = @HAVE_SYS_SOCKET_H@
+HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@
+HAVE_SYS_TYPES_H = @HAVE_SYS_TYPES_H@
+HAVE_SYS_UIO_H = @HAVE_SYS_UIO_H@
+HAVE_TIMEGM = @HAVE_TIMEGM@
+HAVE_TIMESPEC_GET = @HAVE_TIMESPEC_GET@
+HAVE_TIMESPEC_GETRES = @HAVE_TIMESPEC_GETRES@
+HAVE_TIMEZONE_T = @HAVE_TIMEZONE_T@
+HAVE_TYPE_VOLATILE_SIG_ATOMIC_T = @HAVE_TYPE_VOLATILE_SIG_ATOMIC_T@
+HAVE_UNISTD_H = @HAVE_UNISTD_H@
+HAVE_UNLINKAT = @HAVE_UNLINKAT@
+HAVE_UNLOCKPT = @HAVE_UNLOCKPT@
+HAVE_USLEEP = @HAVE_USLEEP@
+HAVE_UTIMENSAT = @HAVE_UTIMENSAT@
+HAVE_VASPRINTF = @HAVE_VASPRINTF@
+HAVE_VDPRINTF = @HAVE_VDPRINTF@
+HAVE_VISIBILITY = @HAVE_VISIBILITY@
+HAVE_WCHAR_H = @HAVE_WCHAR_H@
+HAVE_WCHAR_T = @HAVE_WCHAR_T@
+HAVE_WCPCPY = @HAVE_WCPCPY@
+HAVE_WCPNCPY = @HAVE_WCPNCPY@
+HAVE_WCRTOMB = @HAVE_WCRTOMB@
+HAVE_WCSCASECMP = @HAVE_WCSCASECMP@
+HAVE_WCSCAT = @HAVE_WCSCAT@
+HAVE_WCSCHR = @HAVE_WCSCHR@
+HAVE_WCSCMP = @HAVE_WCSCMP@
+HAVE_WCSCOLL = @HAVE_WCSCOLL@
+HAVE_WCSCPY = @HAVE_WCSCPY@
+HAVE_WCSCSPN = @HAVE_WCSCSPN@
+HAVE_WCSDUP = @HAVE_WCSDUP@
+HAVE_WCSFTIME = @HAVE_WCSFTIME@
+HAVE_WCSLEN = @HAVE_WCSLEN@
+HAVE_WCSNCASECMP = @HAVE_WCSNCASECMP@
+HAVE_WCSNCAT = @HAVE_WCSNCAT@
+HAVE_WCSNCMP = @HAVE_WCSNCMP@
+HAVE_WCSNCPY = @HAVE_WCSNCPY@
+HAVE_WCSNLEN = @HAVE_WCSNLEN@
+HAVE_WCSNRTOMBS = @HAVE_WCSNRTOMBS@
+HAVE_WCSPBRK = @HAVE_WCSPBRK@
+HAVE_WCSRCHR = @HAVE_WCSRCHR@
+HAVE_WCSRTOMBS = @HAVE_WCSRTOMBS@
+HAVE_WCSSPN = @HAVE_WCSSPN@
+HAVE_WCSSTR = @HAVE_WCSSTR@
+HAVE_WCSTOK = @HAVE_WCSTOK@
+HAVE_WCSWIDTH = @HAVE_WCSWIDTH@
+HAVE_WCSXFRM = @HAVE_WCSXFRM@
+HAVE_WCTRANS_T = @HAVE_WCTRANS_T@
+HAVE_WCTYPE_H = @HAVE_WCTYPE_H@
+HAVE_WCTYPE_T = @HAVE_WCTYPE_T@
+HAVE_WINSOCK2_H = @HAVE_WINSOCK2_H@
+HAVE_WINT_T = @HAVE_WINT_T@
+HAVE_WMEMCHR = @HAVE_WMEMCHR@
+HAVE_WMEMCMP = @HAVE_WMEMCMP@
+HAVE_WMEMCPY = @HAVE_WMEMCPY@
+HAVE_WMEMMOVE = @HAVE_WMEMMOVE@
+HAVE_WMEMPCPY = @HAVE_WMEMPCPY@
+HAVE_WMEMSET = @HAVE_WMEMSET@
+HAVE_WS2TCPIP_H = @HAVE_WS2TCPIP_H@
+HAVE_XLOCALE_H = @HAVE_XLOCALE_H@
+HAVE__EXIT = @HAVE__EXIT@
+IGNORE_UNUSED_LIBRARIES_CFLAGS = @IGNORE_UNUSED_LIBRARIES_CFLAGS@
+INCLUDE_NEXT = @INCLUDE_NEXT@
+INCLUDE_NEXT_AS_FIRST_DIRECTIVE = @INCLUDE_NEXT_AS_FIRST_DIRECTIVE@
+INET_PTON_LIB = @INET_PTON_LIB@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+INT32_MAX_LT_INTMAX_MAX = @INT32_MAX_LT_INTMAX_MAX@
+INT64_MAX_EQ_LONG_MAX = @INT64_MAX_EQ_LONG_MAX@
+INTLINCS = @INTLINCS@
+INTLLIBS = @INTLLIBS@
+INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBICONV = @LIBICONV@
+LIBINTL = @LIBINTL@
+LIBMULTITHREAD = @LIBMULTITHREAD@
+LIBOBJS = @LIBOBJS@
+LIBPMULTITHREAD = @LIBPMULTITHREAD@
+LIBPTHREAD = @LIBPTHREAD@
+LIBS = @LIBS@
+LIBSOCKET = @LIBSOCKET@
+LIBSTDTHREAD = @LIBSTDTHREAD@
+LIBTESTS_LIBDEPS = @LIBTESTS_LIBDEPS@
+LIBTHREAD = @LIBTHREAD@
+LIBTOOL = @LIBTOOL@
+LIB_BLKID = @LIB_BLKID@
+LIB_CLOCK_GETTIME = @LIB_CLOCK_GETTIME@
+LIB_GETRANDOM = @LIB_GETRANDOM@
+LIB_HARD_LOCALE = @LIB_HARD_LOCALE@
+LIB_MBRTOWC = @LIB_MBRTOWC@
+LIB_NANOSLEEP = @LIB_NANOSLEEP@
+LIB_NL_LANGINFO = @LIB_NL_LANGINFO@
+LIB_PTHREAD = @LIB_PTHREAD@
+LIB_PTHREAD_SIGMASK = @LIB_PTHREAD_SIGMASK@
+LIB_SCHED_YIELD = @LIB_SCHED_YIELD@
+LIB_SELECT = @LIB_SELECT@
+LIB_SEMAPHORE = @LIB_SEMAPHORE@
+LIB_SETLOCALE = @LIB_SETLOCALE@
+LIB_SETLOCALE_NULL = @LIB_SETLOCALE_NULL@
+LIMITS_H = @LIMITS_H@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LOCALCHARSET_TESTS_ENVIRONMENT = @LOCALCHARSET_TESTS_ENVIRONMENT@
+LOCALENAME_ENHANCE_LOCALE_FUNCS = @LOCALENAME_ENHANCE_LOCALE_FUNCS@
+LOCALE_FR = @LOCALE_FR@
+LOCALE_FR_UTF8 = @LOCALE_FR_UTF8@
+LOCALE_JA = @LOCALE_JA@
+LOCALE_TR_UTF8 = @LOCALE_TR_UTF8@
+LOCALE_ZH_CN = @LOCALE_ZH_CN@
+LTALLOCA = @LTALLOCA@
+LTLIBICONV = @LTLIBICONV@
+LTLIBINTL = @LTLIBINTL@
+LTLIBMULTITHREAD = @LTLIBMULTITHREAD@
+LTLIBOBJS = @LTLIBOBJS@
+LTLIBTHREAD = @LTLIBTHREAD@
+LT_AGE = @LT_AGE@
+LT_CURRENT = @LT_CURRENT@
+LT_RELEASE = @LT_RELEASE@
+LT_REVISION = @LT_REVISION@
+LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MBRTOWC_LIB = @MBRTOWC_LIB@
+MKDIR_P = @MKDIR_P@
+MSGFMT = @MSGFMT@
+MSGFMT_015 = @MSGFMT_015@
+MSGMERGE = @MSGMERGE@
+NANOSLEEP_LIB = @NANOSLEEP_LIB@
+NETINET_IN_H = @NETINET_IN_H@
+NEXT_ARPA_INET_H = @NEXT_ARPA_INET_H@
+NEXT_ASSERT_H = @NEXT_ASSERT_H@
+NEXT_AS_FIRST_DIRECTIVE_ARPA_INET_H = @NEXT_AS_FIRST_DIRECTIVE_ARPA_INET_H@
+NEXT_AS_FIRST_DIRECTIVE_ASSERT_H = @NEXT_AS_FIRST_DIRECTIVE_ASSERT_H@
+NEXT_AS_FIRST_DIRECTIVE_CTYPE_H = @NEXT_AS_FIRST_DIRECTIVE_CTYPE_H@
+NEXT_AS_FIRST_DIRECTIVE_ERRNO_H = @NEXT_AS_FIRST_DIRECTIVE_ERRNO_H@
+NEXT_AS_FIRST_DIRECTIVE_ERROR_H = @NEXT_AS_FIRST_DIRECTIVE_ERROR_H@
+NEXT_AS_FIRST_DIRECTIVE_FCNTL_H = @NEXT_AS_FIRST_DIRECTIVE_FCNTL_H@
+NEXT_AS_FIRST_DIRECTIVE_GETOPT_H = @NEXT_AS_FIRST_DIRECTIVE_GETOPT_H@
+NEXT_AS_FIRST_DIRECTIVE_INTTYPES_H = @NEXT_AS_FIRST_DIRECTIVE_INTTYPES_H@
+NEXT_AS_FIRST_DIRECTIVE_LANGINFO_H = @NEXT_AS_FIRST_DIRECTIVE_LANGINFO_H@
+NEXT_AS_FIRST_DIRECTIVE_LIMITS_H = @NEXT_AS_FIRST_DIRECTIVE_LIMITS_H@
+NEXT_AS_FIRST_DIRECTIVE_LOCALE_H = @NEXT_AS_FIRST_DIRECTIVE_LOCALE_H@
+NEXT_AS_FIRST_DIRECTIVE_NETINET_IN_H = @NEXT_AS_FIRST_DIRECTIVE_NETINET_IN_H@
+NEXT_AS_FIRST_DIRECTIVE_PTHREAD_H = @NEXT_AS_FIRST_DIRECTIVE_PTHREAD_H@
+NEXT_AS_FIRST_DIRECTIVE_SCHED_H = @NEXT_AS_FIRST_DIRECTIVE_SCHED_H@
+NEXT_AS_FIRST_DIRECTIVE_SIGNAL_H = @NEXT_AS_FIRST_DIRECTIVE_SIGNAL_H@
+NEXT_AS_FIRST_DIRECTIVE_STDARG_H = @NEXT_AS_FIRST_DIRECTIVE_STDARG_H@
+NEXT_AS_FIRST_DIRECTIVE_STDDEF_H = @NEXT_AS_FIRST_DIRECTIVE_STDDEF_H@
+NEXT_AS_FIRST_DIRECTIVE_STDINT_H = @NEXT_AS_FIRST_DIRECTIVE_STDINT_H@
+NEXT_AS_FIRST_DIRECTIVE_STDIO_H = @NEXT_AS_FIRST_DIRECTIVE_STDIO_H@
+NEXT_AS_FIRST_DIRECTIVE_STDLIB_H = @NEXT_AS_FIRST_DIRECTIVE_STDLIB_H@
+NEXT_AS_FIRST_DIRECTIVE_STRING_H = @NEXT_AS_FIRST_DIRECTIVE_STRING_H@
+NEXT_AS_FIRST_DIRECTIVE_SYS_IOCTL_H = @NEXT_AS_FIRST_DIRECTIVE_SYS_IOCTL_H@
+NEXT_AS_FIRST_DIRECTIVE_SYS_RANDOM_H = @NEXT_AS_FIRST_DIRECTIVE_SYS_RANDOM_H@
+NEXT_AS_FIRST_DIRECTIVE_SYS_SELECT_H = @NEXT_AS_FIRST_DIRECTIVE_SYS_SELECT_H@
+NEXT_AS_FIRST_DIRECTIVE_SYS_SOCKET_H = @NEXT_AS_FIRST_DIRECTIVE_SYS_SOCKET_H@
+NEXT_AS_FIRST_DIRECTIVE_SYS_STAT_H = @NEXT_AS_FIRST_DIRECTIVE_SYS_STAT_H@
+NEXT_AS_FIRST_DIRECTIVE_SYS_TIME_H = @NEXT_AS_FIRST_DIRECTIVE_SYS_TIME_H@
+NEXT_AS_FIRST_DIRECTIVE_SYS_TYPES_H = @NEXT_AS_FIRST_DIRECTIVE_SYS_TYPES_H@
+NEXT_AS_FIRST_DIRECTIVE_SYS_UIO_H = @NEXT_AS_FIRST_DIRECTIVE_SYS_UIO_H@
+NEXT_AS_FIRST_DIRECTIVE_TIME_H = @NEXT_AS_FIRST_DIRECTIVE_TIME_H@
+NEXT_AS_FIRST_DIRECTIVE_UNISTD_H = @NEXT_AS_FIRST_DIRECTIVE_UNISTD_H@
+NEXT_AS_FIRST_DIRECTIVE_WCHAR_H = @NEXT_AS_FIRST_DIRECTIVE_WCHAR_H@
+NEXT_AS_FIRST_DIRECTIVE_WCTYPE_H = @NEXT_AS_FIRST_DIRECTIVE_WCTYPE_H@
+NEXT_CTYPE_H = @NEXT_CTYPE_H@
+NEXT_ERRNO_H = @NEXT_ERRNO_H@
+NEXT_ERROR_H = @NEXT_ERROR_H@
+NEXT_FCNTL_H = @NEXT_FCNTL_H@
+NEXT_GETOPT_H = @NEXT_GETOPT_H@
+NEXT_INTTYPES_H = @NEXT_INTTYPES_H@
+NEXT_LANGINFO_H = @NEXT_LANGINFO_H@
+NEXT_LIMITS_H = @NEXT_LIMITS_H@
+NEXT_LOCALE_H = @NEXT_LOCALE_H@
+NEXT_NETINET_IN_H = @NEXT_NETINET_IN_H@
+NEXT_PTHREAD_H = @NEXT_PTHREAD_H@
+NEXT_SCHED_H = @NEXT_SCHED_H@
+NEXT_SIGNAL_H = @NEXT_SIGNAL_H@
+NEXT_STDARG_H = @NEXT_STDARG_H@
+NEXT_STDDEF_H = @NEXT_STDDEF_H@
+NEXT_STDINT_H = @NEXT_STDINT_H@
+NEXT_STDIO_H = @NEXT_STDIO_H@
+NEXT_STDLIB_H = @NEXT_STDLIB_H@
+NEXT_STRING_H = @NEXT_STRING_H@
+NEXT_SYS_IOCTL_H = @NEXT_SYS_IOCTL_H@
+NEXT_SYS_RANDOM_H = @NEXT_SYS_RANDOM_H@
+NEXT_SYS_SELECT_H = @NEXT_SYS_SELECT_H@
+NEXT_SYS_SOCKET_H = @NEXT_SYS_SOCKET_H@
+NEXT_SYS_STAT_H = @NEXT_SYS_STAT_H@
+NEXT_SYS_TIME_H = @NEXT_SYS_TIME_H@
+NEXT_SYS_TYPES_H = @NEXT_SYS_TYPES_H@
+NEXT_SYS_UIO_H = @NEXT_SYS_UIO_H@
+NEXT_TIME_H = @NEXT_TIME_H@
+NEXT_UNISTD_H = @NEXT_UNISTD_H@
+NEXT_WCHAR_H = @NEXT_WCHAR_H@
+NEXT_WCTYPE_H = @NEXT_WCTYPE_H@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OS = @OS@
+OS_LIBS = @OS_LIBS@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PARTEDLDFLAGS = @PARTEDLDFLAGS@
+PARTED_LIBS = @PARTED_LIBS@
+PARTED_USABLE_TEST_DIR = @PARTED_USABLE_TEST_DIR@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
+PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
+POSUB = @POSUB@
+PRAGMA_COLUMNS = @PRAGMA_COLUMNS@
+PRAGMA_SYSTEM_HEADER = @PRAGMA_SYSTEM_HEADER@
+PRIPTR_PREFIX = @PRIPTR_PREFIX@
+PTHREAD_H_DEFINES_STRUCT_TIMESPEC = @PTHREAD_H_DEFINES_STRUCT_TIMESPEC@
+PTHREAD_SIGMASK_LIB = @PTHREAD_SIGMASK_LIB@
+PTRDIFF_T_SUFFIX = @PTRDIFF_T_SUFFIX@
+RANLIB = @RANLIB@
+REPLACE_ACCESS = @REPLACE_ACCESS@
+REPLACE_ALIGNED_ALLOC = @REPLACE_ALIGNED_ALLOC@
+REPLACE_BTOWC = @REPLACE_BTOWC@
+REPLACE_CALLOC_FOR_CALLOC_GNU = @REPLACE_CALLOC_FOR_CALLOC_GNU@
+REPLACE_CALLOC_FOR_CALLOC_POSIX = @REPLACE_CALLOC_FOR_CALLOC_POSIX@
+REPLACE_CANONICALIZE_FILE_NAME = @REPLACE_CANONICALIZE_FILE_NAME@
+REPLACE_CHMOD = @REPLACE_CHMOD@
+REPLACE_CHOWN = @REPLACE_CHOWN@
+REPLACE_CLOSE = @REPLACE_CLOSE@
+REPLACE_COPY_FILE_RANGE = @REPLACE_COPY_FILE_RANGE@
+REPLACE_CREAT = @REPLACE_CREAT@
+REPLACE_CTIME = @REPLACE_CTIME@
+REPLACE_DPRINTF = @REPLACE_DPRINTF@
+REPLACE_DUP = @REPLACE_DUP@
+REPLACE_DUP2 = @REPLACE_DUP2@
+REPLACE_DUP3 = @REPLACE_DUP3@
+REPLACE_DUPLOCALE = @REPLACE_DUPLOCALE@
+REPLACE_ERROR = @REPLACE_ERROR@
+REPLACE_ERROR_AT_LINE = @REPLACE_ERROR_AT_LINE@
+REPLACE_EXECL = @REPLACE_EXECL@
+REPLACE_EXECLE = @REPLACE_EXECLE@
+REPLACE_EXECLP = @REPLACE_EXECLP@
+REPLACE_EXECV = @REPLACE_EXECV@
+REPLACE_EXECVE = @REPLACE_EXECVE@
+REPLACE_EXECVP = @REPLACE_EXECVP@
+REPLACE_EXECVPE = @REPLACE_EXECVPE@
+REPLACE_FACCESSAT = @REPLACE_FACCESSAT@
+REPLACE_FCHMODAT = @REPLACE_FCHMODAT@
+REPLACE_FCHOWNAT = @REPLACE_FCHOWNAT@
+REPLACE_FCLOSE = @REPLACE_FCLOSE@
+REPLACE_FCNTL = @REPLACE_FCNTL@
+REPLACE_FDATASYNC = @REPLACE_FDATASYNC@
+REPLACE_FDOPEN = @REPLACE_FDOPEN@
+REPLACE_FFLUSH = @REPLACE_FFLUSH@
+REPLACE_FFSLL = @REPLACE_FFSLL@
+REPLACE_FOPEN = @REPLACE_FOPEN@
+REPLACE_FOPEN_FOR_FOPEN_GNU = @REPLACE_FOPEN_FOR_FOPEN_GNU@
+REPLACE_FPRINTF = @REPLACE_FPRINTF@
+REPLACE_FPURGE = @REPLACE_FPURGE@
+REPLACE_FREE = @REPLACE_FREE@
+REPLACE_FREELOCALE = @REPLACE_FREELOCALE@
+REPLACE_FREOPEN = @REPLACE_FREOPEN@
+REPLACE_FSEEK = @REPLACE_FSEEK@
+REPLACE_FSEEKO = @REPLACE_FSEEKO@
+REPLACE_FSTAT = @REPLACE_FSTAT@
+REPLACE_FSTATAT = @REPLACE_FSTATAT@
+REPLACE_FTELL = @REPLACE_FTELL@
+REPLACE_FTELLO = @REPLACE_FTELLO@
+REPLACE_FTRUNCATE = @REPLACE_FTRUNCATE@
+REPLACE_FUTIMENS = @REPLACE_FUTIMENS@
+REPLACE_GETCWD = @REPLACE_GETCWD@
+REPLACE_GETDELIM = @REPLACE_GETDELIM@
+REPLACE_GETDOMAINNAME = @REPLACE_GETDOMAINNAME@
+REPLACE_GETDTABLESIZE = @REPLACE_GETDTABLESIZE@
+REPLACE_GETENTROPY = @REPLACE_GETENTROPY@
+REPLACE_GETGROUPS = @REPLACE_GETGROUPS@
+REPLACE_GETLINE = @REPLACE_GETLINE@
+REPLACE_GETLOADAVG = @REPLACE_GETLOADAVG@
+REPLACE_GETLOGIN_R = @REPLACE_GETLOGIN_R@
+REPLACE_GETPAGESIZE = @REPLACE_GETPAGESIZE@
+REPLACE_GETPASS = @REPLACE_GETPASS@
+REPLACE_GETPASS_FOR_GETPASS_GNU = @REPLACE_GETPASS_FOR_GETPASS_GNU@
+REPLACE_GETPROGNAME = @REPLACE_GETPROGNAME@
+REPLACE_GETRANDOM = @REPLACE_GETRANDOM@
+REPLACE_GETSUBOPT = @REPLACE_GETSUBOPT@
+REPLACE_GETTIMEOFDAY = @REPLACE_GETTIMEOFDAY@
+REPLACE_GMTIME = @REPLACE_GMTIME@
+REPLACE_IMAXABS = @REPLACE_IMAXABS@
+REPLACE_IMAXDIV = @REPLACE_IMAXDIV@
+REPLACE_INET_NTOP = @REPLACE_INET_NTOP@
+REPLACE_INET_PTON = @REPLACE_INET_PTON@
+REPLACE_INITSTATE = @REPLACE_INITSTATE@
+REPLACE_IOCTL = @REPLACE_IOCTL@
+REPLACE_ISATTY = @REPLACE_ISATTY@
+REPLACE_ISWBLANK = @REPLACE_ISWBLANK@
+REPLACE_ISWCNTRL = @REPLACE_ISWCNTRL@
+REPLACE_ISWDIGIT = @REPLACE_ISWDIGIT@
+REPLACE_ISWXDIGIT = @REPLACE_ISWXDIGIT@
+REPLACE_LCHOWN = @REPLACE_LCHOWN@
+REPLACE_LINK = @REPLACE_LINK@
+REPLACE_LINKAT = @REPLACE_LINKAT@
+REPLACE_LOCALECONV = @REPLACE_LOCALECONV@
+REPLACE_LOCALTIME = @REPLACE_LOCALTIME@
+REPLACE_LOCALTIME_R = @REPLACE_LOCALTIME_R@
+REPLACE_LSEEK = @REPLACE_LSEEK@
+REPLACE_LSTAT = @REPLACE_LSTAT@
+REPLACE_MALLOC_FOR_MALLOC_GNU = @REPLACE_MALLOC_FOR_MALLOC_GNU@
+REPLACE_MALLOC_FOR_MALLOC_POSIX = @REPLACE_MALLOC_FOR_MALLOC_POSIX@
+REPLACE_MBRLEN = @REPLACE_MBRLEN@
+REPLACE_MBRTOWC = @REPLACE_MBRTOWC@
+REPLACE_MBSINIT = @REPLACE_MBSINIT@
+REPLACE_MBSNRTOWCS = @REPLACE_MBSNRTOWCS@
+REPLACE_MBSRTOWCS = @REPLACE_MBSRTOWCS@
+REPLACE_MBSTATE_T = @REPLACE_MBSTATE_T@
+REPLACE_MBTOWC = @REPLACE_MBTOWC@
+REPLACE_MEMCHR = @REPLACE_MEMCHR@
+REPLACE_MEMMEM = @REPLACE_MEMMEM@
+REPLACE_MEMPCPY = @REPLACE_MEMPCPY@
+REPLACE_MKDIR = @REPLACE_MKDIR@
+REPLACE_MKFIFO = @REPLACE_MKFIFO@
+REPLACE_MKFIFOAT = @REPLACE_MKFIFOAT@
+REPLACE_MKNOD = @REPLACE_MKNOD@
+REPLACE_MKNODAT = @REPLACE_MKNODAT@
+REPLACE_MKOSTEMP = @REPLACE_MKOSTEMP@
+REPLACE_MKOSTEMPS = @REPLACE_MKOSTEMPS@
+REPLACE_MKSTEMP = @REPLACE_MKSTEMP@
+REPLACE_MKTIME = @REPLACE_MKTIME@
+REPLACE_NANOSLEEP = @REPLACE_NANOSLEEP@
+REPLACE_NEWLOCALE = @REPLACE_NEWLOCALE@
+REPLACE_NL_LANGINFO = @REPLACE_NL_LANGINFO@
+REPLACE_NULL = @REPLACE_NULL@
+REPLACE_OBSTACK_PRINTF = @REPLACE_OBSTACK_PRINTF@
+REPLACE_OPEN = @REPLACE_OPEN@
+REPLACE_OPENAT = @REPLACE_OPENAT@
+REPLACE_PERROR = @REPLACE_PERROR@
+REPLACE_PIPE2 = @REPLACE_PIPE2@
+REPLACE_POPEN = @REPLACE_POPEN@
+REPLACE_POSIX_MEMALIGN = @REPLACE_POSIX_MEMALIGN@
+REPLACE_POSIX_OPENPT = @REPLACE_POSIX_OPENPT@
+REPLACE_PREAD = @REPLACE_PREAD@
+REPLACE_PRINTF = @REPLACE_PRINTF@
+REPLACE_PSELECT = @REPLACE_PSELECT@
+REPLACE_PTHREAD_ATTR_DESTROY = @REPLACE_PTHREAD_ATTR_DESTROY@
+REPLACE_PTHREAD_ATTR_GETDETACHSTATE = @REPLACE_PTHREAD_ATTR_GETDETACHSTATE@
+REPLACE_PTHREAD_ATTR_INIT = @REPLACE_PTHREAD_ATTR_INIT@
+REPLACE_PTHREAD_ATTR_SETDETACHSTATE = @REPLACE_PTHREAD_ATTR_SETDETACHSTATE@
+REPLACE_PTHREAD_CONDATTR_DESTROY = @REPLACE_PTHREAD_CONDATTR_DESTROY@
+REPLACE_PTHREAD_CONDATTR_INIT = @REPLACE_PTHREAD_CONDATTR_INIT@
+REPLACE_PTHREAD_COND_BROADCAST = @REPLACE_PTHREAD_COND_BROADCAST@
+REPLACE_PTHREAD_COND_DESTROY = @REPLACE_PTHREAD_COND_DESTROY@
+REPLACE_PTHREAD_COND_INIT = @REPLACE_PTHREAD_COND_INIT@
+REPLACE_PTHREAD_COND_SIGNAL = @REPLACE_PTHREAD_COND_SIGNAL@
+REPLACE_PTHREAD_COND_TIMEDWAIT = @REPLACE_PTHREAD_COND_TIMEDWAIT@
+REPLACE_PTHREAD_COND_WAIT = @REPLACE_PTHREAD_COND_WAIT@
+REPLACE_PTHREAD_CREATE = @REPLACE_PTHREAD_CREATE@
+REPLACE_PTHREAD_DETACH = @REPLACE_PTHREAD_DETACH@
+REPLACE_PTHREAD_EQUAL = @REPLACE_PTHREAD_EQUAL@
+REPLACE_PTHREAD_EXIT = @REPLACE_PTHREAD_EXIT@
+REPLACE_PTHREAD_GETSPECIFIC = @REPLACE_PTHREAD_GETSPECIFIC@
+REPLACE_PTHREAD_JOIN = @REPLACE_PTHREAD_JOIN@
+REPLACE_PTHREAD_KEY_CREATE = @REPLACE_PTHREAD_KEY_CREATE@
+REPLACE_PTHREAD_KEY_DELETE = @REPLACE_PTHREAD_KEY_DELETE@
+REPLACE_PTHREAD_MUTEXATTR_DESTROY = @REPLACE_PTHREAD_MUTEXATTR_DESTROY@
+REPLACE_PTHREAD_MUTEXATTR_GETROBUST = @REPLACE_PTHREAD_MUTEXATTR_GETROBUST@
+REPLACE_PTHREAD_MUTEXATTR_GETTYPE = @REPLACE_PTHREAD_MUTEXATTR_GETTYPE@
+REPLACE_PTHREAD_MUTEXATTR_INIT = @REPLACE_PTHREAD_MUTEXATTR_INIT@
+REPLACE_PTHREAD_MUTEXATTR_SETROBUST = @REPLACE_PTHREAD_MUTEXATTR_SETROBUST@
+REPLACE_PTHREAD_MUTEXATTR_SETTYPE = @REPLACE_PTHREAD_MUTEXATTR_SETTYPE@
+REPLACE_PTHREAD_MUTEX_DESTROY = @REPLACE_PTHREAD_MUTEX_DESTROY@
+REPLACE_PTHREAD_MUTEX_INIT = @REPLACE_PTHREAD_MUTEX_INIT@
+REPLACE_PTHREAD_MUTEX_LOCK = @REPLACE_PTHREAD_MUTEX_LOCK@
+REPLACE_PTHREAD_MUTEX_TIMEDLOCK = @REPLACE_PTHREAD_MUTEX_TIMEDLOCK@
+REPLACE_PTHREAD_MUTEX_TRYLOCK = @REPLACE_PTHREAD_MUTEX_TRYLOCK@
+REPLACE_PTHREAD_MUTEX_UNLOCK = @REPLACE_PTHREAD_MUTEX_UNLOCK@
+REPLACE_PTHREAD_ONCE = @REPLACE_PTHREAD_ONCE@
+REPLACE_PTHREAD_RWLOCKATTR_DESTROY = @REPLACE_PTHREAD_RWLOCKATTR_DESTROY@
+REPLACE_PTHREAD_RWLOCKATTR_INIT = @REPLACE_PTHREAD_RWLOCKATTR_INIT@
+REPLACE_PTHREAD_RWLOCK_DESTROY = @REPLACE_PTHREAD_RWLOCK_DESTROY@
+REPLACE_PTHREAD_RWLOCK_INIT = @REPLACE_PTHREAD_RWLOCK_INIT@
+REPLACE_PTHREAD_RWLOCK_RDLOCK = @REPLACE_PTHREAD_RWLOCK_RDLOCK@
+REPLACE_PTHREAD_RWLOCK_TIMEDRDLOCK = @REPLACE_PTHREAD_RWLOCK_TIMEDRDLOCK@
+REPLACE_PTHREAD_RWLOCK_TIMEDWRLOCK = @REPLACE_PTHREAD_RWLOCK_TIMEDWRLOCK@
+REPLACE_PTHREAD_RWLOCK_TRYRDLOCK = @REPLACE_PTHREAD_RWLOCK_TRYRDLOCK@
+REPLACE_PTHREAD_RWLOCK_TRYWRLOCK = @REPLACE_PTHREAD_RWLOCK_TRYWRLOCK@
+REPLACE_PTHREAD_RWLOCK_UNLOCK = @REPLACE_PTHREAD_RWLOCK_UNLOCK@
+REPLACE_PTHREAD_RWLOCK_WRLOCK = @REPLACE_PTHREAD_RWLOCK_WRLOCK@
+REPLACE_PTHREAD_SELF = @REPLACE_PTHREAD_SELF@
+REPLACE_PTHREAD_SETSPECIFIC = @REPLACE_PTHREAD_SETSPECIFIC@
+REPLACE_PTHREAD_SIGMASK = @REPLACE_PTHREAD_SIGMASK@
+REPLACE_PTHREAD_SPIN_DESTROY = @REPLACE_PTHREAD_SPIN_DESTROY@
+REPLACE_PTHREAD_SPIN_INIT = @REPLACE_PTHREAD_SPIN_INIT@
+REPLACE_PTHREAD_SPIN_LOCK = @REPLACE_PTHREAD_SPIN_LOCK@
+REPLACE_PTHREAD_SPIN_TRYLOCK = @REPLACE_PTHREAD_SPIN_TRYLOCK@
+REPLACE_PTHREAD_SPIN_UNLOCK = @REPLACE_PTHREAD_SPIN_UNLOCK@
+REPLACE_PTSNAME = @REPLACE_PTSNAME@
+REPLACE_PTSNAME_R = @REPLACE_PTSNAME_R@
+REPLACE_PUTENV = @REPLACE_PUTENV@
+REPLACE_PWRITE = @REPLACE_PWRITE@
+REPLACE_QSORT_R = @REPLACE_QSORT_R@
+REPLACE_RAISE = @REPLACE_RAISE@
+REPLACE_RANDOM = @REPLACE_RANDOM@
+REPLACE_RANDOM_R = @REPLACE_RANDOM_R@
+REPLACE_READ = @REPLACE_READ@
+REPLACE_READLINK = @REPLACE_READLINK@
+REPLACE_READLINKAT = @REPLACE_READLINKAT@
+REPLACE_REALLOCARRAY = @REPLACE_REALLOCARRAY@
+REPLACE_REALLOC_FOR_REALLOC_GNU = @REPLACE_REALLOC_FOR_REALLOC_GNU@
+REPLACE_REALLOC_FOR_REALLOC_POSIX = @REPLACE_REALLOC_FOR_REALLOC_POSIX@
+REPLACE_REALPATH = @REPLACE_REALPATH@
+REPLACE_REMOVE = @REPLACE_REMOVE@
+REPLACE_RENAME = @REPLACE_RENAME@
+REPLACE_RENAMEAT = @REPLACE_RENAMEAT@
+REPLACE_RMDIR = @REPLACE_RMDIR@
+REPLACE_SCHED_YIELD = @REPLACE_SCHED_YIELD@
+REPLACE_SELECT = @REPLACE_SELECT@
+REPLACE_SETENV = @REPLACE_SETENV@
+REPLACE_SETHOSTNAME = @REPLACE_SETHOSTNAME@
+REPLACE_SETLOCALE = @REPLACE_SETLOCALE@
+REPLACE_SETSTATE = @REPLACE_SETSTATE@
+REPLACE_SLEEP = @REPLACE_SLEEP@
+REPLACE_SNPRINTF = @REPLACE_SNPRINTF@
+REPLACE_SPRINTF = @REPLACE_SPRINTF@
+REPLACE_STAT = @REPLACE_STAT@
+REPLACE_STDIO_READ_FUNCS = @REPLACE_STDIO_READ_FUNCS@
+REPLACE_STDIO_WRITE_FUNCS = @REPLACE_STDIO_WRITE_FUNCS@
+REPLACE_STPCPY = @REPLACE_STPCPY@
+REPLACE_STPNCPY = @REPLACE_STPNCPY@
+REPLACE_STRCASESTR = @REPLACE_STRCASESTR@
+REPLACE_STRCHRNUL = @REPLACE_STRCHRNUL@
+REPLACE_STRDUP = @REPLACE_STRDUP@
+REPLACE_STRERROR = @REPLACE_STRERROR@
+REPLACE_STRERRORNAME_NP = @REPLACE_STRERRORNAME_NP@
+REPLACE_STRERROR_R = @REPLACE_STRERROR_R@
+REPLACE_STRFTIME = @REPLACE_STRFTIME@
+REPLACE_STRNCAT = @REPLACE_STRNCAT@
+REPLACE_STRNDUP = @REPLACE_STRNDUP@
+REPLACE_STRNLEN = @REPLACE_STRNLEN@
+REPLACE_STRSIGNAL = @REPLACE_STRSIGNAL@
+REPLACE_STRSTR = @REPLACE_STRSTR@
+REPLACE_STRTOD = @REPLACE_STRTOD@
+REPLACE_STRTOIMAX = @REPLACE_STRTOIMAX@
+REPLACE_STRTOK_R = @REPLACE_STRTOK_R@
+REPLACE_STRTOL = @REPLACE_STRTOL@
+REPLACE_STRTOLD = @REPLACE_STRTOLD@
+REPLACE_STRTOLL = @REPLACE_STRTOLL@
+REPLACE_STRTOUL = @REPLACE_STRTOUL@
+REPLACE_STRTOULL = @REPLACE_STRTOULL@
+REPLACE_STRTOUMAX = @REPLACE_STRTOUMAX@
+REPLACE_STRUCT_LCONV = @REPLACE_STRUCT_LCONV@
+REPLACE_STRUCT_TIMEVAL = @REPLACE_STRUCT_TIMEVAL@
+REPLACE_SYMLINK = @REPLACE_SYMLINK@
+REPLACE_SYMLINKAT = @REPLACE_SYMLINKAT@
+REPLACE_TIME = @REPLACE_TIME@
+REPLACE_TIMEGM = @REPLACE_TIMEGM@
+REPLACE_TIMESPEC_GET = @REPLACE_TIMESPEC_GET@
+REPLACE_TMPFILE = @REPLACE_TMPFILE@
+REPLACE_TOWLOWER = @REPLACE_TOWLOWER@
+REPLACE_TRUNCATE = @REPLACE_TRUNCATE@
+REPLACE_TTYNAME_R = @REPLACE_TTYNAME_R@
+REPLACE_TZSET = @REPLACE_TZSET@
+REPLACE_UNLINK = @REPLACE_UNLINK@
+REPLACE_UNLINKAT = @REPLACE_UNLINKAT@
+REPLACE_UNSETENV = @REPLACE_UNSETENV@
+REPLACE_USLEEP = @REPLACE_USLEEP@
+REPLACE_UTIMENSAT = @REPLACE_UTIMENSAT@
+REPLACE_VASPRINTF = @REPLACE_VASPRINTF@
+REPLACE_VDPRINTF = @REPLACE_VDPRINTF@
+REPLACE_VFPRINTF = @REPLACE_VFPRINTF@
+REPLACE_VPRINTF = @REPLACE_VPRINTF@
+REPLACE_VSNPRINTF = @REPLACE_VSNPRINTF@
+REPLACE_VSPRINTF = @REPLACE_VSPRINTF@
+REPLACE_WCRTOMB = @REPLACE_WCRTOMB@
+REPLACE_WCSFTIME = @REPLACE_WCSFTIME@
+REPLACE_WCSNRTOMBS = @REPLACE_WCSNRTOMBS@
+REPLACE_WCSRTOMBS = @REPLACE_WCSRTOMBS@
+REPLACE_WCSTOK = @REPLACE_WCSTOK@
+REPLACE_WCSWIDTH = @REPLACE_WCSWIDTH@
+REPLACE_WCTOB = @REPLACE_WCTOB@
+REPLACE_WCTOMB = @REPLACE_WCTOMB@
+REPLACE_WCWIDTH = @REPLACE_WCWIDTH@
+REPLACE_WMEMPCPY = @REPLACE_WMEMPCPY@
+REPLACE_WRITE = @REPLACE_WRITE@
+REPLACE__EXIT = @REPLACE__EXIT@
+SCHED_YIELD_LIB = @SCHED_YIELD_LIB@
+SED = @SED@
+SELECT_LIB = @SELECT_LIB@
+SETLOCALE_LIB = @SETLOCALE_LIB@
+SETLOCALE_NULL_LIB = @SETLOCALE_NULL_LIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SIG_ATOMIC_T_SUFFIX = @SIG_ATOMIC_T_SUFFIX@
+SIZE_T_SUFFIX = @SIZE_T_SUFFIX@
+STDARG_H = @STDARG_H@
+STDCKDINT_H = @STDCKDINT_H@
+STDDEF_H = @STDDEF_H@
+STDINT_H = @STDINT_H@
+STRIP = @STRIP@
+SYS_IOCTL_H_HAVE_WINSOCK2_H = @SYS_IOCTL_H_HAVE_WINSOCK2_H@
+SYS_IOCTL_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS = @SYS_IOCTL_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@
+SYS_TIME_H_DEFINES_STRUCT_TIMESPEC = @SYS_TIME_H_DEFINES_STRUCT_TIMESPEC@
+TIME_H_DEFINES_STRUCT_TIMESPEC = @TIME_H_DEFINES_STRUCT_TIMESPEC@
+TIME_H_DEFINES_TIME_UTC = @TIME_H_DEFINES_TIME_UTC@
+UINT32_MAX_LT_UINTMAX_MAX = @UINT32_MAX_LT_UINTMAX_MAX@
+UINT64_MAX_EQ_ULONG_MAX = @UINT64_MAX_EQ_ULONG_MAX@
+UNDEFINE_STRTOK_R = @UNDEFINE_STRTOK_R@
+UNISTD_H_DEFINES_STRUCT_TIMESPEC = @UNISTD_H_DEFINES_STRUCT_TIMESPEC@
+UNISTD_H_HAVE_SYS_RANDOM_H = @UNISTD_H_HAVE_SYS_RANDOM_H@
+UNISTD_H_HAVE_WINSOCK2_H = @UNISTD_H_HAVE_WINSOCK2_H@
+UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS = @UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@
+USE_NLS = @USE_NLS@
+UUID_LIBS = @UUID_LIBS@
+VERSION = @VERSION@
+WARN_CFLAGS = @WARN_CFLAGS@
+WCHAR_T_SUFFIX = @WCHAR_T_SUFFIX@
+WINDOWS_64_BIT_OFF_T = @WINDOWS_64_BIT_OFF_T@
+WINDOWS_64_BIT_ST_SIZE = @WINDOWS_64_BIT_ST_SIZE@
+WINDOWS_STAT_INODES = @WINDOWS_STAT_INODES@
+WINDOWS_STAT_TIMESPEC = @WINDOWS_STAT_TIMESPEC@
+WINT_T_SUFFIX = @WINT_T_SUFFIX@
+XGETTEXT = @XGETTEXT@
+XGETTEXT_015 = @XGETTEXT_015@
+XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
+YIELD_LIB = @YIELD_LIB@
+abs_aux_dir = @abs_aux_dir@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+bindir_c = @bindir_c@
+bindir_c_make = @bindir_c_make@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datadir_c = @datadir_c@
+datadir_c_make = @datadir_c_make@
+datarootdir = @datarootdir@
+datarootdir_c = @datarootdir_c@
+datarootdir_c_make = @datarootdir_c_make@
+docdir = @docdir@
+docdir_c = @docdir_c@
+docdir_c_make = @docdir_c_make@
+dvidir = @dvidir@
+dvidir_c = @dvidir_c@
+dvidir_c_make = @dvidir_c_make@
+exec_prefix = @exec_prefix@
+exec_prefix_c = @exec_prefix_c@
+exec_prefix_c_make = @exec_prefix_c_make@
+gl_LIBOBJDEPS = @gl_LIBOBJDEPS@
+gl_LIBOBJS = @gl_LIBOBJS@
+gl_LTLIBOBJS = @gl_LTLIBOBJS@
+gltests_LIBOBJDEPS = @gltests_LIBOBJDEPS@
+gltests_LIBOBJS = @gltests_LIBOBJS@
+gltests_LTLIBOBJS = @gltests_LTLIBOBJS@
+gltests_WITNESS = @gltests_WITNESS@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+htmldir_c = @htmldir_c@
+htmldir_c_make = @htmldir_c_make@
+includedir = @includedir@
+includedir_c = @includedir_c@
+includedir_c_make = @includedir_c_make@
+infodir = @infodir@
+infodir_c = @infodir_c@
+infodir_c_make = @infodir_c_make@
+install_sh = @install_sh@
+libdir = @libdir@
+libdir_c = @libdir_c@
+libdir_c_make = @libdir_c_make@
+libexecdir = @libexecdir@
+libexecdir_c = @libexecdir_c@
+libexecdir_c_make = @libexecdir_c_make@
+lispdir = @lispdir@
+lispdir_c = @lispdir_c@
+lispdir_c_make = @lispdir_c_make@
+localedir = @localedir@
+localedir_c = @localedir_c@
+localedir_c_make = @localedir_c_make@
+localstatedir = @localstatedir@
+localstatedir_c = @localstatedir_c@
+localstatedir_c_make = @localstatedir_c_make@
+mandir = @mandir@
+mandir_c = @mandir_c@
+mandir_c_make = @mandir_c_make@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+oldincludedir_c = @oldincludedir_c@
+oldincludedir_c_make = @oldincludedir_c_make@
+pdfdir = @pdfdir@
+pdfdir_c = @pdfdir_c@
+pdfdir_c_make = @pdfdir_c_make@
+pkgdatadir_c = @pkgdatadir_c@
+pkgdatadir_c_make = @pkgdatadir_c_make@
+pkgincludedir_c = @pkgincludedir_c@
+pkgincludedir_c_make = @pkgincludedir_c_make@
+pkglibdir_c = @pkglibdir_c@
+pkglibdir_c_make = @pkglibdir_c_make@
+pkglibexecdir_c = @pkglibexecdir_c@
+pkglibexecdir_c_make = @pkglibexecdir_c_make@
+prefix = @prefix@
+prefix_c = @prefix_c@
+prefix_c_make = @prefix_c_make@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+psdir_c = @psdir_c@
+psdir_c_make = @psdir_c_make@
+runstatedir = @runstatedir@
+runstatedir_c = @runstatedir_c@
+runstatedir_c_make = @runstatedir_c_make@
+sbindir = @sbindir@
+sbindir_c = @sbindir_c@
+sbindir_c_make = @sbindir_c_make@
+sharedstatedir = @sharedstatedir@
+sharedstatedir_c = @sharedstatedir_c@
+sharedstatedir_c_make = @sharedstatedir_c_make@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+sysconfdir_c = @sysconfdir_c@
+sysconfdir_c_make = @sysconfdir_c_make@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+BUILT_SOURCES = version.c version.h
+AM_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS)
+partedincludedir = \
+ -I$(top_srcdir)/lib -I$(top_builddir)/include -I$(top_srcdir)/include
+
+parted_SOURCES = command.c \
+ command.h \
+ parted.c \
+ strlist.c \
+ strlist.h \
+ ui.c \
+ ui.h \
+ jsonwrt.c \
+ jsonwrt.h \
+ table.c \
+ table.h
+
+noinst_LIBRARIES = libver.a
+nodist_libver_a_SOURCES = version.c version.h
+DISTCLEANFILES = version.c version.h
+MAINTAINERCLEANFILES = $(BUILT_SOURCES) Makefile.in
+parted_LDADD = \
+ libver.a \
+ $(top_builddir)/libparted/libparted.la \
+ $(INTLLIBS) $(LIBS) \
+ $(PARTED_LIBS)
+
+
+# Tell the linker to omit references to unused shared libraries.
+parted_LDFLAGS = $(PARTEDLDFLAGS) $(IGNORE_UNUSED_LIBRARIES_CFLAGS)
+AM_CPPFLAGS = $(partedincludedir) $(INTLINCS)
+all: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu parted/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --gnu parted/Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+install-sbinPROGRAMS: $(sbin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ @list='$(sbin_PROGRAMS)'; test -n "$(sbindir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(sbindir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(sbindir)" || exit 1; \
+ fi; \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed 's/$(EXEEXT)$$//' | \
+ while read p p1; do if test -f $$p \
+ || test -f $$p1 \
+ ; then echo "$$p"; echo "$$p"; else :; fi; \
+ done | \
+ sed -e 'p;s,.*/,,;n;h' \
+ -e 's|.*|.|' \
+ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
+ sed 'N;N;N;s,\n, ,g' | \
+ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
+ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+ if ($$2 == $$4) files[d] = files[d] " " $$1; \
+ else { print "f", $$3 "/" $$4, $$1; } } \
+ END { for (d in files) print "f", d, files[d] }' | \
+ while read type dir files; do \
+ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+ test -z "$$files" || { \
+ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(sbindir)$$dir'"; \
+ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(sbindir)$$dir" || exit $$?; \
+ } \
+ ; done
+
+uninstall-sbinPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(sbin_PROGRAMS)'; test -n "$(sbindir)" || list=; \
+ files=`for p in $$list; do echo "$$p"; done | \
+ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
+ -e 's/$$/$(EXEEXT)/' \
+ `; \
+ test -n "$$list" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(sbindir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(sbindir)" && rm -f $$files
+
+clean-sbinPROGRAMS:
+ @list='$(sbin_PROGRAMS)'; test -n "$$list" || exit 0; \
+ echo " rm -f" $$list; \
+ rm -f $$list || exit $$?; \
+ test -n "$(EXEEXT)" || exit 0; \
+ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f" $$list; \
+ rm -f $$list
+
+clean-noinstLIBRARIES:
+ -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
+
+libver.a: $(libver_a_OBJECTS) $(libver_a_DEPENDENCIES) $(EXTRA_libver_a_DEPENDENCIES)
+ $(AM_V_at)-rm -f libver.a
+ $(AM_V_AR)$(libver_a_AR) libver.a $(libver_a_OBJECTS) $(libver_a_LIBADD)
+ $(AM_V_at)$(RANLIB) libver.a
+
+parted$(EXEEXT): $(parted_OBJECTS) $(parted_DEPENDENCIES) $(EXTRA_parted_DEPENDENCIES)
+ @rm -f parted$(EXEEXT)
+ $(AM_V_CCLD)$(parted_LINK) $(parted_OBJECTS) $(parted_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/command.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jsonwrt.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/parted.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strlist.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/table.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ui.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/version.Po@am__quote@ # am--include-marker
+
+$(am__depfiles_remade):
+ @$(MKDIR_P) $(@D)
+ @echo '# dummy' >$@-t && $(am__mv) $@-t $@
+
+am--depfiles: $(am__depfiles_remade)
+
+.c.o:
+@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+ID: $(am__tagged_files)
+ $(am__define_uniq_tagged_files); mkid -fID $$unique
+tags: tags-am
+TAGS: tags
+
+tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+ set x; \
+ here=`pwd`; \
+ $(am__define_uniq_tagged_files); \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: ctags-am
+
+CTAGS: ctags
+ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+ $(am__define_uniq_tagged_files); \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+cscopelist: cscopelist-am
+
+cscopelist-am: $(am__tagged_files)
+ list='$(am__tagged_files)'; \
+ case "$(srcdir)" in \
+ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+ *) sdir=$(subdir)/$(srcdir) ;; \
+ esac; \
+ for i in $$list; do \
+ if test -f "$$i"; then \
+ echo "$(subdir)/$$i"; \
+ else \
+ echo "$$sdir/$$i"; \
+ fi; \
+ done >> $(top_builddir)/cscope.files
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+distdir: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) distdir-am
+
+distdir-am: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) check-am
+all-am: Makefile $(PROGRAMS) $(LIBRARIES)
+installdirs:
+ for dir in "$(DESTDIR)$(sbindir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) install-am
+install-exec: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+ -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+ -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
+ -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-noinstLIBRARIES \
+ clean-sbinPROGRAMS mostlyclean-am
+
+distclean: distclean-am
+ -rm -f ./$(DEPDIR)/command.Po
+ -rm -f ./$(DEPDIR)/jsonwrt.Po
+ -rm -f ./$(DEPDIR)/parted.Po
+ -rm -f ./$(DEPDIR)/strlist.Po
+ -rm -f ./$(DEPDIR)/table.Po
+ -rm -f ./$(DEPDIR)/ui.Po
+ -rm -f ./$(DEPDIR)/version.Po
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am: install-sbinPROGRAMS
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f ./$(DEPDIR)/command.Po
+ -rm -f ./$(DEPDIR)/jsonwrt.Po
+ -rm -f ./$(DEPDIR)/parted.Po
+ -rm -f ./$(DEPDIR)/strlist.Po
+ -rm -f ./$(DEPDIR)/table.Po
+ -rm -f ./$(DEPDIR)/ui.Po
+ -rm -f ./$(DEPDIR)/version.Po
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-sbinPROGRAMS
+
+.MAKE: all check install install-am install-exec install-strip
+
+.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \
+ clean-generic clean-libtool clean-noinstLIBRARIES \
+ clean-sbinPROGRAMS cscopelist-am ctags ctags-am distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-sbinPROGRAMS install-strip installcheck \
+ installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags tags-am uninstall uninstall-am uninstall-sbinPROGRAMS
+
+.PRECIOUS: Makefile
+
+version.c: Makefile
+ $(AM_V_GEN)rm -f $@
+ $(AM_V_at)printf '#include <config.h>\n' > $@t
+ $(AM_V_at)printf 'char const *Version = "$(PACKAGE_VERSION)";\n' >> $@t
+ $(AM_V_at)chmod a-w $@t
+ $(AM_V_at)mv $@t $@
+version.h: Makefile
+ $(AM_V_GEN)rm -f $@
+ $(AM_V_at)printf 'extern char const *Version;\n' > $@t
+ $(AM_V_at)chmod a-w $@t
+ $(AM_V_at)mv $@t $@
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/parted/command.c b/parted/command.c
new file mode 100644
index 0000000..41031ee
--- /dev/null
+++ b/parted/command.c
@@ -0,0 +1,143 @@
+/*
+ parted - a frontend to libparted
+ Copyright (C) 1999-2000, 2007, 2009-2014, 2019-2023 Free Software
+ Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include <config.h>
+#include "command.h"
+#include "ui.h"
+
+#include <parted/debug.h>
+
+#include <stdlib.h>
+#include <string.h>
+#include "xalloc.h"
+
+Command*
+command_create (const StrList* names,
+ int (*method) (PedDevice** dev, PedDisk** diskp),
+ const StrList* summary,
+ const StrList* help,
+ const int non_interactive)
+{
+ Command* cmd;
+
+ cmd = xmalloc (sizeof (Command));
+
+ if (non_interactive)
+ cmd->non_interactive = 1;
+ else
+ cmd->non_interactive = 0;
+
+ cmd->names = (StrList*) names;
+ cmd->method = method;
+ cmd->summary = (StrList*) summary;
+ cmd->help = (StrList*) help;
+
+ return cmd;
+}
+
+void
+command_destroy (Command* cmd)
+{
+ str_list_destroy (cmd->names);
+ str_list_destroy (cmd->summary);
+ str_list_destroy (cmd->help);
+ free (cmd);
+}
+
+void
+command_register (Command** list, Command* cmd)
+{
+ int i;
+
+ for (i = 0; list [i]; i++);
+
+ list [i] = cmd;
+ list [i + 1] = (Command*) NULL;
+}
+
+Command*
+command_get (Command** list, char* name)
+{
+ int i;
+ int partial_match = -1;
+ int ambiguous = 0;
+
+ if (!name)
+ return NULL;
+
+ for (i=0; list [i]; i++) {
+ switch (str_list_match_any (list [i]->names, name)) {
+ case 2:
+ return list [i];
+
+ case 1:
+ if (!ambiguous) {
+ if (partial_match == -1) {
+ partial_match = i;
+ } else {
+ partial_match = -1;
+ ambiguous = 1;
+ }
+ }
+ }
+ }
+
+ if (partial_match == -1)
+ return NULL;
+ else
+ return list [partial_match];
+}
+
+StrList*
+command_get_names (Command** list)
+{
+ Command** walk;
+ StrList* result = NULL;
+
+ for (walk = list; *walk; walk++)
+ result = str_list_join (result,
+ str_list_duplicate ((*walk)->names));
+ return result;
+}
+
+void
+command_print_summary (Command* cmd)
+{
+ if (cmd->summary == NULL)
+ return;
+ fputs (" ", stdout);
+ str_list_print_wrap (cmd->summary, screen_width(), 2, 8, stdout);
+ putchar ('\n');
+}
+
+void
+command_print_help (Command* cmd)
+{
+ command_print_summary (cmd);
+ if (cmd->help) {
+ fputs ("\n\t", stdout);
+ str_list_print_wrap (cmd->help, screen_width(), 8, 8, stdout);
+ }
+}
+
+int
+command_run (Command* cmd, PedDevice** dev, PedDisk** diskp)
+{
+ return cmd->method (dev, diskp);
+}
diff --git a/parted/command.h b/parted/command.h
new file mode 100644
index 0000000..c307dca
--- /dev/null
+++ b/parted/command.h
@@ -0,0 +1,48 @@
+/*
+ parted - a frontend to libparted
+ Copyright (C) 1999-2000, 2007, 2009-2014, 2019-2023 Free Software
+ Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef COMMAND_H_INCLUDED
+#define COMMAND_H_INCLUDED
+
+#include <parted/parted.h>
+#include "strlist.h"
+
+typedef struct {
+ StrList* names;
+ int (*method) (PedDevice** dev, PedDisk** diskp);
+ StrList* summary;
+ StrList* help;
+ int non_interactive:1;
+} Command;
+
+extern Command* command_create (const StrList* names,
+ int (*method) (PedDevice** dev, PedDisk** diskp),
+ const StrList* summary,
+ const StrList* help,
+ int non_interactive);
+extern void command_destroy (Command* cmd);
+void command_register (Command** list, Command* cmd);
+
+extern Command* command_get (Command** list, char* name);
+extern StrList* command_get_names (Command** list);
+extern void command_print_summary (Command* cmd);
+extern void command_print_help (Command* cmd);
+extern int command_run (Command* cmd, PedDevice** dev, PedDisk** diskp);
+
+#endif /* COMMAND_H_INCLUDED */
diff --git a/parted/jsonwrt.c b/parted/jsonwrt.c
new file mode 100644
index 0000000..d562133
--- /dev/null
+++ b/parted/jsonwrt.c
@@ -0,0 +1,225 @@
+/*
+ * JSON output formatting functions.
+ *
+ * No copyright is claimed. This code is in the public domain; do with
+ * it what you wish.
+ *
+ * Written by Karel Zak <kzak@redhat.com>
+ */
+
+#include <config.h>
+#include <stdio.h>
+#include <inttypes.h>
+#include <ctype.h>
+#include <c-ctype.h>
+#include <assert.h>
+#include "jsonwrt.h"
+
+/*
+ * Requirements enumerated via testing (V8, Firefox, IE11):
+ *
+ * var charsToEscape = [];
+ * for (var i = 0; i < 65535; i += 1) {
+ * try {
+ * JSON.parse('{"sample": "' + String.fromCodePoint(i) + '"}');
+ * } catch (e) {
+ * charsToEscape.push(i);
+ * }
+ * }
+ */
+static void fputs_quoted_case_json(const char *data, FILE *out, int dir)
+{
+ const char *p;
+
+ fputc('"', out);
+ for (p = data; p && *p; p++) {
+
+ const unsigned int c = (unsigned int) *p;
+
+ /* From http://www.json.org
+ *
+ * The double-quote and backslashes would break out a string or
+ * init an escape sequence if not escaped.
+ *
+ * Note that single-quotes and forward slashes, while they're
+ * in the JSON spec, don't break double-quoted strings.
+ */
+ if (c == '"' || c == '\\') {
+ fputc('\\', out);
+ fputc(c, out);
+ continue;
+ }
+
+ /* All non-control characters OK; do the case swap as required. */
+ if (c >= 0x20) {
+ /*
+ * Don't use locale sensitive ctype.h functions for regular
+ * ASCII chars, because for example with Turkish locale
+ * (aka LANG=tr_TR.UTF-8) toupper('I') returns 'I'.
+ */
+ if (c <= 127)
+ fputc(dir == 1 ? c_toupper(c) :
+ dir == -1 ? c_tolower(c) : *p, out);
+ else
+ fputc(dir == 1 ? toupper(c) :
+ dir == -1 ? tolower(c) : *p, out);
+ continue;
+ }
+
+ /* In addition, all chars under ' ' break Node's/V8/Chrome's, and
+ * Firefox's JSON.parse function
+ */
+ switch (c) {
+ /* Handle short-hand cases to reduce output size. C
+ * has most of the same stuff here, so if there's an
+ * "Escape for C" function somewhere in the STL, we
+ * should probably be using it.
+ */
+ case '\b':
+ fputs("\\b", out);
+ break;
+ case '\t':
+ fputs("\\t", out);
+ break;
+ case '\n':
+ fputs("\\n", out);
+ break;
+ case '\f':
+ fputs("\\f", out);
+ break;
+ case '\r':
+ fputs("\\r", out);
+ break;
+ default:
+ /* Other assorted control characters */
+ fprintf(out, "\\u00%02x", c);
+ break;
+ }
+ }
+ fputc('"', out);
+}
+
+#define fputs_quoted_json(_d, _o) fputs_quoted_case_json(_d, _o, 0)
+#define fputs_quoted_json_upper(_d, _o) fputs_quoted_case_json(_d, _o, 1)
+#define fputs_quoted_json_lower(_d, _o) fputs_quoted_case_json(_d, _o, -1)
+
+void ul_jsonwrt_init(struct ul_jsonwrt *fmt, FILE *out, int indent)
+{
+ fmt->out = out;
+ fmt->indent = indent;
+ fmt->after_close = 0;
+}
+
+void ul_jsonwrt_indent(struct ul_jsonwrt *fmt)
+{
+ int i;
+
+ for (i = 0; i < fmt->indent; i++)
+ fputs(" ", fmt->out);
+}
+
+void ul_jsonwrt_open(struct ul_jsonwrt *fmt, const char *name, int type)
+{
+ if (name) {
+ if (fmt->after_close)
+ fputs(",\n", fmt->out);
+ ul_jsonwrt_indent(fmt);
+ fputs_quoted_json_lower(name, fmt->out);
+ } else {
+ if (fmt->after_close)
+ fputs(",", fmt->out);
+ else
+ ul_jsonwrt_indent(fmt);
+ }
+
+ switch (type) {
+ case UL_JSON_OBJECT:
+ fputs(name ? ": {\n" : "{\n", fmt->out);
+ fmt->indent++;
+ break;
+ case UL_JSON_ARRAY:
+ fputs(name ? ": [\n" : "[\n", fmt->out);
+ fmt->indent++;
+ break;
+ case UL_JSON_VALUE:
+ fputs(name ? ": " : " ", fmt->out);
+ break;
+ }
+ fmt->after_close = 0;
+}
+
+void ul_jsonwrt_close(struct ul_jsonwrt *fmt, int type)
+{
+ if (fmt->indent == 1) {
+ fputs("\n}\n", fmt->out);
+ fmt->indent--;
+ fmt->after_close = 1;
+ return;
+ }
+ assert(fmt->indent > 0);
+
+ switch (type) {
+ case UL_JSON_OBJECT:
+ fmt->indent--;
+ fputc('\n', fmt->out);
+ ul_jsonwrt_indent(fmt);
+ fputs("}", fmt->out);
+ break;
+ case UL_JSON_ARRAY:
+ fmt->indent--;
+ fputc('\n', fmt->out);
+ ul_jsonwrt_indent(fmt);
+ fputs("]", fmt->out);
+ break;
+ case UL_JSON_VALUE:
+ break;
+ }
+
+ fmt->after_close = 1;
+}
+
+void ul_jsonwrt_value_raw(struct ul_jsonwrt *fmt,
+ const char *name, const char *data)
+{
+ ul_jsonwrt_value_open(fmt, name);
+ if (data && *data)
+ fputs(data, fmt->out);
+ else
+ fputs("null", fmt->out);
+ ul_jsonwrt_value_close(fmt);
+}
+
+void ul_jsonwrt_value_s(struct ul_jsonwrt *fmt,
+ const char *name, const char *data)
+{
+ ul_jsonwrt_value_open(fmt, name);
+ if (data)
+ fputs_quoted_json(data, fmt->out);
+ else
+ fputs("null", fmt->out);
+ ul_jsonwrt_value_close(fmt);
+}
+
+void ul_jsonwrt_value_u64(struct ul_jsonwrt *fmt,
+ const char *name, uint64_t data)
+{
+ ul_jsonwrt_value_open(fmt, name);
+ fprintf(fmt->out, "%"PRIu64, data);
+ ul_jsonwrt_value_close(fmt);
+}
+
+void ul_jsonwrt_value_boolean(struct ul_jsonwrt *fmt,
+ const char *name, int data)
+{
+ ul_jsonwrt_value_open(fmt, name);
+ fputs(data ? "true" : "false", fmt->out);
+ ul_jsonwrt_value_close(fmt);
+}
+
+void ul_jsonwrt_value_null(struct ul_jsonwrt *fmt,
+ const char *name)
+{
+ ul_jsonwrt_value_open(fmt, name);
+ fputs("null", fmt->out);
+ ul_jsonwrt_value_close(fmt);
+}
diff --git a/parted/jsonwrt.h b/parted/jsonwrt.h
new file mode 100644
index 0000000..4587b60
--- /dev/null
+++ b/parted/jsonwrt.h
@@ -0,0 +1,46 @@
+#ifndef UTIL_LINUX_JSONWRT_H
+#define UTIL_LINUX_JSONWRT_H
+
+enum {
+ UL_JSON_OBJECT,
+ UL_JSON_ARRAY,
+ UL_JSON_VALUE
+};
+
+struct ul_jsonwrt {
+ FILE *out;
+ int indent;
+
+ unsigned int after_close :1;
+};
+
+void ul_jsonwrt_init(struct ul_jsonwrt *fmt, FILE *out, int indent);
+void ul_jsonwrt_indent(struct ul_jsonwrt *fmt);
+void ul_jsonwrt_open(struct ul_jsonwrt *fmt, const char *name, int type);
+void ul_jsonwrt_close(struct ul_jsonwrt *fmt, int type);
+
+#define ul_jsonwrt_root_open(_f) ul_jsonwrt_open(_f, NULL, UL_JSON_OBJECT)
+#define ul_jsonwrt_root_close(_f) ul_jsonwrt_close(_f, UL_JSON_OBJECT)
+
+#define ul_jsonwrt_array_open(_f, _n) ul_jsonwrt_open(_f, _n, UL_JSON_ARRAY)
+#define ul_jsonwrt_array_close(_f) ul_jsonwrt_close(_f, UL_JSON_ARRAY)
+
+#define ul_jsonwrt_object_open(_f, _n) ul_jsonwrt_open(_f, _n, UL_JSON_OBJECT)
+#define ul_jsonwrt_object_close(_f) ul_jsonwrt_close(_f, UL_JSON_OBJECT)
+
+#define ul_jsonwrt_value_open(_f, _n) ul_jsonwrt_open(_f, _n, UL_JSON_VALUE)
+#define ul_jsonwrt_value_close(_f) ul_jsonwrt_close(_f, UL_JSON_VALUE)
+
+
+void ul_jsonwrt_value_raw(struct ul_jsonwrt *fmt,
+ const char *name, const char *data);
+void ul_jsonwrt_value_s(struct ul_jsonwrt *fmt,
+ const char *name, const char *data);
+void ul_jsonwrt_value_u64(struct ul_jsonwrt *fmt,
+ const char *name, uint64_t data);
+void ul_jsonwrt_value_boolean(struct ul_jsonwrt *fmt,
+ const char *name, int data);
+void ul_jsonwrt_value_null(struct ul_jsonwrt *fmt,
+ const char *name);
+
+#endif /* UTIL_LINUX_JSONWRT_H */
diff --git a/parted/parted.c b/parted/parted.c
new file mode 100644
index 0000000..3abb52f
--- /dev/null
+++ b/parted/parted.c
@@ -0,0 +1,2699 @@
+/*
+ parted - a frontend to libparted
+ Copyright (C) 1999-2003, 2005-2014, 2019-2023 Free Software Foundation,
+ Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include <config.h>
+#include <stdbool.h>
+#include <uuid/uuid.h>
+
+#include "argmatch.h"
+#include "closeout.h"
+#include "configmake.h"
+#include "version-etc.h"
+#include "command.h"
+#include "ui.h"
+#include "progname.h"
+#include "table.h"
+#include "version.h"
+
+#define AUTHORS \
+ "<http://git.debian.org/?p=parted/parted.git;a=blob_plain;f=AUTHORS>"
+
+/* The official name of this program (e.g., no `g' prefix). */
+#define PROGRAM_NAME "parted"
+
+#define N_(String) String
+#if ENABLE_NLS
+# include <libintl.h>
+# include <locale.h>
+# define _(String) dgettext (PACKAGE, String)
+#else
+# define _(String) (String)
+#endif /* ENABLE_NLS */
+
+#include <parted/parted.h>
+#include <parted/debug.h>
+
+#include <ctype.h>
+#include <stdarg.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <limits.h>
+#include "c-ctype.h"
+#include "c-strcase.h"
+#include "xalloc.h"
+#include "jsonwrt.h"
+
+#ifdef ENABLE_MTRACE
+#include <mcheck.h>
+#endif
+
+#include <getopt.h>
+
+/* minimum amount of free space to leave, or maximum amount to gobble up */
+#define MIN_FREESPACE (1000 * 2) /* 1000k */
+
+static int MEGABYTE_SECTORS (PedDevice* dev)
+{
+ return PED_MEGABYTE_SIZE / dev->sector_size;
+}
+
+/* For long options that have no equivalent short option, use a
+ non-character as a pseudo short option, starting with CHAR_MAX + 1. */
+enum
+{
+ PRETEND_INPUT_TTY = CHAR_MAX + 1,
+};
+
+/* Output modes */
+enum
+{
+ HUMAN,
+ MACHINE,
+ JSON
+};
+
+enum
+{
+ ALIGNMENT_NONE = 2,
+ ALIGNMENT_CYLINDER,
+ ALIGNMENT_MINIMAL,
+ ALIGNMENT_OPTIMAL
+};
+
+static char const *const align_args[] =
+{
+ "none",
+ "cylinder",
+ "minimal",
+ "optimal",
+ NULL
+};
+
+static int const align_types[] =
+{
+ ALIGNMENT_NONE,
+ ALIGNMENT_CYLINDER,
+ ALIGNMENT_MINIMAL,
+ ALIGNMENT_OPTIMAL
+};
+ARGMATCH_VERIFY (align_args, align_types);
+
+typedef struct {
+ time_t last_update;
+ time_t predicted_time_left;
+} TimerContext;
+
+static struct option const options[] = {
+ /* name, has-arg, string-return-val, char-return-val */
+ {"help", 0, NULL, 'h'},
+ {"list", 0, NULL, 'l'},
+ {"machine", 0, NULL, 'm'},
+ {"json", 0, NULL, 'j'},
+ {"script", 0, NULL, 's'},
+ {"fix", 0, NULL, 'f'},
+ {"version", 0, NULL, 'v'},
+ {"align", required_argument, NULL, 'a'},
+ {"-pretend-input-tty", 0, NULL, PRETEND_INPUT_TTY},
+ {NULL, 0, NULL, 0}
+};
+
+static const char *const options_help [][2] = {
+ {"help", N_("displays this help message")},
+ {"list", N_("lists partition layout on all block devices")},
+ {"machine", N_("displays machine parseable output")},
+ {"json", N_("displays JSON output")},
+ {"script", N_("never prompts for user intervention")},
+ {"fix", N_("in script mode, fix instead of abort when asked")},
+ {"version", N_("displays the version")},
+ {"align=[none|cyl|min|opt]", N_("alignment for new partitions")},
+ {NULL, NULL}
+};
+
+int opt_script_mode = 0;
+int opt_fix_mode = 0;
+int pretend_input_tty = 0;
+int opt_output_mode = HUMAN;
+int disk_is_modified = 0;
+int is_toggle_mode = 0;
+int alignment = ALIGNMENT_OPTIMAL;
+
+static const char* number_msg = N_(
+"NUMBER is the partition number used by Linux. On MS-DOS disk labels, the "
+"primary partitions number from 1 to 4, logical partitions from 5 onwards.\n");
+
+static const char* label_type_msg_start = N_("LABEL-TYPE is one of: ");
+static const char* flag_msg_start = N_("FLAG is one of: ");
+static const char* disk_flag_msg_start = N_("FLAG is one of: ");
+static const char* unit_msg_start = N_("UNIT is one of: ");
+static const char* min_or_opt_msg = N_("desired alignment: minimum or optimal");
+static const char* part_type_msg = N_("PART-TYPE is one of: primary, logical, "
+ "extended\n");
+static const char* fs_type_msg_start = N_("FS-TYPE is one of: ");
+static const char* start_end_msg = N_("START and END are disk locations, such as "
+ "4GB or 10%. Negative values count from the end of the disk. "
+ "For example, -1s specifies exactly the last sector.\n");
+static const char* end_msg = N_("END is disk location, such as "
+ "4GB or 10%. Negative value counts from the end of the disk. "
+ "For example, -1s specifies exactly the last sector.\n");
+static const char* state_msg = N_("STATE is one of: on, off\n");
+static const char* device_msg = N_("DEVICE is usually /dev/hda or /dev/sda\n");
+static const char* name_msg = N_("NAME is any word you want\n");
+static const char* type_msg = N_("TYPE_ID is a value between 0x01 and 0xff, "
+ "TYPE_UUID is a UUID\n");
+
+static const char* copyright_msg = N_(
+"Copyright (C) 1998 - 2006 Free Software Foundation, Inc.\n"
+"This program is free software, covered by the GNU General Public License.\n"
+"\n"
+"This program is distributed in the hope that it will be useful,\n"
+"but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
+"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"
+"GNU General Public License for more details.\n\n");
+
+static char* label_type_msg;
+static char* flag_msg;
+static char* disk_flag_msg;
+static char* unit_msg;
+
+static char* mkpart_fs_type_msg;
+
+static Command* commands [256] = {NULL};
+static PedTimer* g_timer;
+static TimerContext timer_context;
+
+static struct ul_jsonwrt json;
+
+static int _print_list ();
+static void _done (PedDevice* dev, PedDisk *diskp);
+static bool partition_align_check (PedDisk const *disk,
+ PedPartition const *part, enum AlignmentType a_type,
+ char **align_err);
+
+static void
+_timer_handler (PedTimer* timer, void* context)
+{
+ TimerContext* tcontext = (TimerContext*) context;
+ int draw_this_time;
+
+ if (opt_script_mode || !isatty(fileno(stdout)))
+ return;
+
+ if (tcontext->last_update != timer->now && timer->now > timer->start) {
+ tcontext->predicted_time_left
+ = timer->predicted_end - timer->now;
+ tcontext->last_update = timer->now;
+ draw_this_time = 1;
+ } else {
+ draw_this_time = 0;
+ }
+
+ if (draw_this_time) {
+ wipe_line ();
+
+ if (timer->state_name)
+ printf ("%s... ", timer->state_name);
+ printf (_("%0.f%%\t(time left %.2d:%.2d)"),
+ (double) (100.0f * timer->frac),
+ (int) (tcontext->predicted_time_left / 60),
+ (int) (tcontext->predicted_time_left % 60));
+
+ fflush (stdout);
+ }
+}
+
+static int
+_partition_warn_busy (PedPartition* part)
+{
+ char* path;
+
+ if (ped_partition_is_busy (part)) {
+ path = ped_partition_get_path (part);
+ if (ped_exception_throw (
+ PED_EXCEPTION_WARNING,
+ PED_EXCEPTION_YES_NO,
+ _("Partition %s is being used. Are you sure you " \
+ "want to continue?"),
+ path) != PED_EXCEPTION_YES)
+ {
+ free (path);
+ return 0;
+ }
+ free (path);
+ }
+ return 1;
+}
+
+static int
+_disk_warn_busy (PedDisk* disk)
+{
+ if (ped_device_is_busy (disk->dev))
+ return ped_exception_throw (
+ (opt_script_mode
+ ? PED_EXCEPTION_ERROR
+ : PED_EXCEPTION_WARNING),
+ PED_EXCEPTION_IGNORE_CANCEL,
+ _("Partition(s) on %s are being used."),
+ disk->dev->path) == PED_EXCEPTION_IGNORE;
+
+ return 1;
+}
+
+static int
+_disk_warn_loss (PedDisk* disk)
+{
+ return ped_exception_throw (
+ PED_EXCEPTION_WARNING,
+ PED_EXCEPTION_YES_NO,
+ _("The existing disk label on %s will be destroyed "
+ "and all data on this disk will be lost. Do you "
+ "want to continue?"),
+ disk->dev->path) == PED_EXCEPTION_YES;
+}
+
+/* This function changes "sector" to "new_sector" if the new value lies
+ * within the required range.
+ */
+static int
+snap (PedSector* sector, PedSector new_sector, PedGeometry* range)
+{
+ PED_ASSERT (ped_geometry_test_sector_inside (range, *sector));
+ if (!ped_geometry_test_sector_inside (range, new_sector))
+ return 0;
+ *sector = new_sector;
+ return 1;
+}
+
+typedef enum {
+ MOVE_NO = 0,
+ MOVE_STILL = 1,
+ MOVE_UP = 2,
+ MOVE_DOWN = 4
+} EMoves;
+
+enum { /* Don't change these values */
+ SECT_START = 0,
+ SECT_END = -1
+};
+
+/* Find the preferred way to adjust the sector s inside range.
+ * If a move isn't allowed or is out of range it can't be selected.
+ * what contains SECT_START if the sector to adjust is a start sector
+ * or SECT_END if it's an end one.
+ * The preferred move is to the nearest allowed boundary of the part
+ * partition (if at equal distance: to start if SECT_START or to end
+ * if SECT_END).
+ * The distance is returned in dist.
+ */
+static EMoves
+prefer_snap (PedSector s, int what, PedGeometry* range, EMoves* allow,
+ PedPartition* part, PedSector* dist)
+{
+ PedSector up_dist = -1, down_dist = -1;
+ PedSector new_sect;
+ EMoves move;
+
+ PED_ASSERT (what == SECT_START || what == SECT_END);
+
+ if (!(*allow & (MOVE_UP | MOVE_DOWN))) {
+ *dist = 0;
+ return MOVE_STILL;
+ }
+
+ if (*allow & MOVE_UP) {
+ new_sect = part->geom.end + 1 + what;
+ if (ped_geometry_test_sector_inside (range, new_sect))
+ up_dist = new_sect - s;
+ else
+ *allow &= ~MOVE_UP;
+ }
+
+ if (*allow & MOVE_DOWN) {
+ new_sect = part->geom.start + what;
+ if (ped_geometry_test_sector_inside (range, new_sect))
+ down_dist = s - new_sect;
+ else
+ *allow &= ~MOVE_DOWN;
+ }
+
+ move = MOVE_STILL;
+ if ((*allow & MOVE_UP) && (*allow & MOVE_DOWN)) {
+ if (down_dist < up_dist || (down_dist == up_dist
+ && what == SECT_START) )
+ move = MOVE_DOWN;
+ else if (up_dist < down_dist || (down_dist == up_dist
+ && what == SECT_END) )
+ move = MOVE_UP;
+ else
+ PED_ASSERT (0);
+ } else if (*allow & MOVE_UP)
+ move = MOVE_UP;
+ else if (*allow & MOVE_DOWN)
+ move = MOVE_DOWN;
+
+ *dist = ( move == MOVE_DOWN ? down_dist :
+ ( move == MOVE_UP ? up_dist :
+ 0 ) );
+ return move;
+}
+
+/* Snaps a partition to nearby partition boundaries. This is useful for
+ * gobbling up small amounts of free space, and also for reinterpreting small
+ * changes to a partition as non-changes (eg: perhaps the user only wanted to
+ * resize the end of a partition).
+ * Note that this isn't the end of the story... this function is
+ * always called before the constraint solver kicks in. So you don't need to
+ * worry too much about inadvertantly creating overlapping partitions, etc.
+ */
+static void
+snap_to_boundaries (PedGeometry* new_geom, PedGeometry* old_geom,
+ PedDisk* disk,
+ PedGeometry* start_range, PedGeometry* end_range)
+{
+ PedPartition* start_part;
+ PedPartition* end_part;
+ PedSector start = new_geom->start;
+ PedSector end = new_geom->end;
+ PedSector start_dist = -1, end_dist = -1;
+ EMoves start_allow, end_allow, start_want, end_want;
+ int adjacent;
+
+ start_allow = end_allow = MOVE_STILL | MOVE_UP | MOVE_DOWN;
+
+ start_part = ped_disk_get_partition_by_sector (disk, start);
+ end_part = ped_disk_get_partition_by_sector (disk, end);
+ adjacent = (start_part->geom.end + 1 == end_part->geom.start);
+
+ /* If we can snap to old_geom, then we will... */
+ /* and this will enforce the snapped positions */
+ if (old_geom) {
+ if (snap (&start, old_geom->start, start_range))
+ start_allow = MOVE_STILL;
+ if (snap (&end, old_geom->end, end_range))
+ end_allow = MOVE_STILL;
+ }
+
+ /* If start and end are on the same partition, we */
+ /* don't allow them to cross. */
+ if (start_part == end_part) {
+ start_allow &= ~MOVE_UP;
+ end_allow &= ~MOVE_DOWN;
+ }
+
+ /* Let's find our way */
+ start_want = prefer_snap (start, SECT_START, start_range, &start_allow,
+ start_part, &start_dist );
+ end_want = prefer_snap (end, SECT_END, end_range, &end_allow,
+ end_part, &end_dist );
+
+ PED_ASSERT (start_dist >= 0 && end_dist >= 0);
+
+ /* If start and end are on adjacent partitions, */
+ /* and if they would prefer crossing, then refrain */
+ /* the farthest to do so. */
+ if (adjacent && start_want == MOVE_UP && end_want == MOVE_DOWN) {
+ if (end_dist < start_dist) {
+ start_allow &= ~MOVE_UP;
+ start_want = prefer_snap (start, SECT_START,
+ start_range, &start_allow,
+ start_part, &start_dist );
+ PED_ASSERT (start_dist >= 0);
+ } else {
+ end_allow &= ~MOVE_DOWN;
+ end_want = prefer_snap (end, SECT_END,
+ end_range, &end_allow,
+ end_part, &end_dist );
+ PED_ASSERT (end_dist >= 0);
+ }
+ }
+
+ /* New positions */
+ start = ( start_want == MOVE_DOWN ? start_part->geom.start :
+ ( start_want == MOVE_UP ? start_part->geom.end + 1 :
+ start ) );
+ end = ( end_want == MOVE_DOWN ? end_part->geom.start - 1 :
+ ( end_want == MOVE_UP ? end_part->geom.end :
+ end ) );
+ PED_ASSERT (ped_geometry_test_sector_inside(start_range,start));
+ PED_ASSERT (ped_geometry_test_sector_inside (end_range, end));
+ PED_ASSERT (start <= end);
+ ped_geometry_set (new_geom, start, end - start + 1);
+}
+
+static PedConstraint*
+constraint_from_start_end (PedDevice* dev, PedGeometry* range_start,
+ PedGeometry* range_end)
+{
+ return ped_constraint_new (ped_alignment_any, ped_alignment_any,
+ range_start, range_end, 1, dev->length);
+}
+
+
+static PedConstraint*
+constraint_from_start_end_fixed_start (PedDevice* dev, PedSector start_sector,
+ PedGeometry* range_end)
+{
+ PedGeometry range_start;
+ range_start.dev = dev;
+ range_start.start = start_sector;
+ range_start.end = start_sector;
+ range_start.length = 1;
+
+ return ped_constraint_new (ped_alignment_any, ped_alignment_any,
+ &range_start, range_end, 1, dev->length);
+}
+
+void
+help_on (char* topic)
+{
+ Command* cmd;
+
+ cmd = command_get (commands, topic);
+ if (!cmd) return;
+
+ command_print_help (cmd);
+}
+
+void
+print_commands_help ()
+{
+ int i;
+
+ for (i=0; commands [i]; i++)
+ command_print_summary (commands [i]);
+}
+
+void
+print_options_help ()
+{
+ int i;
+
+ for (i=0; options_help [i][0]; i++) {
+ printf (" -%c, --%-25.25s %s\n",
+ options_help [i][0][0],
+ options_help [i][0],
+ _(options_help [i][1]));
+ }
+}
+
+int
+do_help (PedDevice** dev, PedDisk** diskp)
+{
+ if (command_line_get_word_count ()) {
+ char* word = command_line_pop_word ();
+ if (word) {
+ help_on (word);
+ free (word);
+ }
+ } else {
+ print_commands_help();
+ }
+ return 1;
+}
+
+static int
+do_mklabel (PedDevice** dev, PedDisk** diskp)
+{
+ PedDisk* disk;
+ const PedDiskType* type = NULL;
+
+ if (*diskp)
+ disk = *diskp;
+ else {
+ ped_exception_fetch_all ();
+ disk = ped_disk_new (*dev);
+ if (!disk) ped_exception_catch ();
+ ped_exception_leave_all ();
+ }
+
+ if (!command_line_get_disk_type (_("New disk label type?"), &type))
+ goto error;
+
+ if (disk) {
+ if (!_disk_warn_busy (disk))
+ goto error;
+ if (!opt_script_mode && !_disk_warn_loss (disk))
+ goto error;
+ }
+
+ disk = ped_disk_new_fresh (*dev, type);
+ if (!disk)
+ goto error;
+
+ if (!ped_disk_commit (disk))
+ goto error_destroy_disk;
+
+ if ((*dev)->type != PED_DEVICE_FILE)
+ disk_is_modified = 1;
+ if (*diskp)
+ ped_disk_destroy (*diskp);
+ *diskp = disk;
+ return 1;
+
+error_destroy_disk:
+ ped_disk_destroy (disk);
+ *diskp = 0;
+error:
+ return 0;
+}
+
+/* Strip blanks from the end of string STR, in place. */
+void _strip_trailing_spaces(char *str)
+{
+ if (!str)
+ return;
+ size_t i = strlen(str);
+ while (i && c_isblank(str[--i]))
+ str[i]='\0';
+}
+
+/* Return true if the unit is one of the supported IEC unit values */
+static bool
+_is_unit_IEC(const PedUnit unit) {
+ return (unit == PED_UNIT_KIBIBYTE) || (unit == PED_UNIT_MEBIBYTE) ||
+ (unit == PED_UNIT_GIBIBYTE) || (unit == PED_UNIT_TEBIBYTE);
+}
+
+/* Return true, if str ends with IEC units. */
+static bool
+_string_ends_with_iec_unit(const char *str)
+{
+ /* 3 characters for the IEC unit and at least 1 digit */
+ if (!str || strlen(str) < 4)
+ return false;
+
+ char const *p = str + strlen(str) - 3;
+ PedUnit unit = ped_unit_get_by_name(p);
+ if (unit == -1) {
+ return false;
+ }
+ return _is_unit_IEC(unit);
+}
+
+/* Return true if str ends with explicit unit identifier.
+ * Do not parse the unit, just check if the unit is specified.
+ * This function expects trailing spaces to be already stripped.
+ */
+static bool
+_string_has_unit_suffix(const char *str)
+{
+ /* At least 1 digit and 1 character to meet the condition */
+ if (!str || strlen(str) < 2)
+ return false;
+
+ if (!isdigit(str[strlen(str) - 1]))
+ return true;
+
+ return false;
+}
+
+/* If the selected unit is one of KiB, MiB, GiB or TiB and the partition is not
+ * only 1 sector long, then adjust the end so that it is one sector before the
+ * given position. Also adjust range_end accordingly. Thus next partition can
+ * start immediately after this one.
+ *
+ * To be called after end sector is read from the user.
+ *
+ * https://lists.gnu.org/archive/html/bug-parted/2011-10/msg00009.html
+ */
+static void
+_adjust_end_if_iec (PedSector* start, PedSector* end,
+ PedGeometry* range_end, char* end_input)
+{
+ PED_ASSERT(start);
+ PED_ASSERT(end);
+ PED_ASSERT(range_end);
+
+ /* 1s partition - do not move the end */
+ if (*start == *end)
+ return;
+
+ _strip_trailing_spaces(end_input);
+ PedUnit unit = ped_unit_get_default();
+ if (_string_ends_with_iec_unit(end_input) ||
+ (!_string_has_unit_suffix(end_input) && _is_unit_IEC(unit))) {
+ *end -= 1;
+ range_end->start -= 1;
+ range_end->end -= 1;
+ }
+}
+
+static int
+do_mkpart (PedDevice** dev, PedDisk** diskp)
+{
+ PedDisk* disk;
+ PedPartition* part;
+ PedPartitionType part_type;
+ const PedFileSystemType* fs_type = ped_file_system_type_get ("ext2");
+ PedSector start = 0, end = 0;
+ PedGeometry *range_start = NULL, *range_end = NULL;
+ PedConstraint* user_constraint;
+ PedConstraint* dev_constraint;
+ PedConstraint* final_constraint;
+ char* peek_word;
+ char* part_name = NULL;
+ char *start_usr = NULL, *end_usr = NULL;
+ char *start_sol = NULL, *end_sol = NULL;
+ char *end_input = NULL;
+
+ if (*diskp)
+ disk = *diskp;
+ else {
+ disk = ped_disk_new (*dev);
+ *diskp = disk;
+ }
+ if (!disk)
+ goto error;
+
+ if (ped_disk_is_flag_available(disk, PED_DISK_CYLINDER_ALIGNMENT))
+ if (!ped_disk_set_flag(disk, PED_DISK_CYLINDER_ALIGNMENT,
+ alignment == ALIGNMENT_CYLINDER))
+ goto error;
+
+ if (!ped_disk_type_check_feature (disk->type, PED_DISK_TYPE_EXTENDED)) {
+ part_type = PED_PARTITION_NORMAL;
+ } else {
+ if (!command_line_get_part_type (_("Partition type?"),
+ disk, &part_type))
+ goto error;
+ }
+
+ /* The undocumented feature that mkpart sometimes takes a
+ partition name is next to useless, at least with a dvh
+ partition table, since it makes the "mkpart" command
+ fail unconditionally for a primary partition. E.g.,
+ mkpart primary any-name xfs 4096s 5000s
+ requires the name, yet always fails, saying that only
+ logical partitions may have names.
+ If you want a name, use parted's separate "name" command. */
+
+ if (ped_disk_type_check_feature (disk->type,
+ PED_DISK_TYPE_PARTITION_NAME)
+ && ! (strcmp (disk->type->name, "dvh") == 0
+ && part_type != PED_PARTITION_LOGICAL))
+ part_name = command_line_get_word (_("Partition name?"),
+ "", NULL, 1);
+
+ peek_word = command_line_peek_word ();
+ if (part_type == PED_PARTITION_EXTENDED
+ || (peek_word && (isdigit (peek_word[0]) || peek_word[0] == '-'))) {
+ fs_type = NULL;
+ free (peek_word);
+ } else {
+ free (peek_word);
+ if (!command_line_get_fs_type (_("File system type?"),
+ &fs_type))
+ goto error;
+ }
+
+ if (!command_line_get_sector (_("Start?"), *dev, &start, &range_start, NULL))
+ goto error;
+ if (!command_line_get_sector (_("End?"), *dev, &end, &range_end, &end_input))
+ goto error;
+
+ _adjust_end_if_iec(&start, &end, range_end, end_input);
+
+ /* processing starts here */
+ part = ped_partition_new (disk, part_type, fs_type, start, end);
+ if (!part)
+ goto error;
+
+ snap_to_boundaries (&part->geom, NULL, disk, range_start, range_end);
+
+ /* create constraints */
+ user_constraint = constraint_from_start_end (*dev, range_start,
+ range_end);
+ PED_ASSERT (user_constraint != NULL);
+
+ if (alignment == ALIGNMENT_OPTIMAL)
+ dev_constraint =
+ ped_device_get_optimal_aligned_constraint(*dev);
+ else if (alignment == ALIGNMENT_MINIMAL)
+ dev_constraint =
+ ped_device_get_minimal_aligned_constraint(*dev);
+ else
+ dev_constraint = ped_device_get_constraint(*dev);
+ PED_ASSERT (dev_constraint != NULL);
+
+ final_constraint = ped_constraint_intersect (user_constraint,
+ dev_constraint);
+ ped_constraint_destroy (user_constraint);
+ ped_constraint_destroy (dev_constraint);
+ if (!final_constraint)
+ goto error_destroy_simple_constraints;
+
+ /* subject to partition constraint */
+ ped_exception_fetch_all();
+ bool added_ok = ped_disk_add_partition (disk, part, final_constraint);
+ ped_constraint_destroy (final_constraint);
+ if (!added_ok) {
+ ped_exception_leave_all();
+
+ PedConstraint *constraint_any = ped_constraint_any (*dev);
+ added_ok = ped_disk_add_partition (disk, part,
+ constraint_any);
+ ped_constraint_destroy (constraint_any);
+
+ if (!added_ok)
+ goto error_destroy_simple_constraints;
+
+ if (!ped_geometry_test_sector_inside(range_start, part->geom.start) ||
+ !ped_geometry_test_sector_inside(range_end, part->geom.end)) {
+ start_usr = ped_unit_format (*dev, start);
+ end_usr = ped_unit_format (*dev, end);
+ start_sol = ped_unit_format (*dev, part->geom.start);
+ end_sol = ped_unit_format (*dev, part->geom.end);
+
+ /* In script mode failure to use specified values is fatal.
+ * However, in interactive mode, it merely elicits a warning
+ * and a prompt for whether to proceed.
+ */
+ switch (ped_exception_throw (
+ (opt_script_mode
+ ? PED_EXCEPTION_ERROR
+ : PED_EXCEPTION_WARNING),
+ (opt_script_mode
+ ? PED_EXCEPTION_CANCEL
+ : PED_EXCEPTION_YES_NO),
+ _("You requested a partition from %s to %s "
+ "(sectors %llu..%llu).\n"
+ "The closest location we can manage is "
+ "%s to %s (sectors %llu..%llu).%s"),
+ start_usr, end_usr,
+ start, end,
+ start_sol, end_sol,
+ part->geom.start, part->geom.end,
+ (opt_script_mode ? ""
+ : _("\nIs this still acceptable to you?"))))
+ {
+ case PED_EXCEPTION_YES:
+ /* all is well in this state */
+ break;
+ case PED_EXCEPTION_NO:
+ case PED_EXCEPTION_UNHANDLED:
+ default:
+ /* undo partition addition */
+ goto error_remove_part;
+ }
+ }
+
+ char *align_err = NULL;
+ if ((alignment == ALIGNMENT_OPTIMAL &&
+ !partition_align_check(disk, part, PA_OPTIMUM, &align_err)) ||
+ (alignment == ALIGNMENT_MINIMAL &&
+ !partition_align_check(disk, part, PA_MINIMUM, &align_err))) {
+ if (ped_exception_throw(
+ PED_EXCEPTION_WARNING,
+ (opt_script_mode
+ ? PED_EXCEPTION_OK
+ : PED_EXCEPTION_IGNORE_CANCEL),
+ _("The resulting partition is not properly "
+ "aligned for best performance: %s"),
+ align_err ? align_err : _("unknown (malloc failed)")) ==
+ PED_EXCEPTION_CANCEL) {
+ free(align_err);
+ /* undo partition addition */
+ goto error_remove_part;
+ }
+ free(align_err);
+ }
+ } else {
+ ped_exception_leave_all();
+ }
+ ped_exception_catch();
+
+ /* set minor attributes */
+ if (part_name)
+ if (!ped_partition_set_name (part, part_name))
+ goto error_remove_part;
+ free (part_name); /* avoid double-free upon failure */
+ part_name = NULL;
+
+ if (!ped_partition_set_system (part, fs_type))
+ goto error_remove_part;
+ if (ped_partition_is_flag_available (part, PED_PARTITION_LBA))
+ ped_partition_set_flag (part, PED_PARTITION_LBA, 1);
+
+ if (!ped_disk_commit (disk))
+ goto error_remove_part;
+
+ /* clean up */
+ if (range_start != NULL)
+ ped_geometry_destroy (range_start);
+ if (range_end != NULL)
+ ped_geometry_destroy (range_end);
+
+ free (start_usr);
+ free (end_usr);
+ free (start_sol);
+ free (end_sol);
+ free(end_input);
+
+ if ((*dev)->type != PED_DEVICE_FILE)
+ disk_is_modified = 1;
+
+ return 1;
+
+error_remove_part:
+ ped_disk_remove_partition (disk, part);
+error_destroy_simple_constraints:
+ ped_partition_destroy (part);
+error:
+ free (part_name);
+ if (range_start != NULL)
+ ped_geometry_destroy (range_start);
+ if (range_end != NULL)
+ ped_geometry_destroy (range_end);
+
+ free (start_usr);
+ free (end_usr);
+ free (start_sol);
+ free (end_sol);
+ free(end_input);
+
+ return 0;
+}
+
+static int
+do_name (PedDevice** dev, PedDisk** diskp)
+{
+ PedPartition* part = NULL;
+ char* name;
+
+ if (!*diskp)
+ *diskp = ped_disk_new (*dev);
+ if (!*diskp)
+ goto error;
+
+ if (!ped_disk_type_check_feature((*diskp)->type, PED_DISK_TYPE_PARTITION_NAME)) {
+ ped_exception_throw (PED_EXCEPTION_ERROR, PED_EXCEPTION_CANCEL,
+ _("%s disk labels do not support partition name."),
+ (*diskp)->type->name);
+ goto error;
+ }
+
+ if (!command_line_get_partition (_("Partition number?"), *diskp, &part))
+ goto error;
+
+ name = command_line_get_word (_("Partition name?"),
+ ped_partition_get_name (part), NULL, 0);
+ if (!name)
+ goto error;
+ if (!ped_partition_set_name (part, name))
+ goto error_free_name;
+ free (name);
+
+ if (!ped_disk_commit (*diskp))
+ goto error;
+ return 1;
+
+error_free_name:
+ free (name);
+error:
+ return 0;
+}
+
+static int
+do_type (PedDevice** dev, PedDisk** diskp)
+{
+ if (!*diskp)
+ *diskp = ped_disk_new (*dev);
+ if (!*diskp)
+ goto error;
+
+ bool has_type_id = ped_disk_type_check_feature ((*diskp)->type,
+ PED_DISK_TYPE_PARTITION_TYPE_ID);
+ bool has_type_uuid = ped_disk_type_check_feature ((*diskp)->type,
+ PED_DISK_TYPE_PARTITION_TYPE_UUID);
+
+ PED_ASSERT (!(has_type_id && has_type_uuid));
+
+ if (!has_type_id && !has_type_uuid) {
+ ped_exception_throw (PED_EXCEPTION_ERROR, PED_EXCEPTION_CANCEL,
+ _("%s disk labels do not support partition type."),
+ (*diskp)->type->name);
+ goto error;
+ }
+
+ PedPartition* part = NULL;
+ if (!command_line_get_partition (_("Partition number?"), *diskp, &part))
+ goto error;
+
+ char* input = NULL;
+
+ if (has_type_id) {
+ uint8_t type_id = ped_partition_get_type_id (part);
+ static char buf[8];
+ snprintf(buf, 8, "0x%02x", type_id);
+
+ input = command_line_get_word (_("Partition type-id?"), buf, NULL, 0);
+ if (!input)
+ goto error;
+
+ unsigned int tmp = strtol (input, (char**) NULL, 16);
+ if (tmp < 0x01 || tmp > 0xff) {
+ ped_exception_throw (PED_EXCEPTION_ERROR, PED_EXCEPTION_CANCEL,
+ _("Invalid type-id."));
+ goto error_free_input;
+ }
+
+ if (!ped_partition_set_type_id (part, tmp))
+ goto error_free_input;
+ }
+
+ if (has_type_uuid) {
+ uint8_t* type_uuid = ped_partition_get_type_uuid (part);
+ static char buf[UUID_STR_LEN];
+ uuid_unparse_lower (type_uuid, buf);
+ free (type_uuid);
+
+ input = command_line_get_word (_("Partition type-uuid?"), buf, NULL, 0);
+ if (!input)
+ goto error;
+
+ uuid_t tmp;
+ if (uuid_parse (input, tmp) != 0 || uuid_is_null (tmp)) {
+ ped_exception_throw (PED_EXCEPTION_ERROR, PED_EXCEPTION_CANCEL,
+ _("Invalid type-uuid."));
+ goto error_free_input;
+ }
+
+ if (!ped_partition_set_type_uuid (part, tmp))
+ goto error_free_input;
+ }
+
+ free (input);
+
+ // Reset the fs_type based on the filesystem, if it exists
+ part->fs_type = ped_file_system_probe (&part->geom);
+
+ if (!ped_disk_commit (*diskp))
+ goto error;
+ return 1;
+
+error_free_input:
+ free (input);
+error:
+ return 0;
+}
+
+static char*
+partition_print_flags (PedPartition const *part)
+{
+ char *res = xstrdup ("");
+ if (!part)
+ return res;
+
+ PedPartitionFlag flag;
+ size_t res_buf_len = 1;
+ char const *sep = "";
+ for (flag = ped_partition_flag_next (0); flag;
+ flag = ped_partition_flag_next (flag))
+ {
+ if (ped_partition_get_flag (part, flag))
+ {
+ const char *name = _(ped_partition_flag_get_name (flag));
+ size_t new_len = res_buf_len + strlen (sep) + strlen (name);
+ res = xrealloc (res, new_len);
+ stpcpy (stpcpy (res + res_buf_len - 1, sep), name);
+ res_buf_len = new_len;
+ sep = ", ";
+ }
+ }
+
+ return res;
+}
+
+static void
+partition_print_flags_json (PedPartition const *part)
+{
+ if (!part)
+ return;
+
+ int did_open_array = 0;
+
+ PedPartitionFlag flag;
+ for (flag = ped_partition_flag_next (0); flag;
+ flag = ped_partition_flag_next (flag))
+ {
+ if (ped_partition_get_flag (part, flag))
+ {
+ if (!did_open_array)
+ ul_jsonwrt_array_open (&json, "flags");
+ did_open_array = 1;
+
+ ul_jsonwrt_value_s (&json, NULL, ped_partition_flag_get_name (flag));
+ }
+ }
+
+ if (did_open_array)
+ ul_jsonwrt_array_close (&json);
+}
+
+static int
+partition_print (PedPartition* part)
+{
+ return 1;
+}
+
+static char*
+disk_print_flags (PedDisk const *disk)
+{
+ char *res = xstrdup ("");
+ if (!disk)
+ return res;
+
+ PedDiskFlag flag;
+ size_t res_buf_len = 1;
+ char const *sep = "";
+ for (flag = ped_disk_flag_next (0); flag;
+ flag = ped_disk_flag_next (flag))
+ {
+ if (ped_disk_get_flag (disk, flag))
+ {
+ const char *name = _(ped_disk_flag_get_name (flag));
+ size_t new_len = res_buf_len + strlen (sep) + strlen (name);
+ res = xrealloc (res, new_len);
+ stpcpy (stpcpy (res + res_buf_len - 1, sep), name);
+ res_buf_len = new_len;
+ sep = ", ";
+ }
+ }
+
+ return res;
+}
+
+static void
+disk_print_flags_json (PedDisk const *disk)
+{
+ if (!disk)
+ return;
+
+ int did_open_array = 0;
+
+ PedDiskFlag flag;
+ for (flag = ped_disk_flag_next (0); flag;
+ flag = ped_disk_flag_next (flag))
+ {
+ if (ped_disk_get_flag (disk, flag))
+ {
+ if (!did_open_array)
+ ul_jsonwrt_array_open (&json, "flags");
+ did_open_array = 1;
+
+ ul_jsonwrt_value_s (&json, NULL, ped_disk_flag_get_name (flag));
+ }
+ }
+
+ if (did_open_array)
+ ul_jsonwrt_array_close (&json);
+}
+
+static void
+_print_disk_geometry (const PedDevice *dev)
+{
+ PED_ASSERT (dev != NULL);
+ const PedCHSGeometry* chs = &dev->bios_geom;
+ char* cyl_size = ped_unit_format_custom (dev,
+ chs->heads * chs->sectors,
+ PED_UNIT_KILOBYTE);
+
+ if (opt_output_mode == MACHINE) {
+ printf ("%d:%d:%d:%s;\n",
+ chs->cylinders, chs->heads, chs->sectors, cyl_size);
+ } else if (opt_output_mode == JSON) {
+ char* tmp = ped_malloc (128);
+ snprintf (tmp, 128, "%d,%d,%d %s", chs->cylinders, chs->heads, chs->sectors, cyl_size);
+ ul_jsonwrt_value_s (&json, "geometry", tmp);
+ free (tmp);
+ } else {
+ printf (_("BIOS cylinder,head,sector geometry: %d,%d,%d. "
+ "Each cylinder is %s.\n"),
+ chs->cylinders, chs->heads, chs->sectors, cyl_size);
+ }
+
+ free (cyl_size);
+}
+
+static char *
+_escape_machine_string (const char *str)
+{
+ size_t i, j;
+ char *dest;
+
+ dest = ped_malloc (2 * strlen(str) + 1);
+ if (!dest)
+ return NULL;
+
+ for (i = 0, j = 0; str[i] != '\0'; i++, j++) {
+ switch (str[i]) {
+ case ':':
+ case '\\':
+ dest[j++] = '\\';
+ /* fallthrough */
+ default:
+ dest[j] = str[i];
+ break;
+ }
+ }
+ dest[j] = '\0';
+
+ return dest;
+}
+
+static void
+_print_disk_info (const PedDevice *dev, const PedDisk *diskp)
+{
+ char const *const transport[] = {"unknown", "scsi", "ide", "dac960",
+ "cpqarray", "file", "ataraid", "i2o",
+ "ubd", "dasd", "viodasd", "sx8", "dm",
+ "xvd", "sd/mmc", "virtblk", "aoe",
+ "md", "loopback", "nvme", "brd",
+ "pmem"};
+
+ char* start = ped_unit_format (dev, 0);
+ PedUnit default_unit = ped_unit_get_default ();
+ char* end = ped_unit_format_byte (dev, dev->length * dev->sector_size
+ - (default_unit == PED_UNIT_CHS ||
+ default_unit == PED_UNIT_CYLINDER));
+
+ const char* pt_name = diskp ? diskp->type->name : "unknown";
+ char *disk_flags = disk_print_flags (diskp);
+
+ if (opt_output_mode == MACHINE) {
+ char *escaped_path = _escape_machine_string (dev->path);
+ char *escaped_model = _escape_machine_string (dev->model);
+
+ switch (default_unit) {
+ case PED_UNIT_CHS: puts ("CHS;");
+ break;
+ case PED_UNIT_CYLINDER: puts ("CYL;");
+ break;
+ default: puts ("BYT;");
+ break;
+
+ }
+ printf ("%s:%s:%s:%lld:%lld:%s:%s:%s;\n",
+ escaped_path, end, transport[dev->type],
+ dev->sector_size, dev->phys_sector_size,
+ pt_name, escaped_model, disk_flags);
+ free (escaped_path);
+ free (escaped_model);
+ } else if (opt_output_mode == JSON) {
+ ul_jsonwrt_value_s (&json, "path", dev->path);
+ ul_jsonwrt_value_s (&json, "size", end);
+ ul_jsonwrt_value_s (&json, "model", dev->model);
+ ul_jsonwrt_value_s (&json, "transport", transport[dev->type]);
+ ul_jsonwrt_value_u64 (&json, "logical-sector-size", dev->sector_size);
+ ul_jsonwrt_value_u64 (&json, "physical-sector-size", dev->phys_sector_size);
+ ul_jsonwrt_value_s (&json, "label", pt_name);
+ if (diskp) {
+ bool has_disk_uuid = ped_disk_type_check_feature (diskp->type, PED_DISK_TYPE_DISK_UUID);
+ if (has_disk_uuid) {
+ uint8_t* uuid = ped_disk_get_uuid (diskp);
+ static char buf[UUID_STR_LEN];
+ uuid_unparse_lower (uuid, buf);
+ ul_jsonwrt_value_s (&json, "uuid", buf);
+ free (uuid);
+ }
+ ul_jsonwrt_value_u64 (&json, "max-partitions",
+ ped_disk_get_max_primary_partition_count(diskp));
+ disk_print_flags_json (diskp);
+ }
+ } else {
+ printf (_("Model: %s (%s)\n"),
+ dev->model, transport[dev->type]);
+ printf (_("Disk %s: %s\n"), dev->path, end);
+ printf (_("Sector size (logical/physical): %lldB/%lldB\n"),
+ dev->sector_size, dev->phys_sector_size);
+ }
+
+ free (start);
+ free (end);
+
+ if (ped_unit_get_default () == PED_UNIT_CHS
+ || ped_unit_get_default () == PED_UNIT_CYLINDER)
+ _print_disk_geometry (dev);
+
+ if (opt_output_mode == HUMAN) {
+ printf (_("Partition Table: %s\n"), pt_name);
+ printf (_("Disk Flags: %s\n"), disk_flags);
+ }
+ free (disk_flags);
+}
+
+static int
+do_print (PedDevice** dev, PedDisk** diskp)
+{
+ Table* table;
+ int has_extended;
+ int has_name;
+ int has_devices_arg = 0;
+ int has_free_arg = 0;
+ int has_list_arg = 0;
+ int has_num_arg = 0;
+ char* peek_word;
+ char* start;
+ char* end;
+ char* size;
+ const char* name;
+ char* tmp;
+ wchar_t* table_rendered;
+ int ok = 1; /* default to success */
+
+ peek_word = command_line_peek_word ();
+ if (peek_word) {
+ if (strncmp (peek_word, "devices", 7) == 0) {
+ char *w = command_line_pop_word();
+ free (w);
+ has_devices_arg = 1;
+ }
+ else if (strncmp (peek_word, "free", 4) == 0) {
+ char *w = command_line_pop_word ();
+ free (w);
+ has_free_arg = 1;
+ }
+ else if (strncmp (peek_word, "list", 4) == 0 ||
+ strncmp (peek_word, "all", 3) == 0) {
+ char *w = command_line_pop_word();
+ free (w);
+ has_list_arg = 1;
+ }
+ else
+ has_num_arg = isdigit(peek_word[0]);
+
+ free (peek_word);
+ }
+
+ if (!has_devices_arg && !has_list_arg) {
+ if (!*diskp)
+ *diskp = ped_disk_new (*dev);
+ /* Returning NULL here is an indication of failure, when in
+ script mode. Otherwise (interactive mode) it may indicate
+ a real error, but it may also indicate that the user
+ declined when asked to perform some operation. FIXME:
+ what this really needs is an API change, but a reliable
+ exit code is less important in interactive mode. */
+ if (*diskp == NULL && opt_script_mode)
+ ok = 0;
+ }
+
+ if (*diskp &&
+ ped_disk_is_flag_available(*diskp, PED_DISK_CYLINDER_ALIGNMENT))
+ if (!ped_disk_set_flag(*diskp, PED_DISK_CYLINDER_ALIGNMENT,
+ alignment == ALIGNMENT_CYLINDER))
+ return 0;
+
+ if (has_devices_arg) {
+ char* dev_name;
+ PedDevice* current_dev = NULL;
+ int status = 0;
+
+ ped_device_probe_all();
+
+ while ((current_dev = ped_device_get_next(current_dev))) {
+ end = ped_unit_format_byte (current_dev,
+ current_dev->length
+ * current_dev->sector_size);
+ printf ("%s (%s)\n", current_dev->path, end);
+ free (end);
+ }
+
+ dev_name = xstrdup ((*dev)->path);
+ ped_device_free_all ();
+
+ *dev = ped_device_get (dev_name);
+ if (*dev && ped_device_open (*dev))
+ status = 1;
+ free (dev_name);
+
+ return status;
+ }
+
+ else if (has_list_arg)
+ return _print_list ();
+
+ else if (*diskp && has_num_arg) {
+ PedPartition* part = NULL;
+ int status = 0;
+ if (command_line_get_partition ("", *diskp, &part))
+ status = partition_print (part);
+ return status;
+ }
+
+ if (opt_output_mode == JSON) {
+ ul_jsonwrt_init (&json, stdout, 0);
+ ul_jsonwrt_root_open (&json);
+ ul_jsonwrt_object_open (&json, "disk");
+ }
+
+ _print_disk_info (*dev, *diskp);
+ if (!*diskp)
+ goto nopt;
+ if (opt_output_mode == HUMAN)
+ putchar ('\n');
+
+ has_extended = ped_disk_type_check_feature ((*diskp)->type,
+ PED_DISK_TYPE_EXTENDED);
+ has_name = ped_disk_type_check_feature ((*diskp)->type,
+ PED_DISK_TYPE_PARTITION_NAME);
+ bool has_type_id = ped_disk_type_check_feature ((*diskp)->type,
+ PED_DISK_TYPE_PARTITION_TYPE_ID);
+ bool has_type_uuid = ped_disk_type_check_feature ((*diskp)->type,
+ PED_DISK_TYPE_PARTITION_TYPE_UUID);
+ bool has_part_uuid = ped_disk_type_check_feature ((*diskp)->type,
+ PED_DISK_TYPE_PARTITION_UUID);
+
+ PedPartition* part;
+ if (opt_output_mode == HUMAN) {
+ StrList *row1;
+
+ if (ped_unit_get_default() == PED_UNIT_CHS) {
+ row1 = str_list_create (_("Number"), _("Start"),
+ _("End"), NULL);
+ } else {
+ row1 = str_list_create (_("Number"), _("Start"),
+ _("End"), _("Size"), NULL);
+ }
+
+ if (has_extended)
+ str_list_append (row1, _("Type"));
+
+ str_list_append (row1, _("File system"));
+
+ if (has_name)
+ str_list_append (row1, _("Name"));
+
+ str_list_append (row1, _("Flags"));
+
+
+ table = table_new (str_list_length(row1));
+
+ table_add_row_from_strlist (table, row1);
+
+ for (part = ped_disk_next_partition (*diskp, NULL); part;
+ part = ped_disk_next_partition (*diskp, part)) {
+
+ if ((!has_free_arg && !ped_partition_is_active(part)) ||
+ part->type & PED_PARTITION_METADATA)
+ continue;
+
+ tmp = ped_malloc (4);
+
+ if (part->num >= 0)
+ sprintf (tmp, "%2d ", part->num);
+ else
+ sprintf (tmp, "%2s ", "");
+
+ StrList *row = str_list_create (tmp, NULL);
+ free(tmp);
+
+ start = ped_unit_format (*dev, part->geom.start);
+ end = ped_unit_format_byte (
+ *dev,
+ (part->geom.end + 1) * (*dev)->sector_size - 1);
+ size = ped_unit_format (*dev, part->geom.length);
+ if (ped_unit_get_default() == PED_UNIT_CHS) {
+ str_list_append (row, start);
+ str_list_append (row, end);
+ } else {
+ str_list_append (row, start);
+ str_list_append (row, end);
+ str_list_append (row, size);
+ }
+
+ if (!(part->type & PED_PARTITION_FREESPACE)) {
+ if (has_extended) {
+ name = ped_partition_type_get_name (part->type);
+ str_list_append (row, name);
+ }
+
+ str_list_append (row, part->fs_type ?
+ part->fs_type->name : "");
+
+ if (has_name) {
+ name = ped_partition_get_name (part);
+ str_list_append (row, name);
+ }
+
+ char *flags = partition_print_flags (part);
+ str_list_append (row, flags);
+ free (flags);
+ } else {
+ if (has_extended)
+ str_list_append (row, "");
+ str_list_append (row, _("Free Space"));
+ if (has_name)
+ str_list_append (row, "");
+ str_list_append (row, "");
+ }
+
+ //PED_ASSERT (row.cols == caption.cols)
+ table_add_row_from_strlist (table, row);
+ str_list_destroy (row);
+ free (start);
+ free (end);
+ free (size);
+ }
+
+ table_rendered = table_render (table);
+#ifdef ENABLE_NLS
+ printf("%ls\n", table_rendered);
+#else
+ printf("%s\n", table_rendered);
+#endif
+ free (table_rendered);
+ table_destroy (table);
+ str_list_destroy (row1);
+
+ } else if (opt_output_mode == JSON) {
+
+ ul_jsonwrt_array_open (&json, "partitions");
+
+ for (part = ped_disk_next_partition (*diskp, NULL); part;
+ part = ped_disk_next_partition (*diskp, part)) {
+
+ if ((!has_free_arg && !ped_partition_is_active(part)) ||
+ part->type & PED_PARTITION_METADATA)
+ continue;
+
+ ul_jsonwrt_object_open (&json, NULL);
+
+ ul_jsonwrt_value_u64 (&json, "number", part->num >= 0 ? part->num : 0);
+
+ tmp = ped_unit_format (*dev, part->geom.start);
+ ul_jsonwrt_value_s (&json, "start", tmp);
+ free (tmp);
+
+ tmp = ped_unit_format_byte (*dev, (part->geom.end + 1) * (*dev)->sector_size - 1);
+ ul_jsonwrt_value_s (&json, "end", tmp);
+ free (tmp);
+
+ if (ped_unit_get_default() != PED_UNIT_CHS) {
+ tmp = ped_unit_format (*dev, part->geom.length);
+ ul_jsonwrt_value_s (&json, "size", tmp);
+ free (tmp);
+ }
+
+ name = ped_partition_type_get_name (part->type);
+ ul_jsonwrt_value_s (&json, "type", name);
+
+ if (!(part->type & PED_PARTITION_FREESPACE)) {
+
+ if (has_type_id) {
+ uint8_t type_id = ped_partition_get_type_id (part);
+ static char buf[8];
+ snprintf(buf, 8, "0x%02x", type_id);
+ ul_jsonwrt_value_s (&json, "type-id", buf);
+ }
+
+ if (has_type_uuid) {
+ uint8_t* type_uuid = ped_partition_get_type_uuid (part);
+ static char buf[UUID_STR_LEN];
+ uuid_unparse_lower (type_uuid, buf);
+ ul_jsonwrt_value_s (&json, "type-uuid", buf);
+ free (type_uuid);
+ }
+
+ if (has_part_uuid) {
+ uint8_t* uuid = ped_partition_get_uuid (part);
+ static char buf[UUID_STR_LEN];
+ uuid_unparse_lower (uuid, buf);
+ ul_jsonwrt_value_s (&json, "uuid", buf);
+ free (uuid);
+ }
+
+ if (has_name) {
+ name = ped_partition_get_name (part);
+ if (strcmp (name, "") != 0)
+ ul_jsonwrt_value_s (&json, "name", name);
+ }
+
+ if (part->fs_type)
+ ul_jsonwrt_value_s (&json, "filesystem", part->fs_type->name);
+
+ partition_print_flags_json (part);
+ }
+
+ ul_jsonwrt_object_close (&json);
+ }
+
+ ul_jsonwrt_array_close (&json);
+
+ } else {
+
+ for (part = ped_disk_next_partition (*diskp, NULL); part;
+ part = ped_disk_next_partition (*diskp, part)) {
+
+ if ((!has_free_arg && !ped_partition_is_active(part)) ||
+ part->type & PED_PARTITION_METADATA)
+ continue;
+
+ if (part->num >= 0)
+ printf ("%d:", part->num);
+ else
+ fputs ("1:", stdout);
+
+ char *s = ped_unit_format (*dev, part->geom.start);
+ printf ("%s:", s);
+ free (s);
+ s = ped_unit_format_byte (*dev,
+ (part->geom.end + 1) *
+ (*dev)->sector_size - 1);
+ printf ("%s:", s);
+ free (s);
+
+ if (ped_unit_get_default() != PED_UNIT_CHS) {
+ s = ped_unit_format (*dev, part->geom.length);
+ printf ("%s:", s);
+ free (s);
+ }
+
+ if (!(part->type & PED_PARTITION_FREESPACE)) {
+
+ if (part->fs_type)
+ printf ("%s:", part->fs_type->name);
+ else
+ putchar (':');
+
+ if (has_name)
+ {
+ char *escaped_name = _escape_machine_string (ped_partition_get_name (part));
+ printf ("%s:", escaped_name);
+ free (escaped_name);
+ } else
+ putchar (':');
+
+ char *flags = partition_print_flags (part);
+ printf ("%s;\n", flags);
+ free (flags);
+
+ } else {
+ puts ("free;");
+ }
+ }
+ }
+
+nopt:
+
+ if (opt_output_mode == JSON) {
+ ul_jsonwrt_object_close (&json);
+ ul_jsonwrt_root_close (&json);
+ }
+
+ return ok;
+}
+
+static int
+_print_list ()
+{
+ PedDevice *current_dev = NULL;
+ PedDisk *diskp = NULL;
+
+ ped_device_probe_all();
+
+ while ((current_dev = ped_device_get_next(current_dev))) {
+ do_print (&current_dev, &diskp);
+ if (diskp)
+ ped_disk_destroy (diskp);
+ diskp = 0;
+ putchar ('\n');
+ }
+
+ return 1;
+}
+
+static int
+do_quit (PedDevice** dev, PedDisk **diskp)
+{
+ _done (*dev, *diskp);
+ exit (EXIT_SUCCESS);
+}
+
+static PedPartitionType
+_disk_get_part_type_for_sector (PedDisk* disk, PedSector sector)
+{
+ PedPartition* extended;
+
+ extended = ped_disk_extended_partition (disk);
+ if (!extended
+ || !ped_geometry_test_sector_inside (&extended->geom, sector))
+ return 0;
+
+ return PED_PARTITION_LOGICAL;
+}
+
+/* This function checks if "part" contains a file system, and returs
+ * 0 if either no file system was found, or the user declined to add it.
+ * 1 if a file system was found, and the user chose to add it.
+ * -1 if the user chose to cancel the entire search.
+ */
+static int
+_rescue_add_partition (PedPartition* part)
+{
+ const PedFileSystemType* fs_type;
+ PedGeometry* probed;
+ PedExceptionOption ex_opt;
+ PedConstraint* constraint;
+ char* found_start;
+ char* found_end;
+
+ fs_type = ped_file_system_probe (&part->geom);
+ if (!fs_type)
+ return 0;
+ probed = ped_file_system_probe_specific (fs_type, &part->geom);
+ if (!probed)
+ return 0;
+
+ if (!ped_geometry_test_inside (&part->geom, probed)) {
+ ped_geometry_destroy (probed);
+ return 0;
+ }
+
+ constraint = ped_constraint_exact (probed);
+ if (!ped_disk_set_partition_geom (part->disk, part, constraint,
+ probed->start, probed->end)) {
+ ped_constraint_destroy (constraint);
+ return 0;
+ }
+ ped_constraint_destroy (constraint);
+
+ found_start = ped_unit_format (probed->dev, probed->start);
+ found_end = ped_unit_format (probed->dev, probed->end);
+ ex_opt = ped_exception_throw (
+ PED_EXCEPTION_INFORMATION,
+ PED_EXCEPTION_YES_NO_CANCEL,
+ _("A %s %s partition was found at %s -> %s. "
+ "Do you want to add it to the partition table?"),
+ fs_type->name, ped_partition_type_get_name (part->type),
+ found_start, found_end);
+ ped_geometry_destroy (probed);
+ free (found_start);
+ free (found_end);
+
+ switch (ex_opt) {
+ case PED_EXCEPTION_CANCEL: return -1;
+ case PED_EXCEPTION_NO: return 0;
+ default: break;
+ }
+
+ if (!ped_partition_set_system (part, fs_type))
+ return 0;
+
+ if (!ped_disk_commit (part->disk))
+ return 0;
+
+ return 1;
+}
+
+/* hack: we only iterate through the start, since most (all) fs's have their
+ * superblocks at the start. We'll need to change this if we generalize
+ * for RAID, or something...
+ */
+static int
+_rescue_pass (PedDisk* disk, PedGeometry* start_range, PedGeometry* end_range)
+{
+ PedSector start;
+ PedGeometry start_geom_exact;
+ PedGeometry entire_dev;
+ PedConstraint constraint;
+ PedPartition* part;
+ PedPartitionType part_type;
+
+ part_type = _disk_get_part_type_for_sector (
+ disk, (start_range->start + end_range->end) / 2);
+
+ ped_geometry_init (&entire_dev, disk->dev, 0, disk->dev->length);
+
+ ped_timer_reset (g_timer);
+ ped_timer_set_state_name (g_timer, _("searching for file systems"));
+ for (start = start_range->start; start <= start_range->end; start++) {
+ ped_timer_update (g_timer, 1.0 * (start - start_range->start)
+ / start_range->length);
+
+ ped_geometry_init (&start_geom_exact, disk->dev, start, 1);
+ ped_constraint_init (
+ &constraint, ped_alignment_any, ped_alignment_any,
+ &start_geom_exact, &entire_dev,
+ 1, disk->dev->length);
+ part = ped_partition_new (disk, part_type, NULL, start,
+ end_range->end);
+ if (!part) {
+ ped_constraint_done (&constraint);
+ continue;
+ }
+
+ ped_exception_fetch_all ();
+ if (ped_disk_add_partition (disk, part, &constraint)) {
+ ped_exception_leave_all ();
+ switch (_rescue_add_partition (part)) {
+ case 1:
+ ped_constraint_done (&constraint);
+ return 1;
+
+ case 0:
+ ped_disk_remove_partition (disk, part);
+ break;
+
+ case -1:
+ goto error_remove_partition;
+ }
+ } else {
+ ped_exception_leave_all ();
+ }
+ ped_partition_destroy (part);
+ ped_constraint_done (&constraint);
+ }
+ ped_timer_update (g_timer, 1.0);
+
+ return 1;
+
+error_remove_partition:
+ ped_disk_remove_partition (disk, part);
+ ped_partition_destroy (part);
+ ped_constraint_done (&constraint);
+ return 0;
+}
+
+static int
+do_rescue (PedDevice** dev, PedDisk** diskp)
+{
+ PedDisk* disk;
+ PedSector start = 0, end = 0;
+ PedSector fuzz;
+ PedGeometry probe_start_region;
+ PedGeometry probe_end_region;
+
+ if (*diskp) {
+ ped_disk_destroy (*diskp);
+ *diskp = 0;
+ }
+ disk = ped_disk_new (*dev);
+ if (!disk)
+ goto error;
+ if (ped_disk_is_flag_available(disk, PED_DISK_CYLINDER_ALIGNMENT))
+ if (!ped_disk_set_flag(disk, PED_DISK_CYLINDER_ALIGNMENT,
+ 0))
+ goto error;
+
+ if (!command_line_get_sector (_("Start?"), *dev, &start, NULL, NULL))
+ goto error_destroy_disk;
+ if (!command_line_get_sector (_("End?"), *dev, &end, NULL, NULL))
+ goto error_destroy_disk;
+
+ fuzz = PED_MAX (PED_MIN ((end - start) / 10, MEGABYTE_SECTORS(*dev)),
+ MEGABYTE_SECTORS(*dev) * 16);
+
+ ped_geometry_init (&probe_start_region, *dev,
+ PED_MAX(start - fuzz, 0),
+ PED_MIN(2 * fuzz, (*dev)->length - (start - fuzz)));
+ ped_geometry_init (&probe_end_region, *dev,
+ PED_MAX(end - fuzz, 0),
+ PED_MIN(2 * fuzz, (*dev)->length - (end - fuzz)));
+
+ if (!_rescue_pass (disk, &probe_start_region, &probe_end_region))
+ goto error_destroy_disk;
+
+ ped_disk_destroy (disk);
+
+ if ((*dev)->type != PED_DEVICE_FILE)
+ disk_is_modified = 1;
+
+ return 1;
+
+error_destroy_disk:
+ ped_disk_destroy (disk);
+error:
+ return 0;
+}
+
+static int
+do_resize (PedDevice **dev, PedDisk** diskp)
+{
+ ped_exception_throw (
+ PED_EXCEPTION_ERROR,
+ PED_EXCEPTION_CANCEL,
+ _("The resize command has been removed in parted 3.0"));
+ return 0;
+}
+
+static int
+do_resizepart (PedDevice** dev, PedDisk** diskp)
+{
+ PedDisk *disk = *diskp;
+ PedPartition *part = NULL;
+ PedSector start, end, oldend;
+ PedGeometry *range_end = NULL;
+ PedConstraint* constraint;
+ int rc = 0;
+ char* end_input = NULL;
+ char* end_size = NULL;
+
+ if (!disk) {
+ disk = ped_disk_new (*dev);
+ *diskp = disk;
+ }
+ if (!disk)
+ goto error;
+
+ if (ped_disk_is_flag_available(disk, PED_DISK_CYLINDER_ALIGNMENT))
+ if (!ped_disk_set_flag(disk, PED_DISK_CYLINDER_ALIGNMENT,
+ alignment == ALIGNMENT_CYLINDER))
+ goto error;
+
+ if (!command_line_get_partition (_("Partition number?"), disk, &part))
+ goto error;
+
+ /* Save the optional End value if the partition is busy. */
+ if (ped_partition_is_busy(part)) {
+ if (command_line_get_word_count())
+ end_size = command_line_pop_word();
+ }
+
+ /* If the partition is busy this may clear the command_line and prompt the user */
+ if (!_partition_warn_busy (part))
+ goto error;
+
+ /* Push the End value back onto the command_line, if it exists */
+ if (end_size) {
+ command_line_push_word(end_size);
+ }
+
+ start = part->geom.start;
+ end = oldend = part->geom.end;
+ if (!command_line_get_sector (_("End?"), *dev, &end, &range_end, &end_input))
+ goto error;
+ _adjust_end_if_iec(&start, &end, range_end, end_input);
+
+ /* Do not move start of the partition */
+ constraint = constraint_from_start_end_fixed_start (*dev, start, range_end);
+ if (!ped_disk_set_partition_geom (disk, part, constraint,
+ start, end))
+ goto error_destroy_constraint;
+ /* warn when shrinking partition - might lose data */
+ if (part->geom.end < oldend)
+ if (ped_exception_throw (
+ PED_EXCEPTION_WARNING,
+ PED_EXCEPTION_YES_NO,
+ _("Shrinking a partition can cause data loss, " \
+ "are you sure you want to continue?")) != PED_EXCEPTION_YES)
+ goto error_destroy_constraint;
+ ped_disk_commit (disk);
+
+ if ((*dev)->type != PED_DEVICE_FILE)
+ disk_is_modified = 1;
+
+ rc = 1;
+
+error_destroy_constraint:
+ ped_constraint_destroy (constraint);
+error:
+ if (range_end != NULL)
+ ped_geometry_destroy (range_end);
+ free(end_input);
+ free(end_size);
+
+ return rc;
+}
+
+
+static int
+do_rm (PedDevice** dev, PedDisk** diskp)
+{
+ PedPartition* part = NULL;
+
+ if (!*diskp)
+ *diskp = ped_disk_new (*dev);
+ if (!*diskp)
+ goto error;
+
+ if (!command_line_get_partition (_("Partition number?"), *diskp, &part))
+ goto error;
+ if (!_partition_warn_busy (part))
+ goto error;
+
+ if (!ped_disk_delete_partition (*diskp, part))
+ goto error;
+ if (!ped_disk_commit (*diskp))
+ goto error;
+
+ if ((*dev)->type != PED_DEVICE_FILE)
+ disk_is_modified = 1;
+
+ return 1;
+
+error:
+ return 0;
+}
+
+static int
+do_select (PedDevice** dev, PedDisk** diskp)
+{
+ PedDevice* new_dev = *dev;
+
+ if (!command_line_get_device (_("New device?"), &new_dev))
+ return 0;
+ if (!ped_device_open (new_dev))
+ return 0;
+
+ ped_device_close (*dev);
+ if (*diskp) {
+ ped_disk_destroy (*diskp);
+ *diskp = 0;
+ }
+ *dev = new_dev;
+ print_using_dev (*dev);
+ return 1;
+}
+
+/* Return true if partition PART is consistent with DISK's selected
+ offset and alignment requirements. Also return true if there is
+ insufficient kernel support to determine DISK's alignment requirements.
+ Otherwise, return false. A_TYPE selects whether to check for minimal
+ or optimal alignment requirements.
+
+ If align_err is not NULL a string describing why the check failed
+ will be allocated and returned. It is up to the caller to free this.
+ Pass NULL if no error description is needed.
+
+ If allocating the error string fails *align_err will be set to NULL, the
+ caller should always check for this.
+*/
+static bool
+partition_align_check (PedDisk const *disk, PedPartition const *part,
+ enum AlignmentType a_type, char **align_err)
+{
+ PED_ASSERT (part->disk == disk);
+ PedDevice const *dev = disk->dev;
+
+ PedAlignment *pa = (a_type == PA_MINIMUM
+ ? ped_device_get_minimum_alignment (dev)
+ : ped_device_get_optimum_alignment (dev));
+ if (pa == NULL)
+ return true;
+
+ PED_ASSERT (pa->grain_size != 0);
+ bool ok = (part->geom.start % pa->grain_size == pa->offset);
+
+ /* If it isn't aligned and the caller wants an explanation,
+ show them the math. */
+ if (!ok && align_err) {
+ if (asprintf(align_err,
+ "%llds %% %llds != %llds",
+ part->geom.start, pa->grain_size, pa->offset) < 0) {
+ *align_err = NULL;
+ }
+ }
+ free (pa);
+ return ok;
+}
+
+static int
+do_align_check (PedDevice **dev, PedDisk** diskp)
+{
+ if (!*diskp)
+ *diskp = ped_disk_new (*dev);
+ if (!*diskp)
+ goto error;
+
+ enum AlignmentType align_type = PA_OPTIMUM;
+ PedPartition *part = NULL;
+
+ if (!command_line_get_align_type (_("alignment type(min/opt)"), &align_type))
+ goto error;
+ if (!command_line_get_partition (_("Partition number?"), *diskp, &part))
+ goto error;
+
+ char *align_err = NULL;
+ bool aligned = partition_align_check (*diskp, part, align_type, &align_err);
+
+ /* Don't print the error in script mode */
+ if (opt_script_mode) {
+ free(align_err);
+ return aligned ? 1 : 0;
+ }
+
+ if (aligned)
+ printf(_("%d aligned\n"), part->num);
+ else
+ printf(_("%d not aligned: %s\n"),
+ part->num,
+ align_err ? align_err : _("unknown (malloc failed)"));
+
+ free(align_err);
+
+ /* Always return 1 in interactive mode, to be consistent
+ with the other modes. */
+ return 1;
+
+error:
+ return 0;
+}
+
+static int
+do_disk_set (PedDevice** dev, PedDisk** diskp)
+{
+ PedDiskFlag flag;
+ int state;
+
+ if (!*diskp)
+ *diskp = ped_disk_new (*dev);
+ if (!*diskp)
+ goto error;
+
+ if (!command_line_get_disk_flag (_("Flag to Invert?"), *diskp, &flag))
+ goto error;
+ state = (ped_disk_get_flag (*diskp, flag) == 0 ? 1 : 0);
+
+ if (!is_toggle_mode) {
+ if (!command_line_get_state (_("New state?"), &state))
+ goto error;
+ }
+
+ if (!ped_disk_set_flag (*diskp, flag, state))
+ goto error;
+ if (!ped_disk_commit (*diskp))
+ goto error;
+
+ if ((*dev)->type != PED_DEVICE_FILE)
+ disk_is_modified = 1;
+
+ return 1;
+
+error:
+ return 0;
+}
+
+static int
+do_set (PedDevice** dev, PedDisk **diskp)
+{
+ PedPartition* part = NULL;
+ PedPartitionFlag flag;
+ int state;
+
+ if (*diskp == 0)
+ *diskp = ped_disk_new (*dev);
+ if (!*diskp)
+ goto error;
+
+ if (!command_line_get_partition (_("Partition number?"), *diskp, &part))
+ goto error;
+ if (!command_line_get_part_flag (_("Flag to Invert?"), part, &flag))
+ goto error;
+ state = (ped_partition_get_flag (part, flag) == 0 ? 1 : 0);
+
+ if (!is_toggle_mode) {
+ if (!command_line_get_state (_("New state?"), &state))
+ goto error;
+ }
+
+ if (!ped_partition_set_flag (part, flag, state))
+ goto error;
+ if (!ped_disk_commit (*diskp))
+ goto error;
+
+ if ((*dev)->type != PED_DEVICE_FILE)
+ disk_is_modified = 1;
+
+ return 1;
+
+error:
+ return 0;
+}
+
+static int
+do_disk_toggle (PedDevice **dev, PedDisk** diskp)
+{
+ int result;
+
+ is_toggle_mode = 1;
+ result = do_disk_set (dev, diskp);
+ is_toggle_mode = 0;
+
+ return result;
+}
+
+static int
+do_toggle (PedDevice **dev, PedDisk** diskp)
+{
+ int result;
+
+ is_toggle_mode = 1;
+ result = do_set (dev, diskp);
+ is_toggle_mode = 0;
+
+ return result;
+}
+
+static int
+do_unit (PedDevice** dev, PedDisk** diskp)
+{
+ PedUnit unit = ped_unit_get_default ();
+ if (!command_line_get_unit (_("Unit?"), &unit))
+ return 0;
+ ped_unit_set_default (unit);
+ return 1;
+}
+
+static int
+do_version ()
+{
+ printf ("\n%s\n%s",
+ prog_name,
+ _(copyright_msg));
+ return 1;
+}
+
+static void
+_init_messages ()
+{
+ StrList* list;
+ int first;
+ PedFileSystemType* fs_type;
+ PedFileSystemAlias* fs_alias;
+ PedDiskType* disk_type;
+ PedPartitionFlag part_flag;
+ PedDiskFlag disk_flag;
+ PedUnit unit;
+
+/* flags */
+ first = 1;
+ list = str_list_create (_(flag_msg_start), NULL);
+ for (part_flag = ped_partition_flag_next (0); part_flag;
+ part_flag = ped_partition_flag_next (part_flag)) {
+ if (first)
+ first = 0;
+ else
+ str_list_append (list, ", ");
+ str_list_append (list,
+ _(ped_partition_flag_get_name (part_flag)));
+ }
+ str_list_append (list, "\n");
+
+ flag_msg = str_list_convert (list);
+ str_list_destroy (list);
+/* disk flags */
+ first = 1;
+ list = str_list_create (_(disk_flag_msg_start), NULL);
+ for (disk_flag = ped_disk_flag_next (0); disk_flag;
+ disk_flag = ped_disk_flag_next (disk_flag)) {
+ if (first)
+ first = 0;
+ else
+ str_list_append (list, ", ");
+ str_list_append (list,
+ _(ped_disk_flag_get_name (disk_flag)));
+ }
+ str_list_append (list, "\n");
+
+ disk_flag_msg = str_list_convert (list);
+ str_list_destroy (list);
+
+/* units */
+ first = 1;
+ list = str_list_create (_(unit_msg_start), NULL);
+ for (unit = PED_UNIT_FIRST; unit <= PED_UNIT_LAST; unit++) {
+ if (first)
+ first = 0;
+ else
+ str_list_append (list, ", ");
+ str_list_append (list, ped_unit_get_name (unit));
+ }
+ str_list_append (list, "\n");
+
+ unit_msg = str_list_convert (list);
+ str_list_destroy (list);
+
+/* disk type */
+ list = str_list_create (_(label_type_msg_start), NULL);
+
+ first = 1;
+ for (disk_type = ped_disk_type_get_next (NULL);
+ disk_type; disk_type = ped_disk_type_get_next (disk_type)) {
+ if (disk_type->ops->write == NULL)
+ continue;
+
+ if (first)
+ first = 0;
+ else
+ str_list_append (list, ", ");
+ str_list_append (list, disk_type->name);
+ }
+ str_list_append (list, "\n");
+
+ label_type_msg = str_list_convert (list);
+ str_list_destroy (list);
+
+/* mkpart - file system types and aliases */
+ list = str_list_create (_(fs_type_msg_start), NULL);
+
+ first = 1;
+ for (fs_type = ped_file_system_type_get_next (NULL);
+ fs_type; fs_type = ped_file_system_type_get_next (fs_type)) {
+ if (first)
+ first = 0;
+ else
+ str_list_append (list, ", ");
+ str_list_append (list, fs_type->name);
+ }
+ for (fs_alias = ped_file_system_alias_get_next (NULL);
+ fs_alias; fs_alias = ped_file_system_alias_get_next (fs_alias)) {
+ if (first)
+ first = 0;
+ else
+ str_list_append (list, ", ");
+ str_list_append (list, fs_alias->alias);
+ }
+ str_list_append (list, "\n");
+
+ mkpart_fs_type_msg = str_list_convert (list);
+ str_list_destroy (list);
+}
+
+static void
+_done_messages ()
+{
+ free (flag_msg);
+ free (unit_msg);
+ free (mkpart_fs_type_msg);
+ free (label_type_msg);
+}
+
+static void
+_init_commands ()
+{
+ command_register (commands,
+ command_create ( str_list_create_unique ("align-check",
+ _("align-check"), NULL),
+ do_align_check,
+ str_list_create (
+ _("align-check TYPE N"
+ " "
+ "check partition N for"
+ " TYPE(min|opt) alignment"), NULL),
+
+ str_list_create (_(number_msg), _(min_or_opt_msg),
+ NULL), 1));
+ command_register (commands, command_create (
+ str_list_create_unique ("help", _("help"), NULL),
+ do_help,
+ str_list_create (
+_("help [COMMAND] print general help, or help "
+ "on COMMAND"),
+NULL),
+ NULL, 1));
+
+ command_register (commands, command_create (
+ str_list_create_unique ("mklabel", _("mklabel"), "mktable", _("mktable"), NULL),
+ do_mklabel,
+ str_list_create (
+_("mklabel,mktable LABEL-TYPE create a new disklabel "
+ "(partition table)"),
+NULL),
+ str_list_create (label_type_msg, NULL), 1));
+
+ command_register (commands, command_create (
+ str_list_create_unique ("mkpart", _("mkpart"), NULL),
+ do_mkpart,
+ str_list_create (
+_("mkpart PART-TYPE [FS-TYPE] START END make a partition"),
+NULL),
+ str_list_create (_(part_type_msg),
+ _(mkpart_fs_type_msg),
+ _(start_end_msg),
+ "\n",
+_("'mkpart' makes a partition without creating a new file system on the "
+ "partition. FS-TYPE may be specified to set an appropriate partition ID.\n"),
+NULL), 1));
+
+command_register (commands, command_create (
+ str_list_create_unique ("name", _("name"), NULL),
+ do_name,
+ str_list_create (
+_("name NUMBER NAME name partition NUMBER as NAME"),
+NULL),
+ str_list_create (_(number_msg), _(name_msg), NULL), 1));
+
+command_register (commands, command_create (
+ str_list_create_unique ("print", _("print"), NULL),
+ do_print,
+ str_list_create (
+_("print [devices|free|list,all] display the partition table, "
+ "or available devices, or free space, or all found partitions"),
+NULL),
+ str_list_create (
+_("Without arguments, 'print' displays the entire partition table. However "
+ "with the following arguments it performs various other actions.\n"),
+_(" devices : display all active block devices\n"),
+_(" free : display information about free unpartitioned space on the "
+ "current block device\n"),
+_(" list, all : display the partition tables of all active block devices\n"),
+NULL), 1));
+
+command_register (commands, command_create (
+ str_list_create_unique ("quit", _("quit"), NULL),
+ do_quit,
+ str_list_create (
+_("quit exit program"),
+NULL),
+ NULL, 1));
+
+command_register (commands, command_create (
+ str_list_create_unique ("rescue", _("rescue"), NULL),
+ do_rescue,
+ str_list_create (
+_("rescue START END rescue a lost partition near "
+"START and END"),
+NULL),
+ str_list_create (_(start_end_msg), NULL), 1));
+
+command_register (commands, command_create (
+ str_list_create_unique ("resize", _("resize"), NULL),
+ do_resize,
+ NULL,
+ str_list_create (_(N_("The resize command was removed in parted 3.0\n")), NULL), 1));
+
+command_register (commands, command_create (
+ str_list_create_unique ("resizepart", _("resizepart"), NULL),
+ do_resizepart,
+ str_list_create (
+_("resizepart NUMBER END resize partition NUMBER"),
+NULL),
+ str_list_create (_(number_msg), _(end_msg), NULL), 1));
+
+command_register (commands, command_create (
+ str_list_create_unique ("rm", _("rm"), NULL),
+ do_rm,
+ str_list_create (
+_("rm NUMBER delete partition NUMBER"),
+NULL),
+ str_list_create (_(number_msg), NULL), 1));
+
+command_register (commands, command_create (
+ str_list_create_unique ("select", _("select"), NULL),
+ do_select,
+ str_list_create (
+_("select DEVICE choose the device to edit"),
+NULL),
+ str_list_create (_(device_msg), NULL), 1));
+
+command_register (commands, command_create (
+ str_list_create_unique ("disk_set", _("disk_set"), NULL),
+ do_disk_set,
+ str_list_create (
+_("disk_set FLAG STATE change the FLAG on selected device"),
+NULL),
+ str_list_create (disk_flag_msg, _(state_msg), NULL), 1));
+
+command_register (commands, command_create (
+ str_list_create_unique ("disk_toggle", _("disk_toggle"), NULL),
+ do_disk_toggle,
+ str_list_create (
+_("disk_toggle [FLAG] toggle the state of FLAG on "
+"selected device"),
+NULL),
+ str_list_create (disk_flag_msg, NULL), 1));
+
+command_register (commands, command_create (
+ str_list_create_unique ("set", _("set"), NULL),
+ do_set,
+ str_list_create (
+_("set NUMBER FLAG STATE change the FLAG on partition "
+ "NUMBER"),
+NULL),
+ str_list_create (_(number_msg), flag_msg, _(state_msg), NULL), 1));
+
+command_register (commands, command_create (
+ str_list_create_unique ("toggle", _("toggle"), NULL),
+ do_toggle,
+ str_list_create (
+_("toggle [NUMBER [FLAG]] toggle the state of FLAG on "
+ "partition NUMBER"),
+NULL),
+ str_list_create (_(number_msg), flag_msg, NULL), 1));
+
+command_register (commands, command_create (
+ str_list_create_unique ("type", _("type"), NULL),
+ do_type,
+ str_list_create (
+_("type NUMBER TYPE-ID or TYPE-UUID type set TYPE-ID or TYPE-UUID of partition NUMBER"),
+NULL),
+ str_list_create (_(number_msg), _(type_msg), NULL), 1));
+
+command_register (commands, command_create (
+ str_list_create_unique ("unit", _("unit"), NULL),
+ do_unit,
+ str_list_create (
+_("unit UNIT set the default unit to UNIT"),
+NULL),
+ str_list_create (unit_msg, NULL), 1));
+
+command_register (commands, command_create (
+ str_list_create_unique ("version", _("version"), NULL),
+ do_version,
+ str_list_create (
+_("version display the version number "
+"and copyright information of GNU Parted"),
+NULL),
+ str_list_create (
+_("'version' displays copyright and version information corresponding to this "
+"copy of GNU Parted\n"),
+NULL), 1));
+
+}
+
+static void
+_done_commands ()
+{
+Command** walk;
+
+for (walk = commands; *walk; walk++) {
+ command_destroy (*walk);
+ *walk = NULL;
+}
+}
+
+static void
+_init_i18n ()
+{
+/* intialize i18n */
+#ifdef ENABLE_NLS
+setlocale(LC_ALL, "");
+bindtextdomain(PACKAGE, LOCALEDIR);
+textdomain(PACKAGE);
+#endif /* ENABLE_NLS */
+}
+
+void
+_version ()
+{
+ version_etc (stdout, PROGRAM_NAME, PACKAGE_NAME, Version, AUTHORS,
+ (char *) NULL);
+}
+
+static int
+_parse_options (int* argc_ptr, char*** argv_ptr)
+{
+int opt, help = 0, list = 0, version = 0, wrong = 0;
+
+while (1)
+{
+ opt = getopt_long (*argc_ptr, *argv_ptr, "hlmjsfva:",
+ options, NULL);
+ if (opt == -1)
+ break;
+
+ switch (opt) {
+ case 'h': help = 1; break;
+ case 'l': list = 1; break;
+ case 'm': opt_output_mode = MACHINE; break;
+ case 'j': opt_output_mode = JSON; break;
+ case 's': opt_script_mode = 1; break;
+ case 'f': opt_fix_mode = 1; break;
+ case 'v': version = 1; break;
+ case 'a':
+ alignment = XARGMATCH ("--align", optarg,
+ align_args, align_types);
+ break;
+ case PRETEND_INPUT_TTY:
+ pretend_input_tty = 1;
+ break;
+ default:
+ wrong = 1;
+ break;
+ }
+}
+
+if (wrong == 1) {
+ fprintf (stderr,
+ _("Usage: %s [-hlmsfv] [-a<align>] [DEVICE [COMMAND [PARAMETERS]]...]\n"),
+ program_name);
+ return 0;
+}
+
+if (version == 1) {
+ _version ();
+ exit (EXIT_SUCCESS);
+}
+
+if (help == 1) {
+ help_msg ();
+ exit (EXIT_SUCCESS);
+}
+
+if (list == 1) {
+ _print_list ();
+ exit (EXIT_SUCCESS);
+}
+
+*argc_ptr -= optind;
+*argv_ptr += optind;
+return 1;
+}
+
+static PedDevice*
+_choose_device (int* argc_ptr, char*** argv_ptr)
+{
+PedDevice* dev;
+
+/* specified on command line? */
+if (*argc_ptr) {
+ dev = ped_device_get ((*argv_ptr) [0]);
+ if (!dev)
+ return NULL;
+ (*argc_ptr)--;
+ (*argv_ptr)++;
+} else {
+retry:
+ ped_device_probe_all ();
+ dev = ped_device_get_next (NULL);
+ if (!dev) {
+ if (ped_exception_throw (PED_EXCEPTION_ERROR,
+ PED_EXCEPTION_RETRY_CANCEL,
+ _("No device found"))
+ == PED_EXCEPTION_RETRY)
+ goto retry;
+ else
+ return NULL;
+ }
+}
+
+if (!ped_device_open (dev))
+ return NULL;
+return dev;
+}
+
+static PedDevice*
+_init (int* argc_ptr, char*** argv_ptr)
+{
+PedDevice* dev;
+
+#ifdef ENABLE_MTRACE
+mtrace();
+#endif
+
+_init_i18n ();
+if (!init_ui ())
+ goto error;
+_init_messages ();
+_init_commands ();
+
+if (!_parse_options (argc_ptr, argv_ptr))
+ goto error_done_commands;
+
+if (!opt_script_mode)
+ if (init_readline ())
+ goto error_done_commands;
+
+#ifdef HAVE_GETUID
+ if (getuid() != 0 && !opt_script_mode) {
+ fputs (_("WARNING: You are not superuser. Watch out for "
+ "permissions.\n"), stderr);
+ }
+#endif
+
+dev = _choose_device (argc_ptr, argv_ptr);
+if (!dev)
+ goto error_done_commands;
+
+g_timer = ped_timer_new (_timer_handler, &timer_context);
+if (!g_timer)
+ goto error_done_commands;
+timer_context.last_update = 0;
+
+return dev;
+
+error_done_commands:
+_done_commands ();
+_done_messages ();
+done_ui ();
+error:
+return NULL;
+}
+
+static void
+_done (PedDevice* dev, PedDisk* diskp)
+{
+ if (diskp)
+ ped_disk_destroy (diskp);
+ if (dev->boot_dirty && dev->type != PED_DEVICE_FILE) {
+ ped_exception_throw (
+ PED_EXCEPTION_WARNING,
+ PED_EXCEPTION_OK,
+ _("You should reinstall your boot loader before "
+ "rebooting. Read section 4 of the Parted User "
+ "documentation for more information."));
+ }
+ if (!opt_script_mode && opt_output_mode == HUMAN && disk_is_modified) {
+ ped_exception_throw (
+ PED_EXCEPTION_INFORMATION, PED_EXCEPTION_OK,
+ _("You may need to update /etc/fstab.\n"));
+}
+
+ped_device_close (dev);
+
+ped_timer_destroy (g_timer);
+_done_commands ();
+_done_messages ();
+done_ui();
+}
+
+int
+main (int argc, char** argv)
+{
+ PedDevice* dev;
+ PedDisk* diskp = 0;
+ int status;
+
+ set_program_name (argv[0]);
+ atexit (close_stdout);
+
+ dev = _init (&argc, &argv);
+ if (!dev)
+ return 1;
+
+ if (argc || opt_script_mode)
+ status = non_interactive_mode (&dev, &diskp, commands, argc, argv);
+ else
+ status = interactive_mode (&dev, &diskp, commands);
+
+ _done (dev, diskp);
+
+ return !status;
+}
diff --git a/parted/strlist.c b/parted/strlist.c
new file mode 100644
index 0000000..c4cb351
--- /dev/null
+++ b/parted/strlist.c
@@ -0,0 +1,582 @@
+/*
+ parted - a frontend to libparted
+ Copyright (C) 1999-2001, 2007, 2009-2014, 2019-2023 Free Software
+ Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include <config.h>
+
+#include <parted/debug.h>
+
+#include <ctype.h>
+#include <errno.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <limits.h>
+#include "xalloc.h"
+
+#ifdef ENABLE_NLS
+
+#undef __USE_GNU
+#define __USE_GNU
+
+#include <wchar.h>
+#include <wctype.h>
+
+#endif /* !ENABLE_NLS */
+
+#include "strlist.h"
+
+#define MIN(a,b) ( (a<b)? a : b )
+
+static int _GL_ATTRIBUTE_PURE
+wchar_strlen (const wchar_t* str)
+{
+#ifdef ENABLE_NLS
+ return wcslen (str);
+#else
+ return strlen (str);
+#endif
+}
+
+static wchar_t * _GL_ATTRIBUTE_PURE
+wchar_strchr (const wchar_t* str, char ch)
+{
+#ifdef ENABLE_NLS
+ return wcschr (str, ch);
+#else
+ return strchr (str, ch);
+#endif
+}
+
+static int _GL_ATTRIBUTE_PURE
+wchar_strcasecmp (const wchar_t* a, const wchar_t* b)
+{
+#ifdef ENABLE_NLS
+ return wcscasecmp (a, b);
+#else
+ return strcasecmp (a, b);
+#endif
+}
+
+static int _GL_ATTRIBUTE_PURE
+wchar_strncasecmp (const wchar_t* a, const wchar_t* b, size_t n)
+{
+#ifdef ENABLE_NLS
+ return wcsncasecmp (a, b, n);
+#else
+ return strncasecmp (a, b, n);
+#endif
+}
+
+static wchar_t * _GL_ATTRIBUTE_PURE
+wchar_strdup (const wchar_t* str)
+{
+#ifdef ENABLE_NLS
+ return wcsdup (str);
+#else
+ return xstrdup (str);
+#endif
+}
+
+/* converts a string from the encoding in the gettext catalogues to wide
+ * character strings (of type wchar_t*).
+ */
+#ifdef ENABLE_NLS
+static wchar_t*
+gettext_to_wchar (const char* str)
+{
+ int count;
+ wchar_t* result;
+ size_t status;
+ mbstate_t ps;
+
+ count = strlen (str) + 1;
+ result = malloc (count * sizeof (wchar_t));
+ if (!result)
+ goto error;
+
+ memset(&ps, 0, sizeof (ps));
+ status = mbsrtowcs(result, &str, count, &ps);
+ if (str != NULL)
+ goto error;
+
+ result = xrealloc (result, (status + 1) * sizeof (wchar_t));
+ return result;
+
+error:
+ fprintf (stderr, "Error during translation: %s\n", strerror (errno));
+ exit (EXIT_FAILURE);
+}
+
+#else /* ENABLE_NLS */
+
+static wchar_t*
+gettext_to_wchar (const char* str)
+{
+ return xstrdup (str);
+}
+
+#endif /* !ENABLE_NLS */
+
+
+#ifdef ENABLE_NLS
+static char*
+wchar_to_str (const wchar_t* str, size_t count)
+{
+ char* result;
+ char* out_buf;
+ size_t status;
+ mbstate_t ps;
+ size_t i;
+
+ if (count == 0 || wcslen(str) < count)
+ count = wcslen (str);
+
+ out_buf = result = malloc ((count + 1) * MB_LEN_MAX);
+ if (!result)
+ goto error;
+
+ memset(&ps, 0, sizeof(ps));
+
+ for (i = 0; i < count; i++) {
+ status = wcrtomb (out_buf, str[i], &ps);
+ if (status == (size_t) -1)
+ goto error;
+ out_buf += status;
+ }
+
+ status = wcrtomb (out_buf, 0, &ps);
+ if (status == (size_t) -1)
+ goto error;
+
+ result = realloc (result, strlen (result) + 1);
+ if (!result)
+ goto error;
+ return result;
+
+error:
+ fprintf (stderr, "Error during translation: %s\n", strerror (errno));
+ exit (EXIT_FAILURE);
+}
+
+#else /* ENABLE_NLS */
+
+static char*
+wchar_to_str (const wchar_t* str, size_t count)
+{
+ char* result;
+
+ result = xstrdup (str);
+ if (count && count < strlen (result))
+ result [count] = 0;
+ return result;
+}
+
+#endif /* !ENABLE_NLS */
+
+static void
+print_wchar (const wchar_t* str, size_t count, FILE *fp)
+{
+ char* tmp = wchar_to_str (str, count);
+ fprintf (fp, "%s", tmp);
+ free (tmp);
+}
+
+static StrList*
+str_list_alloc ()
+{
+ StrList* list;
+
+ list = xmalloc (sizeof (StrList));
+ list->next = NULL;
+
+ return list;
+}
+
+void
+str_list_destroy (StrList* list)
+{
+ if (list) {
+ str_list_destroy (list->next);
+ str_list_destroy_node (list);
+ }
+}
+
+void
+str_list_destroy_node (StrList* list)
+{
+ void *p = (char *) (list->str); /* discard const */
+ free (p);
+ free (list);
+}
+
+StrList*
+str_list_duplicate_node (const StrList* node)
+{
+ StrList* result = str_list_alloc ();
+ result->str = wchar_strdup (node->str);
+ return result;
+}
+
+StrList*
+str_list_duplicate (const StrList* list)
+{
+ if (list)
+ return str_list_join (str_list_duplicate_node (list),
+ str_list_duplicate (list->next));
+ else
+ return NULL;
+}
+
+StrList*
+str_list_join (StrList* a, StrList* b)
+{
+ StrList* walk;
+
+ for (walk = a; walk && walk->next; walk = walk->next);
+
+ if (walk) {
+ walk->next = b;
+ return a;
+ } else {
+ return b;
+ }
+}
+
+static StrList*
+_str_list_append (StrList* list, const wchar_t* str)
+{
+ StrList* walk;
+
+ if (list) {
+ for (walk = list; walk->next; walk = walk->next);
+ walk->next = str_list_alloc ();
+ walk = walk->next;
+ } else {
+ walk = list = str_list_alloc ();
+ }
+ walk->str = str;
+
+ return list;
+}
+
+StrList*
+str_list_append (StrList* list, const char* str)
+{
+ return _str_list_append (list, gettext_to_wchar (str));
+}
+
+StrList*
+str_list_append_unique (StrList* list, const char* str)
+{
+ StrList* walk;
+ wchar_t* new_str = gettext_to_wchar (str);
+
+ for (walk=list; walk; walk=walk->next) {
+ if (walk->str) {
+ if (wchar_strcasecmp (new_str, walk->str) == 0) {
+ free (new_str);
+ return list;
+ }
+ }
+ }
+
+ return _str_list_append (list, new_str);
+}
+
+StrList*
+str_list_insert (StrList* list, const char* str)
+{
+ return str_list_join (str_list_create (str, NULL), list);
+}
+
+StrList*
+str_list_create (const char* first, ...)
+{
+ va_list args;
+ char* str;
+ StrList* list;
+
+ list = str_list_append (NULL, first);
+
+ if (first) {
+ va_start (args, first);
+ while ( (str = va_arg (args, char*)) )
+ str_list_append (list, str);
+ va_end (args);
+ }
+
+ return list;
+}
+
+StrList*
+str_list_create_unique (const char* first, ...)
+{
+ va_list args;
+ char* str;
+ StrList* list;
+
+ list = str_list_append (NULL, first);
+
+ if (first) {
+ va_start (args, first);
+ while ( (str = va_arg (args, char*)) )
+ str_list_append_unique (list, str);
+ va_end (args);
+ }
+
+ return list;
+}
+
+char*
+str_list_convert_node (const StrList* list)
+{
+ return wchar_to_str (list->str, 0);
+}
+
+char*
+str_list_convert (const StrList* list)
+{
+ const StrList* walk;
+ int pos = 0;
+ int length = 1;
+ char* str = xstrdup ("");
+
+ for (walk = list; walk; walk = walk->next) {
+ if (walk->str) {
+ char* tmp = wchar_to_str (walk->str, 0);
+
+ length += strlen (tmp);
+
+ str = realloc (str, length);
+ strcpy (str + pos, tmp);
+
+ pos = length - 1;
+ free (tmp);
+ }
+ }
+
+ return str;
+}
+
+void
+str_list_print (const StrList* list, FILE *fp)
+{
+ const StrList* walk;
+
+ for (walk=list; walk; walk=walk->next) {
+ if (walk->str)
+ print_wchar (walk->str, 0, fp);
+ }
+}
+
+static int
+str_search (const wchar_t* str, int n, wchar_t c)
+{
+ int i;
+
+ for (i=0; i<n; i++)
+ if (str [i] == c)
+ return i;
+ return -1;
+}
+
+
+/* Japanese don't leave spaces between words, so ALL Japanese characters
+ * are treated as delimiters. Note: since the translations should already
+ * be properly formatted (eg: spaces after commas), there should be no
+ * need to include them. Best not to avoid side effects, like 3.
+14159 :-)
+ * FIXME: how do we exclude "." and "(" ?
+ * FIXME: glibc doesn't like umlaute. i.e. \"o (TeX notation), which should
+ * look like: ö
+ */
+
+static int
+is_break_point (wchar_t c)
+{
+#ifdef ENABLE_NLS
+ return !iswalnum (c) && !iswpunct (c);
+#else
+ return !isalnum (c) && !ispunct (c);
+#endif
+}
+
+/* NOTE: this should not return '\n' as a space, because explicit '\n' may
+ * be placed inside strings.
+ */
+static int
+is_space (wchar_t c)
+{
+#ifdef ENABLE_NLS
+ return c == (wchar_t) btowc(' ');
+#else
+ return c == ' ';
+#endif
+}
+
+void
+str_list_print_wrap (const StrList* list, int line_length, int offset,
+ int indent, FILE *fp)
+{
+ const StrList* walk;
+ const wchar_t* str;
+ int str_len;
+ int cut_right;
+ int cut_left;
+ int line_left;
+ int search_result;
+ int line_break;
+
+ PED_ASSERT (line_length - indent > 10);
+
+ line_left = line_length - offset;
+
+ for (walk=list; walk; walk=walk->next) {
+ if (!walk->str)
+ continue;
+ str = walk->str;
+ str_len = wchar_strlen (str);
+
+ while (line_left < str_len || wchar_strchr (str, '\n')) {
+ line_break = 0;
+
+ cut_left = MIN (line_left - 1, str_len - 1);
+
+ /* we can have a space "over", but not a comma */
+ if (cut_left < str_len
+ && is_space (str [cut_left + 1]))
+ cut_left++;
+
+ while (cut_left && !is_break_point (str [cut_left]))
+ cut_left--;
+ while (cut_left && is_space (str [cut_left]))
+ cut_left--;
+
+ /* str [cut_left] is either the end of a word, or a
+ * Japanese character, or the start of a blank line.
+ */
+
+ search_result = str_search (str, cut_left + 1, '\n');
+ if (search_result != -1) {
+ cut_left = search_result - 1;
+ line_break = 1;
+ }
+
+ for (cut_right = cut_left + (line_break ? 2 : 1);
+ cut_right < str_len && is_space (str [cut_right]);
+ cut_right++);
+
+ if (cut_left > 0)
+ print_wchar (str, cut_left + 1, fp);
+
+ str += cut_right;
+ str_len -= cut_right;
+ line_left = line_length - indent;
+
+ if (walk->next || *str)
+ fprintf (fp, "\n%*s", indent, "");
+ else if (line_break)
+ fputc ('\n', fp);
+ }
+
+ print_wchar (str, 0, fp);
+ line_left -= wchar_strlen (str);
+ }
+}
+
+static int
+_str_list_match_node (const StrList* list, const wchar_t* str)
+{
+ if (wchar_strcasecmp (list->str, str) == 0)
+ return 2;
+ if (wchar_strncasecmp (list->str, str, wchar_strlen (str)) == 0)
+ return 1;
+ return 0;
+}
+
+int
+str_list_match_node (const StrList* list, const char* str)
+{
+ wchar_t* wc_str = gettext_to_wchar (str); /* FIXME */
+ int status;
+
+ status = _str_list_match_node (list, wc_str);
+ free (wc_str);
+
+ return status;
+}
+
+/* returns: 2 for full match
+ 1 for partial match
+ 0 for no match
+ */
+int
+str_list_match_any (const StrList* list, const char* str)
+{
+ const StrList* walk;
+ int best_status = 0;
+ wchar_t* wc_str = gettext_to_wchar (str);
+
+ for (walk = list; walk; walk = walk->next) {
+ int this_status = _str_list_match_node (walk, wc_str);
+ if (this_status > best_status)
+ best_status = this_status;
+ }
+
+ free (wc_str);
+ return best_status;
+}
+
+StrList*
+str_list_match (const StrList* list, const char* str)
+{
+ const StrList* walk;
+ const StrList* partial_match = NULL;
+ int ambiguous = 0;
+ wchar_t* wc_str = gettext_to_wchar (str);
+
+ for (walk = list; walk; walk = walk->next) {
+ switch (_str_list_match_node (walk, wc_str)) {
+ case 2:
+ free (wc_str);
+ return (StrList*) walk;
+
+ case 1:
+ if (partial_match)
+ ambiguous = 1;
+ partial_match = walk;
+ }
+ }
+
+ free (wc_str);
+ return ambiguous ? NULL : (StrList*) partial_match;
+}
+
+int
+str_list_length (const StrList* list)
+{
+ int length = 0;
+ const StrList* walk;
+
+ for (walk = list; walk; walk = walk->next)
+ length++;
+
+ return length;
+}
diff --git a/parted/strlist.h b/parted/strlist.h
new file mode 100644
index 0000000..f9c4183
--- /dev/null
+++ b/parted/strlist.h
@@ -0,0 +1,66 @@
+/*
+ parted - a frontend to libparted
+ Copyright (C) 1999-2001, 2007, 2009-2014, 2019-2023 Free Software
+ Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef STRLIST_H_INCLUDED
+#define STRLIST_H_INCLUDED
+
+#include <wchar.h>
+
+#ifndef ENABLE_NLS
+# define L_(str) str
+# ifdef wchar_t
+# undef wchar_t
+# endif
+# define wchar_t char
+#endif
+
+typedef struct _StrList StrList;
+struct _StrList {
+ StrList* next;
+ const wchar_t* str;
+};
+
+extern char* language;
+extern char* gettext_charset;
+extern char* term_charset;
+
+extern StrList* str_list_create (const char* first, ...);
+extern StrList* str_list_create_unique (const char* first, ...);
+extern void str_list_destroy (StrList* list);
+extern void str_list_destroy_node (StrList* list);
+
+extern StrList* str_list_duplicate (const StrList* list);
+extern StrList* str_list_duplicate_node (const StrList* list);
+extern StrList* str_list_insert (StrList* list, const char* str);
+extern StrList* str_list_append (StrList* list, const char* str);
+extern StrList* str_list_append_unique (StrList* list, const char* str);
+extern StrList* str_list_join (StrList* a, StrList* b);
+extern char* str_list_convert (const StrList* list);
+extern char* str_list_convert_node (const StrList* list);
+
+extern void str_list_print (const StrList* list, FILE *fp);
+extern void str_list_print_wrap (const StrList* list, int line_length,
+ int offset, int indent, FILE *fp);
+extern int str_list_match_any (const StrList* list, const char* str);
+extern int str_list_match_node (const StrList* list, const char* str);
+extern StrList* str_list_match (const StrList* list, const char* str);
+
+extern int str_list_length (const StrList* list) _GL_ATTRIBUTE_PURE;
+
+#endif /* STRLIST_H_INCLUDED */
diff --git a/parted/table.c b/parted/table.c
new file mode 100644
index 0000000..63c0e6a
--- /dev/null
+++ b/parted/table.c
@@ -0,0 +1,245 @@
+/*
+ * TODO: - make right and centered alignment possible
+ */
+/*
+ parted - a frontend to libparted
+ Copyright (C) 2006-2014, 2019-2023 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+
+#include <config.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <assert.h>
+#include <wchar.h>
+#include <string.h>
+
+#include "xalloc.h"
+#include "strlist.h"
+
+#ifdef ENABLE_NLS
+# define L_(str) L##str
+#else
+# define L_(str) str
+# define wcslen strlen
+# define wcswidth strnlen
+# define wcscat strcat
+# define wcsdup xstrdup
+#endif
+
+
+static const unsigned int MAX_WIDTH = 512;
+static const wchar_t* DELIMITER = L_(" ");
+static const wchar_t* COLSUFFIX = L_("\n");
+
+typedef struct
+{
+ unsigned int ncols;
+ unsigned int nrows;
+ wchar_t*** rows;
+ int* widths;
+} Table;
+
+
+Table* table_new(int ncols)
+{
+ assert ( ncols >= 0 );
+
+ Table *t = xmalloc (sizeof(*t));
+
+ t->ncols = ncols;
+ t->nrows = 0;
+ t->rows = (wchar_t***)NULL;
+ t->widths = NULL;
+
+ return t;
+}
+
+
+void table_destroy (Table* t)
+{
+ unsigned int r, c;
+
+ assert (t);
+ assert (t->ncols > 0);
+
+ for (r = 0; r < t->nrows; ++r)
+ {
+ for (c = 0; c < t->ncols; ++c)
+ free (t->rows[r][c]);
+ free (t->rows[r]);
+ }
+
+ free (t->rows);
+ free (t->widths);
+ free (t);
+}
+
+
+static int max (int x, int y)
+{
+ return x > y ? x : y;
+}
+
+
+static void table_calc_column_widths (Table* t)
+{
+ unsigned int r, c;
+
+ assert(t);
+ assert(t->ncols > 0);
+
+ if (!t->widths)
+ t->widths = xmalloc (t->ncols * sizeof(t->widths[0]));
+
+ for (c = 0; c < t->ncols; ++c)
+ t->widths[c] = 0;
+
+ for (r = 0; r < t->nrows; ++r)
+ for (c = 0; c < t->ncols; ++c)
+ {
+ t->widths[c] = max ( t->widths[c],
+ wcswidth(t->rows[r][c],
+ MAX_WIDTH) );
+ }
+}
+
+
+/*
+ * add a row which is a string array of ncols elements.
+ * 'row' will get freed by table_destroy; you must not free it
+ * yourself.
+ */
+void table_add_row (Table* t, wchar_t** row)
+{
+ assert(t);
+
+ /*unsigned int i;
+ fputs ("adding row: ", stdout);
+ for (i = 0; i < t->ncols; ++i)
+ printf("[%s]", row[i]);
+ putchar ('\n');*/
+
+ t->rows = xrealloc (t->rows, (t->nrows + 1) * sizeof(*(t->rows)));
+
+ t->rows[t->nrows] = row;
+
+ ++t->nrows;
+
+ table_calc_column_widths (t);
+}
+
+
+void table_add_row_from_strlist (Table* t, StrList* list)
+{
+ wchar_t** row = xmalloc (str_list_length(list) * sizeof(*row));
+ int i = 0;
+
+ while (list)
+ {
+ row[i] = wcsdup (list->str);
+ if (row[i] == NULL)
+ xalloc_die ();
+
+
+ list = list->next;
+ ++i;
+ }
+
+ table_add_row (t, row);
+}
+
+
+/* render a row */
+static void table_render_row (Table* t, int rownum, int ncols, wchar_t** s)
+{
+ wchar_t** row = t->rows[rownum];
+ size_t len = 1, i;
+ size_t newsize;
+
+ assert(t);
+ assert(s != NULL);
+
+ for (i = 0; i < ncols; ++i)
+ len += t->widths[i] + wcslen(DELIMITER);
+
+ len += wcslen(COLSUFFIX);
+
+ newsize = (wcslen(*s) + len + 1) * sizeof(wchar_t);
+ *s = xrealloc (*s, newsize);
+
+ for (i = 0; i < ncols; ++i)
+ {
+ wcscat (*s, row[i]);
+ if (ncols <= i + 1)
+ break;
+
+ int j;
+ int nspaces = max(t->widths[i] - wcswidth(row[i], MAX_WIDTH),
+ 0);
+ wchar_t* pad = xmalloc ((nspaces + 1) * sizeof(*pad));
+
+ for (j = 0; j < nspaces; ++j)
+ pad[j] = L' ';
+
+ pad[nspaces] = L_('\0');
+
+ wcscat (*s, pad);
+ if (i + 1 < ncols)
+ wcscat (*s, DELIMITER);
+
+ free (pad);
+ }
+
+ /* Remove any trailing blanks. */
+ wchar_t *p = *s;
+ size_t k = wcslen (p);
+ while (k && p[k-1] == L_(' '))
+ --k;
+ p[k] = L_('\0');
+
+
+ wcscat (*s, COLSUFFIX);
+}
+
+
+/*
+ * Render the rows.
+ * \p s must be a null-terminated string.
+ */
+static void table_render_rows (Table* t, wchar_t** s)
+{
+ unsigned int i;
+
+ assert (**s == L_('\0'));
+ for (i = 0; i < t->nrows; ++i)
+ table_render_row (t, i, t->ncols, s);
+}
+
+/*
+ * Render the table to a string.
+ * You are responsible for freeing the returned string.
+ */
+wchar_t* table_render(Table* t)
+{
+ wchar_t* s = xmalloc (sizeof(*s));
+
+ *s = L_('\0');
+ table_render_rows (t, &s);
+ return s;
+}
diff --git a/parted/table.h b/parted/table.h
new file mode 100644
index 0000000..8c645d7
--- /dev/null
+++ b/parted/table.h
@@ -0,0 +1,52 @@
+/*
+ parted - a frontend to libparted
+ Copyright (C) 2006-2007, 2009-2014, 2019-2023 Free Software Foundation,
+ Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include <wchar.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <assert.h>
+
+#include "strlist.h"
+
+#ifdef ENABLE_NLS
+# include <wchar.h>
+#else
+# ifdef wchar_t
+# undef wchar_t
+# endif
+# define wchar_t char
+#endif
+
+
+/* opaque data type */
+typedef void Table;
+
+Table* table_new(int ncols);
+void table_destroy (Table* t);
+
+/*
+ * you must not free neither 'row' nor 'list'
+ * -- this will be done by table_destroy()
+ */
+void table_add_row (Table* t, wchar_t** row);
+void table_add_row_from_strlist (Table* t, StrList* list);
+
+wchar_t* table_render(Table* t);
diff --git a/parted/ui.c b/parted/ui.c
new file mode 100644
index 0000000..33a1808
--- /dev/null
+++ b/parted/ui.c
@@ -0,0 +1,1702 @@
+/*
+ parted - a frontend to libparted
+ Copyright (C) 1999-2002, 2006-2014, 2019-2023 Free Software Foundation,
+ Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include <config.h>
+
+#include <parted/parted.h>
+#include <parted/debug.h>
+
+#include <ctype.h>
+#include <signal.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <setjmp.h>
+#include <assert.h>
+#include <limits.h>
+#include <errno.h>
+
+#include "command.h"
+#include "strlist.h"
+#include "ui.h"
+#include "error.h"
+
+#define N_(String) String
+#if ENABLE_NLS
+# include <libintl.h>
+# include <locale.h>
+# define _(String) dgettext (PACKAGE, String)
+#else
+# define _(String) (String)
+#endif /* ENABLE_NLS */
+
+#ifdef HAVE_LIBREADLINE
+
+#ifdef HAVE_TERMCAP_H
+#include <termcap.h>
+#else
+extern int tgetnum (char* key);
+#endif
+
+#include <readline/readline.h>
+#include <readline/history.h>
+
+#ifndef HAVE_RL_COMPLETION_MATCHES
+#define rl_completion_matches completion_matches
+#endif
+
+#ifndef rl_compentry_func_t
+#define rl_compentry_func_t void
+#endif
+
+#endif /* HAVE_LIBREADLINE */
+
+#ifndef SA_SIGINFO
+# ifndef HAVE_SIGACTION
+
+struct sigaction {
+};
+
+static inline int
+sigaction (int signum, const struct* sigaction, struct* sigaction)
+{
+}
+
+# endif /* HAVE_SIGACTON */
+
+struct siginfo_t {
+ int si_code;
+};
+
+#endif /* SA_SIGINFO */
+
+#ifndef SEGV_MAPERR
+# define SEGV_MAPERR (INTMAX - 1)
+#endif
+
+#ifndef SEGV_ACCERR
+# define SEGV_ACCERR (INTMAX - 2)
+#endif
+
+#ifndef FPE_INTDIV
+# define FPE_INTDIV (INTMAX - 1)
+#endif
+
+#ifndef FPE_INTOVF
+# define FPE_INTOVF (INTMAX - 2)
+#endif
+
+#ifndef FPE_FLTDIV
+# define FPE_FLTDIV (INTMAX - 3)
+#endif
+
+#ifndef FPE_FLTOVF
+# define FPE_FLTOVF (INTMAX - 4)
+#endif
+
+#ifndef FPE_FLTUND
+# define FPE_FLTUND (INTMAX - 5)
+#endif
+
+#ifndef FPE_FLTRES
+# define FPE_FLTRES (INTMAX - 6)
+#endif
+
+#ifndef FPE_FLTINV
+# define FPE_FLTINV (INTMAX - 7)
+#endif
+
+#ifndef FPE_FLTSUB
+# define FPE_FLTSUB (INTMAX - 8)
+#endif
+
+#ifndef ILL_ILLOPC
+# define ILL_ILLOPC (INTMAX - 1)
+#endif
+
+#ifndef ILL_ILLOPN
+# define ILL_ILLOPN (INTMAX - 2)
+#endif
+
+#ifndef ILL_ILLADR
+# define ILL_ILLADR (INTMAX - 3)
+#endif
+
+#ifndef ILL_ILLTRP
+# define ILL_ILLTRP (INTMAX - 4)
+#endif
+
+#ifndef ILL_PRVOPC
+# define ILL_PRVOPC (INTMAX - 5)
+#endif
+
+#ifndef ILL_PRVREG
+# define ILL_PRVREG (INTMAX - 6)
+#endif
+
+#ifndef ILL_COPROC
+# define ILL_COPROC (INTMAX - 7)
+#endif
+
+#ifndef ILL_BADSTK
+# define ILL_BADSTK (INTMAX - 8)
+#endif
+
+const char* prog_name = "GNU Parted " VERSION "\n";
+
+static const char* banner_msg = N_(
+"Welcome to GNU Parted! Type 'help' to view a list of commands.\n");
+
+static const char* usage_msg = N_(
+"Usage: parted [OPTION]... [DEVICE [COMMAND [PARAMETERS]...]...]\n"
+"Apply COMMANDs with PARAMETERS to DEVICE. If no COMMAND(s) are given, "
+"run in\ninteractive mode.\n");
+
+static const char* bug_msg = N_(
+"\n\nYou found a bug in GNU Parted! Here's what you have to do:\n\n"
+"Don't panic! The bug has most likely not affected any of your data.\n"
+"Help us to fix this bug by doing the following:\n\n"
+"Check whether the bug has already been fixed by checking\n"
+"the last version of GNU Parted that you can find at:\n\n"
+"\thttp://ftp.gnu.org/gnu/parted/\n\n"
+"Please check this version prior to bug reporting.\n\n"
+"If this has not been fixed yet or if you don't know how to check,\n"
+"please visit the GNU Parted website:\n\n"
+"\thttp://www.gnu.org/software/parted\n\n"
+"for further information.\n\n"
+"Your report should contain the version of this release (%s)\n"
+"along with the error message below, the output of\n\n"
+"\tparted DEVICE unit co print unit s print\n\n"
+"and the following history of commands you entered.\n"
+"Also include any additional information about your setup you\n"
+"consider important.\n");
+
+#define MAX_WORDS 1024
+
+static StrList* command_line;
+static Command** commands;
+static StrList* ex_opt_str [64];
+static StrList* on_list;
+static StrList* off_list;
+static StrList* on_off_list;
+
+static StrList* align_opt_list;
+static StrList* align_min_list;
+static StrList* align_opt_min_list;
+
+static StrList* fs_type_list;
+static StrList* disk_type_list;
+
+static struct {
+ const StrList* possibilities;
+ const StrList* cur_pos;
+ int in_readline;
+ sigjmp_buf jmp_state;
+} readline_state;
+
+static struct sigaction sig_segv;
+static struct sigaction sig_int;
+static struct sigaction sig_fpe;
+static struct sigaction sig_ill;
+
+volatile int got_ctrl_c = 0; /* used in exception_handler */
+
+int
+screen_width ()
+{
+ int width = 0;
+
+ if (opt_script_mode || pretend_input_tty)
+ return 32768; /* no wrapping ;) */
+
+/* HACK: don't specify termcap separately - it'll annoy the users. */
+#ifdef HAVE_LIBREADLINE
+ width = tgetnum ((char *) "co");
+#endif
+
+ if (width <= 0)
+ width = 80;
+
+ return width;
+}
+
+void
+wipe_line ()
+{
+ if (opt_script_mode)
+ return;
+
+ /* yuck */
+ fputs ("\r "
+ " \r", stdout);
+}
+
+#ifdef HAVE_LIBREADLINE
+/* returns matching commands for text */
+static char*
+command_generator (char* text, int state)
+{
+ if (!state)
+ readline_state.cur_pos = readline_state.possibilities;
+
+ while (readline_state.cur_pos) {
+ const StrList* cur = readline_state.cur_pos;
+ readline_state.cur_pos = cur->next;
+ if (str_list_match_node (cur, text))
+ return str_list_convert_node (cur);
+ }
+
+ return NULL;
+}
+
+/* completion function for readline() */
+char**
+complete_function (char* text, int start, int end)
+{
+ return rl_completion_matches (text,
+ (rl_compentry_func_t*) command_generator);
+}
+
+static void
+_add_history_unique (const char* line)
+{
+ HIST_ENTRY* last_entry = current_history ();
+ if (!strlen (line))
+ return;
+ if (!last_entry || strcmp (last_entry->line, line))
+ add_history ((char*) line);
+}
+
+/* Prints command history, to be used before aborting */
+static void
+_dump_history ()
+{
+ int i = 0;
+ HIST_ENTRY** all_entries = history_list ();
+
+ fputs (_("\nCommand History:\n"), stdout);
+ while (all_entries[i]) {
+ puts(all_entries[i++]->line);
+ }
+}
+
+#else
+
+/* Print nothing because Readline is absent. */
+static inline void
+_dump_history (void)
+{
+}
+
+#endif /* HAVE_LIBREADLINE */
+
+/* Resets the environment by jumping to the initial state
+ * saved during ui intitialisation.
+ * Pass 1 as the parameter if you want to quit parted,
+ * 0 if you just want to reset to the command prompt.
+ */
+static void
+reset_env (int quit)
+{
+ int in_readline = readline_state.in_readline;
+
+ readline_state.in_readline = 0;
+
+ if (in_readline) {
+ putchar ('\n');
+ if (quit)
+ exit (EXIT_SUCCESS);
+
+ siglongjmp (readline_state.jmp_state, 1);
+ }
+}
+
+/* Signal handler for SIGINT using 'sigaction'. */
+static void
+sa_sigint_handler (int signum, siginfo_t* info, void *ucontext)
+{
+ if (info)
+ sigaction (SIGINT, &sig_int, NULL);
+
+ got_ctrl_c = 1;
+ reset_env (0);
+}
+
+/* Signal handler for SIGSEGV using 'sigaction'. */
+static void
+sa_sigsegv_handler (int signum, siginfo_t* info, void* ucontext)
+{
+ fprintf (stderr, bug_msg, VERSION);
+ _dump_history ();
+
+ if (!info)
+ abort ();
+
+ sigaction (SIGSEGV, &sig_segv, NULL);
+
+ switch (info->si_code) {
+
+ case SEGV_MAPERR:
+ fputs(_("\nError: SEGV_MAPERR (Address not mapped "
+ "to object)\n"), stdout);
+ PED_ASSERT(0); /* Force a backtrace */
+ break;
+
+ case SEGV_ACCERR:
+ fputs(_("\nError: SEGV_ACCERR (Invalid permissions "
+ "for mapped object)\n"), stdout);
+ break;
+
+ default:
+ fputs(_("\nError: A general SIGSEGV signal was "
+ "encountered.\n"), stdout);
+ PED_ASSERT(0); /* Force a backtrace */
+ break;
+ }
+
+ abort ();
+}
+
+/* Signal handler for SIGFPE using 'sigaction'. */
+static void
+sa_sigfpe_handler (int signum, siginfo_t* info, void* ucontext)
+{
+ fprintf (stderr, bug_msg, VERSION);
+ _dump_history ();
+
+ if (!info)
+ abort ();
+
+ sigaction (SIGFPE, &sig_fpe, NULL);
+
+ switch (info->si_code) {
+
+ case FPE_INTDIV:
+ fputs(_("\nError: FPE_INTDIV (Integer: "
+ "divide by zero)"), stdout);
+ break;
+
+ case FPE_INTOVF:
+ fputs(_("\nError: FPE_INTOVF (Integer: "
+ "overflow)"), stdout);
+ break;
+
+ case FPE_FLTDIV:
+ fputs(_("\nError: FPE_FLTDIV (Float: "
+ "divide by zero)"), stdout);
+ break;
+
+ case FPE_FLTOVF:
+ fputs(_("\nError: FPE_FLTOVF (Float: "
+ "overflow)"), stdout);
+ break;
+
+ case FPE_FLTUND:
+ fputs(_("\nError: FPE_FLTUND (Float: "
+ "underflow)"), stdout);
+ break;
+
+ case FPE_FLTRES:
+ fputs(_("\nError: FPE_FLTRES (Float: "
+ "inexact result)"), stdout);
+ break;
+
+ case FPE_FLTINV:
+ fputs(_("\nError: FPE_FLTINV (Float: "
+ "invalid operation)"), stdout);
+ break;
+
+ case FPE_FLTSUB:
+ fputs(_("\nError: FPE_FLTSUB (Float: "
+ "subscript out of range)"), stdout);
+ break;
+
+ default:
+ fputs(_("\nError: A general SIGFPE signal "
+ "was encountered."), stdout);
+ break;
+
+ }
+
+ abort ();
+}
+
+/* Signal handler for SIGILL using 'sigaction'. */
+static void
+sa_sigill_handler (int signum, siginfo_t* info, void* ucontext)
+{
+ fprintf (stderr, bug_msg, VERSION);
+ _dump_history ();
+
+ if (!info)
+ abort();
+
+ sigaction (SIGILL, &sig_ill, NULL);
+
+ switch (info->si_code) {
+
+ case ILL_ILLOPC:
+ fputs(_("\nError: ILL_ILLOPC "
+ "(Illegal Opcode)"), stdout);
+ break;
+
+ case ILL_ILLOPN:
+ fputs(_("\nError: ILL_ILLOPN "
+ "(Illegal Operand)"), stdout);
+ break;
+
+ case ILL_ILLADR:
+ fputs(_("\nError: ILL_ILLADR "
+ "(Illegal addressing mode)"), stdout);
+ break;
+
+ case ILL_ILLTRP:
+ fputs(_("\nError: ILL_ILLTRP "
+ "(Illegal Trap)"), stdout);
+ break;
+
+ case ILL_PRVOPC:
+ fputs(_("\nError: ILL_PRVOPC "
+ "(Privileged Opcode)"), stdout);
+ break;
+
+ case ILL_PRVREG:
+ fputs(_("\nError: ILL_PRVREG "
+ "(Privileged Register)"), stdout);
+ break;
+
+ case ILL_COPROC:
+ fputs(_("\nError: ILL_COPROC "
+ "(Coprocessor Error)"), stdout);
+ break;
+
+ case ILL_BADSTK:
+ fputs(_("\nError: ILL_BADSTK "
+ "(Internal Stack Error)"), stdout);
+ break;
+
+ default:
+ fputs(_("\nError: A general SIGILL "
+ "signal was encountered."), stdout);
+ break;
+ }
+
+ abort ();
+}
+
+#ifndef SA_SIGINFO
+
+static void
+mask_signal()
+{
+ sigset_t curr;
+ sigset_t prev;
+
+ sigfillset(&curr);
+ sigprocmask(SIG_SETMASK, &curr, &prev);
+}
+
+/* Signal handler for SIGINT using 'signal'. */
+static void
+s_sigint_handler (int signum)
+{
+ signal (SIGINT, &s_sigint_handler);
+ mask_signal ();
+ sa_sigint_handler (signum, NULL, NULL);
+}
+
+/* Signal handler for SIGILL using 'signal'. */
+static void
+s_sigill_handler (int signum)
+{
+ signal (SIGILL, &s_sigill_handler);
+ mask_signal ();
+ sa_sigill_handler (signum, NULL, NULL);
+}
+
+/* Signal handler for SIGSEGV using 'signal'. */
+static void
+s_sigsegv_handler (int signum)
+{
+ signal (SIGSEGV, &s_sigsegv_handler);
+ mask_signal ();
+ sa_sigsegv_handler (signum, NULL, NULL);
+}
+
+/* Signal handler for SIGFPE using 'signal'. */
+static void
+s_sigfpe_handler (int signum)
+{
+ signal (SIGFPE, &s_sigfpe_handler);
+ mask_signal ();
+ sa_sigfpe_handler (signum, NULL, NULL);
+}
+#endif
+
+static char*
+_readline (const char* prompt, const StrList* possibilities)
+{
+ char* line;
+
+ readline_state.possibilities = possibilities;
+ readline_state.cur_pos = NULL;
+ readline_state.in_readline = 1;
+
+ if (sigsetjmp (readline_state.jmp_state,1))
+ return NULL;
+
+ wipe_line ();
+#ifdef HAVE_LIBREADLINE
+ if (!opt_script_mode) {
+ line = readline (prompt);
+ if (line)
+ _add_history_unique (line);
+ } else
+#endif
+ {
+ fputs (prompt, stdout);
+ fflush (stdout);
+ line = (char*) malloc (256);
+ if (fgets (line, 256, stdin) && strcmp (line, "") != 0) {
+#ifndef HAVE_LIBREADLINE
+ /* Echo the input line, to be consistent with
+ how readline-5.2 works. */
+ fputs (line, stdout);
+ fflush (stdout);
+#endif
+ /* kill trailing NL */
+ if (strlen (line))
+ line [strlen (line) - 1] = 0;
+ } else {
+ free (line);
+ line = NULL;
+ }
+ }
+
+ readline_state.in_readline = 0;
+ return line;
+}
+
+static PedExceptionOption _GL_ATTRIBUTE_PURE
+option_get_next (PedExceptionOption options, PedExceptionOption current)
+{
+ PedExceptionOption i;
+
+ if (current == 0)
+ i = PED_EXCEPTION_OPTION_FIRST;
+ else
+ i = current * 2;
+
+ for (; i <= options; i *= 2) {
+ if (options & i)
+ return i;
+ }
+ return 0;
+}
+
+static void
+_print_exception_text (PedException* ex)
+{
+ StrList* text;
+
+ wipe_line ();
+
+ if (ex->type == PED_EXCEPTION_BUG) {
+ fprintf (stderr, bug_msg, VERSION);
+ text = str_list_create ("\n", ex->message, "\n\n", NULL);
+ } else {
+ text = str_list_create (
+ _(ped_exception_get_type_string (ex->type)),
+ ": ", ex->message, "\n", NULL);
+ }
+
+ str_list_print_wrap (text, screen_width (), 0, 0, stderr);
+ str_list_destroy (text);
+}
+
+static PedExceptionOption
+exception_handler (PedException* ex)
+{
+ PedExceptionOption opt;
+
+ _print_exception_text (ex);
+
+ /* only one choice? Take it ;-) */
+ opt = option_get_next (ex->options, 0);
+ if (!option_get_next (ex->options, opt))
+ return opt;
+
+ /* script-mode and fix? */
+ int fix_is_an_option = (ex->options & PED_EXCEPTION_FIX);
+ if (opt_script_mode && opt_fix_mode && fix_is_an_option) {
+ printf ("Fixing, due to --fix\n");
+ return PED_EXCEPTION_FIX;
+ }
+
+ /* script-mode: don't handle the exception */
+ if (opt_script_mode || (!isatty (0) && !pretend_input_tty))
+ return PED_EXCEPTION_UNHANDLED;
+
+ got_ctrl_c = 0;
+
+ opt = command_line_get_ex_opt ("", ex->options);
+
+ return opt;
+}
+
+void
+command_line_push_word (const char* word)
+{
+ command_line = str_list_append (command_line, word);
+}
+
+char*
+command_line_pop_word ()
+{
+ char* result;
+ StrList* next;
+
+ PED_ASSERT (command_line != NULL);
+
+ result = str_list_convert_node (command_line);
+ next = command_line->next;
+
+ str_list_destroy_node (command_line);
+ command_line = next;
+ return result;
+}
+
+void
+command_line_flush ()
+{
+ str_list_destroy (command_line);
+ command_line = NULL;
+}
+
+char*
+command_line_peek_word ()
+{
+ if (command_line)
+ return str_list_convert_node (command_line);
+ else
+ return NULL;
+}
+
+int
+command_line_get_word_count ()
+{
+ return str_list_length (command_line);
+}
+
+static int _GL_ATTRIBUTE_PURE
+_str_is_spaces (const char* str)
+{
+ while (isspace (*str))
+ str++;
+
+ return *str == 0;
+}
+
+/* "multi_word mode" is the "normal" mode... many words can be typed,
+ * delimited by spaces, etc.
+ * In single-word mode, only one word is parsed per line.
+ * Leading and trailing spaces are removed. For example: " a b c "
+ * is a single word "a b c". The motivation for this mode is partition
+ * names, etc. In single-word mode, the empty string is a word.
+ * (but not in multi-word mode).
+ */
+void
+command_line_push_line (const char* line, int multi_word)
+{
+ int quoted = 0;
+ int quotes_empty = 0;
+ char quote_char = 0;
+ char this_word [256];
+ int i;
+
+ do {
+ while (*line == ' ')
+ line++;
+
+ i = 0;
+ for (; *line && i < sizeof (this_word) - 1; line++) {
+ if (*line == ' ' && !quoted) {
+ if (multi_word)
+ break;
+
+ /* single word: check for trailing spaces + eol */
+ if (_str_is_spaces (line))
+ break;
+ }
+
+ if (!quoted && strchr ("'\"", *line)) {
+ quoted = 1;
+ quote_char = *line;
+ continue;
+ }
+
+ if (quoted && *line == quote_char) {
+ quoted = 0;
+ /* allow empty partition name in script mode */
+ if (!i)
+ quotes_empty = 1;
+ continue;
+ }
+
+ /* hack: escape characters */
+ if (quoted && line[0] == '\\' && line[1])
+ line++;
+
+ quotes_empty = 0;
+ this_word [i++] = *line;
+ }
+ if (i || !multi_word || quotes_empty) {
+ quotes_empty = 0;
+ this_word [i] = 0;
+ command_line_push_word (this_word);
+ }
+ } while (*line && multi_word);
+}
+
+static char*
+realloc_and_cat (char* str, const char* append)
+{
+ int length = strlen (str) + strlen (append) + 1;
+ char* new_str = realloc (str, length);
+
+ PED_ASSERT(new_str != NULL);
+
+ strcat (new_str, append);
+ return new_str;
+}
+
+static char*
+_construct_prompt (const char* head, const char* def,
+ const StrList* possibilities)
+{
+ PED_ASSERT(head != NULL);
+ char* prompt = strdup (head);
+ PED_ASSERT(prompt != NULL);
+
+ if (def && possibilities)
+ PED_ASSERT (str_list_match_any (possibilities, def));
+
+ if (possibilities && str_list_length (possibilities) < 8) {
+ const StrList* walk;
+
+ if (strlen (prompt))
+ prompt = realloc_and_cat (prompt, " ");
+
+ for (walk = possibilities; walk; walk = walk->next) {
+ if (walk != possibilities)
+ prompt = realloc_and_cat (prompt, "/");
+
+ if (def && str_list_match_node (walk, def) == 2) {
+ prompt = realloc_and_cat (prompt, "[");
+ prompt = realloc_and_cat (prompt, def);
+ prompt = realloc_and_cat (prompt, "]");
+ } else {
+ char* text = str_list_convert_node (walk);
+ prompt = realloc_and_cat (prompt, text);
+ free (text);
+ }
+ }
+ prompt = realloc_and_cat (prompt, "? ");
+ } else if (def) {
+ if (strlen (prompt))
+ prompt = realloc_and_cat (prompt, " ");
+ prompt = realloc_and_cat (prompt, "[");
+ prompt = realloc_and_cat (prompt, def);
+ prompt = realloc_and_cat (prompt, "]? ");
+ } else {
+ if (strlen (prompt))
+ prompt = realloc_and_cat (prompt, " ");
+ }
+
+ return prompt;
+}
+
+void
+command_line_prompt_words (const char* prompt, const char* def,
+ const StrList* possibilities, int multi_word)
+{
+ char* line;
+ char* real_prompt;
+ char* _def = (char*) def;
+ int _def_needs_free = 0;
+
+ if (!def && str_list_length (possibilities) == 1) {
+ _def = str_list_convert_node (possibilities);
+ _def_needs_free = 1;
+ }
+
+ if (opt_script_mode) {
+ if (_def) {
+ command_line_push_line (_def, 0);
+ if (_def_needs_free)
+ free (_def);
+ }
+ return;
+ }
+
+ do {
+ real_prompt = _construct_prompt (prompt, _def, possibilities);
+ line = _readline (real_prompt, possibilities);
+ free (real_prompt);
+ if (!line) {
+ /* readline returns NULL to indicate EOF.
+ Treat that like an interrupt. */
+ got_ctrl_c = 1;
+ break;
+ }
+
+ if (!strlen (line)) {
+ if (_def)
+ command_line_push_line (_def, 0);
+ } else {
+ command_line_push_line (line, multi_word);
+ }
+ free (line);
+ } while (!command_line_get_word_count () && !_def);
+
+ if (_def_needs_free)
+ free (_def);
+}
+
+/**
+ * Get a word from command line.
+ *
+ * \param possibilities a StrList of valid strings, NULL if all are valid.
+ * \param multi_word whether multiple words are allowed.
+ *
+ * \return The word(s), or NULL if empty.
+ */
+char*
+command_line_get_word (const char* prompt, const char* def,
+ const StrList* possibilities, int multi_word)
+{
+ do {
+ if (command_line_get_word_count ()) {
+ char* result = command_line_pop_word ();
+ StrList* result_node;
+
+ if (!possibilities)
+ return result;
+
+ result_node = str_list_match (possibilities, result);
+ if (result_node == NULL)
+ error (0, 0, _("invalid token: %s"), result);
+ free (result);
+ if (result_node)
+ return str_list_convert_node (result_node);
+
+ command_line_flush ();
+ if (opt_script_mode)
+ return NULL;
+ }
+
+ command_line_prompt_words (prompt, def, possibilities,
+ multi_word);
+ if (got_ctrl_c) {
+ got_ctrl_c = 0;
+ return NULL;
+ }
+ } while (command_line_get_word_count ());
+
+ return NULL;
+}
+
+int
+command_line_get_integer (const char* prompt, int* value)
+{
+ char def_str [20];
+ char* input;
+ long ret;
+
+ snprintf (def_str, 20, "%d", *value);
+ input = command_line_get_word (prompt, *value ? def_str : NULL,
+ NULL, 1);
+ if (!input)
+ return 0;
+
+ errno = 0;
+ ret = strtol (input, (char**) NULL, 10);
+ if (errno)
+ goto error;
+
+ if ((ret > INT_MAX) || (ret < INT_MIN))
+ goto error;
+ else
+ *value = (int) ret;
+
+ free (input);
+ return 1;
+
+error:
+ free (input);
+ return 0;
+}
+
+int
+command_line_get_sector (const char* prompt, PedDevice* dev, PedSector* value,
+ PedGeometry** range, char** raw_input)
+{
+ char* def_str;
+ char* input;
+ int valid;
+
+ def_str = ped_unit_format (dev, *value);
+ input = command_line_get_word (prompt, *value ? def_str : NULL,
+ NULL, 1);
+
+ /* def_str might have rounded *value a little bit. If the user picked
+ * the default, make sure the selected sector is identical to the
+ * default.
+ */
+ if (input && *value && !strcmp (input, def_str)) {
+ if (range) {
+ *range = ped_geometry_new (dev, *value, 1);
+ free (def_str);
+ free (input);
+ return *range != NULL;
+ }
+
+ free (def_str);
+ free (input);
+ return 1;
+ }
+
+ free (def_str);
+ if (!input) {
+ *value = 0;
+ if (range)
+ *range = NULL;
+ return 0;
+ }
+
+ valid = ped_unit_parse (input, dev, value, range);
+
+ if (raw_input)
+ *raw_input = input;
+ else
+ free (input);
+ return valid;
+}
+
+int
+command_line_get_state (const char* prompt, int* value)
+{
+ char* def_word;
+ char* input;
+
+ if (*value)
+ def_word = str_list_convert_node (on_list);
+ else
+ def_word = str_list_convert_node (off_list);
+ input = command_line_get_word (prompt, def_word, on_off_list, 1);
+ free (def_word);
+ if (!input)
+ return 0;
+ if (str_list_match_any (on_list, input))
+ *value = 1;
+ else
+ *value = 0;
+ free (input);
+ return 1;
+}
+
+int
+command_line_get_device (const char* prompt, PedDevice** value)
+{
+ char *def_dev_name = *value ? (*value)->path : NULL;
+ char *dev_name = command_line_get_word (prompt, def_dev_name, NULL, 1);
+ if (!dev_name)
+ return 0;
+
+ PedDevice *dev = ped_device_get (dev_name);
+ free (dev_name);
+ if (!dev)
+ return 0;
+
+ *value = dev;
+ return 1;
+}
+
+int
+command_line_get_disk (const char* prompt, PedDisk** value)
+{
+ PedDevice* dev = *value ? (*value)->dev : NULL;
+
+ if (!command_line_get_device (prompt, &dev))
+ return 0;
+
+ assert (*value);
+ if (dev != (*value)->dev) {
+ PedDisk* new_disk = ped_disk_new (dev);
+ if (!new_disk)
+ return 0;
+ *value = new_disk;
+ }
+ return 1;
+}
+
+int
+command_line_get_partition (const char* prompt, PedDisk* disk,
+ PedPartition** value)
+{
+ PedPartition* part;
+ int ret;
+
+ /* Flawed logic, doesn't seem to work?!
+ check = ped_disk_next_partition (disk, part);
+ part = ped_disk_next_partition (disk, check);
+
+ if (part == NULL) {
+
+ *value = check;
+ printf (_("The (only) primary partition has "
+ "been automatically selected\n"));
+ return 1;
+
+ } else {
+ */
+ int num = (*value) ? (*value)->num : 0;
+
+ ret = command_line_get_integer (prompt, &num);
+ if ((!ret) || (num < 0)) {
+ ped_exception_throw (PED_EXCEPTION_ERROR,
+ PED_EXCEPTION_CANCEL,
+ _("Expecting a partition number."));
+ return 0;
+ }
+
+ part = ped_disk_get_partition (disk, num);
+
+ if (!part) {
+ ped_exception_throw (PED_EXCEPTION_ERROR,
+ PED_EXCEPTION_CANCEL,
+ _("Partition doesn't exist."));
+ return 0;
+ }
+
+ *value = part;
+ return 1;
+ //}
+}
+
+int
+command_line_get_fs_type (const char* prompt, const PedFileSystemType*(* value))
+{
+ char* fs_type_name;
+ PedFileSystemType* fs_type;
+
+ fs_type_name = command_line_get_word (prompt,
+ *value ? (*value)->name : NULL,
+ fs_type_list, 1);
+ if (!fs_type_name) {
+ ped_exception_throw (PED_EXCEPTION_ERROR, PED_EXCEPTION_CANCEL,
+ _("Expecting a file system type."));
+ return 0;
+ }
+
+ fs_type = ped_file_system_type_get (fs_type_name);
+ if (!fs_type) {
+ ped_exception_throw (PED_EXCEPTION_ERROR, PED_EXCEPTION_CANCEL,
+ _("Unknown file system type \"%s\"."),
+ fs_type_name);
+ free (fs_type_name);
+ return 0;
+ }
+
+ free (fs_type_name);
+ *value = fs_type;
+ return 1;
+}
+
+int
+command_line_get_disk_type (const char* prompt, const PedDiskType*(* value))
+{
+ char* disk_type_name;
+
+ disk_type_name = command_line_get_word (prompt,
+ *value ? (*value)->name : NULL,
+ disk_type_list, 1);
+ if (!disk_type_name) {
+ ped_exception_throw (PED_EXCEPTION_ERROR, PED_EXCEPTION_CANCEL,
+ _("Expecting a disk label type."));
+ return 0;
+ }
+
+ *value = ped_disk_type_get (disk_type_name);
+ free (disk_type_name);
+ PED_ASSERT (*value != NULL);
+ return 1;
+}
+
+int
+command_line_get_disk_flag (const char* prompt, const PedDisk* disk,
+ PedDiskFlag* flag)
+{
+ StrList* opts = NULL;
+ PedDiskFlag walk = 0;
+ char* flag_name;
+
+ while ( (walk = ped_disk_flag_next (walk)) ) {
+ if (ped_disk_is_flag_available (disk, walk)) {
+ const char* walk_name;
+
+ walk_name = ped_disk_flag_get_name (walk);
+ opts = str_list_append (opts, walk_name);
+ opts = str_list_append_unique (opts, _(walk_name));
+ }
+ }
+ if (opts == NULL)
+ {
+ ped_exception_throw (PED_EXCEPTION_ERROR,
+ PED_EXCEPTION_OK,
+ _("No flags supported"));
+
+ return 0;
+ }
+ flag_name = command_line_get_word (prompt, NULL, opts, 1);
+ str_list_destroy (opts);
+
+ if (flag_name) {
+ *flag = ped_disk_flag_get_by_name (flag_name);
+ free (flag_name);
+ return 1;
+ } else
+ return 0;
+}
+
+int
+command_line_get_part_flag (const char* prompt, const PedPartition* part,
+ PedPartitionFlag* flag)
+{
+ StrList* opts = NULL;
+ PedPartitionFlag walk = 0;
+ char* flag_name;
+
+ while ( (walk = ped_partition_flag_next (walk)) ) {
+ if (ped_partition_is_flag_available (part, walk)) {
+ const char* walk_name;
+
+ walk_name = ped_partition_flag_get_name (walk);
+ opts = str_list_append (opts, walk_name);
+ opts = str_list_append_unique (opts, _(walk_name));
+ }
+ }
+ if (opts == NULL)
+ {
+ ped_exception_throw (PED_EXCEPTION_ERROR,
+ PED_EXCEPTION_OK,
+ _("No flags supported"));
+
+ return 0;
+ }
+ flag_name = command_line_get_word (prompt, NULL, opts, 1);
+ str_list_destroy (opts);
+
+ if (flag_name) {
+ *flag = ped_partition_flag_get_by_name (flag_name);
+ free (flag_name);
+ return 1;
+ } else
+ return 0;
+}
+
+static int
+_can_create_primary (const PedDisk* disk)
+{
+ int i;
+
+ for (i = 1; i <= ped_disk_get_max_primary_partition_count (disk); i++) {
+ if (!ped_disk_get_partition (disk, i))
+ return 1;
+ }
+
+ return 0;
+}
+
+static int
+_can_create_extended (const PedDisk* disk)
+{
+ if (!_can_create_primary (disk))
+ return 0;
+
+ if (!ped_disk_type_check_feature (disk->type, PED_DISK_TYPE_EXTENDED))
+ return 0;
+
+ if (ped_disk_extended_partition (disk))
+ return 0;
+
+ return 1;
+}
+
+static int
+_can_create_logical (const PedDisk* disk)
+{
+ if (!ped_disk_type_check_feature (disk->type, PED_DISK_TYPE_EXTENDED))
+ return 0;
+
+ return ped_disk_extended_partition (disk) != 0;
+}
+
+int
+command_line_get_part_type (const char* prompt, const PedDisk* disk,
+ PedPartitionType* type)
+{
+ StrList* opts = NULL;
+ char* type_name;
+
+ if (_can_create_primary (disk)) {
+ opts = str_list_append_unique (opts, "primary");
+ opts = str_list_append_unique (opts, _("primary"));
+ }
+ if (_can_create_extended (disk)) {
+ opts = str_list_append_unique (opts, "extended");
+ opts = str_list_append_unique (opts, _("extended"));
+ }
+ if (_can_create_logical (disk)) {
+ opts = str_list_append_unique (opts, "logical");
+ opts = str_list_append_unique (opts, _("logical"));
+ }
+ if (!opts) {
+ ped_exception_throw (
+ PED_EXCEPTION_ERROR, PED_EXCEPTION_CANCEL,
+ _("Can't create any more partitions."));
+ return 0;
+ }
+
+ type_name = command_line_get_word (prompt, NULL, opts, 1);
+ str_list_destroy (opts);
+
+ if (!type_name) {
+ ped_exception_throw (
+ PED_EXCEPTION_ERROR, PED_EXCEPTION_CANCEL,
+ _("Expecting a partition type."));
+ return 0;
+ }
+
+ if (!strcmp (type_name, "primary")
+ || !strcmp (type_name, _("primary"))) {
+ *type = 0;
+ }
+ if (!strcmp (type_name, "extended")
+ || !strcmp (type_name, _("extended"))) {
+ *type = PED_PARTITION_EXTENDED;
+ }
+ if (!strcmp (type_name, "logical")
+ || !strcmp (type_name, _("logical"))) {
+ *type = PED_PARTITION_LOGICAL;
+ }
+
+ free (type_name);
+ return 1;
+}
+
+PedExceptionOption
+command_line_get_ex_opt (const char* prompt, PedExceptionOption options)
+{
+ StrList* options_strlist = NULL;
+ PedExceptionOption opt;
+ char* opt_name;
+
+ command_line_flush ();
+ for (opt = option_get_next (options, 0); opt;
+ opt = option_get_next (options, opt)) {
+ options_strlist = str_list_append_unique (options_strlist,
+ _(ped_exception_get_option_string (opt)));
+ options_strlist = str_list_append_unique (options_strlist,
+ ped_exception_get_option_string (opt));
+ }
+
+ opt_name = command_line_get_word (prompt, NULL, options_strlist, 1);
+ if (!opt_name)
+ return PED_EXCEPTION_UNHANDLED;
+ str_list_destroy (options_strlist);
+
+ opt = PED_EXCEPTION_OPTION_FIRST;
+ while (1) {
+ if (strcmp (opt_name,
+ ped_exception_get_option_string (opt)) == 0)
+ break;
+ if (strcmp (opt_name,
+ _(ped_exception_get_option_string (opt))) == 0)
+ break;
+ opt = option_get_next (options, opt);
+ }
+ free (opt_name);
+ return opt;
+}
+
+int
+command_line_get_align_type (const char *prompt, enum AlignmentType *align_type)
+{
+ char* def_word;
+ char* input;
+
+ if (*align_type)
+ def_word = str_list_convert_node (align_opt_list);
+ else
+ def_word = str_list_convert_node (align_min_list);
+ input = command_line_get_word (prompt, def_word, align_opt_min_list, 1);
+ free (def_word);
+ if (!input)
+ return 0;
+ *align_type = (str_list_match_any (align_opt_list, input)
+ ? PA_OPTIMUM
+ : PA_MINIMUM);
+ free (input);
+ return 1;
+}
+
+int
+command_line_get_unit (const char* prompt, PedUnit* unit)
+{
+ StrList* opts = NULL;
+ PedUnit walk;
+ char* unit_name;
+ const char* default_unit_name;
+
+ for (walk = PED_UNIT_FIRST; walk <= PED_UNIT_LAST; walk++)
+ opts = str_list_append (opts, ped_unit_get_name (walk));
+
+ default_unit_name = ped_unit_get_name (ped_unit_get_default ());
+ unit_name = command_line_get_word (prompt, default_unit_name, opts, 1);
+ str_list_destroy (opts);
+
+ if (unit_name) {
+ *unit = ped_unit_get_by_name (unit_name);
+ free (unit_name);
+ return 1;
+ } else
+ return 0;
+}
+
+int
+command_line_is_integer ()
+{
+ char* word;
+ int is_integer;
+ int scratch;
+
+ word = command_line_peek_word ();
+ if (!word)
+ return 0;
+
+ is_integer = sscanf (word, "%d", &scratch);
+ free (word);
+ return is_integer;
+}
+
+static int
+init_ex_opt_str ()
+{
+ int i;
+ PedExceptionOption opt;
+
+ for (i = 0; (1 << i) <= PED_EXCEPTION_OPTION_LAST; i++) {
+ opt = (1 << i);
+ ex_opt_str [i]
+ = str_list_create (
+ ped_exception_get_option_string (opt),
+ _(ped_exception_get_option_string (opt)),
+ NULL);
+ if (!ex_opt_str [i])
+ return 0;
+ }
+
+ ex_opt_str [i] = NULL;
+ return 1;
+}
+
+static void
+done_ex_opt_str ()
+{
+ int i;
+
+ for (i=0; ex_opt_str [i]; i++)
+ str_list_destroy (ex_opt_str [i]);
+}
+
+static int
+init_state_str ()
+{
+ on_list = str_list_create_unique (_("on"), "on", NULL);
+ off_list = str_list_create_unique (_("off"), "off", NULL);
+ on_off_list = str_list_join (str_list_duplicate (on_list),
+ str_list_duplicate (off_list));
+ return 1;
+}
+
+static void
+done_state_str ()
+{
+ str_list_destroy (on_list);
+ str_list_destroy (off_list);
+ str_list_destroy (on_off_list);
+}
+
+static int
+init_alignment_type_str ()
+{
+ align_opt_list = str_list_create_unique (_("optimal"), "optimal", NULL);
+ align_min_list = str_list_create_unique (_("minimal"), "minimal", NULL);
+ align_opt_min_list = str_list_join (str_list_duplicate (align_opt_list),
+ str_list_duplicate (align_min_list));
+ return 1;
+}
+
+static void
+done_alignment_type_str ()
+{
+ str_list_destroy (align_opt_list);
+ str_list_destroy (align_min_list);
+ str_list_destroy (align_opt_min_list);
+}
+
+static int
+init_fs_type_str ()
+{
+ PedFileSystemType* walk;
+ PedFileSystemAlias* alias_walk;
+
+ fs_type_list = NULL;
+
+ for (walk = ped_file_system_type_get_next (NULL); walk;
+ walk = ped_file_system_type_get_next (walk))
+ {
+ fs_type_list = str_list_insert (fs_type_list, walk->name);
+ if (!fs_type_list)
+ return 0;
+ }
+ for (alias_walk = ped_file_system_alias_get_next (NULL); alias_walk;
+ alias_walk = ped_file_system_alias_get_next (alias_walk))
+ {
+ fs_type_list = str_list_insert (fs_type_list,
+ alias_walk->alias);
+ if (!fs_type_list)
+ return 0;
+ }
+
+ return 1;
+}
+
+static int
+init_disk_type_str ()
+{
+ PedDiskType* walk;
+
+ disk_type_list = NULL;
+
+ for (walk = ped_disk_type_get_next (NULL); walk;
+ walk = ped_disk_type_get_next (walk))
+ {
+ disk_type_list = str_list_insert (disk_type_list, walk->name);
+ if (!disk_type_list)
+ return 0;
+ }
+
+ return 1;
+}
+
+int
+init_readline (void)
+{
+#ifdef HAVE_LIBREADLINE
+ if (!opt_script_mode) {
+ rl_initialize ();
+ rl_attempted_completion_function = (rl_completion_func_t *) complete_function;
+ readline_state.in_readline = 0;
+ }
+#endif
+ return 0;
+}
+
+int
+init_ui ()
+{
+ if (!init_ex_opt_str ()
+ || !init_state_str ()
+ || !init_alignment_type_str ()
+ || !init_fs_type_str ()
+ || !init_disk_type_str ())
+ return 0;
+ ped_exception_set_handler (exception_handler);
+
+#ifdef SA_SIGINFO
+ sigset_t curr;
+ sigfillset (&curr);
+
+ sig_segv.sa_sigaction = &sa_sigsegv_handler;
+ sig_int.sa_sigaction = &sa_sigint_handler;
+ sig_fpe.sa_sigaction = &sa_sigfpe_handler;
+ sig_ill.sa_sigaction = &sa_sigill_handler;
+
+ sig_segv.sa_mask =
+ sig_int.sa_mask =
+ sig_fpe.sa_mask =
+ sig_ill.sa_mask = curr;
+
+ sig_segv.sa_flags =
+ sig_int.sa_flags =
+ sig_fpe.sa_flags =
+ sig_ill.sa_flags = SA_SIGINFO;
+
+ sigaction (SIGSEGV, &sig_segv, NULL);
+ sigaction (SIGINT, &sig_int, NULL);
+ sigaction (SIGFPE, &sig_fpe, NULL);
+ sigaction (SIGILL, &sig_ill, NULL);
+#else
+ signal (SIGSEGV, s_sigsegv_handler);
+ signal (SIGINT, s_sigint_handler);
+ signal (SIGFPE, s_sigfpe_handler);
+ signal (SIGILL, s_sigill_handler);
+#endif /* SA_SIGINFO */
+
+ return 1;
+}
+
+void
+done_ui ()
+{
+ ped_exception_set_handler (NULL);
+ done_ex_opt_str ();
+ done_state_str ();
+ done_alignment_type_str ();
+ str_list_destroy (fs_type_list);
+ str_list_destroy (disk_type_list);
+}
+
+void
+help_msg ()
+{
+ fputs (_(usage_msg), stdout);
+
+ putchar ('\n');
+ fputs (_("OPTIONs:"), stdout);
+ putchar ('\n');
+ print_options_help ();
+
+ putchar ('\n');
+ fputs (_("COMMANDs:"), stdout);
+ putchar ('\n');
+ print_commands_help ();
+ printf (_("\nReport bugs to %s\n"), PACKAGE_BUGREPORT);
+ exit (EXIT_SUCCESS);
+}
+
+void
+print_using_dev (PedDevice* dev)
+{
+ printf (_("Using %s\n"), dev->path);
+}
+
+int
+interactive_mode (PedDevice** dev, PedDisk** disk, Command* cmd_list[])
+{
+ StrList* list;
+ StrList* command_names = command_get_names (cmd_list);
+
+ commands = cmd_list; /* FIXME yucky, nasty, evil hack */
+
+ fputs (prog_name, stdout);
+
+ print_using_dev (*dev);
+
+ list = str_list_create (_(banner_msg), NULL);
+ str_list_print_wrap (list, screen_width (), 0, 0, stdout);
+ str_list_destroy (list);
+
+ while (1) {
+ char* word;
+ Command* cmd;
+
+ while (!command_line_get_word_count ()) {
+ if (got_ctrl_c) {
+ putchar ('\n');
+ return 1;
+ }
+ command_line_prompt_words ("(parted)", NULL,
+ command_names, 1);
+ }
+
+ word = command_line_pop_word ();
+ if (word) {
+ cmd = command_get (commands, word);
+ free (word);
+ if (cmd) {
+ if (!command_run (cmd, dev, disk)) {
+ command_line_flush ();
+
+ if (*disk) {
+ ped_disk_destroy (*disk);
+ *disk = 0;
+ }
+ }
+ } else
+ print_commands_help ();
+ }
+ }
+
+ return 1;
+}
+
+
+int
+non_interactive_mode (PedDevice** dev, PedDisk **disk, Command* cmd_list[],
+ int argc, char* argv[])
+{
+ int i;
+ Command* cmd;
+
+ commands = cmd_list; /* FIXME yucky, nasty, evil hack */
+
+ for (i = 0; i < argc; i++)
+ command_line_push_line (argv [i], 1);
+
+ while (command_line_get_word_count ()) {
+ char* word;
+
+ word = command_line_pop_word ();
+ if (!word)
+ break;
+
+ cmd = command_get (commands, word);
+ free (word);
+ if (!cmd) {
+ help_msg ();
+ goto error;
+ }
+ if (!(cmd->non_interactive)) {
+ fputs(_("This command does not make sense in "
+ "non-interactive mode.\n"), stdout);
+ exit(EXIT_FAILURE);
+ goto error;
+ }
+
+ if (!command_run (cmd, dev, disk))
+ goto error;
+ }
+ return 1;
+
+error:
+ return 0;
+}
diff --git a/parted/ui.h b/parted/ui.h
new file mode 100644
index 0000000..61a71de
--- /dev/null
+++ b/parted/ui.h
@@ -0,0 +1,98 @@
+/*
+ parted - a frontend to libparted
+ Copyright (C) 1999-2001, 2007-2014, 2019-2023 Free Software Foundation,
+ Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef UI_H_INCLUDED
+#define UI_H_INCLUDED
+
+#include "strlist.h"
+
+enum AlignmentType
+ {
+ PA_MINIMUM = 1,
+ PA_OPTIMUM
+ };
+
+extern const char *prog_name;
+
+extern int init_ui ();
+extern int init_readline ();
+extern int non_interactive_mode (PedDevice** dev, PedDisk **disk,
+ Command* cmd_list[], int argc,
+ char* argv[]);
+extern int interactive_mode (PedDevice** dev, PedDisk **disk,
+ Command* cmd_list[]);
+extern void done_ui ();
+
+extern int screen_width ();
+extern void wipe_line ();
+
+extern void command_line_push_word (const char* word);
+extern char* command_line_pop_word ();
+extern char* command_line_peek_word ();
+extern void command_line_flush ();
+extern int command_line_get_word_count () _GL_ATTRIBUTE_PURE;
+extern void command_line_prompt_words (const char* prompt, const char* def,
+ const StrList* possibilities,
+ int multi_word);
+extern char* command_line_get_word (const char* prompt, const char* def,
+ const StrList* possibilities,
+ int multi_word);
+extern int command_line_get_integer (const char* prompt, int* value);
+extern int command_line_get_sector (const char* prompt, PedDevice* dev,
+ PedSector* value, PedGeometry** range, char** raw_input);
+extern int command_line_get_state (const char* prompt, int* value);
+extern int command_line_get_device (const char* prompt, PedDevice** value);
+extern int command_line_get_disk (const char* prompt, PedDisk** value)
+ __attribute__((__nonnull__(2)));
+extern int command_line_get_partition (const char* prompt, PedDisk* disk,
+ PedPartition** value);
+extern int command_line_get_fs_type (const char* prompt,
+ const PedFileSystemType*(* value));
+extern int command_line_get_disk_type (const char* prompt,
+ const PedDiskType*(* value));
+extern int command_line_get_disk_flag (const char* prompt,
+ const PedDisk* disk,
+ PedDiskFlag* flag);
+extern int command_line_get_part_flag (const char* prompt,
+ const PedPartition* part,
+ PedPartitionFlag* flag);
+extern int command_line_get_part_type (const char* prompt, const PedDisk* disk,
+ PedPartitionType* type);
+extern PedExceptionOption command_line_get_ex_opt (const char* prompt,
+ PedExceptionOption options);
+extern int command_line_get_unit (const char* prompt, PedUnit* unit);
+extern int command_line_get_align_type (const char *prompt,
+ enum AlignmentType *align_type);
+
+extern int command_line_is_integer ();
+extern int command_line_is_sector ();
+
+extern void help_msg () __attribute__((__noreturn__));
+
+extern void print_using_dev (PedDevice* dev);
+
+/* in parted.c */
+extern int opt_script_mode;
+extern int opt_fix_mode;
+extern int pretend_input_tty;
+
+extern void print_options_help ();
+extern void print_commands_help ();
+
+#endif /* UI_H_INCLUDED */