Blame SOURCES/a2ps-4.13-glibcpaper.patch

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