|
|
296099 |
diff -up libpaper-1.1.24+nmu3/lib/paper.c.useglibcfallback libpaper-1.1.24+nmu3/lib/paper.c
|
|
|
296099 |
--- libpaper-1.1.24+nmu3/lib/paper.c.useglibcfallback 2010-04-24 08:12:11.000000000 -0400
|
|
|
296099 |
+++ libpaper-1.1.24+nmu3/lib/paper.c 2014-04-22 15:58:33.120039001 -0400
|
|
|
296099 |
@@ -20,6 +20,9 @@
|
|
|
296099 |
|
|
|
296099 |
#include <unistd.h>
|
|
|
296099 |
|
|
|
296099 |
+#include <locale.h>
|
|
|
296099 |
+#include <langinfo.h>
|
|
|
296099 |
+
|
|
|
296099 |
#include "paper.h"
|
|
|
296099 |
|
|
|
296099 |
struct paper {
|
|
|
296099 |
@@ -108,6 +111,27 @@ in PAPERCONFVAR, fall-back to the old be
|
|
|
296099 |
}
|
|
|
296099 |
|
|
|
296099 |
const char* defaultpapername(void) {
|
|
|
296099 |
+#if defined(LC_PAPER) && defined(_GNU_SOURCE)
|
|
|
296099 |
+
|
|
|
296099 |
+#define NL_PAPER_GET(x) \
|
|
|
296099 |
+ ((union { char *string; unsigned int word; })nl_langinfo(x)).word
|
|
|
296099 |
+
|
|
|
296099 |
+#define PT_TO_MM(v) (unsigned int)((v * 2.54 * 10 / 72) + 0.5)
|
|
|
296099 |
+
|
|
|
296099 |
+ const struct paper* pp;
|
|
|
296099 |
+
|
|
|
296099 |
+ unsigned int w = NL_PAPER_GET(_NL_PAPER_WIDTH);
|
|
|
296099 |
+ unsigned int h = NL_PAPER_GET(_NL_PAPER_HEIGHT);
|
|
|
296099 |
+
|
|
|
296099 |
+ for (pp = paperfirst(); pp; pp = papernext(pp)) {
|
|
|
296099 |
+ if (
|
|
|
296099 |
+ PT_TO_MM(pp->pswidth) == w &&
|
|
|
296099 |
+ PT_TO_MM(pp->psheight) == h
|
|
|
296099 |
+ ) {
|
|
|
296099 |
+ return pp->name;
|
|
|
296099 |
+ }
|
|
|
296099 |
+ }
|
|
|
296099 |
+#endif
|
|
|
296099 |
return PAPERSIZE;
|
|
|
296099 |
}
|
|
|
296099 |
|
|
|
296099 |
diff -up libpaper-1.1.24+nmu3/man/paperconf.1.in.useglibcfallback libpaper-1.1.24+nmu3/man/paperconf.1.in
|
|
|
296099 |
--- libpaper-1.1.24+nmu3/man/paperconf.1.in.useglibcfallback 2014-04-22 15:58:33.121038995 -0400
|
|
|
296099 |
+++ libpaper-1.1.24+nmu3/man/paperconf.1.in 2014-04-22 16:00:15.973428376 -0400
|
|
|
296099 |
@@ -48,10 +48,12 @@ looking in order at the
|
|
|
296099 |
.B @PAPERSIZEVAR@
|
|
|
296099 |
environment variable, at the contents of the file specified by the
|
|
|
296099 |
.B @PAPERCONFVAR@
|
|
|
296099 |
-environment variable, at the contents of
|
|
|
296099 |
+environment variable, at the contents of the file
|
|
|
296099 |
.B @PAPERCONF@
|
|
|
296099 |
-or by using
|
|
|
296099 |
-.B letter
|
|
|
296099 |
+, consulting the values controlled by the
|
|
|
296099 |
+.B LC_PAPER
|
|
|
296099 |
+locale setting, or by using
|
|
|
296099 |
+.B @PAPERSIZE@
|
|
|
296099 |
as a fall-back value if none of the other alternatives are successful.
|
|
|
296099 |
By default, width and height of the paper are printed in PostScript points.
|
|
|
296099 |
.SH OPTIONS
|
|
|
296099 |
diff -up libpaper-1.1.24+nmu3/src/paperconf.c.useglibcfallback libpaper-1.1.24+nmu3/src/paperconf.c
|
|
|
296099 |
--- libpaper-1.1.24+nmu3/src/paperconf.c.useglibcfallback 2012-05-03 15:05:12.000000000 -0400
|
|
|
296099 |
+++ libpaper-1.1.24+nmu3/src/paperconf.c 2014-04-22 15:58:33.121038995 -0400
|
|
|
296099 |
@@ -13,6 +13,7 @@
|
|
|
296099 |
#include <errno.h>
|
|
|
296099 |
|
|
|
296099 |
#include <paper.h>
|
|
|
296099 |
+#include <locale.h>
|
|
|
296099 |
|
|
|
296099 |
|
|
|
296099 |
/* needed for GNU/Hurd */
|
|
|
296099 |
@@ -99,6 +100,8 @@ int main(int argc, char** argv)
|
|
|
296099 |
|
|
|
296099 |
const char* progname;
|
|
|
296099 |
|
|
|
296099 |
+ setlocale(LC_ALL, "");
|
|
|
296099 |
+
|
|
|
296099 |
progname = strrchr(*argv, '/');
|
|
|
296099 |
if (progname) {
|
|
|
296099 |
++progname;
|