- while (1) {
- int long_index;
- static const struct option long_options[] = {
- { "raw", no_argument, NULL, 'b'},
- { "kbytes", no_argument, NULL, 'k'},
- { "mbytes", no_argument, NULL, 'm'},
- { "gbytes", no_argument, NULL, 'g'},
- { "tbytes", no_argument, NULL, 't'},
- { "si", no_argument, NULL, GETOPT_VAL_SI},
- { "iec", no_argument, NULL, GETOPT_VAL_IEC},
- { "human-readable", no_argument, NULL,
- GETOPT_VAL_HUMAN_READABLE},
- };
- int c = getopt_long(argc, argv, "bhHkmgt", long_options,
- &long_index);
- if (c < 0)
- break;
- switch (c) {
- case 'b':
- unit_mode = UNITS_RAW;
- break;
- case 'k':
- units_set_base(&unit_mode, UNITS_KBYTES);
- break;
- case 'm':
- units_set_base(&unit_mode, UNITS_MBYTES);
- break;
- case 'g':
- units_set_base(&unit_mode, UNITS_GBYTES);
- break;
- case 't':
- units_set_base(&unit_mode, UNITS_TBYTES);
- break;
- case GETOPT_VAL_HUMAN_READABLE:
- case 'h':
- unit_mode = UNITS_HUMAN_BINARY;
- break;
- case 'H':
- unit_mode = UNITS_HUMAN_DECIMAL;
- break;
- case GETOPT_VAL_SI:
- units_set_mode(&unit_mode, UNITS_DECIMAL);
- break;
- case GETOPT_VAL_IEC:
- units_set_mode(&unit_mode, UNITS_BINARY);
- break;
- default:
- usage(cmd_filesystem_df_usage);
- }
- }