source:
patches/man-1.6f-i18n-1.patch@
8df8e62
Last change on this file since 8df8e62 was b0c96c6, checked in by , 16 years ago | |
---|---|
|
|
File size: 10.3 KB |
-
catopen/catopen.c
Submitted By: Jim Gifford <jim at cross-lfs dot org> Date: 2009-01-08 Initial Package Version: 1.6f Upstream Status: Unkown Origin: Mandriva Description: i18n Updates diff -Naur man-1.6f.orig/catopen/catopen.c man-1.6f/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.6f.orig/configure man-1.6f/configure
old new 412 412 fi 413 413 done 414 414 done 415 troff= ""416 nroff= ""417 jnroff= ""415 troff=/usr/bin/troff 416 nroff=/usr/bin/nroff 417 jnroff=/usr/bin/nroff 418 418 eqn="" 419 419 neqn="" 420 420 jneqn="" … … 472 472 done 473 473 # -Tlatin1 is bad when utf8 is used, but needed for groff, not for nroff 474 474 # Hmm - also needed for nroff, to prevent double conversion on uxterm 475 Fgroff=/usr/bin/groff 476 Fnroff=/usr/bin/nroff 477 Fjnroff=/usr/bin/nroff 475 478 if test $Fgroff = "missing" 476 479 then 477 480 if test $Fnroff = "missing" 478 481 then 479 nroff="nroff -T latin1-mandoc"482 nroff="nroff -Tutf8 -mandoc" 480 483 else 481 nroff="$Fnroff -T latin1-mandoc"484 nroff="$Fnroff -Tutf8 -mandoc" 482 485 fi 483 486 troff="troff -mandoc" 484 487 echo "Warning: could not find groff" 485 488 else 486 489 if test $Fnroff = "missing" 487 490 then 488 nroff="$Fgroff -T latin1-mandoc"491 nroff="$Fgroff -Tutf8 -mandoc" 489 492 else 490 nroff="$Fnroff -T latin1-mandoc"493 nroff="$Fnroff -Tutf8 -mandoc" 491 494 fi 492 495 troff="$Fgroff -Tps -mandoc" 493 jnroff="$F groff -Tnippon-mandocj"496 jnroff="$Fjnroff -Tutf8 -mandocj" 494 497 fi 495 498 eqn="$Fgeqn -Tps" 496 neqn="$Fgeqn -T latin1"497 jneqn="$Fgeqn -T nippon"499 neqn="$Fgeqn -Tutf8" 500 jneqn="$Fgeqn -Tutf8" 498 501 tbl="$Fgtbl" 499 502 col="$Fcol" 500 503 vgrind="$Fvgrind" … … 960 963 961 964 # What sections do we anticipate? 962 965 963 tmpsections="1 1p 8 2 3 3p 4 5 6 7 9 0p tcl n l p o"966 tmpsections="1 1p 8 2 3 3p 3pm 4 5 6 7 9 0p tcl n l p o" 964 967 965 968 if [ x$default = x ]; then 966 969 echo "" -
msgs/inst.sh
diff -Naur man-1.6f.orig/msgs/inst.sh man-1.6f/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.6f.orig/src/apropos.sh man-1.6f/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.6f.orig/src/makewhatis.sh man-1.6f/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.6f.orig/src/manpath.c man-1.6f/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.