From 5037cbab892ec635d584ad4b3d693ae591cb2237 Mon Sep 17 00:00:00 2001 From: Hiroki Sato Date: Fri, 10 May 2013 04:34:33 +0000 Subject: [PATCH] Fix the case when LANG is not set. Spotted by: Hiroto Kagotani --- print/tex-ptexenc/Makefile | 1 + print/tex-ptexenc/files/patch-ptexenc.c | 13 ++++++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/print/tex-ptexenc/Makefile b/print/tex-ptexenc/Makefile index a985cc2073a3..9294ee17cfa7 100644 --- a/print/tex-ptexenc/Makefile +++ b/print/tex-ptexenc/Makefile @@ -2,6 +2,7 @@ PORTNAME= ptexenc PORTVERSION= 1.3.0 +PORTREVISION= 1 CATEGORIES= print MASTER_SITES= ftp://tug.org/historic/systems/texlive/2012/ PKGNAMEPREFIX= tex- diff --git a/print/tex-ptexenc/files/patch-ptexenc.c b/print/tex-ptexenc/files/patch-ptexenc.c index 9185637a4309..385ae3f581bf 100644 --- a/print/tex-ptexenc/files/patch-ptexenc.c +++ b/print/tex-ptexenc/files/patch-ptexenc.c @@ -1,5 +1,5 @@ --- ptexenc.c.orig 2012-03-05 17:50:28.000000000 +0900 -+++ ptexenc.c 2013-03-06 06:34:13.000000000 +0900 ++++ ptexenc.c 2013-05-10 13:31:02.000000000 +0900 @@ -15,6 +15,7 @@ #include @@ -8,7 +8,7 @@ #define ENC_UNKNOWN 0 #define ENC_JIS 1 -@@ -23,7 +24,39 @@ +@@ -23,7 +24,42 @@ #define ENC_UTF8 4 #define ENC_UPTEX 5 @@ -39,6 +39,9 @@ + if (default_kanji_is_uptex) + return (ENC_UPTEX); + name = getenv("LANG"); ++ if (name == NULL) ++ return (ENC_UTF8); ++ + for (i = 0; letable[i].name != NULL; i++) { + if (fnmatch(letable[i].name, name, letable[i].flag) != + FNM_NOMATCH) @@ -49,7 +52,7 @@ static boolean UPTEX_enabled; static boolean prior_file_enc = false; -@@ -64,7 +97,7 @@ +@@ -64,7 +100,7 @@ static int string_to_enc(const_string str) { if (str == NULL) return ENC_UNKNOWN; @@ -58,7 +61,7 @@ if (strcasecmp(str, "jis") == 0) return ENC_JIS; if (strcasecmp(str, "euc") == 0) return ENC_EUC; if (strcasecmp(str, "sjis") == 0) return ENC_SJIS; -@@ -92,7 +125,7 @@ +@@ -92,7 +128,7 @@ } else if (enc != ENC_UNKNOWN) { return enc; } @@ -67,7 +70,7 @@ } static void set_file_enc(int enc) -@@ -150,9 +183,9 @@ +@@ -150,9 +186,9 @@ { UPTEX_enabled = enable; if (enable)