2 * localepaper: print the dimensions in mm of the current locale's
3 * paper size, if possible.
5 * Based on a patch by Caolan McNamara:
6 * http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=481213
8 * Copyright (C) Reuben Thomas <rrt@sc3d.org>, 2013.
10 * Copying and distribution of this file, with or without modification,
11 * are permitted in any medium without royalty provided the copyright
12 * notice and this notice are preserved.
20 #if defined LC_PAPER && defined _GNU_SOURCE
26 int main(int argc
, char *argv
[])
28 set_program_name(argv
[0]);
29 argc
= argc
; /* Avoid a compiler warning. */
31 #if defined LC_PAPER && defined _GNU_SOURCE
32 setlocale(LC_ALL
, "");
34 #define NL_PAPER_GET(x) \
35 ((union { char *string; unsigned word; })nl_langinfo(x)).word
37 printf("%d %d\n", NL_PAPER_GET(_NL_PAPER_WIDTH
), NL_PAPER_GET(_NL_PAPER_HEIGHT
));
41 printf("%s: locale paper size information is not supported on this system", program_name
);