2 * Copyright (C) 2009 Karel Zak <kzak@redhat.com>
4 * This file may be redistributed under the terms of the GNU Public
15 #include "closestream.h"
18 static void __attribute__((__noreturn__
)) usage(int rc
)
20 FILE *out
= rc
? stderr
: stdout
;
21 fputs(USAGE_HEADER
, out
);
22 fprintf(out
, _(" %1$s [options] LABEL=<label>\n"
23 " %1$s [options] UUID=<uuid>\n"),
24 program_invocation_short_name
);
25 fputs(USAGE_OPTIONS
, out
);
26 fputs(USAGE_HELP
, out
);
27 fputs(USAGE_VERSION
, out
);
28 fprintf(out
, USAGE_MAN_TAIL("findfs(8)"));
32 int main(int argc
, char **argv
)
36 setlocale(LC_ALL
, "");
37 bindtextdomain(PACKAGE
, LOCALEDIR
);
42 /* we return '2' for backward compatibility
43 * with version from e2fsprogs */
46 if (!strncmp(argv
[1], "LABEL=", 6)) {
49 } else if (!strncmp(argv
[1], "UUID=", 5)) {
52 } else if (strcmp(argv
[1], "-V") == 0 ||
53 strcmp(argv
[1], "--version") == 0) {
54 printf(UTIL_LINUX_VERSION
);
56 } else if (strcmp(argv
[1], "-h") == 0 ||
57 strcmp(argv
[1], "--help") == 0) {
62 dev
= blkid_evaluate_tag(tk
, vl
, NULL
);
64 errx(EXIT_FAILURE
, _("unable to resolve '%s'"), argv
[1]);