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