source:
patches/man-1.6g-i18n-1.patch@
b12793f
Last change on this file since b12793f was 3eeef443, checked in by , 14 years ago | |
---|---|
|
|
File size: 10.3 KB |
-
catopen/catopen.c
Submitted By: Joe Ciccone <jciccone@gmail.com> Date: 2011-01-08 Initial Package Version: 1.6f Upstream Status: Unkown Origin: Mandriva Description: i18n Updates diff -Naur man-1.6g.orig/catopen/catopen.c man-1.6g/catopen/catopen.c
old new 9 9 extern char *index (const char *, int); /* not always in <string.h> */ 10 10 extern char *my_malloc(int); /* in util.c */ 11 11 12 /* if the program has sgid/suid privileges then getenv doesn't return 13 * NLSPATH; so we set here a good default value. 14 */ 12 15 #ifndef DEFAULT_NLSPATH 13 16 # if __GLIBC__ >= 2 14 # define DEFAULT_NLSPATH "/usr/share/locale/%L/%N "17 # define DEFAULT_NLSPATH "/usr/share/locale/%L/%N:/usr/share/locale/%l_%t/%N:/usr/share/locale/%l/%N" 15 18 # else 16 19 # define DEFAULT_NLSPATH "/usr/lib/locale/%N/%L" 17 20 # endif 18 21 #endif 19 22 20 static nl_catd my_catopenpath(char *name, char *path );23 static nl_catd my_catopenpath(char *name, char *path, char *lang); 21 24 22 25 static /* this source included in gripes.c */ 23 26 nl_catd 24 27 my_catopen(char *name, int oflag) { 25 nl_catd fd; 28 nl_catd fd = (nl_catd) -1; 29 30 /* using first the my_catopenpath, which looks with LANGUAGE 31 * and only if it fails ressort to catopen, it gives better i18n 32 */ 33 { 34 char *nlspath, *lang, *s; 26 35 27 fd = catopen(name, oflag); 36 /* 37 * "If NLSPATH does not exist in the environment, or if a 38 * message catalog cannot be opened in any of the paths specified 39 * by NLSPATH, then an implementation defined default path is used" 40 */ 41 nlspath = getenv("NLSPATH"); 42 if (!nlspath) 43 nlspath = DEFAULT_NLSPATH; 44 45 lang = getenv("LANGUAGE"); 46 if (!lang) 47 lang = getenv("LC_ALL"); 48 if (!lang) 49 lang = getenv("LC_MESSAGES"); 50 if (!lang) 51 lang = getenv("LANG"); 52 if (!lang) 53 lang = ""; 54 55 while(*lang && (fd == (nl_catd) -1)) { 56 s = index(lang, ':'); 57 if (s) *s = 0; 58 fd = my_catopenpath(name, nlspath, lang); 59 if (s) lang=s+1; 60 else lang = ""; 61 } 62 if (fd == (nl_catd) -1) 63 fd = my_catopenpath(name, nlspath, "en"); 64 } 65 66 /* still not found, use the system catopen */ 67 if (fd == (nl_catd) -1) 68 fd = catopen(name, oflag); 28 69 29 70 if (fd == (nl_catd) -1 && oflag) { 30 71 oflag = 0; … … 32 73 } 33 74 34 75 if (fd == (nl_catd) -1) { 35 char *nlspath;36 37 76 /* The libc catopen fails - let us see if we can do better */ 38 77 /* The quotes below are from X/Open, XPG 1987, Vol. 3. */ 39 78 … … 58 97 #endif 59 98 } 60 99 61 /*62 * "If NLSPATH does not exist in the environment, or if a63 * message catalog cannot be opened in any of the paths specified64 * by NLSPATH, then an implementation defined default path is used"65 */66 67 nlspath = getenv("NLSPATH");68 if (nlspath)69 fd = my_catopenpath(name, nlspath);70 if (fd == (nl_catd) -1)71 fd = my_catopenpath(name, DEFAULT_NLSPATH);72 100 } 73 101 return fd; 74 102 } … … 90 118 * 91 119 */ 92 120 static nl_catd 93 my_catopenpath(char *name, char *nlspath) { 94 int fd; 121 my_catopenpath(char *name, char *nlspath, char *lang) { 95 122 nl_catd cfd = (nl_catd) -1; 96 char *path0, *path, *s, *file, *lang , *lang_l, *lang_t, *lang_c;123 char *path0, *path, *s, *file, *lang_l, *lang_t, *lang_c; 97 124 int langsz, namesz, sz, lang_l_sz, lang_t_sz, lang_c_sz; 98 125 99 126 namesz = strlen(name); 100 127 101 lang = getenv("LANG");102 128 if (!lang) 103 129 lang = ""; 104 130 langsz = strlen(lang); … … 194 220 path = s+1; 195 221 } else 196 222 path = 0; 197 fd = open(file, O_RDONLY); 198 if (fd != -1) { 199 /* we found the right catalog - but we don't know the 200 type of nl_catd, so close it again and ask libc */ 201 close(fd); 202 cfd = catopen(file, 0); 203 break; 204 } 223 cfd = catopen(file, 0); 224 if (cfd != (nl_catd) -1) 225 break; 205 226 } 206 227 207 228 free(path0); -
configure
diff -Naur man-1.6g.orig/configure man-1.6g/configure
old new 416 416 fi 417 417 done 418 418 done 419 troff= ""420 nroff= ""421 jnroff= ""419 troff=/usr/bin/troff 420 nroff=/usr/bin/nroff 421 jnroff=/usr/bin/nroff 422 422 eqn="" 423 423 neqn="" 424 424 jneqn="" … … 476 476 done 477 477 # -Tlatin1 is bad when utf8 is used, but needed for groff, not for nroff 478 478 # Hmm - also needed for nroff, to prevent double conversion on uxterm 479 Fgroff=/usr/bin/groff 480 Fnroff=/usr/bin/nroff 481 Fjnroff=/usr/bin/nroff 479 482 if test $Fgroff = "missing" 480 483 then 481 484 if test $Fnroff = "missing" 482 485 then 483 nroff="nroff -T latin1-mandoc"486 nroff="nroff -Tutf8 -mandoc" 484 487 else 485 nroff="$Fnroff -T latin1-mandoc"488 nroff="$Fnroff -Tutf8 -mandoc" 486 489 fi 487 490 troff="troff -mandoc" 488 491 echo "Warning: could not find groff" 489 492 else 490 493 if test $Fnroff = "missing" 491 494 then 492 nroff="$Fgroff -T latin1-mandoc"495 nroff="$Fgroff -Tutf8 -mandoc" 493 496 else 494 nroff="$Fnroff -T latin1-mandoc"497 nroff="$Fnroff -Tutf8 -mandoc" 495 498 fi 496 499 troff="$Fgroff -Tps -mandoc" 497 jnroff="$F groff -Tnippon-mandocj"500 jnroff="$Fjnroff -Tutf8 -mandocj" 498 501 fi 499 502 eqn="$Fgeqn -Tps" 500 neqn="$Fgeqn -T latin1"501 jneqn="$Fgeqn -T nippon"503 neqn="$Fgeqn -Tutf8" 504 jneqn="$Fgeqn -Tutf8" 502 505 tbl="$Fgtbl" 503 506 col="$Fcol" 504 507 vgrind="$Fvgrind" … … 964 967 965 968 # What sections do we anticipate? 966 969 967 tmpsections="1 1p 8 2 3 3p 4 5 6 7 9 0p tcl n l p o"970 tmpsections="1 1p 8 2 3 3p 3pm 4 5 6 7 9 0p tcl n l p o" 968 971 969 972 if [ x$default = x ]; then 970 973 echo "" -
msgs/inst.sh
diff -Naur man-1.6g.orig/msgs/inst.sh man-1.6g/msgs/inst.sh
old new 27 27 for j in $M; do 28 28 if [ -f $j ]; then 29 29 i=`echo $j | sed -e 's/mess.//; s/.cat//'` 30 dest=`echo $locdir | sed -e "s/%N/man/; s/%L/$i/"` 31 dest=${PREFIX}$dest 30 dest=${PREFIX}/`echo $locdir | sed -e "s/%N/man/; s/%L/$i/"` 32 31 echo "mkdir -p `dirname $dest`" 33 32 mkdir -p `dirname $dest`; 34 33 echo "install -c -m 644 $j $dest" -
src/apropos.sh
diff -Naur man-1.6g.orig/src/apropos.sh man-1.6g/src/apropos.sh
old new 60 60 esac 61 61 done 62 62 63 # list of languages to look for 64 LANG_LIST=`echo $LANGUAGE:$LC_ALL:$LC_MESSAGES:$LANG | tr ':' ' '` 65 DIR_LIST="" 66 for d in /var/cache/man $manpath /usr/lib 67 do 68 for l in $LANG_LIST 69 do 70 if [ -d $d/$l ] 71 then 72 # check that the path is not already in the list 73 if ! echo "$DIR_LIST" | grep " $d/$l\b" > /dev/null 74 then 75 DIR_LIST="$DIR_LIST $d/$l" 76 fi 77 fi 78 done 79 DIR_LIST="$DIR_LIST $d" 80 # check that the path is not already in the list 81 if ! echo "$DIR_LIST" | grep " $d\b" > /dev/null 82 then 83 DIR_LIST="$DIR_LIST $d/$l" 84 fi 85 done 86 63 87 while [ "$1" != "" ] 64 88 do 65 89 found=0 66 for d in /var/cache/man $manpath /usr/lib 90 # in order not to display lines in more than one language for 91 # a same man page; we check that a given man page name 92 # hasn't already been displayed 93 BAZ="" 94 for d in $DIR_LIST 67 95 do 68 96 if [ -f $d/whatis ] 69 97 then 70 if grep -"$grepopt1" "$grepopt2""$1" $d/whatis98 if FOO=`grep -"$grepopt1" "$grepopt2""$1" $d/whatis` 71 99 then 72 found=1 100 # the LC_ALL=C is needed in case the text is 101 # in a different encoding than the locale 102 BAR=`echo -e "$FOO" | LC_ALL=C sed 's/ - .*$//' | tr ' []' '_' | sort -u` 103 for i in $BAR 104 do 105 if ! echo "$BAZ" | grep "$i" > /dev/null 106 then 107 BAZ="$BAZ $i" 108 i="^`echo $i | sed 's:_\+:\\\(\[_ \]\\\|\\\[\\\|\\\]\\\)\\\+:g'`" 109 echo -e "$FOO" | grep "$i" 110 found=1 111 fi 112 done 73 113 # Some people are satisfied with a single occurrence 74 114 # But it is better to give all 75 115 # break -
src/makewhatis.sh
diff -Naur man-1.6g.orig/src/makewhatis.sh man-1.6g/src/makewhatis.sh
old new 55 55 dc= 56 56 for d in /usr/man/preformat /usr/man /usr/share/man/preformat /usr/share/man 57 57 do 58 if [ -n "$LANG" -a -d "$d/$LANG" ]; then 59 if [ x$dc = x ]; then dm="$d/$LANG"; else dm=$dc:"$d/$LANG"; fi 60 fi 58 61 if [ -d $d ]; then 59 62 if [ x$dc = x ]; then dc=$d; else dc=$dc:$d; fi 60 63 fi … … 227 230 section=$i 228 231 curdir=$mandir/${pages}$i 229 232 export section verbose curdir 230 find $mandir/${pages}$i/. -name '*' $findarg0 $findarg -print | $AWK'233 find $mandir/${pages}$i/. -name '*' $findarg0 $findarg -print | LC_ALL=C $AWK -v MAN_NAME="$MAN_NAME" -v MAN_DESCRIPTION="$MAN_DESCRIPTION" ' 231 234 232 235 function readline() { 233 236 if (use_zcat || use_bzcat || use_lzcat) { … … 315 318 if ($1 ~ /^\.[Ss][HhYS]/ || 316 319 (pages == "cat" && 317 320 ($1 ~ /^S[yYeE]/ || $1 ~ /^DESCRIPTION/ || 321 $1 ~ MAN_DESCRIPTION || 318 322 $1 ~ /^COMMAND/ || $1 ~ /^OVERVIEW/ || 319 323 $1 ~ /^STRUCTURES/ || $1 ~ /^INTRODUCTION/ || 320 324 $0 ~ /^[^ ]/))) { -
src/manpath.c
diff -Naur man-1.6g.orig/src/manpath.c man-1.6g/src/manpath.c
old new 282 282 /* We cannot use "lang = setlocale(LC_MESSAGES, NULL)" or so: 283 283 the return value of setlocale is an opaque string. */ 284 284 /* POSIX prescribes the order: LC_ALL, LC_MESSAGES, LANG */ 285 if((lang = getenv("LC_ALL")) != NULL) 285 /* LANGUAGE is GNU/Linux and overrules all */ 286 if((lang = getenv("LANGUAGE")) != NULL) 286 287 split2(dir, lang, add_to_mandirlist_x, perrs); 287 if((lang = getenv("LC_MESSAGES")) != NULL)288 else if((lang = getenv("LC_ALL")) != NULL) 288 289 split2(dir, lang, add_to_mandirlist_x, perrs); 289 if((lang = getenv("LANG")) != NULL)290 else if((lang = getenv("LC_MESSAGES")) != NULL) 290 291 split2(dir, lang, add_to_mandirlist_x, perrs); 291 if((lang = getenv("LANGUAGE")) != NULL)292 else if((lang = getenv("LANG")) != NULL) 292 293 split2(dir, lang, add_to_mandirlist_x, perrs); 293 294 add_to_mandirlist_x(dir, 0, perrs); 294 295 }
Note:
See TracBrowser
for help on using the repository browser.