*** parted/parted.c.ORIG Sat Feb 18 13:39:29 2012 --- parted/parted.c Sat Feb 18 13:53:40 2012 *************** *** 100,107 **** --- 100,127 ---- ALIGNMENT_MINIMAL, ALIGNMENT_OPTIMAL }; + ARGMATCH_VERIFY (align_args, align_types); + static char const *const unit_args[] = + { + "compact", + "sector", + "byte", + "cylinder", + "chs", + NULL + }; + + static PedUnit const unit_types[] = + { + PED_UNIT_COMPACT, + PED_UNIT_SECTOR, + PED_UNIT_BYTE, + PED_UNIT_CYLINDER, + PED_UNIT_CHS, + }; + typedef struct { time_t last_update; time_t predicted_time_left; *************** *** 114,119 **** --- 134,140 ---- {"machine", 0, NULL, 'm'}, {"script", 0, NULL, 's'}, {"version", 0, NULL, 'v'}, + {"unit", required_argument, NULL, 'u'}, {"align", required_argument, NULL, 'a'}, {"-pretend-input-tty", 0, NULL, PRETEND_INPUT_TTY}, {NULL, 0, NULL, 0} *************** *** 125,130 **** --- 146,152 ---- {"machine", N_("displays machine parseable output")}, {"script", N_("never prompts for user intervention")}, {"version", N_("displays the version")}, + {"unit=[compact|sector|byte|cylinder|chs]", N_("specify units to display")}, {"align=[none|cyl|min|opt]", N_("alignment for new partitions")}, {NULL, NULL} }; *************** *** 1823,1828 **** --- 1845,1851 ---- _parse_options (int* argc_ptr, char*** argv_ptr) { int opt, help = 0, list = 0, version = 0, wrong = 0; + PedUnit unit; while (1) { *************** *** 1841,1846 **** --- 1864,1874 ---- alignment = XARGMATCH ("--align", optarg, align_args, align_types); break; + case 'u': + unit = XARGMATCH ("--unit", optarg, + unit_args, unit_types); + ped_unit_set_default(unit); + break; case PRETEND_INPUT_TTY: pretend_input_tty = 1; break;