diff -rN old-fdisk/ChangeLog new-fdisk/ChangeLog 0a1,7 > 2008-09-23 gettextize > > * Makefile.am (SUBDIRS): Add m4. > (EXTRA_DIST): Add autotools/config.rpath autotools/mkinstalldirs. > * configure.ac (AC_CONFIG_FILES): Add po/Makefile.in, > (AM_GNU_GETTEXT_VERSION): Bump to 0.14.1. > diff -rN old-fdisk/Makefile.am new-fdisk/Makefile.am 4c4,6 < SUBDIRS = po src doc --- > # lib for GNULib > SUBDIRS = m4 po src doc lib > 9c11 < EXTRA_DIST = autotools/config.rpath autotools/mkinstalldirs \ --- > EXTRA_DIST = autotools/config.rpath autotools/mkinstalldirs autotools/config.rpath autotools/mkinstalldirs \ diff -rN old-fdisk/acinclude.m4 new-fdisk/acinclude.m4 1,346d0 < # library paths for libparted < # written by Damien Genet < < dnl Usage: < dnl CHECK_LIBPARTED([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) < dnl where MINIMUM-VERSION must be >= 1.2.8 and != 1.3.0 < dnl < dnl Example: < dnl CHECK_LIBPARTED(1.2.8, , [AC_MSG_ERROR([*** libparted >= 1.2.8 not installed - please install first ***])]) < dnl < dnl Adds the required libraries to $PARTED_LIBS and does an < dnl AC_SUBST(PARTED_LIBS) < dnl < < < AC_DEFUN([CHECK_LIBPARTED], < [ < AC_REQUIRE([AC_CANONICAL_HOST]) < < dnl save LIBS < saved_LIBS="$LIBS" < < dnl Check for headers and library < AC_CHECK_HEADER(parted/parted.h, , < [AC_MSG_ERROR([ not found; install GNU/Parted])] < $3) < AC_CHECK_LIB(uuid, uuid_generate, , < [AC_MSG_ERROR([libuuid not found; install e2fsprogs available at http://web.mit.edu/tytso/www/linux/e2fsprogs.html])] < $3) < AC_CHECK_LIB(parted,ped_device_read, , < [AC_MSG_ERROR([libparted not found; install GNU/Parted available at http://www.gnu.org/software/parted/parted.html])] < $3) < < case "$host_os" in < gnu*) # The Hurd requires some special system libraries < # with very generic names, which is why we special < # case these tests. < < AC_CHECK_LIB(shouldbeinlibc,lcm, , < [AC_MSG_ERROR([libshouldbeinlibc not found; install the Hurd development libraries.])] < $3) < < AC_CHECK_LIB(store,store_open, , < [AC_MSG_ERROR([libstore not found; install the Hurd development libraries.])] < $3) < ;; < *) ;; < esac < < AC_MSG_CHECKING(for libparted - version >= $1) < < AC_TRY_LINK_FUNC(ped_get_version,, < AC_MSG_RESULT(failed) < AC_MSG_ERROR([*** libparted < 1.2.8 or == 1.3.0 can't execute test ***])) < < dnl Get major, minor, and micro version from arg MINIMUM-VERSION < parted_config_major_version=`echo $1 | \ < sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` < parted_config_minor_version=`echo $1 | \ < sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` < parted_config_micro_version=`echo $1 | \ < sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` < < dnl Compare MINIMUM-VERSION with libparted version < AC_TRY_RUN([ < #include < #include < #include < < int main () < { < int major, minor, micro; < const char *version; < < if ( !(version = ped_get_version ()) ) < exit(1); < if (sscanf(version, "%d.%d.%d", &major, &minor, µ) != 3) { < printf("%s, bad version string\n", version); < exit(1); < } < < if ((major > $parted_config_major_version) || < ((major == $parted_config_major_version) && (minor > $parted_config_minor_version)) || < ((major == $parted_config_major_version) && (minor == $parted_config_minor_version) && (micro >= $parted_config_micro_version))) { < return 0; < } else { < printf("\n*** An old version of libparted (%s) was found.\n", < version); < printf("*** You need a version of libparted equal to or newer than %d.%d.%d.\n", < $parted_config_major_version, < $parted_config_minor_version, < $parted_config_micro_version); < printf("*** You can get it at - ftp://ftp.gnu.org/gnu/parted/\n"); < return 1; < } < } < ], < AC_MSG_RESULT(yes); $2, < AC_MSG_RESULT(no) ; $3, < [echo $ac_n "cross compiling; assumed OK... $ac_c"]) < < dnl restore orignial LIBS and set @PARTED_LIBS@ < PARTED_LIBS="$LIBS" < LIBS="$saved_LIBS" < AC_SUBST(PARTED_LIBS) < < dnl Execute ACTION-IF-FOUND < $2 < < ]) < < dnl Usage: < dnl CHECK_CHECK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) < dnl < dnl Adds the required libraries to $CHECK_LIBS and $CHECK_CFLAGS does an < dnl AC_SUBST(CHECK_LIBS) and AC_SUBST(CHECK_CFLAGS) < dnl < < < AC_DEFUN([CHECK_CHECK], < [ < AC_REQUIRE([AC_CANONICAL_HOST]) < < < AC_ARG_WITH(check, < AS_HELP_STRING([--with-check=PATH], < [prefix where check is installed [default=auto]])) < < if test x$with_check = xno; then < < $3 < < else < < < < dnl save LIBS < saved_LIBS="$LIBS" < saved_CFGLAGS="$CFLAGS" < < if test x$with_check != x; then < CFLAGS="$CFLAGS -I$with_check/include" < LIBS="$LIBS -L$with_check/lib -lcheck" < fi < < AC_MSG_CHECKING(for check >= $1) < < dnl Get major, minor, and micro version from arg MINIMUM-VERSION < check_config_major_version=`echo $1 | \ < sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` < check_config_minor_version=`echo $1 | \ < sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` < check_config_micro_version=`echo $1 | \ < sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` < < dnl Compare MINIMUM-VERSION with libparted version < AC_TRY_RUN([ < #include < #include < #include < < int main () < { < int major = CHECK_MAJOR_VERSION, < minor = CHECK_MINOR_VERSION, < micro = CHECK_MICRO_VERSION; < const char *version; < < < if ((major > $check_config_major_version) || < ((major == $check_config_major_version) && (minor > $check_config_minor_version)) || < ((major == $check_config_major_version) && (minor == $check_config_minor_version) && (micro >= $check_config_micro_version))) { < < return 0; < } else { < printf(" *** Looked for check version >= %d.%d.%d, found %d.%d.%d\n", < $check_config_major_version, $check_config_minor_version, < $check_config_micro_version, major, minor, micro); < return 1; < } < } < ], < AC_MSG_RESULT(yes), < AC_MSG_RESULT(no) ; $3, < [echo $ac_n "cross compiling; assumed OK... $ac_c"]) < < dnl restore orignial LIBS and set @CHECK_LIBS@ < < if test x$with_check != x; then < CHECK_CFLAGS="-I$with_check/include" < CHECK_LIBS="-L$with_check/lib -lcheck" < else < CHECK_LIBS="-lcheck" < CHECK_CFLAGS="" < fi < AC_SUBST(CHECK_LIBS) < AC_SUBST(CHECK_CFLAGS) < LIBS="$saved_LIBS" < < < dnl Execute ACTION-IF-FOUND < $2 < < fi < < ]) < < < dnl Usage: < dnl CHECK_CHECK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) < dnl < dnl Adds the required libraries to $CHECK_LIBS and $CHECK_CFLAGS does an < dnl AC_SUBST(CHECK_LIBS) and AC_SUBST(CHECK_CFLAGS) < dnl < < < AC_DEFUN([CHECK_CHECK], < [ < AC_REQUIRE([AC_CANONICAL_HOST]) < < < AC_ARG_WITH(check, < AS_HELP_STRING([--with-check=PATH], < [prefix where check is installed [default=auto]])) < < if test x$with_check = xno; then < < $3 < < else < < < < dnl save LIBS < saved_LIBS="$LIBS" < saved_CFGLAGS="$CFLAGS" < < if test x$with_check != x; then < CFLAGS="$CFLAGS -I$with_check/include" < LIBS="$LIBS -L$with_check/lib -lcheck" < fi < < AC_MSG_CHECKING(for check >= $1) < < dnl Get major, minor, and micro version from arg MINIMUM-VERSION < check_config_major_version=`echo $1 | \ < sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` < check_config_minor_version=`echo $1 | \ < sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` < check_config_micro_version=`echo $1 | \ < sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` < < dnl Compare MINIMUM-VERSION with libparted version < AC_TRY_RUN([ < #include < #include < #include < < int main () < { < int major = CHECK_MAJOR_VERSION, < minor = CHECK_MINOR_VERSION, < micro = CHECK_MICRO_VERSION; < const char *version; < < < if ((major > $check_config_major_version) || < ((major == $check_config_major_version) && (minor > $check_config_minor_version)) || < ((major == $check_config_major_version) && (minor == $check_config_minor_version) && (micro >= $check_config_micro_version))) { < < return 0; < } else { < printf(" *** Looked for check version >= %d.%d.%d, found %d.%d.%d\n", < $check_config_major_version, $check_config_minor_version, < $check_config_micro_version, major, minor, micro); < return 1; < } < } < ], < AC_MSG_RESULT(yes), < AC_MSG_RESULT(no) ; $3, < [echo $ac_n "cross compiling; assumed OK... $ac_c"]) < < dnl restore orignial LIBS and set @CHECK_LIBS@ < < if test x$with_check != x; then < CHECK_CFLAGS="-I$with_check/include" < CHECK_LIBS="-L$with_check/lib -lcheck" < else < CHECK_LIBS="-lcheck" < CHECK_CFLAGS="" < fi < AC_SUBST(CHECK_LIBS) < AC_SUBST(CHECK_CFLAGS) < LIBS="$saved_LIBS" < < fi < < ]) < < < dnl Usage: < dnl CHECK_CURSES([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) < dnl < dnl Example: < dnl CHECK_CURSES(, AC_MSG_ERROR([ncurses not installed; please install it first])) < dnl < dnl Adds the required libraries to $CURSES_LIBS and does an < dnl AC_SUBST(CURSES_LIBS) < dnl < < AC_DEFUN([CHECK_CURSES], < [ < AC_REQUIRE([AC_CANONICAL_HOST]) < < dnl save LIBS < saved_LIBS="$LIBS" < LIBS="" < < < dnl Check for headers and library < AC_CHECK_HEADER(ncurses.h, have_ncurses_h=true < AC_DEFINE(HAVE_NCURSES_H, 1, [We have the ncurses.h header.]), < [AC_CHECK_HEADER(curses.h, < have_ncurses_h=false < AC_DEFINE(HAVE_CURSES_H, 1, [We have the curses.h header.]), < $2)]) < if test x$have_ncurses_h == xtrue; then < AC_CHECK_LIB(ncurses, getch, LIBS="-lncurses" < $1 , < $2) < else < AC_CHECK_LIB(curses, getch, LIBS="-lcurses" < $1 , < $2) < fi < < < < dnl restore orignial LIBS and set @CURSES_LIBS@ < CURSES_LIBS="$LIBS" < LIBS="$saved_LIBS" < AC_SUBST(CURSES_LIBS) < < < ]) diff -rN old-fdisk/configure.ac new-fdisk/configure.ac 1c1,2 < AC_PREREQ(2.50) --- > # 2.59 is needed by GNULib modules > AC_PREREQ([2.59]) 7c8 < AM_GNU_GETTEXT_VERSION([0.16.1]) --- > AM_GNU_GETTEXT_VERSION(0.14.1) 19a21,23 > # add calls for gnulib > gl_EARLY > 23a28 > # configure.ac:24: warning: AC_CANONICAL_HOST invoked multiple times (mmm...) 26,27c31,34 < linux*) AC_DEFINE([NAMING_LINUX], [1], [Define 1 if this is an OS with Linux naming scheme]) ;; < freebsd*) AC_DEFINE([NAMING_BSD], [1], [Define 1 if this is an OS with BSD naming scheme]) ;; --- > linux*) > AC_DEFINE([NAMING_LINUX], [1], [Define 1 if this is an OS with Linux naming scheme]) ;; > freebsd*) > AC_DEFINE([NAMING_BSD], [1], [Define 1 if this is an OS with BSD naming scheme]) ;; 31,32c38,40 < AC_CHECK_HEADERS([ctype.h errno.h stdio.h getopt.h stdarg.h string.h \ < stdlib.h unistd.h parted/parted.h]) --- > # getopt.h removed because we already have it; > AC_CHECK_HEADERS([ctype.h errno.h stdio.h stdarg.h locale.h]) > AC_CHECK_HEADERS([string.h stdlib.h unistd.h parted/parted.h]) 42a51,53 > # LIBS="$LIBS -ldl" > ## better hack > XLIBS="$LIBS" 45,46c56 < AC_MSG_ERROR([*** libparted >= 1.7.0 not installed - please install first ***])) < --- > AC_MSG_ERROR([*** libparted >= 1.7.0 not installed - please install first ***])) 48c58 < --- > LIBS="$XLIBS" 53a64,87 > dnl readline checking > > XLIBS="$LIBS" > LIBS="$XLIBS -ltermcap" > fdisk_have_libreadline=0 > > AC_CHECK_LIB( [readline], [readline], > [fdisk_have_libreadline=1; LIBS="$LIBS -lreadline";], > [fdisk_have_libreadline=0; LIBS="$XLIBS"], []) > > AC_DEFINE_UNQUOTED([HAVE_READLINE], [$fdisk_have_libreadline], > [Defined to 1 if your system have readline library]) > > # if [ $fdisk_have_readline eq 1 ] > # then > # AC_SUBST(LIBREADLINE, [-lreadline]) > # else > # AC_SUBST(LIBREADLINE, []) > # fi > > AC_CHECK_HEADERS([readline/readline.h]) > > dnl readline checking > 94c128 < [cfdisk=auto]) --- > [cfdisk=auto]) 102c136,141 < AC_CONFIG_FILES([Makefile src/Makefile doc/Makefile tests/Makefile po/Makefile.in]) --- > # add for gnulib > gl_INIT > > # lib/Makefile is for GNULib > AC_CONFIG_FILES([Makefile src/Makefile doc/Makefile tests/Makefile po/Makefile.in m4/Makefile lib/Makefile]) > diff -rN old-fdisk/po/POTFILES.in new-fdisk/po/POTFILES.in 3c3,5 < src/cfdisk.c \ No newline at end of file --- > src/cfdisk.c > src/fdisk.c > src/strlist.c diff -rN old-fdisk/src/Makefile.am new-fdisk/src/Makefile.am 10a11,13 > AM_CPPFLAGS = -I$(top_builddir)/lib -I$(top_srcdir)/lib > LDADD = $(top_builddir)/lib/libgnu.a > diff -rN old-fdisk/src/command.h new-fdisk/src/command.h 33c33 < int non_interactive:1; --- > int non_interactive:1; 40c40 < int non_interactive); --- > int non_interactive); diff -rN old-fdisk/src/common.c new-fdisk/src/common.c 62c62 < //StrList *fs_type_resize; --- > /*StrList *fs_type_resize;*/ 234c234 < after a partition, for example, in msdos partition table, the sector, --- > after a partition, for example, in msdos partition table, the sector, 240,241c240,241 < < if (!strcmp(part->disk->type->name, "msdos") --- > > if (!strcmp(part->disk->type->name, "msdos") 423c423 < fuzzify (PedGeometry *geom, PedDevice *dev, PedConstraint *constraint, --- > fuzzify (PedGeometry *geom, PedDevice *dev, PedConstraint *constraint, 440c440 < * --- > * 488c488 < --- > 492c492 < } --- > } 533c533 < --- > 544c544 < --- > 555c555 < --- > 568c568 < if (constraint && (constraint->start_align->grain_size == 0 || --- > if (constraint && (constraint->start_align->grain_size == 0 || 575c575 < action_new should use 's' as it doesn't matter there. --- > action_new should use 's' as it doesn't matter there. 621c621 < --- > 668c668 < /* Desired: start = last-length+1LL */ --- > /* Desired: start = last-length+1LL */ 684c684 < --- > 732c732 < int num; --- > int num; 734c734 < if (!disk) --- > if (!disk) 785c785 < --- > 823c823 < --- > 930c930 < --- > 940c940 < GET_SECT = UI_CUSTOM_VALUES, --- > GET_SECT = UI_CUSTOM_VALUES, 952c952 < the previous selected sector, used if the user --- > the previous selected sector, used if the user 962c962 < --- > 975c975 < if (def_str) --- > if (def_str) 978c978 < --- > 1011c1011 < SectPos pos; --- > SectPos pos; 1035c1035 < --- > 1047c1047 < type = (type & PED_PARTITION_LOGICAL) | PED_PARTITION_FREESPACE; --- > type = (type & PED_PARTITION_LOGICAL) | PED_PARTITION_FREESPACE; 1064c1064 < pos->start.sector); --- > pos->start.sector); 1069c1069 < return 1; --- > return 1; 1077c1077 < start and end of the partition and is called from the functions in here */ --- > start and end of the partition and is called from the functions in here */ 1140c1140 < return 0; --- > return 0; 1160c1160 < --- > 1165,1166c1165,1166 < if (!ask_boolean_question < (_("WARNING: This writes all data to disk automatically, continue?"))) --- > if (!ask_boolean_question > (_("WARNING: This writes all data to disk automatically, continue?"))) 1170c1170 < --- > 1175c1175 < --- > 1256c1256 < --- > 1275,1276c1275,1276 < if (!ask_boolean_question < (_("WARNING: This writes all data to disk automatically, continue?"))) --- > if (!ask_boolean_question > (_("WARNING: This writes all data to disk automatically, continue?"))) 1355c1355 < --- > 1368c1368 < --- > 1386,1387c1386,1387 < PED_DISK_TYPE_PARTITION_NAME)) < uiquery->getstring(_("Partition name"), &part_name, NULL, NULL, 1); --- > PED_DISK_TYPE_PARTITION_NAME)) > uiquery->getstring(_("Partition name"), &part_name, NULL, NULL, 1); 1407c1407 < /* Check if the partition occupying the space before the place we --- > /* Check if the partition occupying the space before the place we 1417c1417 < disk, --- > disk, 1445c1445 < --- > 1452,1453c1452,1453 < /* TODO: With the changes from 06/08/06, we might remove < the "if" and warn the user always if this is out of --- > /* TODO: With the changes from 06/08/06, we might remove > the "if" and warn the user always if this is out of 1525c1525 < --- > 1529c1529 < --- > 1535c1535 < --- > 1540c1540 < --- > 1588c1588 < --- > 1593,1594c1593,1594 < if (!ask_boolean_question < (_("WARNING: This writes all data to disk automatically, continue?"))) --- > if (!ask_boolean_question > (_("WARNING: This writes all data to disk automatically, continue?"))) 1616c1616 < --- > 1625c1625 < --- > 1627,1628c1627,1628 < if (!ask_boolean_question < (_("WARNING: This writes all data to disk automatically, continue?"))) --- > if (!ask_boolean_question > (_("WARNING: This writes all data to disk automatically, continue?"))) 1674c1674 < /* So here we do something worth commiting and dangerous. UI *must* --- > /* So here we do something worth commiting and dangerous. UI *must* 1732c1732 < if (!part) --- > if (!part) 1920,1921c1920,1921 < if (!ask_boolean_question < (_("WARNING: This writes all data to disk automatically, continue?"))) --- > if (!ask_boolean_question > (_("WARNING: This writes all data to disk automatically, continue?"))) 1972c1972 < if (!part) --- > if (!part) 1977,1978c1977,1978 < if (opts & UI_WARN_COMMIT && !ask_boolean_question < (_("WARNING: This writes all data to disk automatically, continue?"))) --- > if (opts & UI_WARN_COMMIT && !ask_boolean_question > (_("WARNING: This writes all data to disk automatically, continue?"))) 1991c1991 < goto error; --- > goto error; 2018c2018 < --- > 2065d2064 < 2067c2066,2067 < --- > > 2070c2070 < if (!part) --- > if (!part) 2077c2077 < --- > 2145c2145 < --- > 2150c2150 < --- > 2165,2166c2165,2166 < if (!ask_boolean_question < (_("WARNING: This writes all data to disk, continue?"))) --- > if (!ask_boolean_question > (_("WARNING: This writes all data to disk, continue?"))) 2213c2213 < range_end = ped_geometry_new (disk->dev,data->geom.end, 1); --- > range_end = ped_geometry_new (disk->dev,data->geom.end, 1); 2216c2216 < memcpy(part->disk_specific, data->part_data, DOS_DATA_SIZE); --- > memcpy(part->disk_specific, data->part_data, DOS_DATA_SIZE); 2234c2234 < "label type not implemented."), --- > "label type not implemented."), 2262,2263c2262,2263 < } < if (i != -1 && j != -1) --- > } > if (i != -1 && j != -1) 2270c2270 < return 0; --- > return 0; 2285,2286c2285,2286 < < --- > > 2319c2319 < --- > 2328c2328 < --- > 2347c2347 < /* If, for example, this is a msdos logical partition, it has a --- > /* If, for example, this is a msdos logical partition, it has a 2401c2401 < char* res = ped_malloc(1); --- > char* res = ped_malloc(1); 2495c2495 < for (walk = ped_disk_next_partition (disk, NULL); walk; --- > for (walk = ped_disk_next_partition (disk, NULL); walk; diff -rN old-fdisk/src/fdisk.c new-fdisk/src/fdisk.c 27a28,37 > /* From gettextize */ > #include "gettext.h" > #if ENABLE_NLS > # include > #endif /* ENABLE_NLS */ > #define N_(String) String > #define _(String) dgettext (PACKAGE, String) > > /* We don't need this definitions because gettext.h already have */ > #if 0 35a46 > #endif /* if 0 */ 52c63,64 < #ifdef HAVE_GETOPT_H --- > /* We have GNULib getopt replacement */ > /* #ifdef HAVE_GETOPT_H */ 71,77c83,99 < /* NOTE: options and options_help MUST be in the same order and count */ < static struct option options[] = { < /* name, has-arg, string-return-val, char-return-val */ < {"help", 0, NULL, 'h'}, < {"list", 0, NULL, 'l'}, < {"raw-print", 0, NULL, 'r'}, < {"size", 1, NULL, 's'}, --- > /* I have created this struct to store options (in short and long form) > * and help in the same variable. The struct option array, wich is > * needed for getopt_long is build dynamically by build_option_table() > * using this array. We can add options here there isn't problems > * with getopt_long() */ > struct { > char *id; > int has_arg; > int *flag; > int val; > char *help; > } extd_options[] = { > /* name has_arg flag val help */ > { "help", no_argument, NULL, 'h', "displays this help message"}, > { "list", no_argument, NULL, 'l', "list partition table(s)"}, > { "raw-print", no_argument, NULL, 'r', "show the raw data in the partition table(s)"}, > { "size", required_argument, NULL, 's', "show partition size"}, 79,91c101,113 < {"linux-fdisk", 0, NULL, 'L'}, < {"gnu-fdisk", 0, NULL, 'G'}, < #endif < {"interactive", 0, NULL, 'i'}, < {"script", 0, NULL, 'p'}, < {"sector-units",0, NULL, 'u'}, < {"sector-size", 1, NULL, 'b'}, < {"cylinders", 1, NULL, 'C'}, < {"heads", 1, NULL, 'H'}, < {"sectors", 1, NULL, 'S'}, < {"list-partition-types", 0, NULL, 't'}, < {"version", 0, NULL, 'v'}, < {NULL, 0, NULL, 0} --- > { "linux-fdisk", no_argument, NULL, 'L', "enable Linux fdisk compatibility mode"}, > { "gnu-fdisk", no_argument, NULL, 'G', "disable Linux fdisk compatibility mode"}, > #endif /* GNU_EXT */ > { "interactive", no_argument, NULL, 'i', "where necessary, prompts for user intervention"}, > { "script", no_argument, NULL, 'p', "never prompts for user intervention"}, > { "sector-units", no_argument, NULL, 'u', "use sectors instead of cylinder as a default unit"}, > { "sector-size", required_argument, NULL, 'b', "specify the sector size in bytes"}, > { "cilyndres", required_argument, NULL, 'C', "specify the number of cylinders, actually does nothing"}, > { "heads", required_argument, NULL, 'H', "in lfdisk, specify the number of heads of the disk"}, > { "sectors", required_argument, NULL, 'S', "in lfdisk, specify the number of sectors per track"}, > { "list-partition-types", no_argument, NULL, 't', "displays a list of supported partition types"}, > { "version", no_argument, NULL, 'v', "displays the version"}, > { NULL, 0, NULL, 0, NULL} 93d114 < #endif 96,116c117,121 < /* NOTE: options and options_help MUST be in the same order and count */ < static char* options_help [][2] = { < {"help", N_("displays this help message")}, < {"list", N_("list partition table(s)")}, < {"raw-print", N_("show the raw data in the partition table(s)")}, < {"size", N_("show partition size")}, < #ifdef GNU_EXT < {"linux-fdisk", N_("enable Linux fdisk compatibility mode")}, < {"gnu-fdisk", N_("disable Linux fdisk compatibility mode")}, < #endif < {"interactive", N_("where necessary, prompts for user intervention")}, < {"script", N_("never prompts for user intervention")}, < {"sector-units",N_("use sectors instead of cylinder as a default unit")}, < {"sector-size", N_("specify the sector size in bytes")}, < {"cylinders", N_("specify the number of cylinders, actually does nothing")}, < {"heads", N_("in lfdisk, specify the number of heads of the disk")}, < {"sectors", N_("in lfdisk, specify the number of sectors per track")}, < {"list-partition-types", N_("displays a list of supported partition types")}, < {"version", N_("displays the version")}, < {NULL, NULL} < }; --- > /* String to use whit getopt() or getopt_long() if you update extd_options[] you must > * also add option in short form to this string */ > > /* NOTE: I will made dynamic this in the future */ > static const char* short_option_string = "hlipvLGs:utb:C:H:S:r"; 184c189 < /* Timer handler and other UI functions */ --- > /* Timer handler and other UI functions */ 217,218d221 < < 277c280 < (*getint) (const char* prompt, int* value) = fdisk_command_line_get_integer; --- > (*getint) (const char* prompt, int* value) = fdisk_command_line_get_integer; 484c487 < * --- > * 506,511c509,514 < static void < help_on (char* topic) < { < FdiskCommand* cmd; < < cmd = fdisk_command_get (fdisk_main_menu_commands, topic); --- > static void > help_on (char* topic) > { > FdiskCommand* cmd; > > cmd = fdisk_command_get (fdisk_main_menu_commands, topic); 513,514c516,517 < < fdisk_command_print_help (cmd); --- > > fdisk_command_print_help (cmd); 520c523 < --- > 543c546 < void --- > void 545,546c548,550 < { < int i; --- > { > unsigned int i; > #if 0 549c553 < #else --- > #else 554c558 < #ifdef HAVE_GETOPT_H --- > #ifdef HAVE_GETOPT_H 558,561c562,569 < #endif < options_help [i][0], < _(options_help [i][1])); < } --- > #endif > options_help [i][0], > _(options_help [i][1])); > } > #endif /* 0 */ > printf("%s CALLED\n", __FUNCTION__); > for(i=0; extd_options[i].id != NULL; i++) > printf(" -%c, --%-23.23s %s\n", extd_options[i].val, extd_options[i].id, _(extd_options[i].help)); 568c576 < --- > 604,606c612,614 < PedDevice *dev = (*disk)->dev; /* Save the address of dev, < because we are going to < destroy disk. */ --- > PedDevice *dev = (*disk)->dev; /* Save the address of dev, > because we are going to > destroy disk. */ 615,617c623,625 < PedDevice *dev = (*disk)->dev; /* Save the address of dev, < because we are going to < destroy disk. */ --- > PedDevice *dev = (*disk)->dev; /* Save the address of dev, > because we are going to > destroy disk. */ 626,628c634,636 < PedDevice *dev = (*disk)->dev; /* Save the address of dev, < because we are going to < destroy disk. */ --- > PedDevice *dev = (*disk)->dev; /* Save the address of dev, > because we are going to > destroy disk. */ 637,639c645,647 < PedDevice *dev = (*disk)->dev; /* Save the address of dev, < because we are going to < destroy disk. */ --- > PedDevice *dev = (*disk)->dev; /* Save the address of dev, > because we are going to > destroy disk. */ 662d669 < 664c671,672 < --- > > 693c701 < _("Do you want to create the filesystem on the partition?"))) --- > _("Do you want to create the filesystem on the partition?"))) 703c711 < --- > 711c719 < --- > 716,717c724,725 < return perform_mkpartfs (*disk, &pos, 0, NULL, NULL, < UI_CUSTOM_VALUES | UI_WARN_COMMIT | --- > return perform_mkpartfs (*disk, &pos, 0, NULL, NULL, > UI_CUSTOM_VALUES | UI_WARN_COMMIT | 804c812 < --- > 852c860 < --- > 874c882 < "Are you sure you want to continue?")) --- > "Are you sure you want to continue?")) 883,884c891,892 < else if (!is_bsd_partition((*disk)->dev->path, < part->geom.start * sect_size, sect_size) && --- > else if (!is_bsd_partition((*disk)->dev->path, > part->geom.start * sect_size, sect_size) && 890c898 < "Do you want to create one?")) --- > "Do you want to create one?")) 959c967 < PedSector blocks; --- > PedSector blocks; 975,978c983,986 < printf (_("\nDisk %s: %lld %s, %lld bytes\n"), (*disk)->dev->path, < total_drive_size >= 1000000000 ? < total_drive_size / 1000000000 : < total_drive_size / 1000000, --- > printf (_("\nDisk %s: %lld %s, %lld bytes\n"), (*disk)->dev->path, > total_drive_size >= 1000000000 ? > total_drive_size / 1000000000 : > total_drive_size / 1000000, 985c993 < heads, sectors, cylinders, (heads * sectors * cylinders), 1, --- > heads, sectors, cylinders, (heads * sectors * cylinders), 1, 990c998 < heads, sectors, cylinders, (heads * sectors), --- > heads, sectors, cylinders, (heads * sectors), 994c1002 < --- > 999c1007 < --- > 1001,1002c1009,1010 < < /* TODO: Make this output the same output as util-linux fdisk(?), --- > > /* TODO: Make this output the same output as util-linux fdisk(?), 1005c1013 < printf ("%s %+10s %+11s %+11s %+4s %+7s ", _("# "), --- > printf ("%s %+10s %+11s %+11s %+4s %+7s ", _("# "), 1025,1026c1033,1034 < < cyl_start = (part->geom.start / (total_cyl)) + 1; --- > > cyl_start = (part->geom.start / (total_cyl)) + 1; 1033c1041 < end = part->geom.end; --- > end = part->geom.end; 1036,1038c1044,1046 < else { < start = (part->geom.start / total_cyl < * total_cyl) + sectors; --- > else { > start = (part->geom.start / total_cyl > * total_cyl) + sectors; 1041,1043c1049,1051 < blocks = ((cyl_end * total_cyl) < - ((part->num == 1) ? < (cyl_start * sectors) : (cyl_start * total_cyl))) --- > blocks = ((cyl_end * total_cyl) > - ((part->num == 1) ? > (cyl_start * sectors) : (cyl_start * total_cyl))) 1048c1056 < blocks = ((end * total_cyl) - ((part->num == 1) ? --- > blocks = ((end * total_cyl) - ((part->num == 1) ? 1051c1059 < --- > 1054c1062 < --- > 1067c1075 < --- > 1076c1084 < char *type_name = _(get_disk_specific_system_name(part,0)); --- > char *type_name = _(get_disk_specific_system_name(part,0)); 1085c1093 < if (part->fs_type --- > if (part->fs_type 1088c1096 < else if (is_bsd_partition ((*disk)->dev->path, --- > else if (is_bsd_partition ((*disk)->dev->path, 1091c1099 < else if (!strcmp (type, "primary")) --- > else if (!strcmp (type, "primary")) 1104c1112 < --- > 1125c1133 < int is_boot, start_cyl, start_head, start_sector, --- > int is_boot, start_cyl, start_head, start_sector, 1138c1146 < --- > 1141c1149 < continue; --- > continue; 1157c1165 < --- > 1159c1167 < part->num, is_boot ? 0x80 : 0, --- > part->num, is_boot ? 0x80 : 0, 1162,1165c1170,1173 < part->geom.start, part->geom.length, < get_disk_specific_system_type(part, NULL)); < < --- > part->geom.start, part->geom.length, > get_disk_specific_system_type(part, NULL)); > > 1217c1225 < do_raw (PedDisk **disk) --- > do_raw (PedDisk **disk) 1235c1243 < --- > 1241c1249 < } --- > } 1262c1270 < --- > 1268c1276 < cyl_start = (part->geom.start / (total_cyl)) + 1; --- > cyl_start = (part->geom.start / (total_cyl)) + 1; 1273,1274c1281,1282 < ((cyl_end * total_cyl) - ((part->num == 1) ? < (cyl_start * sectors) : (cyl_start * total_cyl))) / --- > ((cyl_end * total_cyl) - ((part->num == 1) ? > (cyl_start * sectors) : (cyl_start * total_cyl))) / 1279c1287 < --- > 1282c1290 < static void --- > static void 1286c1294 < --- > 1288c1296 < --- > 1292c1300 < --- > 1471c1479 < if (!command_line_prompt_boolean_question --- > if (!command_line_prompt_boolean_question 1509c1517 < --- > 1547c1555 < return 0; --- > return 0; 1554c1562 < --- > 1563c1571 < --- > 1566c1574 < else --- > else 1595c1603 < if (!command_line_prompt_boolean_question --- > if (!command_line_prompt_boolean_question 1678,1679c1686,1687 < if (uiquery.need_commit) < if (!command_line_prompt_boolean_question --- > if (uiquery.need_commit) > if (!command_line_prompt_boolean_question 1688c1696 < --- > 1706,1707c1714,1715 < < --- > > 1731c1739 < static int --- > static int 1733c1741 < { --- > { 1764c1772 < --- > 1793c1801 < status = fdisk_interactive_menu (disk, --- > status = fdisk_interactive_menu (disk, 1844c1852 < if (!command_line_prompt_boolean_question --- > if (!command_line_prompt_boolean_question 1846c1854 < "seem unavailable, continue?"))) --- > "seem unavailable, continue?"))) 1876c1884 < --- > 1939c1947 < --- > 1945,1946c1953,1954 < if (pos.start.sector < part->geom.start || < pos.start.sector >= part->geom.end) --- > if (pos.start.sector < part->geom.start || > pos.start.sector >= part->geom.end) 2176c2184 < --- > 2185,2191c2193,2202 < fdisk_command_register (fdisk_ex_menu_commands, fdisk_command_create ( < str_list_create_unique ("v", _("v"), NULL), < do_move, < str_list_create ( < _(" v move a partition"), < NULL), < str_list_create (_(number_msg), _(start_end_msg), NULL), 1)); --- > fdisk_command_register ( > fdisk_ex_menu_commands, > fdisk_command_create ( > str_list_create_unique ("v", _("v"), NULL), > do_move, > str_list_create (_(" v move a partition"), NULL), > str_list_create (_(number_msg), _(start_end_msg), NULL), > 1) > ); > 2229c2240 < } --- > } 2305c2316 < --- > 2337c2348 < --- > 2510c2521 < printf ("%s\n", interface_name); --- > puts(interface_name); 2513a2525,2552 > /** > * build a struct option array from extd_options table > * \return a pointer to NULL terminated struct option array allocated with malloc > */ > static struct option * > build_option_table(void) > { > unsigned int i, len = sizeof(extd_options) / sizeof(extd_options[0]); > struct option *option = malloc(sizeof(struct option) * len); > if(option == NULL) > { > perror(_("dynamic memory allocation failure")); > exit(EXIT_FAILURE); > } > for(i=0; i < len; i++) > #if 0 > { > option[i].name = extd_options[i].id; > option[i].has_arg = extd_options[i].has_arg; > option[i].flag = extd_options[i].flag; > option[i].val = extd_options[i].val; > } > #else > memcpy(&(option[i]), &(extd_options[i]), sizeof(struct option)); > #endif > return option; > } > 2517a2557 > struct option *options_table, *ptr; 2519,2529c2559 < while (1) < { < /* NOTE: b, C, H, S are ignored, for Linux fdisk compatibility */ < #ifdef HAVE_GETOPT_H < opt = getopt_long (*argc_ptr, *argv_ptr, "hlipvLGs:utb:C:H:S:r", < options, NULL); < #else < opt = getopt (*argc_ptr, *argv_ptr, "hlipvLGs:utb:C:H:S:r"); < #endif < if (opt == -1) < break; --- > options_table = ptr = build_option_table(); 2530a2561,2563 > while((opt = getopt_long(*argc_ptr, *argv_ptr, short_option_string, ptr, NULL)) != -1) > { > /* NOTE: b, C, H, S are ignored, for Linux fdisk compatibility */ 2532,2540c2565,2580 < case 'h': fdisk_help_msg (); break; < case 'l': fdisk_list_table = 1; break; < < case 'r': fdisk_list_table = 1; < fdisk_print_raw = 1; < break; < < case 'i': fdisk_opt_script_mode = 0; break; < case 'p': fdisk_opt_script_mode = 1; break; --- > case 'h': > fdisk_help_msg (); > break; > case 'l': > fdisk_list_table = 1; > break; > case 'r': > fdisk_list_table = 1; > fdisk_print_raw = 1; > break; > case 'i': > fdisk_opt_script_mode = 0; > break; > case 'p': > fdisk_opt_script_mode = 1; > break; 2542,2543c2582,2587 < case 'G': fdisk_compatibility_mode = 0; break; < case 'L': fdisk_compatibility_mode = 1; break; --- > case 'G': > fdisk_compatibility_mode = 0; > break; > case 'L': > fdisk_compatibility_mode = 1; > break; 2545,2551c2589,2602 < case 's': fdisk_partsize_device = optarg; break; < case 't': print_partition_types(); break; < case 'u': ped_unit_set_default(PED_UNIT_SECTOR); < cylinder_unit = 0; < break; < case 'v': _version (); break; < case 'b': --- > case 's': > fdisk_partsize_device = optarg; > break; > case 't': > print_partition_types(); > break; > case 'u': > ped_unit_set_default(PED_UNIT_SECTOR); > cylinder_unit = 0; > break; > case 'v': > _version(); > break; > case 'b': 2553,2556c2604,2617 < if (user_sectsize <= 0 || user_sectsize % 512) { < fdisk_usage_msg(); < return 0; < } --- > if (user_sectsize <= 0 || user_sectsize % 512) > { > fdisk_usage_msg(); > return 0; > } > break; > case 'C': > user_cyls = atoi(optarg); > break; > case 'H': > user_heads = atoi(optarg); > break; > case 'S': > user_sectors = atoi(optarg); 2558,2560d2618 < case 'C': user_cyls = atoi(optarg); break; < case 'H': user_heads = atoi(optarg); break; < case 'S': user_sectors = atoi(optarg); break; 2565a2624,2626 > > free(options_table); > 2568,2569c2629,2631 < error: < return 0; --- > /* ? */ > /* error: */ > /* return 0; */ 2608c2670 < dev->length = bytes / user_sectsize; --- > dev->length = bytes / user_sectsize; 2617c2679 < llcyl = dev->length / --- > llcyl = dev->length / 2630c2692 < --- > 2632c2694 < printf(_("Unable to open %s\n"), path); --- > printf(_("Unable to open %s\n"), path); 2637c2699 < return NULL; --- > return NULL; 2655d2716 < 2663c2724 < --- > 2686a2748 > 2688a2751 > 2704a2768,2773 > /** > * Program entry point > * \param argc number of command line arguments > * \param argv array of command line arguments > * \return EXIT_SUCCESS or EXIT_FAILURE > */ 2708,2710c2777,2778 < PedDevice* dev; < PedDisk* disk; < int status; --- > PedDevice* dev; > PedDisk* disk; 2712,2715c2780,2785 < if (argc <= 1) { < fdisk_usage_msg(); < return -1; < } --- > if (argc <= 1) > { > /* Missing device parameter */ > fdisk_usage_msg(); > return EXIT_FAILURE; > } 2717d2786 < 2730c2799 < #endif --- > #endif /* GNU_EXT */ 2735,2738c2804,2807 < /* List all devices. */ < do_list_devices (NULL); < else if (!dev) < return 1; --- > /* List all devices. */ > do_list_devices (NULL); > else if(!dev) > return EXIT_FAILURE; 2740c2809,2812 < disk = ped_disk_new (dev); --- > disk = ped_disk_new(dev); > > if(!disk) > return EXIT_FAILURE; 2742,2743d2813 < if (!disk) < return 1; 2745c2815 < if (fdisk_partsize_device) --- > if(fdisk_partsize_device) 2750,2755c2820 < do_list_devices(disk); < < status = fdisk_interactive_mode (&disk, fdisk_main_menu_commands); < < return !status; < } --- > do_list_devices(disk); 2756a2822,2823 > return (fdisk_interactive_mode(&disk, fdisk_main_menu_commands) ? EXIT_SUCCESS : EXIT_FAILURE); > } diff -rN old-fdisk/src/main.c new-fdisk/src/main.c 20a21,23 > /** > * Main entry point. > */ 26c29 < return fdisk (argc, argv); --- > return fdisk(argc, argv); 28d30 < diff -rN old-fdisk/src/strlist.c new-fdisk/src/strlist.c 22c22,29 < #include "config.h" --- > #include "../config.h" > > #include "gettext.h" > #if ENABLE_NLS > # include > #endif /* ENABLE_NLS */ > #define N_(String) String > #define _(String) dgettext (PACKAGE, String) 34c41 < #ifdef ENABLE_NLS --- > #if ENABLE_NLS 42c49 < #else /* ENABLE_NLS */ --- > #else /* !ENABLE_NLS */ 59c66 < #ifdef ENABLE_NLS --- > #if ENABLE_NLS 69c76 < #ifdef ENABLE_NLS --- > #if ENABLE_NLS 79c86 < #ifdef ENABLE_NLS --- > #if ENABLE_NLS 89c96 < #ifdef ENABLE_NLS --- > #if ENABLE_NLS 99c106 < #ifdef ENABLE_NLS --- > #if ENABLE_NLS 109c116 < #ifdef ENABLE_NLS --- > #if ENABLE_NLS 132c139 < printf ("Error during translation: %s\n", strerror (errno)); --- > printf ("%s: %s\n", _("Error during translation"), strerror (errno)); 136,137c143 < #else /* ENABLE_NLS */ < --- > #else /* !ENABLE_NLS */ 142a149 > #endif /* ENABLE_NLS */ 144d150 < #endif /* !ENABLE_NLS */ 146,147c152 < < #ifdef ENABLE_NLS --- > #if ENABLE_NLS 181c186 < printf ("Error during translation: %s\n", strerror (errno)); --- > printf ("%s: %s\n", _("Error during translation"), strerror (errno)); 208c213 < static StrList* --- > static StrList* 231c236,237 < free ((wchar_t*) list->str); --- > /* Warning about qualifyers */ > free (list->str); 541d546 < wchar_t* wc_str = gettext_to_wchar (str); /* FIXME */ 543c548 < --- > wchar_t* wc_str = gettext_to_wchar (str); /* FIXME */ diff -rN old-fdisk/src/ui.c new-fdisk/src/ui.c 35,42d34 < #define N_(String) String < #if ENABLE_NLS < # include < # include < # define _(String) dgettext (PACKAGE, String) < #else < # define _(String) (String) < #endif /* ENABLE_NLS */ 44c36,38 < #ifdef HAVE_LIBREADLINE --- > #if HAVE_LOCALE_H > #include > #endif /* HAVE_LOCALE_H */ 46,50c40,42 < #ifdef HAVE_TERMCAP_H < #include < #else < extern int tgetnum (char* key); < #endif --- > #include "gettext.h" > #define N_(String) String > #define _(String) dgettext (PACKAGE, String) 52,53c44,45 < #include < #include --- > /* BEGIN readline stuff */ > #if HAVE_READLINE 55,57c47,67 < #ifndef HAVE_RL_COMPLETION_MATCHES < #define rl_completion_matches completion_matches < #endif --- > # if HAVE_TERMCAP_H > # include > # else > extern int tgetnum (char* key); > # endif > > # if HAVE_READLINE_READLINE_H > # include > # else > extern char * readline (); > extern void add_history (); > # endif /* HAVE_READLINE_READLINE_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_READLINE */ 59,61c69 < #ifndef rl_compentry_func_t < #define rl_compentry_func_t void < #endif --- > /* END readline stuff */ 63c71 < #endif /* HAVE_LIBREADLINE */ --- > /* global and used in fdisk.c */ 66,91d73 < static char* banner_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, " < "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.\n\n"); < < static char* usage_msg = N_( < "Usage: fdisk [OPTION]... [DEVICE]\n"); < < static char* bug_msg = N_( < "You found a bug in GNU Fdisk.\n" < "This may have been fixed in the last version of GNU Parted that you can find at:\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, please email:\n" < "address@hidden" < "or (preferably) file a bug report at:\n" < "\thttp://parted.alioth.debian.org/bugs/\n\n" < "Your report should contain the version of this release (%s) along with the\n" < "error message below, the output of\n" < "\tparted DEVICE unit co print unit s print\n" < "and additional information about your setup you consider important.\n"); < 112c94 < /* If we don't want the possibilities to appear on the prompt, this --- > /* If we don't want the possibilities to appear on the prompt, this 117c99 < #ifdef HAVE_LIBREADLINE --- > #ifdef HAVE_READLINE 142a125 > #if 0 152c135,137 < #endif /* HAVE_LIBREADLINE */ --- > #endif /* 0 */ > > #endif /* HAVE_READLINE */ 168a154,164 > static int > is_empty_line(const char *s) > { > while(*s) > if(!isspace(*s)) > return 0; > else > s++; > return 1; > } > 172c168 < char* line; --- > char* line = NULL; 182,188c178,199 < #ifdef HAVE_LIBREADLINE < if (!fdisk_opt_script_mode) { < /* XXX: why isn't prompt const? */ < line = readline ((char*) prompt); < if (line) < _add_history_unique (line); < } else --- > > if (!fdisk_opt_script_mode) > #ifdef HAVE_READLINE > { /* !fdisk_opt_script_mode && HAVE_READLINE */ > line = readline(prompt); > if(line && *line) > //_add_history_unique (line); > add_history(line); > } > #else > { /* !fdisk_opt_script_mode */ > printf ("%s", prompt); > fflush (stdout); > line = (char*) calloc(sizeof(char), 256); > /* FIXME: strcmp(line, "xX") is not enought > * what appen if the user insert a space and a newline? */ > if (fgets (line, 256, stdin) == NULL || is_empty_line(line)) > { > free (line); > line = NULL; > } > } 190,198c201,215 < { < printf ("%s", prompt); < fflush (stdout); < line = (char*) malloc (256); < if (fgets (line, 256, stdin) && strcmp (line, "") != 0) { < line [strlen (line) - 1] = 0; /* kill trailing CR */ < } else { < free (line); < line = NULL; --- > /* MMM... I assume that `disk_opt_script_mode' is true when fdisk > * would be used whit a script, but this script where come from, > * a file or stdin? the following codo works on stdin > * but we kan do better with an option and a file... ? */ > else > { /* disk_opt_script_mode */ > line = (char*) calloc(sizeof(char), 256); > /* FIXME: strcmp(line, "xX") is not enought > * what appen if the user insert a space and a newline? > */ > if (fgets (line, 256, stdin) == NULL || is_empty_line(line)) > { > free (line); > line = NULL; > } 200,201d216 < } < 227a243,255 > char* bug_msg = > _("You found a bug in GNU Fdisk.\n" > "This may have been fixed in the last version of GNU Parted that you can find at:\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, please email:\n" > "address@hidden" > "or (preferably) file a bug report at:\n" > "\thttp://parted.alioth.debian.org/bugs/\n\n" > "Your report should contain the version of this release (%s) along with the\n" > "error message below, the output of\n" > "\tparted DEVICE unit co print unit s print\n" > "and additional information about your setup you consider important.\n"); 287,288c315 < _construct_prompt (const char* head, const char* def, < const StrList* possibilities) --- > _construct_prompt (const char* head, const char* def, const StrList* possibilities) 296c323 < if (possibilities && prompt_possibilities && --- > if (possibilities && prompt_possibilities && 454,456c481,488 < void < fdisk_usage_msg() { < printf (_(usage_msg)); --- > /* NOTE: The next call to _ make a memory corruption > * if we write (puts|printf) (_("Usage: fdisk [OPTION... [DEVICE]")); > */ > void > fdisk_usage_msg() > { > char *s = _("Usage: fdisk [OPTION]... [DEVICE]"); > puts(s); 462c494 < fdisk_usage_msg(); --- > fdisk_usage_msg(); 472a505,525 > /* move all in a function so we reduce stack size */ > static void > do_banner_message(void) > { > char* banner_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, " > "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.\n\n" ); > StrList* list; > > list = str_list_create (_(banner_msg), NULL); > str_list_print_wrap (list, fdisk_screen_width (), 0, 0); > str_list_destroy (list); > } > /* > * Begin interactive mode > */ 476a530,540 > #if 0 > char* banner_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, " > "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.\n\n" ); > #endif > 477a542 > 480c545 < printf ("%s\n", interface_name); --- > puts (interface_name); 481a547 > #if 0 484a551,553 > #else > do_banner_message(); > #endif 495,498c564,568 < if (feof (stdin)) { < printf ("\n"); < return 1; < } --- > if (feof (stdin)) > { > printf ("\n"); > return 1; > } 500,501c570 < fdisk_command_line_prompt_words ("Command (m for help):", NULL, < command_names, 1); --- > fdisk_command_line_prompt_words ("Command (m for help):", NULL, command_names, 1); 523c592 < * 1 - filesystem menu. --- > * 1 - filesystem menu. 536c605 < --- > 606c675 < #ifdef HAVE_LIBREADLINE --- > #ifdef HAVE_READLINE 637c706 < for (opt = option_get_next (options, 0); opt && i < sizeof(optlist) - 1; --- > for (opt = option_get_next (options, 0); opt && i < sizeof(optlist) - 1; 649c718 < for (opt = option_get_next (options, 0); opt; --- > for (opt = option_get_next (options, 0); opt; 652c721 < if (result == tolower(opt_name[0])) --- > if (result == tolower(opt_name[0])) 976c1045 < char buf[128]; --- > char buf[128]; 1000c1069 < --- > 1007c1076 < --- > 1018c1087 < } --- > } 1023c1092 < --- > 1035c1104 < --- > 1058c1127 < i++; --- > i++; 1186a1256,1258 > /* Readline support */ > > /* End readline support */ 1196c1268 < #ifdef HAVE_LIBREADLINE --- > #ifdef HAVE_READLINE 1200c1272 < #endif --- > #endif /* HAVE_READLINE */ diff -rN old-fdisk/src/ui.h new-fdisk/src/ui.h 37c37 < extern char* interface_name; --- > extern char *interface_name; 44c44 < extern PedExceptionOption --- > extern PedExceptionOption 66c66 < /*extern int fdisk_command_line_get_fs_type (const char* prompt, --- > /*extern int fdisk_command_line_get_fs_type (const char* prompt, 76c76 < extern int fdisk_get_partpos (const char* prompt, const void* context, --- > extern int fdisk_get_partpos (const char* prompt, const void* context,