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