+++ /dev/null
---- a2ps-4.13.rh/src/main.c Fri Feb 23 17:39:02 2001
-+++ a2ps-4.13.euc/src/main.c Fri Feb 23 23:07:40 2001
-@@ -31,6 +31,8 @@
- /* */
- /************************************************************************/
- #include <assert.h>
-+#include <string.h>
-+#include <locale.h>
-
- #include "a2ps.h"
- #include "argmatch.h"
-@@ -925,6 +927,7 @@
- main (int argc, char *argv[])
- {
- int argn;
-+ char *locale;
-
- /* Architecture specific initialization. */
- #ifdef __EMX__
-@@ -947,6 +950,9 @@
- setlocale (LC_CTYPE, "");
- setlocale (LC_PAPER, "");
-
-+ locale = setlocale (LC_ALL, "");
-+ /* fprintf(stderr, "locale : %s\n", locale); */
-+
- bindtextdomain (PACKAGE, LOCALEDIR);
- textdomain (PACKAGE);
-
-@@ -1013,6 +1019,10 @@
- yet read sheets. */
- sheets_map = sheets_map_new ();
- style_sheets = new_style_sheets ();
-+
-+ /* Process special case: Japanese Document */
-+ if (! strncmp (locale, "ja", 2) )
-+ job->requested_encoding_name = xstrdup ("euc-jp");
-
- /* Process the command line options. */
- argn = a2ps_handle_options (job, argc, argv);
+++ /dev/null
-diff -ur a2ps-4.13.orig/lib/routines.c a2ps-4.13/lib/routines.c\r
---- a2ps-4.13.orig/lib/routines.c Sat Oct 16 06:46:37 1999\r
-+++ a2ps-4.13/lib/routines.c Fri Jan 5 12:51:20 2001\r
-@@ -242,3 +242,50 @@\r
- /* Don't complain if you can't unlink. Who cares of a tmp file? */\r
- unlink (filename);\r
- }\r
-+\r
-+/*\r
-+ * Securely generate a temp file, and make sure it gets\r
-+ * deleted upon exit.\r
-+ */\r
-+static char ** tempfiles = NULL;\r
-+static unsigned ntempfiles = 0;\r
-+\r
-+static void\r
-+cleanup_tempfiles()\r
-+{\r
-+ while (ntempfiles--)\r
-+ unlink(tempfiles[ntempfiles]);\r
-+}\r
-+\r
-+char *\r
-+safe_tempnam(const char *pfx)\r
-+{\r
-+ char *dirname, *filename;\r
-+ int fd;\r
-+\r
-+ if (!(dirname = getenv("TMPDIR")))\r
-+ dirname = "/tmp";\r
-+\r
-+ tempfiles = (char **) realloc(tempfiles,\r
-+ (ntempfiles+1) * sizeof(char *));\r
-+ if (tempfiles == NULL)\r
-+ return NULL;\r
-+\r
-+ filename = malloc(strlen(dirname) + strlen(pfx) + sizeof("/XXXXXX"));\r
-+ if (!filename)\r
-+ return NULL;\r
-+\r
-+ sprintf(filename, "%s/%sXXXXXX", dirname, pfx);\r
-+\r
-+ if ((fd = mkstemp(filename)) < 0) {\r
-+ free(filename);\r
-+ return NULL;\r
-+ }\r
-+ close(fd);\r
-+\r
-+ if (ntempfiles == 0)\r
-+ atexit(cleanup_tempfiles);\r
-+ tempfiles[ntempfiles++] = filename;\r
-+\r
-+ return filename;\r
-+}\r
-diff -ur a2ps-4.13.orig/lib/routines.h a2ps-4.13/lib/routines.h\r
---- a2ps-4.13.orig/lib/routines.h Mon Oct 18 22:24:41 1999\r
-+++ a2ps-4.13/lib/routines.h Fri Jan 5 12:37:53 2001\r
-@@ -255,7 +255,8 @@\r
- /* If _STR_ is not defined, give it a tempname in _TMPDIR_ */\r
- #define tempname_ensure(Str) \\r
- do { \\r
-- (Str) = (Str) ? (Str) : tempnam (NULL, "a2_"); \\r
-+ (Str) = (Str) ? (Str) : safe_tempnam("a2_"); \\r
- } while (0)\r
-+char * safe_tempnam(const char *);\r
- \r
- #endif\r