diff -rN old-fdisk/ChangeLog new-fdisk/ChangeLog 0a1,13 > 2008-09-23 Christian > > * Complete readline support. > * Add getopt and getopt_long support from GNU Lib > * Better option handling. > > 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. > 4c17 < This file is part of GNU fdisk --- > This file is part of GNU fdisk 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/TODO new-fdisk/TODO 9c9 < - add readline support --- > - better readline support? 16c16 < This file is part of GNU fdisk --- > This file is part of GNU fdisk 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,34 > /* From gettextize */ > #include "gettext.h" > > #if HAVE_LOCALE_H > # include > #endif /* HAVE_LOCALE_H */ > 29,35c36 < #if ENABLE_NLS < # include < # include < # define _(String) dgettext (PACKAGE, String) < #else < # define _(String) (String) < #endif /* ENABLE_NLS */ --- > #define _(String) dgettext (PACKAGE, String) 52d52 < #ifdef HAVE_GETOPT_H 71,77c71,87 < /* 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,91c89,103 < {"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"}, > > /* Last element must be NULL */ > { NULL, 0, NULL, 0, NULL} 93d104 < #endif 96,116c107,110 < /* 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 make function to build dynamic in the future */ > static const char* short_option_string = "hlipvLGs:utb:C:H:S:r"; 184c178 < /* Timer handler and other UI functions */ --- > /* Timer handler and other UI functions */ 217,218d210 < < 277c269 < (*getint) (const char* prompt, int* value) = fdisk_command_line_get_integer; --- > (*getint) (const char* prompt, int* value) = fdisk_command_line_get_integer; 484c476 < * --- > * 506,511c498,503 < 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,514c505,506 < < fdisk_command_print_help (cmd); --- > > fdisk_command_print_help (cmd); 520c512 < --- > 542,543c534 < /* FIXME: Doesn't work correctly without getopt.h */ < void --- > void 545,561c536,539 < { < int i; < #ifdef HAVE_GETOPT_H < for (i=0; options_help [i][0] && options[i].val; i++) { < #else < #warning Printing help without getopt.h is broken. Fix it. < for (i=0; options_help [i][0]; i++) { < #endif < printf (" -%c, --%-23.23s %s\n", < #ifdef HAVE_GETOPT_H < options [i].val, < #else < options[i][0][0], < #endif < options_help [i][0], < _(options_help [i][1])); < } --- > { > unsigned int i; > 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)); 568c546 < --- > 591c569 < printf (_("Command action\n")); --- > puts(_("Command action")); 604,606c582,584 < 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,617c593,595 < 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,628c604,606 < 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,639c615,617 < 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. */ 662d639 < 664c641,642 < --- > > 693c671 < _("Do you want to create the filesystem on the partition?"))) --- > _("Do you want to create the filesystem on the partition?"))) 703c681 < --- > 711c689 < --- > 716,717c694,695 < 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 | 804c782 < --- > 852c830 < --- > 874c852 < "Are you sure you want to continue?")) --- > "Are you sure you want to continue?")) 883,884c861,862 < 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) && 890c868 < "Do you want to create one?")) --- > "Do you want to create one?")) 959c937 < PedSector blocks; --- > PedSector blocks; 975,978c953,956 < 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, 985c963 < heads, sectors, cylinders, (heads * sectors * cylinders), 1, --- > heads, sectors, cylinders, (heads * sectors * cylinders), 1, 990c968 < heads, sectors, cylinders, (heads * sectors), --- > heads, sectors, cylinders, (heads * sectors), 994c972 < --- > 999c977 < --- > 1001,1002c979,980 < < /* TODO: Make this output the same output as util-linux fdisk(?), --- > > /* TODO: Make this output the same output as util-linux fdisk(?), 1005c983 < printf ("%s %+10s %+11s %+11s %+4s %+7s ", _("# "), --- > printf ("%s %+10s %+11s %+11s %+4s %+7s ", _("# "), 1025,1026c1003,1004 < < cyl_start = (part->geom.start / (total_cyl)) + 1; --- > > cyl_start = (part->geom.start / (total_cyl)) + 1; 1033c1011 < end = part->geom.end; --- > end = part->geom.end; 1036,1038c1014,1016 < else { < start = (part->geom.start / total_cyl < * total_cyl) + sectors; --- > else { > start = (part->geom.start / total_cyl > * total_cyl) + sectors; 1041,1043c1019,1021 < 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))) 1048c1026 < blocks = ((end * total_cyl) - ((part->num == 1) ? --- > blocks = ((end * total_cyl) - ((part->num == 1) ? 1051c1029 < --- > 1054c1032 < --- > 1067c1045 < --- > 1076c1054 < char *type_name = _(get_disk_specific_system_name(part,0)); --- > char *type_name = _(get_disk_specific_system_name(part,0)); 1085c1063 < if (part->fs_type --- > if (part->fs_type 1088c1066 < else if (is_bsd_partition ((*disk)->dev->path, --- > else if (is_bsd_partition ((*disk)->dev->path, 1091c1069 < else if (!strcmp (type, "primary")) --- > else if (!strcmp (type, "primary")) 1104c1082 < --- > 1125c1103 < int is_boot, start_cyl, start_head, start_sector, --- > int is_boot, start_cyl, start_head, start_sector, 1138c1116 < --- > 1141c1119 < continue; --- > continue; 1157c1135 < --- > 1159c1137 < part->num, is_boot ? 0x80 : 0, --- > part->num, is_boot ? 0x80 : 0, 1162,1165c1140,1143 < 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)); > > 1217c1195 < do_raw (PedDisk **disk) --- > do_raw (PedDisk **disk) 1235c1213 < --- > 1241c1219 < } --- > } 1262c1240 < --- > 1268c1246 < cyl_start = (part->geom.start / (total_cyl)) + 1; --- > cyl_start = (part->geom.start / (total_cyl)) + 1; 1273,1274c1251,1252 < ((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))) / 1279c1257 < --- > 1282c1260 < static void --- > static void 1286c1264 < --- > 1288c1266 < --- > 1292c1270 < --- > 1471c1449 < if (!command_line_prompt_boolean_question --- > if (!command_line_prompt_boolean_question 1509c1487 < --- > 1547c1525 < return 0; --- > return 0; 1554c1532 < --- > 1563c1541 < --- > 1566c1544 < else --- > else 1595c1573 < if (!command_line_prompt_boolean_question --- > if (!command_line_prompt_boolean_question 1678,1679c1656,1657 < if (uiquery.need_commit) < if (!command_line_prompt_boolean_question --- > if (uiquery.need_commit) > if (!command_line_prompt_boolean_question 1688c1666 < --- > 1706,1707c1684,1685 < < --- > > 1731c1709 < static int --- > static int 1733c1711 < { --- > { 1764c1742 < --- > 1793c1771 < status = fdisk_interactive_menu (disk, --- > status = fdisk_interactive_menu (disk, 1844c1822 < if (!command_line_prompt_boolean_question --- > if (!command_line_prompt_boolean_question 1846c1824 < "seem unavailable, continue?"))) --- > "seem unavailable, continue?"))) 1876c1854 < --- > 1939c1917 < --- > 1945,1946c1923,1924 < 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) 2176c2154 < --- > 2185,2191c2163,2172 < 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) > ); > 2229c2210 < } --- > } 2305c2286 < --- > 2337c2318 < --- > 2510c2491 < printf ("%s\n", interface_name); --- > puts(interface_name); 2513a2495,2513 > /** > * 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++) > memcpy(&(option[i]), &(extd_options[i]), sizeof(struct option)); > return option; > } > 2517a2518 > struct option *options_table, *ptr; 2519,2530c2520,2526 < 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; < --- > /* Build option table > * we need two pointers because getopt long modify `ptr' and we can't feree it */ > options_table = ptr = build_option_table(); > > 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,2540c2528,2543 < 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,2543c2545,2550 < 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,2551c2552,2565 < 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,2556c2567,2580 < 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,2560d2581 < case 'C': user_cyls = atoi(optarg); break; < case 'H': user_heads = atoi(optarg); break; < case 'S': user_sectors = atoi(optarg); break; 2565a2587,2589 > > free(options_table); > 2567a2592 > /* what is? */ 2608c2633 < dev->length = bytes / user_sectsize; --- > dev->length = bytes / user_sectsize; 2617c2642 < llcyl = dev->length / --- > llcyl = dev->length / 2630c2655 < --- > 2632c2657 < printf(_("Unable to open %s\n"), path); --- > printf(_("Unable to open %s\n"), path); 2637c2662 < return NULL; --- > return NULL; 2655d2679 < 2663c2687 < --- > 2686a2711 > 2688a2714 > 2704a2731,2736 > /** > * Program entry point > * \param argc number of command line arguments > * \param argv array of command line arguments > * \return EXIT_SUCCESS or EXIT_FAILURE > */ 2708,2710c2740,2741 < PedDevice* dev; < PedDisk* disk; < int status; --- > PedDevice* dev; > PedDisk* disk; 2712,2715c2743,2748 < if (argc <= 1) { < fdisk_usage_msg(); < return -1; < } --- > if (argc <= 1) > { > /* Missing device parameter */ > fdisk_usage_msg(); > return EXIT_FAILURE; > } 2717d2749 < 2730c2762 < #endif --- > #endif /* GNU_EXT */ 2735,2738c2767,2770 < /* 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; 2740c2772,2775 < disk = ped_disk_new (dev); --- > disk = ped_disk_new(dev); > > if(!disk) > return EXIT_FAILURE; 2742,2743d2776 < if (!disk) < return 1; 2745c2778 < if (fdisk_partsize_device) --- > if(fdisk_partsize_device) 2750,2755c2783 < do_list_devices(disk); < < status = fdisk_interactive_mode (&disk, fdisk_main_menu_commands); < < return !status; < } --- > do_list_devices(disk); 2756a2785,2786 > 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,130 > /* > * I think that this function will add current > * input line to history _only_ if is not duplicated. > * Well? What is HIST_ENTRY ? */ > > #if 0 152c140,142 < #endif /* HAVE_LIBREADLINE */ --- > #endif > > #endif /* HAVE_READLINE */ 168a159,170 > /* check if line is only spaces */ > static int > is_empty_line(const char *s) > { > while(*s) > if(!isspace(*s)) > return 0; > else > s++; > return 1; > } > 172c174 < char* line; --- > char* line = NULL; 182,188c184,203 < #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); > if (fgets (line, 256, stdin) == NULL || is_empty_line(line)) > { > free (line); > line = NULL; > } > } 190,198c205,216 < { < 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); > if (fgets (line, 256, stdin) == NULL || is_empty_line(line)) > { > free (line); > line = NULL; > } 200,201d217 < } < 227a244,256 > 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,288c316 < _construct_prompt (const char* head, const char* def, < const StrList* possibilities) --- > _construct_prompt (const char* head, const char* def, const StrList* possibilities) 296c324 < if (possibilities && prompt_possibilities && --- > if (possibilities && prompt_possibilities && 454,456c482,489 < 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); 462c495 < fdisk_usage_msg(); --- > fdisk_usage_msg(); 472a506,526 > /* 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 > */ 476a531,541 > #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 > 477a543 > 480c546 < printf ("%s\n", interface_name); --- > puts (interface_name); 481a548 > #if 0 484a552,554 > #else > do_banner_message(); > #endif 495,498c565,569 < if (feof (stdin)) { < printf ("\n"); < return 1; < } --- > if (feof (stdin)) > { > printf ("\n"); > return 1; > } 500,501c571 < 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); 523c593 < * 1 - filesystem menu. --- > * 1 - filesystem menu. 536c606 < --- > 606c676 < #ifdef HAVE_LIBREADLINE --- > #ifdef HAVE_READLINE 637c707 < for (opt = option_get_next (options, 0); opt && i < sizeof(optlist) - 1; --- > for (opt = option_get_next (options, 0); opt && i < sizeof(optlist) - 1; 649c719 < for (opt = option_get_next (options, 0); opt; --- > for (opt = option_get_next (options, 0); opt; 652c722 < if (result == tolower(opt_name[0])) --- > if (result == tolower(opt_name[0])) 976c1046 < char buf[128]; --- > char buf[128]; 1000c1070 < --- > 1007c1077 < --- > 1018c1088 < } --- > } 1023c1093 < --- > 1035c1105 < --- > 1058c1128 < i++; --- > i++; 1186a1257,1259 > /* Readline support */ > > /* End readline support */ 1196c1269 < #ifdef HAVE_LIBREADLINE --- > #ifdef HAVE_READLINE 1200c1273 < #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,