summaryrefslogtreecommitdiffstats
path: root/disk-utils/cfdisk.c
Commit message (Collapse)AuthorAgeFilesLines
* cfdisk: free libfdisk itemsKarel Zak2019-06-111-0/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* cfdisk: simplify codeKarel Zak2019-06-111-3/+1Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* misc: consolidate version printing and close_stdout()Karel Zak2019-04-161-3/+2Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* fdisk: use 2 decimal places for size in disk summaryKarel Zak2019-02-121-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | In the disk summary it seems nice, but I'm not sure about lists (SIZE columns). It seems more readable to keep the lists with one decimal place only. New output: # sfdisk --list /dev/sda Old output: Disk /dev/sda: 223.6 GiB, 240057409536 bytes, 468862128 sectors New output: Disk /dev/sda: 223.58 GiB, 240057409536 bytes, 468862128 sectors The rest is unchanged: ... Device Start End Sectors Size Type /dev/sda1 2048 411647 409600 200M EFI System /dev/sda2 411648 821247 409600 200M Linux filesystem /dev/sda3 821248 274087935 273266688 130.3G Linux filesystem /dev/sda4 274087936 378945535 104857600 50G Linux filesystem /dev/sda5 378945536 468862094 89916559 42.9G Linux filesystem Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1673452 Signed-off-by: Karel Zak <kzak@redhat.com>
* cfdisk: fix compiler warnings [-Wcast-qual]Karel Zak2018-07-231-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* cfdisk: fix compiler warnings, follow-up 7085f1e4 (#636)Ruediger Meier2018-05-241-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | Seen on OSX 10.13, xcode 9.3. disk-utils/cfdisk.c:1860:45: error: format specifies type 'uintmax_t' (aka 'unsigned long') but the argument has type 'uint64_t' (aka 'unsigned long long') [-Werror,-Wformat] DBG(UI, ul_debug("get_size (default=%ju)", *res)); ~~~ ^~~~ %llu disk-utils/cfdisk.c:267:60: note: expanded from macro 'DBG' #define DBG(m, x) __UL_DBG(cfdisk, CFDISK_DEBUG_, m, x) ^ ./include/debug.h:67:4: note: expanded from macro '__UL_DBG' x; \ ^ disk-utils/cfdisk.c:1889:25: error: incompatible pointer types passing 'uint64_t *' (aka 'unsigned long long *') to parameter of type 'uintmax_t *' (aka 'unsigned long *') [-Werror,-Wincompatible-pointer-types] rc = parse_size(buf, &user, &pwr); /* parse */ ^~~~~ ./include/strutils.h:15:51: note: passing argument to parameter 'res' here extern int parse_size(const char *str, uintmax_t *res, int *power); ^ 2 errors generated. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* cfdisk: use uint64_t to avoid compiler warningsKarel Zak2018-05-241-11/+11
| | | | | Reported-by: Ruediger Meier <ruediger.meier@ga-group.nl> Signed-off-by: Karel Zak <kzak@redhat.com>
* cfdisk: fix missing prototype for `get_wch`Patrick Steinhardt2018-04-111-0/+4
| | | | | | | | | | | | The header <ncursesw/ncurses.h> defines the get_wch(3) function only when `NCURSES_WIDECHAR` is defined. This define is actually getting set in the same header file, but only in case `_XOPEN_SOURCE` is defined and has a value of 500 or higher. As we already have the precedence of defining `_XOPEN_SOURCE` to a value of 600 in some other files, simply define it to the minimum required value of 500 in "cfdisk.c". This silences a warning for `get_wch` being unknown. Signed-off-by: Patrick Steinhardt <ps@pks.im>
* include/debug: introduce __UL_INIT_DEBUG_FROM_STRING()Karel Zak2018-01-171-1/+1
| | | | | | | Let's make it possible to use debug.h without environment variables. Suggested-by: J William Piggott <elseifthen@gmx.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* cfdisk: cleanup die-on-signal codeKarel Zak2017-09-261-16/+47
| | | | | | | Let's keep signal handler simple and don't cleanup terminal from the handler. Signed-off-by: Karel Zak <kzak@redhat.com>
* cfdisk: make resize code more readableKarel Zak2017-09-261-10/+10
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* cfdisk: add missing 0x7F key mappingKarel Zak2017-08-151-0/+1
| | | | | Addresses: https://github.com/karelzak/util-linux/issues/499 Signed-off-by: Karel Zak <kzak@redhat.com>
* cfdisk: add resize functionKarel Zak2017-07-191-7/+49
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* cfdisk: use fdisk_reread_changes()Karel Zak2017-07-141-1/+11
| | | | | | Let's make cfdisk usable for disks where some partitions are mounted. Signed-off-by: Karel Zak <kzak@redhat.com>
* misc: consolidate macro style USAGE_HELP_OPTIONSRuediger Meier2017-06-291-2/+2
| | | | | | | | | changed in include/c.h and applied via sed: sed -i 's/fprintf.*\(USAGE_MAN_TAIL.*\)/printf(\1/' $(git ls-files -- "*.c") sed -i 's/print_usage_help_options\(.*\);/printf(USAGE_HELP_OPTIONS\1);/' $(git ls-files -- "*.c") Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* misc: introduce print_usage_help_options()Ruediger Meier2017-06-271-2/+1Star
| | | | | | | | | | | | Consolidate --help and --version descriptions. We are now able to align them to the other options. We changed include/c.h. The rest of this patch was generated by sed, plus manually setting the right alignment numbers. We do not change anything but white spaces in the --help output. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* misc: cosmetics, remove argument from usage(FILE*)Ruediger Meier2017-06-261-3/+4
| | | | | | | | | | | | | | This patch is trivial and changes nothing, because we were always using usage(stdout) Now all our usage() functions look very similar. If wanted we could auto-generate another big cosmetical patch to remove all the useless "FILE *out" constants and use printf and puts rather than their f* friends. Such patch could be automatically synchronized with the translation project (newlines!) to not make the translators sick. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* misc: fix reassigned values before old ones has been used [cppcheck]Sami Kerola2017-06-141-1/+1
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* cfdisk: fix compiler warningKarel Zak2017-05-311-2/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* cfdisk: add hints for scanners [coverity scan]Karel Zak2017-05-171-0/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* Fix menu spelling in cfdisk debug messagesKarel Zak2017-03-221-2/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* misc: stop mixing declarations and codeSami Kerola2017-03-131-1/+3
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* misc: add static keyword to where needed [smatch scan]Sami Kerola2017-02-201-3/+3
| | | | | | | text-utils/rev.c:68:9: warning: symbol 'buf' was not declared. Should it be static? Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* misc: do not use plain 0 as NULL [smatch scan]Sami Kerola2017-02-201-1/+1
| | | | | | | | | | text-utils/tailf.c:69:21: warning: Using plain integer as NULL pointer Since many 'struct option' has used zero as NULL make them more readable in same go by reindenting, and using named argument requirements. Reference: https://lwn.net/Articles/93577/ Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* cfdisk: avoid use of VLA in combination with sizeof() [smatch scan]Sami Kerola2017-02-201-2/+5
| | | | | | | | | disk-utils/cfdisk.c:1066:29: error: cannot size expression One should use sizeof() only when variable size can be known at time of compilation. That is not the case with variable length arrays. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* cfdisk: use buffer editor for ui_get_string()Karel Zak2017-02-161-53/+46Star
| | | | | Addresses: https://github.com/karelzak/util-linux/issues/403 Signed-off-by: Karel Zak <kzak@redhat.com>
* cfdisk: add copyright to helpKarel Zak2017-02-021-1/+4
| | | | | | ... to make it obvious this is a new cfdisk. Signed-off-by: Karel Zak <kzak@redhat.com>
* cfdisk: support UI refresh on ^LKarel Zak2017-02-011-2/+14
| | | | | Addresses: https://github.com/karelzak/util-linux/issues/404 Signed-off-by: Karel Zak <kzak@redhat.com>
* Use --help suggestion on invalid optionKarel Zak2016-12-191-0/+2
| | | | | | | | The current default is to print all usage() output. This is overkill in many case. Addresses: https://github.com/karelzak/util-linux/issues/338 Signed-off-by: Karel Zak <kzak@redhat.com>
* cfdisk: fix mountpoint detectionKarel Zak2016-10-041-21/+26
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* cfisk: add /dev/vda as another default diskKarel Zak2016-07-071-13/+23
| | | | | | | And use array for all default alternative disks. Reported-by: Thierry Vignaud <thierry.vignaud@gmail.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* cfdisk: use libsmartcols ASCII for non-widechar environmentKarel Zak2016-06-031-0/+4
| | | | | Reported-by: Stanislav Brabec <sbrabec@suse.cz> Signed-off-by: Karel Zak <kzak@redhat.com>
* misc: Fix various typosSebastian Rasmussen2016-05-311-1/+1
| | | | | | | Fix various typos in error messages, warnings, debug strings, comments and names of static functions. Signed-off-by: Sebastian Rasmussen <sebras@gmail.com>
* build-sys: remove obsolete [cs]fdisk LDADDsKarel Zak2016-05-041-4/+0Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* sfdisk: add --wipe-partitions=auto|never|defaultKarel Zak2016-05-041-33/+12Star
| | | | | | | | | | | | | The option allows to remove filesystes/RAIDs from newly created partitions before the partition table is updated (and partition device created). The default is "auto" in this case wipe is enabled in interactive mode only and user's confirmation (yes/no dialog) is required. Note that keep filesystem signature on partition is pretty valid use-case, so we don't erase anything by default. Signed-off-by: Karel Zak <kzak@redhat.com>
* fdisk, cfdisk, sfdisk: improve the grammar of three messagesBenno Schulenberg2016-03-161-1/+1
| | | | Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* cfdisk: wipe device if create a new labelKarel Zak2016-02-181-0/+8
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* cfdisk: use new libsmartcols functionality to fix outputKarel Zak2015-12-071-0/+1
| | | | | Reported-by: Benno Schulenberg <bensberg@justemail.net> Signed-off-by: Karel Zak <kzak@redhat.com>
* Revert "cfdisk: make sure that output fits to terminal width"Karel Zak2015-12-071-13/+2Star
| | | | This reverts commit ed99eac0e2a83a315c7cf5d8a461df16b3106596.
* cfdisk, sfdisk: remove unused variablesKarel Zak2015-08-051-9/+8Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* cfdisk: check return value [coverity scan]Karel Zak2015-08-041-3/+5
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* textual: adjust grammar and punctuation of some messagesBenno Schulenberg2015-08-031-1/+1
| | | | | | | Also equalize three messages to one other one, and fix a typo in USE_COLORS_BY_DEFAULT. Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* cfdisk: don't print obsolete CHS addressesKarel Zak2015-07-271-10/+0Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* cfdisk: make sure that output fits to terminal widthKarel Zak2015-07-271-2/+13
| | | | | Reported-by: Benno Schulenberg <bensberg@justemail.net> Signed-off-by: Karel Zak <kzak@redhat.com>
* cfdisk: remove extra line between menu and info lineKarel Zak2015-07-271-1/+1
| | | | | Reported-by: Benno Schulenberg <bensberg@justemail.net> Signed-off-by: Karel Zak <kzak@redhat.com>
* cfdisk: spell "label" in lower caseBenno Schulenberg2015-07-271-1/+1
| | | | | | To be less shouty. It is not an abbreviation like "UUID". Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* cfdisk: allow an uppercase X to toggle the extra infoBenno Schulenberg2015-07-271-0/+1
| | | | | | | To make true the help text line that says that all commands can be entered with either upper or lower case. Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* cfdisk: make sure that extra info is refreshed/removedKarel Zak2015-07-221-1/+3
| | | | | | | For example when you move from a Partition to the FreeSapce then we need to remove old extra info and draw nothing. Signed-off-by: Karel Zak <kzak@redhat.com>
* cfdisk: properly toggle extra info window, make it more robustKarel Zak2015-07-221-9/+31
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* cfdisk: fix condition logic [cppcheck]Boris Egorov2015-06-251-1/+1
| | | | | | | | [disk-utils/cfdisk.c:1181] -> [disk-utils/cfdisk.c:1181]: (warning) Possible null pointer dereference: data - otherwise it is redundant to check it against null. Signed-off-by: Boris Egorov <egorov@linux.com>