/* * 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 #ifdef HAVE_GETOPT_H #include #else extern int getopt(int argc, char * const argv[], const char *optstring); extern char *optarg; extern int optind; #endif #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 LOWPROBE_TOPOLOGY (1 << 1) #define LOWPROBE_SUPERBLOCKS (1 << 2) #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" #define STRTOXX_EXIT_CODE BLKID_EXIT_OTHER /* strtoxx_or_err() */ #include "strutils.h" #define OPTUTILS_EXIT_CODE BLKID_EXIT_OTHER /* exclusive_option() */ #include "optutils.h" #include "closestream.h" #include "ttyutils.h" #include "xalloc.h" int raw_chars; static void print_version(FILE *out) { fprintf(out, "%s from %s (libblkid %s, %s)\n", program_invocation_short_name, PACKAGE_STRING, LIBBLKID_VERSION, LIBBLKID_DATE); } static void usage(int error) { FILE *out = error ? stderr : stdout; print_version(out); fprintf(out, "Usage:\n" " %1$s -L