From cfe5e3905201349e9cf3f95d52ff4bd100bde37d Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 14 Apr 2024 21:10:49 +0200 Subject: Adding upstream version 2.39.3. Signed-off-by: Daniel Baumann --- misc-utils/blkid.c | 1007 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1007 insertions(+) create mode 100644 misc-utils/blkid.c (limited to 'misc-utils/blkid.c') diff --git a/misc-utils/blkid.c b/misc-utils/blkid.c new file mode 100644 index 0000000..6df4e07 --- /dev/null +++ b/misc-utils/blkid.c @@ -0,0 +1,1007 @@ +/* + * blkid.c - User command-line interface for libblkid + * + * Copyright (C) 2001 Andreas Dilger + * + * %Begin-Header% + * This file may be redistributed under the terms of the + * GNU Lesser General Public License. + * %End-Header% + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define OUTPUT_FULL (1 << 0) +#define OUTPUT_VALUE_ONLY (1 << 1) +#define OUTPUT_DEVICE_ONLY (1 << 2) +#define OUTPUT_PRETTY_LIST (1 << 3) /* deprecated */ +#define OUTPUT_UDEV_LIST (1 << 4) /* deprecated */ +#define OUTPUT_EXPORT_LIST (1 << 5) + +#define BLKID_EXIT_NOTFOUND 2 /* token or device not found */ +#define BLKID_EXIT_OTHER 4 /* bad usage or other error */ +#define BLKID_EXIT_AMBIVAL 8 /* ambivalent low-level probing detected */ + +#include + +#include "ismounted.h" + +#include "strutils.h" +#define OPTUTILS_EXIT_CODE BLKID_EXIT_OTHER /* exclusive_option() */ +#include "optutils.h" +#define CLOSE_EXIT_CODE BLKID_EXIT_OTHER /* close_stdout() */ +#include "closestream.h" + +#include "nls.h" +#include "ttyutils.h" + +#define XALLOC_EXIT_CODE BLKID_EXIT_OTHER /* x.*alloc(), xstrndup() */ +#include "xalloc.h" + +#include "sysfs.h" + +struct blkid_control { + int output; + uintmax_t offset; + uintmax_t size; + char *show[128]; + unsigned int + eval:1, + gc:1, + lookup:1, + lowprobe:1, + lowprobe_superblocks:1, + lowprobe_topology:1, + no_part_details:1, + raw_chars:1; +}; + +static void __attribute__((__noreturn__)) usage(void) +{ + FILE *out = stdout; + + fputs(USAGE_HEADER, out); + fprintf(out, _( " %s --label