From 7d2ba34044662eb559f5eb158ec01e918fdec749 Mon Sep 17 00:00:00 2001 From: Sami Kerola Date: Sun, 15 Jul 2012 08:58:51 +0200 Subject: [PATCH] fdisk: make if clause easier to read Signed-off-by: Sami Kerola --- fdisks/fdisk.c | 37 ++++++++++++++++++------------------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/fdisks/fdisk.c b/fdisks/fdisk.c index 4d5ab02ceb..3fede9591b 100644 --- a/fdisks/fdisk.c +++ b/fdisks/fdisk.c @@ -2080,27 +2080,26 @@ int main(int argc, char **argv) exit(EXIT_SUCCESS); } - if (argc-optind == 1) { - cxt = fdisk_new_context_from_filename(argv[optind], 0); - if (!cxt) - err(EXIT_FAILURE, _("unable to open %s"), argv[optind]); - if (sector_size) /* passed -b option, override autodiscovery */ - cxt->phy_sector_size = cxt->sector_size = sector_size; - /* passed CHS option(s), override autodiscovery */ - if (user_cylinders) - cxt->geom.cylinders = user_cylinders; - if (user_heads) { - cxt->geom.heads = user_heads; - fdisk_geom_set_cyls(cxt); - } - if (user_sectors) { - cxt->geom.sectors = user_sectors; - fdisk_geom_set_cyls(cxt); - } - } - else + if (argc-optind != 1) usage(stderr); + cxt = fdisk_new_context_from_filename(argv[optind], 0); + if (!cxt) + err(EXIT_FAILURE, _("unable to open %s"), argv[optind]); + if (sector_size) /* passed -b option, override autodiscovery */ + cxt->phy_sector_size = cxt->sector_size = sector_size; + /* passed CHS option(s), override autodiscovery */ + if (user_cylinders) + cxt->geom.cylinders = user_cylinders; + if (user_heads) { + cxt->geom.heads = user_heads; + fdisk_geom_set_cyls(cxt); + } + if (user_sectors) { + cxt->geom.sectors = user_sectors; + fdisk_geom_set_cyls(cxt); + } + print_welcome(); if (!fdisk_dev_sectsz_is_default(cxt)) -- 2.47.3