Blame SOURCES/a2ps-4.13-glibcpaper.patch

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