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