e7b00f5fcf
Thu Jul 19 2001 Than Ngo <than@redhat.com> 1.17-13 - add patch from enrico.scholz@informatik.tu-chemnitz.de Fri Jul 13 2001 Than Ngo <than@redhat.com> 1.17-12 - media size as letter (Bug #48831) - Copyright->License - don't hardcode manpath
203 lines
5.6 KiB
Diff
203 lines
5.6 KiB
Diff
--- psutils/pstops.man.paper Tue Mar 11 23:53:04 1997
|
|
+++ psutils/pstops.man Thu Jul 19 15:21:51 2001
|
|
@@ -108,10 +108,11 @@
|
|
The
|
|
.I \-p
|
|
option can be used as an alternative, to set the paper size to
|
|
-.B a3, a4, a5, b5, letter, legal, tabloid, statement, executive, folio, quarto
|
|
+.B a3, a4, a5, b5, letter, legal, tabloid, statement, executive, folio, quarto, 10x14
|
|
or
|
|
-.B 10x14.
|
|
-The default paper size is
|
|
+.B _glibc,
|
|
+where latter one means the format of the current locale. The default
|
|
+paper size is
|
|
.B @PAPER@.
|
|
.PP
|
|
The
|
|
@@ -154,6 +155,12 @@
|
|
4:1L@.7(21cm,0)+-2L@.7(21cm,14.85cm)
|
|
.sp
|
|
for the reverse sides (or join them with a comma for duplex printing).
|
|
+.SH "ENVIRONMENT VARIABLES"
|
|
+.TP
|
|
+.B LC_ALL, LC_PAPER
|
|
+These variables are specifying the papertype when used paper is
|
|
+.B _glibc.
|
|
+For details see the locale(7) manpage.
|
|
.SH AUTHOR
|
|
Copyright (C) Angus J. C. Duggan 1991-1995
|
|
.SH "SEE ALSO"
|
|
--- psutils/psutil.c.paper Tue Mar 11 23:53:04 1997
|
|
+++ psutils/psutil.c Thu Jul 19 15:21:51 2001
|
|
@@ -21,6 +21,11 @@
|
|
#include <sys/types.h>
|
|
#include <sys/stat.h>
|
|
|
|
+#ifdef HAVE_LANGINFO_H
|
|
+# include <langinfo.h>
|
|
+# include <locale.h>
|
|
+#endif
|
|
+
|
|
#define iscomment(x,y) (strncmp(x,y,strlen(y)) == 0)
|
|
|
|
extern char *program ;
|
|
@@ -31,6 +36,16 @@
|
|
extern char pagelabel[BUFSIZ];
|
|
extern int pageno;
|
|
|
|
+#ifdef HAVE_LANGINFO_H
|
|
+/* When using papertype _glibc we are comparing floating point values. Therefore
|
|
+ * and because values in the papersize table are not exactly we are needing an
|
|
+ * epsilon value. */
|
|
+static float PT_EPSILON = 2.0;
|
|
+
|
|
+/* The factor needed to convert lengths given in mm to length in pt.*/
|
|
+static float MM_TO_PT_FACTOR = 72/25.4;
|
|
+#endif /* HAVE_LANGINFO_H */
|
|
+
|
|
static char buffer[BUFSIZ];
|
|
static long bytes = 0;
|
|
static long pagescmt = 0;
|
|
@@ -64,16 +79,52 @@
|
|
{ NULL, 0, 0 }
|
|
};
|
|
|
|
+#ifdef HAVE_LANGINFO_H
|
|
+/* Called if papertype is '_glibc'. It uses the current locale to determine the
|
|
+ * height and width of the current LC_PAPER and compares it with the items of
|
|
+ * the 'papersizes' list. */
|
|
+Paper* findpaperglibc()
|
|
+{
|
|
+ float height, width;
|
|
+ char *old_locale = setlocale (LC_PAPER, "");
|
|
+ Paper *result = 0, *pp;
|
|
+
|
|
+ height = MM_TO_PT_FACTOR * (unsigned int)(nl_langinfo(_NL_PAPER_HEIGHT));
|
|
+ width = MM_TO_PT_FACTOR * (unsigned int)(nl_langinfo(_NL_PAPER_WIDTH));
|
|
+
|
|
+ for (pp = papersizes; PaperName(pp) && result==0; pp++) {
|
|
+ if ( abs(PaperWidth(pp)-width)<PT_EPSILON &&
|
|
+ abs(PaperHeight(pp)-height)<PT_EPSILON )
|
|
+ result = pp;
|
|
+ }
|
|
+
|
|
+ setlocale(LC_PAPER, old_locale);
|
|
+
|
|
+ return result;
|
|
+}
|
|
+#endif /* HAVE_LANGINFO_H */
|
|
+
|
|
/* return pointer to paper size struct or NULL */
|
|
Paper* findpaper(char *name)
|
|
{
|
|
- Paper *pp;
|
|
- for (pp = papersizes; PaperName(pp); pp++) {
|
|
- if (strcmp(PaperName(pp), name) == 0) {
|
|
+ Paper *pp = 0;
|
|
+
|
|
+#ifdef HAVE_LANGINFO_H
|
|
+ if (strcmp(name, "_glibc") == 0) {
|
|
+ pp = findpaperglibc();
|
|
+ if (pp==0) name = "a4"; /* Paper in C locale */
|
|
+ }
|
|
+#endif /* HAVE_LANGINFO_H */
|
|
+
|
|
+ if (pp==0) {
|
|
+ for (pp = papersizes; PaperName(pp); pp++) {
|
|
+ if (strcmp(PaperName(pp), name) == 0) {
|
|
return pp;
|
|
- }
|
|
+ }
|
|
+ }
|
|
}
|
|
- return (Paper *)NULL;
|
|
+
|
|
+ return pp;
|
|
}
|
|
|
|
/* Make a file seekable, using temporary files if necessary */
|
|
--- psutils/psresize.man.paper Tue Mar 11 23:53:03 1997
|
|
+++ psutils/psresize.man Thu Jul 19 15:21:51 2001
|
|
@@ -42,10 +42,11 @@
|
|
The
|
|
.I \-p
|
|
option can be used as an alternative, to set the output paper size to
|
|
-.B a3, a4, a5, b5, letter, legal, tabloid, statement, executive, folio, quarto
|
|
+.B a3, a4, a5, b5, letter, legal, tabloid, statement, executive, folio, quarto, 10x24
|
|
or
|
|
-.B 10x14.
|
|
-The default output paper size is
|
|
+.B _glibc,
|
|
+where latter one means the format of the current locale. The default
|
|
+output paper size is
|
|
.B @PAPER@.
|
|
.PP
|
|
The
|
|
@@ -69,6 +70,12 @@
|
|
.sp
|
|
psresize -PA4 -pletter in.ps out.ps
|
|
.sp
|
|
+.SH "ENVIRONMENT VARIABLES"
|
|
+.TP
|
|
+.B LC_ALL, LC_PAPER
|
|
+These variables are specifying the papertype when used paper is
|
|
+.B _glibc.
|
|
+For details see the locale(7) manpage.
|
|
.SH AUTHOR
|
|
Copyright (C) Angus J. C. Duggan 1991-1995
|
|
.SH "SEE ALSO"
|
|
--- psutils/psnup.man.paper Tue Mar 11 23:53:02 1997
|
|
+++ psutils/psnup.man Thu Jul 19 15:21:51 2001
|
|
@@ -61,9 +61,11 @@
|
|
The
|
|
.I \-p
|
|
option can be used as an alternative, to set the paper size to
|
|
-.B a3, a4, a5, b5, letter, legal, tabloid, statement, executive, folio, quarto
|
|
+.B a3, a4, a5, b5, letter, legal, tabloid, statement, executive, folio, quarto,
|
|
+.B 10x14
|
|
or
|
|
-.B 10x14.
|
|
+.B _glibc,
|
|
+where latter one means the format of the current locale.
|
|
The default paper size is
|
|
.B @PAPER@.
|
|
The
|
|
@@ -148,6 +150,12 @@
|
|
on the first output page and
|
|
pages 2 then 3 of the input document
|
|
on the second output page.
|
|
+.SH "ENVIRONMENT VARIABLES"
|
|
+.TP
|
|
+.B LC_ALL, LC_PAPER
|
|
+These variables are specifying the papertype when used paper is
|
|
+.B _glibc.
|
|
+For details see the locale(7) manpage.
|
|
.SH AUTHOR
|
|
Copyright (C) Angus J. C. Duggan 1991-1995
|
|
.SH "SEE ALSO"
|
|
--- psutils/Makefile.unix.paper Thu Jul 19 15:21:51 2001
|
|
+++ psutils/Makefile.unix Thu Jul 19 15:24:07 2001
|
|
@@ -19,7 +19,11 @@
|
|
# psnup puts multiple logical pages on one physical page
|
|
# psresize scales and moves pages to fit on different paper sizes
|
|
|
|
-PAPER=a4
|
|
+PAPER="_glibc"
|
|
+
|
|
+# Comment it out if your machine does not have the <langutil.h> header
|
|
+# or does not know nl_langinfo()
|
|
+LANGINFO_FLAG = -DHAVE_LANGINFO_H
|
|
|
|
# Makefile for PSUtils under Unix
|
|
|
|
@@ -39,7 +43,7 @@
|
|
MANDIR = $(DESTDIR)/usr/man/man$(MANEXT)
|
|
|
|
CC = gcc
|
|
-CFLAGS = -DPAPER=\"$(PAPER)\" -DUNIX $(RPM_OPT_FLAGS) -Wall
|
|
+CFLAGS = -DPAPER=\"$(PAPER)\" -DUNIX $(RPM_OPT_FLAGS) $(LANGINFO_FLAG) -Wall
|
|
|
|
BIN = psbook psselect pstops epsffit psnup \
|
|
psresize
|