assert(partition);
if (devno) {
- struct sysfs_cxt cxt;
+ struct path_cxt *pc;
int rc;
- if (sysfs_init(&cxt, devno, NULL))
+ pc = ul_new_sysfs_path(devno, NULL, NULL);
+ if (!pc)
goto err;
- rc = sysfs_read_int(&cxt, "partition", &partno);
- sysfs_deinit(&cxt);
+ rc = ul_path_read_s32(pc, &partno, "partition");
+ ul_unref_path(pc);
if (rc == 0)
return partno;
fputs(_(" -g, --noheadings don't print headings for --show\n"), out);
fputs(_(" -n, --nr <n:m> specify the range of partitions (e.g. --nr 2:4)\n"), out);
fputs(_(" -o, --output <list> define which output columns to use\n"), out);
+ fputs(_(" --output-all output all columns\n"), out);
fputs(_(" -P, --pairs use key=\"value\" output format\n"), out);
fputs(_(" -r, --raw use raw output format\n"), out);
fputs(_(" -S, --sector-size <num> overwrite sector size\n"), out);
fputs(_(" -v, --verbose verbose mode\n"), out);
fputs(USAGE_SEPARATOR, out);
- print_usage_help_options(22);
+ printf(USAGE_HELP_OPTIONS(22));
fputs(USAGE_COLUMNS, out);
for (i = 0; i < NCOLS; i++)
fprintf(out, " %10s %s\n", infos[i].name, _(infos[i].help));
- fprintf(out, USAGE_MAN_TAIL("partx(8)"));
+ printf(USAGE_MAN_TAIL("partx(8)"));
exit(EXIT_SUCCESS);
}
unsigned int sector_size = 0;
enum {
- OPT_LIST_TYPES = CHAR_MAX + 1
+ OPT_LIST_TYPES = CHAR_MAX + 1,
+ OPT_OUTPUT_ALL
};
static const struct option long_opts[] = {
{ "bytes", no_argument, NULL, 'b' },
{ "list-types", no_argument, NULL, OPT_LIST_TYPES },
{ "nr", required_argument, NULL, 'n' },
{ "output", required_argument, NULL, 'o' },
+ { "output-all", no_argument, NULL, OPT_OUTPUT_ALL },
{ "pairs", no_argument, NULL, 'P' },
{ "sector-size",required_argument, NULL, 'S' },
{ "help", no_argument, NULL, 'h' },
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- atexit(close_stdout);
+ close_stdout_atexit();
while ((c = getopt_long(argc, argv,
"abdglrsuvn:t:o:PS:hV", long_opts, NULL)) != -1) {
case 'o':
outarg = optarg;
break;
+ case OPT_OUTPUT_ALL:
+ for (ncolumns = 0; ncolumns < ARRAY_SIZE(infos); ncolumns++)
+ columns[ncolumns] = ncolumns;
+ break;
case 'P':
scols_flags |= PARTX_EXPORT;
what = ACT_SHOW;
case 'h':
usage();
case 'V':
- printf(UTIL_LINUX_VERSION);
- return EXIT_SUCCESS;
+ print_version(EXIT_SUCCESS);
default:
errtryhelp(EXIT_FAILURE);
}
default:
abort();
}
- }
+ } else
+ rc = 1;
+
blkid_free_probe(pr);
}