Blame SOURCES/a2ps-4.13-glibcpaper.patch

0d8902
--- a2ps-4.13/lib/jobs.c.glibcpaper	Sat Jan 15 18:15:07 2000
0d8902
+++ a2ps-4.13/lib/jobs.c	Tue Feb 20 18:44:48 2001
0d8902
@@ -138,6 +138,7 @@
0d8902
   setlocale (LC_MESSAGES, "");
0d8902
 #endif
0d8902
   setlocale (LC_CTYPE, "");
0d8902
+  setlocale (LC_PAPER, "");
0d8902
 
0d8902
   bindtextdomain (PACKAGE, LOCALEDIR);
0d8902
   textdomain (PACKAGE);
0d8902
--- a2ps-4.13/lib/options.c.glibcpaper	Tue Aug 31 13:42:41 1999
0d8902
+++ a2ps-4.13/lib/options.c	Tue Feb 20 18:44:48 2001
0d8902
@@ -54,6 +54,8 @@
0d8902
 #include "argv.h"
0d8902
 #include "quotearg.h"
0d8902
 #include "filalign.h"
0d8902
+#include <locale.h>
0d8902
+#include <langinfo.h>
0d8902
 
0d8902
 #define MAN_LINES               66	/* no lines for a man */
0d8902
 extern char *program_name;
0d8902
@@ -281,7 +283,8 @@
0d8902
   struct opt_optarg *opt_optarg_head = NULL;
0d8902
   struct opt_optarg *opt_optarg = NULL;
0d8902
   int res;
0d8902
-
0d8902
+  unsigned int paper_height=0;
0d8902
+  
0d8902
   /* Reset optind so that getopt is reinitialized. */
0d8902
   optind = 0;
0d8902
 
0d8902
@@ -545,7 +548,14 @@
0d8902
 	break;
0d8902
 
0d8902
       case 'M':                 		/* select a medium */
0d8902
-	xstrcpy (job->medium_request, optarg);
0d8902
+          if(strcasecmp("_glibc",optarg)==0){
0d8902
+              paper_height = ((union { char *string; unsigned int word; })nl_langinfo(_NL_PAPER_HEIGHT)).word;
0d8902
+              if(paper_height==279) /* US Letter */
0d8902
+                  strcpy(optarg,"letter");
0d8902
+              else /* Everyone else */
0d8902
+                  strcpy(optarg,"a4");
0d8902
+          }
0d8902
+          xstrcpy (job->medium_request, optarg);
0d8902
 	break;
0d8902
 
0d8902
       case 'n':				/* n copies */
0d8902
--- a2ps-4.13/src/main.c.glibcpaper	Wed Jan 26 19:29:15 2000
0d8902
+++ a2ps-4.13/src/main.c	Tue Feb 20 18:45:18 2001
0d8902
@@ -945,6 +945,7 @@
0d8902
   setlocale (LC_MESSAGES, "");
0d8902
 #endif
0d8902
   setlocale (LC_CTYPE, "");
0d8902
+  setlocale (LC_PAPER, "");
0d8902
 
0d8902
   bindtextdomain (PACKAGE, LOCALEDIR);
0d8902
   textdomain (PACKAGE);
0d8902
--- a2ps-4.13/doc/a2ps.texi.glibcpaper	Wed Jan 23 12:36:30 2002
0d8902
+++ a2ps-4.13/doc/a2ps.texi	Wed Jan 23 12:40:08 2002
0d8902
@@ -1363,6 +1363,12 @@
0d8902
 ask the library @code{libpaper} for the medium to use.  This choice is
0d8902
 valid only if @code{libpaper} was available when @pack{} was configured.
0d8902
 See the man page of @code{paperconf} for more information.
0d8902
+
0d8902
+The special @var{medium} @samp{_glibc} (which, in this Red Hat Linux
0d8902
+version of @samp{a2ps}, is the default) means that you want the medium
0d8902
+to be determined by the locale category @samp{LC_PAPER}.  Note that this
0d8902
+information is obtained from environment variables which may not be set
0d8902
+up in non-interactive environments (such as in a cron job).
0d8902
 @end defvr
0d8902
 
0d8902
 @defvr {Option}  -r
0d8902
--- a2ps-4.13/man/a2ps.1.glibcpaper	Wed Jan 23 12:42:36 2002
0d8902
+++ a2ps-4.13/man/a2ps.1	Wed Jan 23 12:45:05 2002
0d8902
@@ -60,6 +60,11 @@
0d8902
 .TP
0d8902
 \fB\-M\fR, \fB\-\-medium\fR=\fINAME\fR
0d8902
 use output medium NAME
0d8902
+
0d8902
+The default behaviour is to use the locale category
0d8902
+\fBLC_PAPER\fR to determine the medium to use.  Note that this
0d8902
+information is obtained from environment variables which may not be set
0d8902
+up in non-interactive environments (such as in a cron job).
0d8902
 .TP
0d8902
 \fB\-r\fR, \fB\-\-landscape\fR
0d8902
 print in landscape mode