Commit Graph

82 Commits

Author SHA1 Message Date
Karel Zak f9fb8290d8 cfdisk: print "wrong order" warning after startup, colorize info messages
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-02-03 11:04:37 +01:00
Karel Zak b5ef65a931 cfdisk: force main menu to default to Quit/New menu items
Reported-by: Benno Schulenberg <bensberg@justemail.net>
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-02-03 10:37:33 +01:00
Karel Zak 635a81513a cfdisk: disable some KEY_* in ui_get_wqstring()
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-02-02 13:05:48 +01:00
Karel Zak 316bce9dd4 cfdisk: default to Quit menu item
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-02-02 12:47:50 +01:00
Benno Schulenberg 2a0ffa311c cfdisk: make '?' an alias of 'h', to also show the help screen
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2015-02-02 10:57:07 +01:00
Benno Schulenberg d4640320df cfdisk: punctuate the bottombar messages consistently
Also adjust the style of two comments and add another.

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2015-02-02 10:57:07 +01:00
Benno Schulenberg 143d9e3e52 cfdisk: improve wording and consistency of the size warnings
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2015-02-02 10:57:07 +01:00
Benno Schulenberg a4fbbbd491 cfdisk: remove the mistaken B from the explanation of size suffixes
Also reword the explanation to be clearer.  It is not necessary to
be complete -- that is what the man page is for.

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2015-02-02 10:57:07 +01:00
Karel Zak ec8a728ae0 cfdisk: fix mem leak and main_menu_action() logic [coverity scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-01-28 14:30:20 +01:00
Benno Schulenberg b6e3c61464 cfdisk: actually translate the table headers and the bottom line
The printout of the table headers and the bottomline descriptions
were lacking calls to gettext().

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2015-01-26 11:53:51 +01:00
Benno Schulenberg e993b9c8e5 cfdisk: shorten the help screen to make it fit within 25 lines
When the terminal has less than 32 lines, the new cfdisk ignored the
fact that the help-screen text was longer and just skipped printing
the remaining lines.  Instead of introducing a minipager for the help
screen, just condense its text and remove unneeded lines.  Now the
text occupies just 25 lines, which should fit on most terminals.

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2015-01-26 11:53:49 +01:00
Benno Schulenberg fd4484a712 cfdisk: don't mess up the help screen by printing the PO file header
Asking for the translation of the empty string ("") produces the header
of the PO file corresponding to the current locale, which messes up the
help screen.  So, don't use empty strings in the array of help strings
but (arbitrary) double spaces.

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2015-01-26 11:53:48 +01:00
Benno Schulenberg 54fefa078e textual: fix spellos and inconsistencies in several program messages
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2015-01-26 11:17:55 +01:00
Sami Kerola 7ee26cbf02 maint: fix shadow declaration
This change fixes all shadow declarations.  The worth while to mention
fix is with libfdisk sun geometry.  It comes from bitops.h cpu_to_be16
macro that further expands from include/bits/byteswap.h that has the
shadowing.

libfdisk/src/sun.c:961:173: warning: declaration of '__v' shadows a previous local [-Wshadow]
libfdisk/src/sun.c:961:69: warning: shadowed declaration is here [-Wshadow]
libfdisk/src/sun.c:961:178: warning: declaration of '__x' shadows a previous local [-Wshadow]
libfdisk/src/sun.c:961:74: warning: shadowed declaration is here [-Wshadow]

That could have caused earlier some unexpected results.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2015-01-07 10:08:21 +01:00
Benno Schulenberg 451dbcfae1 textual: add a docstring to most of the utilities
This adds a concise description of a tool to its usage text.

A first form of this patch was proposed by Steven Honeyman
(see http://www.spinics.net/lists/util-linux-ng/msg09994.html).

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2015-01-06 11:27:38 +01:00
Karel Zak 8c9615a99b cfdisk: improve Dump dialog
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-01-05 12:53:50 +01:00
Karel Zak 702d0e1cef cfdisk: improve menu clean function
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-01-05 12:42:24 +01:00
Karel Zak 7509020126 cfdisk: detect too small partition sizes
References: https://github.com/karelzak/util-linux/issues/136
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-01-05 12:13:25 +01:00
Karel Zak a1ef792fda libfdisk: rename and move function
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-11-26 17:33:07 +01:00
Karel Zak 5c04b40850 cfdisk: cleanup menuitem draw functions
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-11-13 12:52:03 +01:00
Karel Zak 5cb9918d59 cfdisk: remove [Load] from menu
This functionality will be rarely used, so it does not make sense to
waste screen space with this menu item. It's enough to provide this
functionality in "Select label type" dialog (cfdisk --zero and then
'L' command).

Signed-off-by: Karel Zak <kzak@redhat.com>
2014-11-13 11:19:58 +01:00
Karel Zak a89eafed85 cfdisk: add support for sfdisk scripts
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-11-12 16:12:39 +01:00
Karel Zak 819d9a2975 include/debug: fix typo
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-10-24 11:19:23 +02:00
Karel Zak ecf40cda76 libfdisk: make it possible to use zero for size and start
The zero may be valid size and start of the partition. This patch
introduces:

	fdisk_partition_has_start()
	fdisk_partition_has_size()
	fdisk_partition_unset_size()
	fdisk_partition_unset_start()

to make it possible to work with zero. The feature is internally
implemented by magic constant ((type) -1) for undefined sizes and
offsets.

Signed-off-by: Karel Zak <kzak@redhat.com>
2014-10-15 12:17:40 +02:00
Karel Zak 05af8bd4f0 sfdisk: ask on EOF
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-10-09 12:23:59 +02:00
Karel Zak 9b0b9fb1bf libfdisk: follow explicitly specified partition size
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-10-09 12:09:07 +02:00
Karel Zak c3bc748352 libfdisk: return partno when add new partition
* improve the way how sfdisk report results
 * the API change simplify applications

Signed-off-by: Karel Zak <kzak@redhat.com>
2014-10-07 14:55:31 +02:00
Sami Kerola f627750083 textual: use version printing macro everywhere
Only mount, umount, and blkid remains not using the macro because they
are print also library references.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-10-01 12:33:23 +02:00
Karel Zak eef6397023 cfdisk: don't modify ncurses LINES and COLS
On Sun, Sep 28, 2014 at 01:48:38AM -0700, pv4 wrote:
 If ncurses is build with --enable-reentrant, building
 util-linux-2.25.1 fails with the folllowing error:

     disk-utils/cfdisk.c: In function 'resize':
     disk-utils/cfdisk.c:202:9: error: lvalue required as left operand of assignment
        LINES = ws.ws_row;
              ^
     disk-utils/cfdisk.c:203:8: error: lvalue required as left operand of assignment
        COLS = ws.ws_col;
             ^

 man COLS gives the following:

     Depending on the configuration, these may be actual variables,
     or macros (see curs_threads(3X)) which provide read-only
     access to curses's state.  In either case, applications should
     treat them as read-only to avoid confusing the library.

Addresses: https://github.com/karelzak/util-linux/issues/125
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-10-01 11:38:49 +02:00
Karel Zak c7119037f0 libfdisk: use reference counting for context
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-08-28 12:49:16 +02:00
Karel Zak 59af21c3f2 cfdisk: fix typo in the previous commit
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-08-26 22:19:26 +02:00
Karel Zak ce3134dfdd cfdisk: wrong interpretation of yes in non-english language
Reported-by: tnut@nutyx.org
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-08-26 17:03:11 +02:00
Karel Zak 8eccde20dd fdisk: use libfdisk public API only
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-08-15 12:16:55 +02:00
Karel Zak 57c83d63e4 cfdisk: use only public libfdisk API
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-08-15 10:50:33 +02:00
Karel Zak a745611d69 libfdisk: final parttype API cleanup
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-08-14 13:28:37 +02:00
Karel Zak 5ab3760071 libfdisk: move get_parttypes to label API
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-08-14 12:01:38 +02:00
Karel Zak 11ee1177ff libfdisk: make it possible to get fields for all labes
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-08-14 00:27:28 +02:00
Karel Zak aa36c2cf2c libfdisk: cleanup fdisk_is_label stuff
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-08-13 23:57:54 +02:00
Karel Zak 6a6321360d libfdisk: clean up API (context.c)
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-08-13 22:26:53 +02:00
Karel Zak 14620822c0 cfdisk: add libfdisk independent debug stuff
Now it's possible to use
	CFDISK_DEBUG=0xffff ./cfdisk
to debug only cfdisk UI.

Signed-off-by: Karel Zak <kzak@redhat.com>
2014-08-13 21:21:46 +02:00
Karel Zak bd85d11fba libfdisk: rename fdisk_column to fdisk_field
.. to make the API and fdisk(s) code more readable.

Signed-off-by: Karel Zak <kzak@redhat.com>
2014-08-13 11:12:27 +02:00
Karel Zak d44115f3b5 libfdisk: remove dependence on libsmartcols
It's application business to convert libfdisk_table to string.

Signed-off-by: Karel Zak <kzak@redhat.com>
2014-08-13 10:10:11 +02:00
Karel Zak cd8414f7a1 cfdisk: move curs_set(1) to ui_end()
This is probably correct to have curs_set() in ui_end(), but according
to Martin it does not work with slang library from signal handler.

Reported-by: Martin Steigerwald <Martin@lichtvoll.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-08-06 15:39:27 +02:00
Andreas Henriksson 4f4daf8f90 cfdisk: reenable cursor when quitting
After quitting cfdisk (built with slang) the cursor would be
missing at the command prompt.

Reported-by: Martin Steigerwald <Martin@Lichtvoll.de>
Addresses-Debian-Bug: #755991
Signed-off-by: Andreas Henriksson <andreas@fatal.se>
2014-07-28 11:09:56 +02:00
Benno Schulenberg 09af3db48e textual: fix some typos and inconsistencies in various messages
Fixing plain typos, miswordings, inconsistent periods, some missing
angular brackets, and a proper pluralization (even when it involves
a constant, because for some languages the precise value matters).

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2014-07-23 08:56:00 +02:00
Benno Schulenberg 86407f2cae cfdisk: actually translate the partition types in the menu
[kzak@redhat.com: - translate also GPT types]

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-07-21 15:36:33 +02:00
Karel Zak a4f0a42dd2 cfdisk: use /dev/sda by default
.. this all is for backward compatibility.

Signed-off-by: Karel Zak <kzak@redhat.com>
2014-07-18 12:54:40 +02:00
Karel Zak d02c203512 cfdisk: make code more readable for analyzers [coverity scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-07-17 13:59:01 +02:00
Karel Zak a9408274b7 cfdisk: fix possible memory leak [coverity scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-07-17 13:46:27 +02:00
Benno Schulenberg 2ddfd9e424 cfdisk: restore the license that was lost in January
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-07-15 13:25:19 +02:00