diff options
author | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2016-02-18 10:10:49 +0000 |
---|---|---|
committer | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2016-02-18 10:10:49 +0000 |
commit | 0b336888541590e095a518fa5fc296ba706503f4 (patch) | |
tree | db9626d4c535c26e04a2dd74d3e0c076a58e5ea5 /Build/source/libs/libpaper/libpaper-src | |
parent | 7baf2ac6d377c1aa8d9f981560946061d7d01353 (diff) |
lib/libpaper: New convention
git-svn-id: svn://tug.org/texlive/trunk@39762 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/libs/libpaper/libpaper-src')
34 files changed, 1585 insertions, 0 deletions
diff --git a/Build/source/libs/libpaper/libpaper-src/ChangeLog b/Build/source/libs/libpaper/libpaper-src/ChangeLog new file mode 100644 index 00000000000..1eadcbd9f1b --- /dev/null +++ b/Build/source/libs/libpaper/libpaper-src/ChangeLog @@ -0,0 +1,33 @@ +Tue Sep 24 06:38:34 Yves Arrouye <arrouye@marin.sevy.fr> + + * completed the set of manual pages. + * added the libpaper.so.1 link in installation. + * added -E to less flags. + +Tue Aug 13 19:14:51 1996 Yves Arrouye <arrouye@marin.sevy.fr> + + * abstract interface (struct paper hidden) so that future changes + can be made safely. + * stores dimensions as double, still in PS points. + +Sun Aug 11 15:16:46 1996 Yves Arrouye <arrouye@marin.sevy.fr> + + * lib/paper.c: added paperinit(), paperdone(), paperfirst(), + paperlast(), papernext() and paperprev(), removed papertable(). + + * lib/paper.h: added new prototypes. + + * src/paper.c: added -N option. + Removed trailing spaces in what is printed. + + * examples/gsfrontend.c: corrected PAPERSIZE to PAGESIZE. + + * examples/a2ps: added calls to paperinit() and paperdone(), + added agressive page size selection at printing time. + +Sat Jul 20 10:15:49 1996 Yves Arrouye <arrouye@marin.fdn.fr> + + * Makefile.in: changed for PAPERSIZE. + * lib/paper.c: added the PAPERSIZE environment variable. + * examples: new directory containing examples (gs.sh and + diffs for a2ps-4.3). diff --git a/Build/source/libs/libpaper/libpaper-src/Makefile.am b/Build/source/libs/libpaper/libpaper-src/Makefile.am new file mode 100644 index 00000000000..b0a136b95c8 --- /dev/null +++ b/Build/source/libs/libpaper/libpaper-src/Makefile.am @@ -0,0 +1,3 @@ +
+SUBDIRS = lib src man
+
diff --git a/Build/source/libs/libpaper/libpaper-src/README b/Build/source/libs/libpaper/libpaper-src/README new file mode 100644 index 00000000000..7c4fb128610 --- /dev/null +++ b/Build/source/libs/libpaper/libpaper-src/README @@ -0,0 +1,39 @@ +The paper library and accompanying files are intended to provide a simple
+way for applications to take actions based on a system- or user-specified
+paper size.
+
+This release is quite minimal, its purpose being to provide really basic
+functions (obtaining the system paper name and getting the height and
+width of a given kond of paper) that applications can immediately
+integrate.
+A more complete library, using a capabilities file for papers (giving,
+in addition to the size, informations like paper weigth, color, etc)
+will be released later.
+
+See the sources for paperconf(1) in src/paper.c for how to use the library.
+
+Adding new paper sizes
+======================
+
+If a paper format is missing, one need to add it to lib/paperspecs. The
+format of this file is one paper format per line, with the name of the
+format, the width and height of the format separated with space. You
+may add an option measurement unit among in, ft, pt, m, dm, cm, mm or you
+may leave the default unit of "point". By defaults the width and height
+are specified in the "point" unit, which is 1/72 inch (2.54 cm). This
+is the A4 entry:
+
+ a4 210 297 mm
+
+that was previously written as
+
+ a4 595 842
+
+The sizes here are 595 points / 72 points pr inch * 2.54 cm per
+inch = 20.99 cm and 842/72*2.54 = 29.70 cm. The A4 format
+is 210x297 mm so this is a good approximation. (Source:
+<URL:http://en.wikipedia.org/wiki/A4_paper_size>)
+
+Copyright (C) Yves Arrouye <yves@debian.org>, 1996
+ Adrian Bunk <bunk@fs.tum.de> , 2000
+
diff --git a/Build/source/libs/libpaper/libpaper-src/config.h.in b/Build/source/libs/libpaper/libpaper-src/config.h.in new file mode 100644 index 00000000000..66e89084033 --- /dev/null +++ b/Build/source/libs/libpaper/libpaper-src/config.h.in @@ -0,0 +1,73 @@ +/* config.h.in. Generated from configure.ac by autoheader. */
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#undef HAVE_DLFCN_H
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#undef HAVE_INTTYPES_H
+
+/* Define to 1 if you have the <memory.h> header file. */
+#undef HAVE_MEMORY_H
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#undef HAVE_STDINT_H
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#undef HAVE_STDLIB_H
+
+/* Define to 1 if you have the <strings.h> header file. */
+#undef HAVE_STRINGS_H
+
+/* Define to 1 if you have the <string.h> header file. */
+#undef HAVE_STRING_H
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#undef HAVE_SYS_STAT_H
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#undef HAVE_SYS_TYPES_H
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#undef HAVE_UNISTD_H
+
+/* Define to the address where bug reports for this package should be sent. */
+#undef PACKAGE_BUGREPORT
+
+/* Define to the full name of this package. */
+#undef PACKAGE_NAME
+
+/* Define to the full name and version of this package. */
+#undef PACKAGE_STRING
+
+/* Define to the one symbol short name of this package. */
+#undef PACKAGE_TARNAME
+
+/* Define to the version of this package. */
+#undef PACKAGE_VERSION
+
+/* Default configuration file location */
+#undef PAPERCONF
+
+/* Environment variable that overrides the default configuration file location
+ */
+#undef PAPERCONFVAR
+
+/* Default paper size */
+#undef PAPERSIZE
+
+/* Environment variable that overrides the defaultpaper size */
+#undef PAPERSIZEVAR
+
+/* Default directory for run-parts */
+#undef RUNPARTSDIR
+
+/* Define to 1 if you have the ANSI C header files. */
+#undef STDC_HEADERS
+
+/* Enable GNU extensions on systems that have them. */
+#ifndef _GNU_SOURCE
+# undef _GNU_SOURCE
+#endif
+
+/* Define to empty if `const' does not conform to ANSI C. */
+#undef const
diff --git a/Build/source/libs/libpaper/libpaper-src/configure.ac b/Build/source/libs/libpaper/libpaper-src/configure.ac new file mode 100644 index 00000000000..cc5bacc7101 --- /dev/null +++ b/Build/source/libs/libpaper/libpaper-src/configure.ac @@ -0,0 +1,66 @@ +dnl Process this file with autoconf to produce a configure script.
+
+AC_INIT([libpaper], [1.1.9])
+AC_CONFIG_SRCDIR([configure.ac])
+AM_INIT_AUTOMAKE([no-define])
+AM_CONFIG_HEADER(config.h)
+AM_MAINTAINER_MODE
+
+dnl Check for standard build environment
+dnl ====================================
+AC_PROG_CC
+AC_GNU_SOURCE
+AC_PROG_INSTALL
+AM_PROG_LIBTOOL
+AC_PROG_MAKE_SET
+
+dnl Complier features
+dnl =================
+AC_C_CONST
+
+dnl set up some substitutions
+dnl =========================
+PAPERCONF="${sysconfdir}/papersize"
+AC_SUBST(PAPERCONF)
+AH_TEMPLATE(PAPERCONF, [Default configuration file location])
+AC_DEFINE_UNQUOTED(PAPERCONF, "$PAPERCONF")
+
+PAPERCONFVAR=PAPERCONF
+AC_SUBST(PAPERCONFVAR)
+AH_TEMPLATE(PAPERCONFVAR, [Environment variable that overrides the default configuration file location])
+AC_DEFINE_UNQUOTED(PAPERCONFVAR, "$PAPERCONFVAR")
+
+PAPERSIZE=letter
+AC_SUBST(PAPERSIZE)
+AH_TEMPLATE(PAPERSIZE, [Default paper size])
+AC_DEFINE_UNQUOTED(PAPERSIZE, "$PAPERSIZE")
+
+RUNPARTSDIR="${sysconfdir}/libpaper.d"
+AC_SUBST(RUNPARTSDIR)
+AH_TEMPLATE(RUNPARTSDIR, [Default directory for run-parts])
+AC_DEFINE_UNQUOTED(RUNPARTSDIR, "$RUNPARTSDIR")
+
+RUNPARTSDIRVAR=PAPERDIR
+AC_SUBST(RUNPARTSDIRVAR)
+AH_TEMPLATE(RUNPARTSDIRVAR, [Environment variable that overrides the default directory for run-parts])
+AC_DEFINE_UNQUOTED(RUNPARTSDIRVAR, "$RUNPARTSDIRVAR")
+
+PAPERSIZEVAR=PAPERSIZE
+AC_SUBST(PAPERSIZEVAR)
+AH_TEMPLATE(PAPERSIZEVAR, [Environment variable that overrides the default paper size])
+AC_DEFINE_UNQUOTED(PAPERSIZEVAR, "$PAPERSIZEVAR")
+
+dnl Create files
+dnl ============
+AC_OUTPUT([
+ Makefile
+ lib/Makefile
+ src/Makefile
+ src/paperconfig
+ man/Makefile
+ man/paperconf.1
+ man/paperconfig.8
+ man/papersize.5
+ man/systempapername.3
+])
+
diff --git a/Build/source/libs/libpaper/libpaper-src/lib/Makefile.am b/Build/source/libs/libpaper/libpaper-src/lib/Makefile.am new file mode 100644 index 00000000000..028abaa59a2 --- /dev/null +++ b/Build/source/libs/libpaper/libpaper-src/lib/Makefile.am @@ -0,0 +1,21 @@ +
+lib_LTLIBRARIES = libpaper.la
+libpaper_la_SOURCES = dimen.c paper.c dimen.h paperspecs.h
+libpaper_la_LDFLAGS = -version-info 2:2:1
+libpaper_la_CPPFLAGS = -D_REENTRANT
+
+BUILT_SOURCES = paperspecs.h
+
+include_HEADERS = paper.h
+
+EXTRA_DIST = paperspecs
+
+paperspecs.h: paperspecs Makefile
+ echo ' /* This file has been automaticaly generated.' >$@
+ echo ' Edit paperspecs to make changes to the papers specifications. */' >>$@
+ echo >>$@
+ env LANG=C LC_ALL=C awk '{ factor = 1.0; \
+ if ($$4 == "mm") factor = 72.0 / 25.4; \
+ if ($$4 == "in") factor = 72.0; \
+ printf(" { \"%s\", %5f, %5f },\n", \
+ $$1, $$2 * factor, $$3 * factor); }' < $< >> $@
diff --git a/Build/source/libs/libpaper/libpaper-src/lib/dimen.c b/Build/source/libs/libpaper/libpaper-src/lib/dimen.c new file mode 100644 index 00000000000..702d7937668 --- /dev/null +++ b/Build/source/libs/libpaper/libpaper-src/lib/dimen.c @@ -0,0 +1,72 @@ + +/* + * Copyright (C) Yves Arrouye <Yves.Arrouye@marin.fdn.fr>, 1996. + * + * Use under the GPL version 2. You are not allowed to remove this + * copyright notice. + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <ctype.h> +#include <string.h> +#include <stdlib.h> + +#include "dimen.h" + +static struct { + const char* name; + float factor; +} units[] = { + { "in", 1. }, + { "ft", 12. }, + { "pt", 1. / 72. }, + { "m", 100. / 2.54 }, + { "dm", 10. / 2.54 }, + { "cm", 1. / 2.54 }, + { "mm", .1 / 2.54 }, + { 0 } +}; + +float unitfactor(const char* unit) +{ + int i; + + for (i = 0; units[i].name; ++i) { + if (!strcasecmp(units[i].name, unit)) { + return units[i].factor; + } + } + + return 0; +} + +int psdimension(const char* what, int* dim) +{ + const char* unit; + int dot = 0; + + if (!what || !*what) return -1; + + if (*(unit = what) == '-') ++unit; + + for (; isdigit((unsigned char)*unit) || (*unit == '.' && !dot++); ++unit); + + if (*unit && !isalpha((unsigned char)*unit)) { + return -1; + } else { + double base = atof(what); + double factor = unitfactor(unit); + + if (factor) { + *dim = base * factor * 72; + return 0; + } + + return 1; + } +} + diff --git a/Build/source/libs/libpaper/libpaper-src/lib/dimen.h b/Build/source/libs/libpaper/libpaper-src/lib/dimen.h new file mode 100644 index 00000000000..d574ac3202d --- /dev/null +++ b/Build/source/libs/libpaper/libpaper-src/lib/dimen.h @@ -0,0 +1,36 @@ + +/* + * Copyright (C) Yves Arrouye <Yves.Arrouye@marin.fdn.fr>, 1996. + * + * Use under the GPL version 2. You are not allowed to remove this + * copyright notice. + * + */ + +#ifndef DIMEN_H +#define DIMEN_H + +/* + * psdimension() converts a string to a number of points, accepting a + * string consisting of a number (eventually decimal but without any + * exponent) followed by a unit (one of `m', `dm', `cm', `mm', `ft', + * `in' or `pt', `in' being the default); on success it returs 0, + * otherwise it returns -1 if no number was found or 1 if the unit is + * incorrect. + * + */ + +#if __STDC__ - 0 == 0 +#define const +#endif + +#if __STDC__ - 0 == 0 +extern float unitfactor(); +extern int psdimension(); +#else +extern float unitfactor(const char* unit); +extern int psdimension(const char* dimspec, int* dim); +#endif + +#endif + diff --git a/Build/source/libs/libpaper/libpaper-src/lib/paper.c b/Build/source/libs/libpaper/libpaper-src/lib/paper.c new file mode 100644 index 00000000000..512dff88452 --- /dev/null +++ b/Build/source/libs/libpaper/libpaper-src/lib/paper.c @@ -0,0 +1,158 @@ + +/* + * Copyright (C) Yves Arrouye <Yves.Arrouye@marin.fdn.fr>, 1996. + * + * Use under the GPL version 2. You are not allowed to remove this + * copyright notice. + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <sys/stat.h> + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <ctype.h> + +#include <unistd.h> + +#include "paper.h" + +struct paper { + const char* name; + double pswidth, psheight; +}; + +/* This table will be searched in order: please put typical paper sizes + at the beginning of it. */ + +/* The paper names have been got from gs 3.68 gs_stadt.ps file, with + some personal additions. */ + +static struct paper papers[] = { +#include "paperspecs.h" + { 0 } +}; + +int paperinit(void) { + return 0; +} + +int paperdone(void) { + return 0; +} + +const char* papername(const struct paper* spaper) +{ + return spaper->name; +} + +double paperpswidth(const struct paper* spaper) +{ + return spaper->pswidth; +} + +double paperpsheight(const struct paper* spaper) +{ + return spaper->psheight; +} + +const struct paper* paperfirst(void) { + return papers; +} + +const struct paper* paperlast(void) { + static const struct paper* lastpaper = 0; + + const struct paper* next = papers; + while (next->name) { + lastpaper = next, ++next; + } + + return lastpaper; +} + +const struct paper* papernext(const struct paper* spaper) +{ + return (++spaper)->name ? spaper : 0; +} + +const struct paper* paperprev(const struct paper* spaper) +{ + return spaper == papers ? 0 : --spaper; +} + +const char* defaultpapersizefile(void) { + return NULL; +} + +const char* systempapersizefile(void) { + return NULL; +} + +const char* defaultpapername(void) { + return PAPERSIZE; +} + +char* systempapername(void) { + char* paperstr; + char* paperenv; + const char* paperdef; + const struct paper* pp; + + paperenv = getenv(PAPERSIZEVAR); + if ((paperenv != NULL) && (strchr(paperenv, '/') != NULL)) { + paperenv = NULL; + } + + if (paperenv) { + paperstr = malloc((strlen(paperenv) + 1) * sizeof(char)); + + if (! paperstr) return 0; + + if ((pp = paperinfo(paperenv))) + return strcpy(paperstr, pp->name); + else + return strcpy(paperstr, paperenv); + } + + paperdef = defaultpapername(); + paperstr = malloc((strlen(paperdef) + 1) * sizeof(char)); + + if (paperstr) + return strcpy(paperstr, paperdef); + else + return 0; +} + +const struct paper* paperinfo(const char* paper) +{ + const struct paper* pp; + + for (pp = paperfirst(); pp; pp = papernext(pp)) { + if (!strcasecmp(pp->name, paper)) { + return pp; + } + } + + return 0; +} + +const struct paper* paperwithsize(double pswidth, double psheight) +{ + const struct paper* pp; + + for (pp = paperfirst(); pp; pp = papernext(pp)) { + if (pp->pswidth == pswidth + && pp->psheight == psheight) { + return pp; + } + } + + return 0; +} + diff --git a/Build/source/libs/libpaper/libpaper-src/lib/paper.h b/Build/source/libs/libpaper/libpaper-src/lib/paper.h new file mode 100644 index 00000000000..993f7463c8c --- /dev/null +++ b/Build/source/libs/libpaper/libpaper-src/lib/paper.h @@ -0,0 +1,73 @@ + +/* + * Copyright (C) Yves Arrouye <Yves.Arrouye@marin.fdn.fr>, 1996. + * + * Use under the GPL version 2. You are not allowed to remove this + * copyright notice. + * + */ + +#ifndef PAPER_H +#define PAPER_H + +/* + * systempapername() returns the preferred paper size got from either the + * PAPER environment variable or the /etc/papersize file. If 0 is + * returned, one should use the value of defaultpapername(). + * + * paperinfo() looks from the given paper name in a table of known sizes + * and returns 0 if it found it; if this is the case, the width and + * height arguments have been set to the correct values in points (one + * inch contains 72 points). The case of paper size is not significant. + * + */ + +#if !defined(__STDC__) + +#define __PAPER_CONST +#define __PAPER_PROTO(p) () + +#else + +#define __PAPER_CONST const +#define __PAPER_PROTO(p) p + +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +struct paper; + +extern int paperinit __PAPER_PROTO((void)); +extern int paperdone __PAPER_PROTO((void)); + +extern __PAPER_CONST char* papername __PAPER_PROTO((const struct paper*)); +extern double paperpswidth __PAPER_PROTO((const struct paper*)); +extern double paperpsheight __PAPER_PROTO((const struct paper*)); + +extern __PAPER_CONST char* defaultpapersizefile __PAPER_PROTO((void)); +extern __PAPER_CONST char* systempapersizefile __PAPER_PROTO((void)); +extern __PAPER_CONST char* defaultpapername __PAPER_PROTO((void)); +extern char* systempapername __PAPER_PROTO((void)); +extern __PAPER_CONST struct paper* paperinfo __PAPER_PROTO((const char*)); +extern __PAPER_CONST struct paper* paperwithsize __PAPER_PROTO(( + double pswidth, double psheight)); + +extern __PAPER_CONST struct paper* paperfirst __PAPER_PROTO((void)); +extern __PAPER_CONST struct paper* paperlast __PAPER_PROTO((void)); +extern __PAPER_CONST struct paper* papernext __PAPER_PROTO(( + const struct paper*)); +extern __PAPER_CONST struct paper* paperprev __PAPER_PROTO(( + const struct paper*)); + +#undef __PAPER_CONST +#undef __PAPER_PROTO + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/Build/source/libs/libpaper/libpaper-src/lib/paperspecs b/Build/source/libs/libpaper/libpaper-src/lib/paperspecs new file mode 100644 index 00000000000..6be0a46dc3a --- /dev/null +++ b/Build/source/libs/libpaper/libpaper-src/lib/paperspecs @@ -0,0 +1,67 @@ +a4 210 297 mm +letter 612 792 +note 612 792 +legal 612 1008 +executive 522 756 +halfletter 396 612 +halfexecutive 378 522 +11x17 792 1224 +statement 396 612 +folio 612 936 +quarto 610 780 +10x14 720 1008 +ledger 1224 792 +tabloid 792 1224 +a0 841 1189 mm +a1 594 841 mm +a2 420 594 mm +a3 297 420 mm +a5 148 210 mm +a6 105 148 mm +a7 74 105 mm +a8 52 74 mm +a9 37 52 mm +a10 26 37 mm +b0 1000 1414 mm +b1 707 1000 mm +b2 500 707 mm +b3 353 500 mm +b4 250 353 mm +b5 176 250 mm +b6 125 176 mm +b7 88 125 mm +b8 62 88 mm +b9 44 62 mm +b10 31 44 mm +c2 458 648 mm +c3 324 458 mm +c4 229 354 mm +c5 162 229 mm +c6 114 162 mm +c7 81 114 mm +c8 57 81 mm +jisb0 1030 1456 mm +jisb1 728 1030 mm +jisb2 515 728 mm +jisb3 364 515 mm +jisb4 257 364 mm +jisb5 182 257 mm +jisb6 128 182 mm +jisb7 91 128 mm +jisb8 64 91 mm +jisb9 45 64 mm +jisb10 32 45 mm +b5var 182 230 mm +DL 110 220 mm +Comm10 297 684 +Monarch 279 540 +archE 2592 3456 +archD 1728 2592 +archC 1296 1728 +archB 864 1296 +archA 648 864 +flsa 612 936 +flse 612 936 +csheet 1224 1584 +dsheet 1584 2448 +esheet 2448 3168 diff --git a/Build/source/libs/libpaper/libpaper-src/lib/paperspecs.h b/Build/source/libs/libpaper/libpaper-src/lib/paperspecs.h new file mode 100644 index 00000000000..a94ec36dafb --- /dev/null +++ b/Build/source/libs/libpaper/libpaper-src/lib/paperspecs.h @@ -0,0 +1,70 @@ + /* This file has been automaticaly generated. + Edit paperspecs to make changes to the papers specifications. */ + + { "a4", 595.275591, 841.889764 }, + { "letter", 612.000000, 792.000000 }, + { "note", 612.000000, 792.000000 }, + { "legal", 612.000000, 1008.000000 }, + { "executive", 522.000000, 756.000000 }, + { "halfletter", 396.000000, 612.000000 }, + { "halfexecutive", 378.000000, 522.000000 }, + { "11x17", 792.000000, 1224.000000 }, + { "statement", 396.000000, 612.000000 }, + { "folio", 612.000000, 936.000000 }, + { "quarto", 610.000000, 780.000000 }, + { "10x14", 720.000000, 1008.000000 }, + { "ledger", 1224.000000, 792.000000 }, + { "tabloid", 792.000000, 1224.000000 }, + { "a0", 2383.937008, 3370.393701 }, + { "a1", 1683.779528, 2383.937008 }, + { "a2", 1190.551181, 1683.779528 }, + { "a3", 841.889764, 1190.551181 }, + { "a5", 419.527559, 595.275591 }, + { "a6", 297.637795, 419.527559 }, + { "a7", 209.763780, 297.637795 }, + { "a8", 147.401575, 209.763780 }, + { "a9", 104.881890, 147.401575 }, + { "a10", 73.700787, 104.881890 }, + { "b0", 2834.645669, 4008.188976 }, + { "b1", 2004.094488, 2834.645669 }, + { "b2", 1417.322835, 2004.094488 }, + { "b3", 1000.629921, 1417.322835 }, + { "b4", 708.661417, 1000.629921 }, + { "b5", 498.897638, 708.661417 }, + { "b6", 354.330709, 498.897638 }, + { "b7", 249.448819, 354.330709 }, + { "b8", 175.748031, 249.448819 }, + { "b9", 124.724409, 175.748031 }, + { "b10", 87.874016, 124.724409 }, + { "c2", 1298.267717, 1836.850394 }, + { "c3", 918.425197, 1298.267717 }, + { "c4", 649.133858, 1003.464567 }, + { "c5", 459.212598, 649.133858 }, + { "c6", 323.149606, 459.212598 }, + { "c7", 229.606299, 323.149606 }, + { "c8", 161.574803, 229.606299 }, + { "jisb0", 2919.685039, 4127.244094 }, + { "jisb1", 2063.622047, 2919.685039 }, + { "jisb2", 1459.842520, 2063.622047 }, + { "jisb3", 1031.811024, 1459.842520 }, + { "jisb4", 728.503937, 1031.811024 }, + { "jisb5", 515.905512, 728.503937 }, + { "jisb6", 362.834646, 515.905512 }, + { "jisb7", 257.952756, 362.834646 }, + { "jisb8", 181.417323, 257.952756 }, + { "jisb9", 127.559055, 181.417323 }, + { "jisb10", 90.708661, 127.559055 }, + { "b5var", 515.905512, 651.968504 }, + { "DL", 311.811024, 623.622047 }, + { "Comm10", 297.000000, 684.000000 }, + { "Monarch", 279.000000, 540.000000 }, + { "archE", 2592.000000, 3456.000000 }, + { "archD", 1728.000000, 2592.000000 }, + { "archC", 1296.000000, 1728.000000 }, + { "archB", 864.000000, 1296.000000 }, + { "archA", 648.000000, 864.000000 }, + { "flsa", 612.000000, 936.000000 }, + { "flse", 612.000000, 936.000000 }, + { "csheet", 1224.000000, 1584.000000 }, + { "dsheet", 1584.000000, 2448.000000 }, + { "esheet", 2448.000000, 3168.000000 }, diff --git a/Build/source/libs/libpaper/libpaper-src/man/Makefile.am b/Build/source/libs/libpaper/libpaper-src/man/Makefile.am new file mode 100644 index 00000000000..6a86233affd --- /dev/null +++ b/Build/source/libs/libpaper/libpaper-src/man/Makefile.am @@ -0,0 +1,25 @@ +man_MANS = \
+ paperconf.1 \
+ defaultpapername.3 \
+ defaultpapersizefile.3 \
+ paperdone.3 \
+ paperfirst.3 \
+ paperinfo.3 \
+ paperinit.3 \
+ paperlast.3 \
+ papernext.3 \
+ paperprev.3 \
+ paperpsheight.3 \
+ paperpsname.3 \
+ paperpswidth.3 \
+ paperwithsize.3 \
+ systempapername.3 \
+ systempapersizefile.3 \
+ papersize.5 \
+ paperconfig.8
+
+EXTRA_DIST = \
+ paperconf.1.in \
+ systempapername.3.in \
+ papersize.5.in \
+ paperconfig.8.in
diff --git a/Build/source/libs/libpaper/libpaper-src/man/defaultpapername.3 b/Build/source/libs/libpaper/libpaper-src/man/defaultpapername.3 new file mode 100644 index 00000000000..32199b5702f --- /dev/null +++ b/Build/source/libs/libpaper/libpaper-src/man/defaultpapername.3 @@ -0,0 +1,2 @@ +.so man3/systempapername.3
+
diff --git a/Build/source/libs/libpaper/libpaper-src/man/defaultpapersizefile.3 b/Build/source/libs/libpaper/libpaper-src/man/defaultpapersizefile.3 new file mode 100644 index 00000000000..b3c0e4823cf --- /dev/null +++ b/Build/source/libs/libpaper/libpaper-src/man/defaultpapersizefile.3 @@ -0,0 +1,2 @@ +.so man3/systempapersizefile.3
+
diff --git a/Build/source/libs/libpaper/libpaper-src/man/paperconf.1.in b/Build/source/libs/libpaper/libpaper-src/man/paperconf.1.in new file mode 100644 index 00000000000..243881cbc57 --- /dev/null +++ b/Build/source/libs/libpaper/libpaper-src/man/paperconf.1.in @@ -0,0 +1,76 @@ +.TH PAPERCONF 1 "25 October 2013"
+.SH NAME
+.B paperconf
+\- print paper configuration information
+.SH SYNOPSIS
+\fBpaperconf\fR
+[\fB\-z\fR]
+[\fB\-n\fR|\fB\-N\fR]
+[\fB\-s\fR|\fB\-w\fR|\fB\-h\fR]
+[\fB\-c\fR|\fB\-m\fR|\fB\-i\fR]
+[[\fB\-p\fR] \fIpaper\fR|\fB\-d\fR|\fB\-a\fR]
+.SH DESCRIPTION
+.B paperconf
+prints information about a given paper.
+The information that can be obtained is the name of the paper, its
+size and its width or height.
+When called without arguments,
+.B paperconf
+prints the name of the system- or user-specified paper, obtained by
+looking in order at the
+.B @PAPERSIZEVAR@
+environment variable
+or by using
+.B a4
+as a fall-back value.
+By default, width and height of the paper are printed in PostScript points.
+.SH OPTIONS
+.TP
+.BI \-p " paper"
+Specify the name of the
+.I paper
+about which information is asked.
+.TP
+.B \-d
+Use the default builtin paper name.
+.TP
+.B \-a
+Consider all known paper names.
+.TP
+.B \-z
+If the paper name is unknown, print it but issue a message on the
+standard error and exit with a non-zero code.
+.TP
+.B \-n
+Print the name of the paper.
+.TP
+.B \-N
+Print the name of the paper with the first letter capitalized.
+.TP
+.B \-s
+Print the size (width followed by height) of the paper.
+.TP
+.B \-w
+Print the width of the paper.
+.TP
+.B \-h
+Print the height of the paper.
+.TP
+.B \-c
+Use centimetres as unit for paper size.
+.TP
+.B \-m
+Use millimetres as unit for paper size.
+.TP
+.B \-i
+Use inches as unit for paper size.
+
+.SH ENVIRONMENT
+.TP 20
+.B @PAPERSIZEVAR@
+Paper size to use.
+.SH AUTHOR
+Yves Arrouye <arrouye@debian.org>
+
+Modified for TeX Live by Peter Breitenlohner <tex-live@tug.org>
+
diff --git a/Build/source/libs/libpaper/libpaper-src/man/paperconfig.8.in b/Build/source/libs/libpaper/libpaper-src/man/paperconfig.8.in new file mode 100644 index 00000000000..c462441f202 --- /dev/null +++ b/Build/source/libs/libpaper/libpaper-src/man/paperconfig.8.in @@ -0,0 +1,73 @@ +.\" paperconfig.8, Copyright (C) 1996, Yves Arrouye <arrouye@debian.org>
+.TH PAPERCONFIG 8 "5 January 2005" "Debian/Linux" "Linux Administrator's Manual"
+.SH NAME
+.B paperconfig
+\- configure the system default paper size
+.SH SYNOPSIS
+.B paperconfig
+[
+.BR \-v\fP, \fB\-\-version
+]
+[
+.BR \-h\fP, \fB\-\-help
+]
+[
+.BI "\-p\fP, \fB\-\-paper" " papername"
+|
+.B \-\-force
+]
+.SH DESCRIPTION
+.B paperconfig
+sets the system (or default) paper to be used by tools using the
+.B papersize
+file.
+It can either ask interactively for the paper to use or be called
+non-interactively by scripts.
+.PP
+When the paper size has been changed,
+.B paperconfig
+notifies other packages of the change by running the scripts in the
+.I @RUNPARTSDIR@
+directory.
+.SH OPTIONS
+.TP
+.BR \-v\fP, \fB\-\-version
+Print the version of
+.B paperconfig
+and exit.
+.TP
+.BR \-h\fP, \fB\-\-help
+Print help about usage and exit.
+.TP
+.BI "\-p\fP, \fB\-\-paper" " papername"
+Use
+.I papername
+if possible. If
+.I papername
+is not a valid paper, print an error message and exit.
+.TP
+.B \-\-force
+Force interactive selection of the system paper even if the actual paper
+is a valid one.
+.SH ENVIRONMENT
+.B PAPERCONF
+Full path to a file containing the paper size to use; this file will
+be rewritten with the system paper size.
+.SH FILES
+.TP 20
+.B @PAPERCONF@
+Contains the name of the system-wide default paper size to be used
+if the
+.B @PAPERSIZEVAR@
+variable is not set.
+.TP 20
+.B @RUNPARTSDIR@
+Directory of scripts to run after the paper size has been changed.
+This package puts no scripts here, but other packages may.
+.SH AUTHOR
+Yves Arrouye <arrouye@debian.org>
+.SH SEE ALSO
+.BR paperconf (1)
+.br
+.BR papersize (5)
+
diff --git a/Build/source/libs/libpaper/libpaper-src/man/paperdone.3 b/Build/source/libs/libpaper/libpaper-src/man/paperdone.3 new file mode 100644 index 00000000000..0ac16967590 --- /dev/null +++ b/Build/source/libs/libpaper/libpaper-src/man/paperdone.3 @@ -0,0 +1,2 @@ +.so man3/paperinit.3
+
diff --git a/Build/source/libs/libpaper/libpaper-src/man/paperfirst.3 b/Build/source/libs/libpaper/libpaper-src/man/paperfirst.3 new file mode 100644 index 00000000000..932aa20a755 --- /dev/null +++ b/Build/source/libs/libpaper/libpaper-src/man/paperfirst.3 @@ -0,0 +1,2 @@ +.so man3/paperinfo.3
+
diff --git a/Build/source/libs/libpaper/libpaper-src/man/paperinfo.3 b/Build/source/libs/libpaper/libpaper-src/man/paperinfo.3 new file mode 100644 index 00000000000..3b59bc9579f --- /dev/null +++ b/Build/source/libs/libpaper/libpaper-src/man/paperinfo.3 @@ -0,0 +1,65 @@ +.TH PAPERINFO 3 "24 September 1996"
+.SH NAME
+paperinfo, paperwithsize, paperfirst, paperlast, papernext, paperprev
+\- return informations about a paper
+.SH SYNOPSYS
+.nf
+.B #include <paper.h>
+.sp
+.B "const struct paper* paperinfo(const char* papername)"
+.B "const struct paper* paperwithsize(double psw, double psh)"
+.sp
+.B "char* papername(const struct paper*)"
+.B "double paperpswidth(const struct paper*)"
+.B "double paperpsheigth(const struct paper*)"
+.sp
+.B "const struct paper* paperfirst(void)"
+.B "const struct paper* papernext(const struct paper* pinfo)"
+.B "const struct paper* paperprev(const struct paper* pinfo)"
+.B "const struct paper* paperlast(void)"
+.fi
+.SH DESCRIPTION
+.B paperinfo()
+returns a pointer to a
+.B struct paper
+containing informations about the paper with name
+.B papername
+.
+.B paperwithsize()
+looks for a paper whose width and height is
+.B psw
+and
+.B psh
+in PostScript points, and return a pointer to a
+.B struct paper
+corresponding to the paper found.
+.PP
+.B papername()
+returns the name of a paper described by an opaque struct paper object
+.
+.B paperpswidth()
+returns the width, in PostScript points, of a paper described by an
+opaque struct paper object
+.
+.B paperpsheight()
+returns the height, in PostScript points, of a paper described by an
+opaque struct paper object
+.
+.PP
+.B paperfirst()
+and
+.B paperlast()
+return the first and last entries for papers.
+Iteration from one entry to the next or the previous one can be done
+with
+.B papernext()
+and
+.B paperprev()
+respectively.
+.SH SEE ALSO
+.BR paperinit (3),
+.BR paperdone (3)
+.BR defaultpapername (3)
+.br
+.BR papersize (5)
+
diff --git a/Build/source/libs/libpaper/libpaper-src/man/paperinit.3 b/Build/source/libs/libpaper/libpaper-src/man/paperinit.3 new file mode 100644 index 00000000000..fd69167ea16 --- /dev/null +++ b/Build/source/libs/libpaper/libpaper-src/man/paperinit.3 @@ -0,0 +1,27 @@ +.TH PAPERINIT 3 "24 September 1996"
+.SH NAME
+paperinit, paperdone \- begin and end using the paper library
+.SH SYNOPSYS
+.nf
+.B #include <paper.h>
+.sp
+.B "void paperinit(void)"
+.B "void paperdone(void)"
+.fi
+.SH DESCRIPTION
+.B paperinit()
+initializes the paper library, allocating any resources that are
+necessary for its use.
+This function must be called before any other function of the paper
+library is used.
+.PP
+.B paperdone()
+frees any resources that were allocated for the paper library.
+No function of the library should be called after a call to this
+function.
+.SH SEE ALSO
+.BR defaultpapername (3),
+.BR paperinfo (3)
+.br
+.BR papersize (5)
+
diff --git a/Build/source/libs/libpaper/libpaper-src/man/paperlast.3 b/Build/source/libs/libpaper/libpaper-src/man/paperlast.3 new file mode 100644 index 00000000000..932aa20a755 --- /dev/null +++ b/Build/source/libs/libpaper/libpaper-src/man/paperlast.3 @@ -0,0 +1,2 @@ +.so man3/paperinfo.3
+
diff --git a/Build/source/libs/libpaper/libpaper-src/man/papernext.3 b/Build/source/libs/libpaper/libpaper-src/man/papernext.3 new file mode 100644 index 00000000000..932aa20a755 --- /dev/null +++ b/Build/source/libs/libpaper/libpaper-src/man/papernext.3 @@ -0,0 +1,2 @@ +.so man3/paperinfo.3
+
diff --git a/Build/source/libs/libpaper/libpaper-src/man/paperprev.3 b/Build/source/libs/libpaper/libpaper-src/man/paperprev.3 new file mode 100644 index 00000000000..932aa20a755 --- /dev/null +++ b/Build/source/libs/libpaper/libpaper-src/man/paperprev.3 @@ -0,0 +1,2 @@ +.so man3/paperinfo.3
+
diff --git a/Build/source/libs/libpaper/libpaper-src/man/paperpsheight.3 b/Build/source/libs/libpaper/libpaper-src/man/paperpsheight.3 new file mode 100644 index 00000000000..932aa20a755 --- /dev/null +++ b/Build/source/libs/libpaper/libpaper-src/man/paperpsheight.3 @@ -0,0 +1,2 @@ +.so man3/paperinfo.3
+
diff --git a/Build/source/libs/libpaper/libpaper-src/man/paperpsname.3 b/Build/source/libs/libpaper/libpaper-src/man/paperpsname.3 new file mode 100644 index 00000000000..932aa20a755 --- /dev/null +++ b/Build/source/libs/libpaper/libpaper-src/man/paperpsname.3 @@ -0,0 +1,2 @@ +.so man3/paperinfo.3
+
diff --git a/Build/source/libs/libpaper/libpaper-src/man/paperpswidth.3 b/Build/source/libs/libpaper/libpaper-src/man/paperpswidth.3 new file mode 100644 index 00000000000..932aa20a755 --- /dev/null +++ b/Build/source/libs/libpaper/libpaper-src/man/paperpswidth.3 @@ -0,0 +1,2 @@ +.so man3/paperinfo.3
+
diff --git a/Build/source/libs/libpaper/libpaper-src/man/papersize.5.in b/Build/source/libs/libpaper/libpaper-src/man/papersize.5.in new file mode 100644 index 00000000000..d553909ad71 --- /dev/null +++ b/Build/source/libs/libpaper/libpaper-src/man/papersize.5.in @@ -0,0 +1,63 @@ +.TH PAPERSIZE 5
+.SH NAME
+.B papersize
+\- specify preferred paper size
+.SH SYNOPSYS
+.B @PAPERCONF@
+.SH DESCRIPTION
+The
+.B papersize
+file is used to specify the preferred paper size to use by available
+commands and programs generating documents.
+.PP
+The format of this file is extremely simple: whitespace and anything
+starting with `#' is ignored, and the name of the paper is the first
+string found; the case in the name of the paper does not import (see
+.B CAVEATS
+section however).
+.SH "PAPER NAMES"
+The following names are commonly understood by programs:
+.B a3\fP,\fB a4\fP,\fB a5\fP,
+.B b5\fP,\fB letter\fP,\fB legal\fP,\fB executive\fP,\fB note\fP
+and
+.BR 11x17 .
+.PP
+Additional paper names that one may encounter are:
+.B a0\fP,\fB a1\fP,\fB a2\fP,\fB a6\fP,\fB a7\fP,\fB a8\fP,\fB a9\fP,\fB a10\fP,
+.B b0\fP,\fB b1\fP,\fB b2\fP,\fB b3\fP,\fB b4\fP,\fB tabloid\fP,
+.B statement\fP,\fB note\fP,
+.B halfletter\fP,\fB halfexecutive\fP,\fB folio\fP,\fB quarto\fP,\fB ledger\fP,
+.B archA\fP,\fB archB\fP,\fB archC\fP,\fB archD\fP,\fB archE\fP,\fB flsa\fP,
+.B flse\fP,\fB csheet\fP,\fB dsheet\fP,\fB esheet\fP
+and
+.BR 10x14 .
+.PP
+The value of the
+.B papersize
+file can be overrideen by
+looking in order at the
+.B @PAPERSIZEVAR@
+environment variable, then at the contents of the file specified by the
+.B @PAPERCONFVAR@
+environment variable. If the
+.B papersize
+file does not exist, programs using the paper library default to using
+.B letter
+as a fall-back value
+.SH CAVEATS
+This manual page documents the format of the
+.B papersize
+file that is read by the
+.B libpaper
+library.
+Some programs that read this file do not yet use the library and may have
+trouble ignoring whitespace and comments in the file; they may also
+require that the paper names use a specific capitalization.
+.SH DOCUMENTATION
+Yves Arrouye <arrouye@debian.org>
+.SH SEE ALSO
+.BR paperconf (1)
+.br
+.BR paperconfig (8)
+
+
diff --git a/Build/source/libs/libpaper/libpaper-src/man/paperwithsize.3 b/Build/source/libs/libpaper/libpaper-src/man/paperwithsize.3 new file mode 100644 index 00000000000..932aa20a755 --- /dev/null +++ b/Build/source/libs/libpaper/libpaper-src/man/paperwithsize.3 @@ -0,0 +1,2 @@ +.so man3/paperinfo.3
+
diff --git a/Build/source/libs/libpaper/libpaper-src/man/systempapername.3.in b/Build/source/libs/libpaper/libpaper-src/man/systempapername.3.in new file mode 100644 index 00000000000..f77d96e7991 --- /dev/null +++ b/Build/source/libs/libpaper/libpaper-src/man/systempapername.3.in @@ -0,0 +1,53 @@ +.TH SYSTEMPAPERNAME 3 "17 September 2001"
+.SH NAME
+systempapername, defaultpapername, systempapersizefile,
+defaultpapersizefile \- return names for managing system paper
+information
+.SH SYNOPSYS
+.nf
+.B #include <paper.h>
+.sp
+.B "const char* systempapername(void)"
+.B "const char* defaultpapername(void)"
+.sp
+.B "const char* systempapersizefile(void)"
+.B "const char* defaultpapersizefile(void)"
+.fi
+.SH DESCRIPTION
+.B systempapername()
+returns the name of the default paper to be used by a program.
+This name is obtained by looking in that order at the
+.B @PAPERCONFVAR@
+environment variable, at the contents of the file returned by
+.B systempapersizefile()
+or by using
+.B defaultpapername()
+as a last chance.
+.PP
+.B defaultpapername()
+returns the name of the default paper to use if it is impossible to get
+its name from the environment.
+.PP
+.B systempapersizefile()
+returns the path of the papersize file to use.
+This path is obtained by looking at the
+.B @PAPERCONFVAR@
+environment variable or by calling
+.BR defaultpapersizefile() .
+.PP
+.B defaultpapersizefile
+returns the path of the default papersize file.
+.SH ENVIRONMENT
+.TP 20
+.B @PAPERSIZEVAR@
+Paper size to use regardless of what the papersize file contains.
+.TP 20
+.B @PAPERCONFVAR@
+Full path to a file containing the paper size to use.
+.SH FILES
+.TP 20
+.B @PAPERCONF@
+Contains the name of the system-wide default paper size to be used.
+.SH SEE ALSO
+.BR papersize (5)
+
diff --git a/Build/source/libs/libpaper/libpaper-src/man/systempapersizefile.3 b/Build/source/libs/libpaper/libpaper-src/man/systempapersizefile.3 new file mode 100644 index 00000000000..c7f4c7f9b21 --- /dev/null +++ b/Build/source/libs/libpaper/libpaper-src/man/systempapersizefile.3 @@ -0,0 +1 @@ +.so man3/systempapername.3
diff --git a/Build/source/libs/libpaper/libpaper-src/src/Makefile.am b/Build/source/libs/libpaper/libpaper-src/src/Makefile.am new file mode 100644 index 00000000000..9e608539781 --- /dev/null +++ b/Build/source/libs/libpaper/libpaper-src/src/Makefile.am @@ -0,0 +1,8 @@ +
+bin_PROGRAMS = paperconf
+paperconf_LDADD = ../lib/libpaper.la
+paperconf_CPPFLAGS = -I$(top_srcdir)/lib
+
+sbin_SCRIPTS = paperconfig
+
+EXTRA_DIST = paperconfig.in
diff --git a/Build/source/libs/libpaper/libpaper-src/src/paperconf.c b/Build/source/libs/libpaper/libpaper-src/src/paperconf.c new file mode 100644 index 00000000000..bbd43802512 --- /dev/null +++ b/Build/source/libs/libpaper/libpaper-src/src/paperconf.c @@ -0,0 +1,234 @@ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <sys/param.h> + +#include <ctype.h> +#include <unistd.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <errno.h> + +#include <paper.h> + + +/* needed for GNU/Hurd */ +#ifndef MAXPATHLEN +#define MAXPATHLEN 4096 +#endif + +static void usage(const char* name) +{ + fprintf(stderr, + "usage: %s [ [ -p ] papername | -d | -a ] [ -z ] [ -n | -N ] [ -s | -w | -h ] [ -c | -m | -i ]\n", + name); + exit(1); +} + +#define OPT_NAME 1 +#define OPT_UPPERNAME 2 +#define OPT_WIDTH 4 +#define OPT_HEIGHT 8 +#define OPT_CM 16 +#define OPT_MM 32 +#define OPT_INCH 64 +#define OPT_CONTINUE 128 + +#define OPT_UNIT (OPT_CM | OPT_MM | OPT_INCH) + +#define INCHxCM 2.54 + +static void printinfo(const struct paper* paper, int options) +{ + int pr = 0; + + if ((options & ~(OPT_CONTINUE)) == 0) { + options = OPT_NAME; + } + + if (options & OPT_NAME) { + printf("%s", papername(paper)); + pr = 1; + } else if (options & OPT_UPPERNAME) { + if (islower((unsigned char)*papername(paper))) { + printf("%c%s", toupper((unsigned char)*papername(paper)), papername(paper) + 1); + } else { + printf("%s", papername(paper)); + } + pr = 1; + } + + if (options & OPT_WIDTH) { + if (pr) putchar(' '); + if (options & OPT_CM) + printf("%g cm", paperpswidth(paper) / 72.0 * INCHxCM ); + else if (options & OPT_MM) + printf("%g mm", paperpswidth(paper) / 72.0 * 10 * INCHxCM ); + else if (options & OPT_INCH) + printf("%g\"", paperpswidth(paper) / 72.0 ); + else + printf("%g", paperpswidth(paper) ); + pr = 1; + } + if (options & OPT_HEIGHT) { + if (pr) putchar(' '); + if (options & OPT_CM) + printf("%g cm", paperpsheight(paper) / 72.0 * INCHxCM ); + else if (options & OPT_MM) + printf("%g mm", paperpsheight(paper) / 72.0 * 10 * INCHxCM ); + else if (options & OPT_INCH) + printf("%g\"", paperpsheight(paper) / 72.0 ); + else + printf("%g", paperpsheight(paper) ); + pr = 1; + } + + putchar('\n'); +} + +int main(int argc, char** argv) +{ + int c; + + int all = 0; + const char* paper = 0; + unsigned options = 0; + + const char* progname; + + progname = strrchr(*argv, '/'); + if (progname) { + ++progname; + } else { + progname = *argv; + } + + while ((c = getopt(argc, argv, "adznNswhcmip:")) != EOF) { + switch (c) { + case 'a': + if (paper || all) { + usage(progname); + } + all = 1; + break; + + case 'd': + if (paper || all) { + usage(progname); + } + paper = defaultpapername(); + break; + + case 'p': + if (paper || all) { + usage(progname); + } + paper = optarg; + break; + + case 'z': + options |= OPT_CONTINUE; + break; + + case 'n': + if (options & OPT_UPPERNAME) usage(progname); + options |= OPT_NAME; + break; + + case 'N': + if (options & OPT_NAME) usage(progname); + options |= OPT_UPPERNAME; + break; + + case 's': + options |= OPT_WIDTH | OPT_HEIGHT; + break; + + case 'w': + options |= OPT_WIDTH; + break; + + case 'h': + options |= OPT_HEIGHT; + break; + + case 'c': + if (options & OPT_UNIT) usage(progname); + options |= OPT_CM; + break; + + case 'm': + if (options & OPT_UNIT) usage(progname); + options |= OPT_MM; + break; + + case 'i': + if (options & OPT_UNIT) usage(progname); + options |= OPT_INCH; + break; + + default: + usage(progname); + } + } + + if (optind < argc - 1 || (paper && optind != argc)) { + usage(progname); + } else if (optind != argc) { + paper = argv[optind]; + } + + paperinit(); + + if (all) { + const struct paper* papers; + + for (papers = paperfirst(); papers; papers = papernext(papers)) { + printinfo(papers, options); + } + } else { + const struct paper* syspaper; + + if (!paper) paper = systempapername(); + if (!paper) paper = defaultpapername(); + if (!paper) { + char errmsg[2 * MAXPATHLEN + 64]; + + sprintf(errmsg, "%s: cannot get paper size from %s", + progname, systempapersizefile()); + + if (errno) { + perror(errmsg); + } else { + fputs(errmsg, stderr); + } + + paperdone(); + + exit(3); + } + + syspaper = paperinfo(paper); + + if (syspaper) { + printinfo(syspaper, options); + } else { + fprintf(stderr, "%s: unknown paper `%s'\n", progname, paper); + if (options & OPT_CONTINUE) { + puts(paper); + } + + paperdone(); + + exit(2); + } + } + + paperdone(); + + return 0; +} + diff --git a/Build/source/libs/libpaper/libpaper-src/src/paperconfig.in b/Build/source/libs/libpaper/libpaper-src/src/paperconfig.in new file mode 100644 index 00000000000..cd04efaa9aa --- /dev/null +++ b/Build/source/libs/libpaper/libpaper-src/src/paperconfig.in @@ -0,0 +1,227 @@ +#! /bin/sh
+
+# paperconfig: configuration of system paper name
+#
+# Copyright (C) 1996, Yves Arrouye <arrouye@debian.org>
+# 2001, Adrian Bunk <bunk@fs.tum.de>
+
+usage() {
+ if [ "$1" = -h ]
+ then
+ exec 1>&2
+ echo -n U
+ else
+ echo -n u
+ fi
+
+ echo "sage: `basename $0` [ -v, --version ] [ -h, --help ] [ -p, --paper name | --force ]"
+
+ if [ "$1" = -h ]
+ then
+ cat <<EOF
+
+Options: -v, --verbose print version information and exit
+ -h, --help print this help and exit
+ -p, --paper name specify the paper to use
+ --force force paper configuration
+EOF
+ exit 0
+ else
+ exit 1
+ fi
+}
+
+# "|| true" added below, to assure that the script does not fail even if
+# called with bash -e. (MP 22/08/98)
+
+unset @PAPERSIZEVAR@ || true
+: ${@PAPERCONFVAR@:=@PAPERCONF@}
+export @PAPERCONFVAR@
+
+unset @RUNPARTSDIRVAR@ || true
+: ${@RUNPARTSDIRVAR@:=@RUNPARTSDIR@}
+export @RUNPARTSDIRVAR@
+
+force=0
+
+if [ "$#" -eq 0 ]
+ then
+ usage
+fi
+
+while [ $# -ne 0 ]
+do
+ case "$1" in
+ -v|--version)
+ echo "`basename $0` version 1.0" \
+ "by Yves Arrouye <arrouye@debian.org>"
+ exit 0
+ ;;
+ -h|--help)
+ usage -h
+ ;;
+ -p|--paper)
+ test $# -gt 1 || usage
+ paper="$2"
+ shift
+ ;;
+ --force)
+ force=1
+ ;;
+ *)
+ usage
+ ;;
+ esac
+ shift
+done
+
+invalidpaper() {
+ ! paperconf "$1" 2>/dev/null 1>&2
+}
+
+format() {
+ _maxwidth=$1; shift
+ _start="$1"; shift
+
+ _cline=
+
+ for w
+ do
+ if [ `echo "$_start$_cline$w " | wc -c` -ge 0$_maxwidth ]
+ then
+ echo "$_cline"
+ _cline=
+ _start=
+ fi
+ _cline="$_cline$w "
+ done
+
+ if [ -n "$_cline" ]
+ then
+ echo "$_cline"
+ fi
+
+ unset _maxwidth _cline _start
+}
+
+# "chmod 644" added below, to assure that the conf file is created
+# with the right access permissions (MP 13/05/2000)
+
+setpaper() {
+ paperright=`paperconf "$1" 2>/dev/null`
+
+ ok=0
+
+ if 2>/dev/null echo "$paperright" >${@PAPERCONFVAR@}.new
+ then
+ if 2>/dev/null mv -f ${@PAPERCONFVAR@}.new $@PAPERCONFVAR@
+ then
+ if 2>/dev/null chmod 644 $@PAPERCONFVAR@
+ then
+ ok=1
+ fi
+ fi
+ fi
+
+ if [ $ok -eq 0 ]
+ then
+ echo `basename $0`: cannot create $@PAPERCONFVAR@
+ exit 2
+ else
+ #
+ # Added code for calling back applications when
+ # papersize changes. See bug #345466
+ # eppesuig@debian.org, 2006-01-05
+ if [ -d ${@RUNPARTSDIRVAR@} ]
+ then
+ run-parts ${@RUNPARTSDIRVAR@}
+ fi
+ fi
+}
+
+if [ ! -z "$paper" ]
+then
+ if invalidpaper $paper
+ then
+ >&2 echo `basename $0`: \"$paper\" is not a known paper name
+ exit 3
+ fi
+ setpaper "$paper"
+ exit 0
+fi
+
+knownpapers="`paperconf -a`"
+
+prompt=
+width=72
+
+# "|| true" added below, to assure that the script does not fail even if
+# called with bash -e. (MP 22/08/98)
+
+paper=`paperconf 2>/dev/null || true`
+dftpaper=`paperconf -d`
+
+if [ $force -eq 1 ] || [ ! -e $@PAPERCONFVAR@ ] || invalidpaper $paper
+then
+ papers="`format $width \"\" $knownpapers`"
+ echo
+
+ if [ -x /usr/bin/pager ]
+ then
+ : ${PAGER:=/usr/bin/pager}
+ fi
+ if [ -x /bin/more ]
+ then
+ : ${PAGER:=/bin/more}
+ fi
+ : ${PAGER:=cat}
+
+ LESS="-X -E $LESS"
+ export LESS
+
+ (
+ cat <<EOF
+The default (also known as system) paper can be chosen from many known
+papers that are currently recognized by programs using the libpaper
+library (with libpaper, paper names are case insensitive; if you use
+programs that use the system paper size but do not rely on the libpaper
+library, this may not be true and some of the papers listed below may
+not be known by these programs):
+
+EOF
+ echo "$papers" | sed 's/^/ /'
+ echo
+ ) | ${PAGER}
+
+ : ${paper:=$dftpaper}
+
+ echo -n "Default paper name? [$paper] "
+ read ans
+ : ${ans:=$paper}
+ paper=$ans
+fi
+
+while invalidpaper "$paper"
+do
+ if [ -z "$paper" ]
+ then
+ echo "Please choose a paper from the available papers list."
+ else
+ echo "Unknow paper \"$paper\"," \
+ "please choose one from the available papers list."
+ fi
+
+ paper=$dftpaper
+
+ echo -n "Default paper name? [$paper] "
+ read ans
+ paper=$ans
+done
+
+if [ "`paperconf 2>/dev/null`" != "$paper" ] || grep -q "[# ]" $@PAPERCONFVAR@
+then
+ setpaper "$paper"
+fi
+
+exit 0
+
|