--- a2ps-4.15.4/liba2ps/jobs.c.orig 2023-06-11 19:59:27.481861785 +0200 +++ a2ps-4.15.4/liba2ps/jobs.c 2023-06-11 19:59:52.208394496 +0200 @@ -119,6 +119,7 @@ a2ps_job_new (void) setlocale (LC_TIME, ""); setlocale (LC_MESSAGES, ""); setlocale (LC_CTYPE, ""); + setlocale (LC_PAPER, ""); bindtextdomain (PACKAGE, LOCALEDIR); bindtextdomain (PACKAGE "-gnulib", LOCALEDIR); --- a2ps-4.15.4/liba2ps/options.c.orig 2023-04-12 20:50:51.000000000 +0200 +++ a2ps-4.15.4/liba2ps/options.c 2023-06-11 20:00:19.368247359 +0200 @@ -23,6 +23,8 @@ /* */ /************************************************************************/ #include +#include +#include #include "a2ps.h" #include "routines.h" @@ -267,7 +269,8 @@ a2ps_handle_options (a2ps_job * job, int 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; @@ -515,7 +518,14 @@ a2ps_handle_options (a2ps_job * job, int 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.15.4/src/main.c.orig 2023-06-11 20:00:41.568127092 +0200 +++ a2ps-4.15.4/src/main.c 2023-06-11 20:01:05.021333368 +0200 @@ -926,6 +926,7 @@ main (int argc, char *argv[]) setlocale (LC_TIME, ""); setlocale (LC_MESSAGES, ""); setlocale (LC_CTYPE, ""); + setlocale (LC_PAPER, ""); bindtextdomain (PACKAGE, LOCALEDIR); bindtextdomain (PACKAGE "-gnulib", LOCALEDIR);