source: patches/man-1.6g-i18n-1.patch @ cc858ed

clfs-2.1clfs-3.0.0-systemdclfs-3.0.0-sysvinitsystemdsysvinit
Last change on this file since cc858ed was 3eeef443, checked in by Joe Ciccone <jciccone@…>, 13 years ago

Updated Man to 1.6g.

  • Property mode set to 100644
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  
    99extern char *index (const char *, int);         /* not always in <string.h> */
    1010extern char *my_malloc(int);    /* in util.c */
    1111
     12/* if the program has sgid/suid privileges then getenv doesn't return
     13 * NLSPATH; so we set here a good default value.
     14 */
    1215#ifndef DEFAULT_NLSPATH
    1316# 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"
    1518# else
    1619#  define DEFAULT_NLSPATH "/usr/lib/locale/%N/%L"
    1720# endif
    1821#endif
    1922
    20 static nl_catd my_catopenpath(char *name, char *path);
     23static nl_catd my_catopenpath(char *name, char *path, char *lang);
    2124
    2225static                          /* this source included in gripes.c */
    2326nl_catd
    2427my_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;
    2635
    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);
    2869
    2970  if (fd == (nl_catd) -1 && oflag) {
    3071    oflag = 0;
     
    3273  }
    3374
    3475  if (fd == (nl_catd) -1) {
    35     char *nlspath;
    36 
    3776    /* The libc catopen fails - let us see if we can do better */
    3877    /* The quotes below are from X/Open, XPG 1987, Vol. 3. */
    3978
     
    5897#endif
    5998    }
    6099
    61     /*
    62      * "If NLSPATH does not exist in the environment, or if a
    63      * message catalog cannot be opened in any of the paths specified
    64      * 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);
    72100  }
    73101  return fd;
    74102}
     
    90118 *
    91119 */
    92120static nl_catd
    93 my_catopenpath(char *name, char *nlspath) {
    94   int fd;
     121my_catopenpath(char *name, char *nlspath, char *lang) {
    95122  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;
    97124  int langsz, namesz, sz, lang_l_sz, lang_t_sz, lang_c_sz;
    98125
    99126  namesz = strlen(name);
    100127
    101   lang = getenv("LANG");
    102128  if (!lang)
    103129    lang = "";
    104130  langsz = strlen(lang);
     
    194220      path = s+1;
    195221    } else
    196222      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;
    205226  }
    206227
    207228  free(path0);
  • configure

    diff -Naur man-1.6g.orig/configure man-1.6g/configure
    old new  
    416416      fi
    417417    done
    418418  done
    419   troff=""
    420   nroff=""
    421   jnroff=""
     419  troff=/usr/bin/troff
     420  nroff=/usr/bin/nroff
     421  jnroff=/usr/bin/nroff
    422422  eqn=""
    423423  neqn=""
    424424  jneqn=""
     
    476476  done
    477477# -Tlatin1 is bad when utf8 is used, but needed for groff, not for nroff
    478478# 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
    479482  if test $Fgroff = "missing"
    480483  then
    481484    if test $Fnroff = "missing"
    482485    then
    483       nroff="nroff -Tlatin1 -mandoc"
     486      nroff="nroff -Tutf8 -mandoc"
    484487    else
    485       nroff="$Fnroff -Tlatin1 -mandoc"
     488      nroff="$Fnroff -Tutf8 -mandoc"
    486489    fi
    487490    troff="troff -mandoc"
    488491    echo "Warning: could not find groff"
    489492  else
    490493    if test $Fnroff = "missing"
    491494    then
    492       nroff="$Fgroff -Tlatin1 -mandoc"
     495      nroff="$Fgroff -Tutf8 -mandoc"
    493496    else
    494       nroff="$Fnroff -Tlatin1 -mandoc"
     497      nroff="$Fnroff -Tutf8 -mandoc"
    495498    fi
    496499    troff="$Fgroff -Tps -mandoc"
    497     jnroff="$Fgroff -Tnippon -mandocj"
     500    jnroff="$Fjnroff -Tutf8 -mandocj"
    498501  fi
    499502  eqn="$Fgeqn -Tps"
    500   neqn="$Fgeqn -Tlatin1"
    501   jneqn="$Fgeqn -Tnippon"
     503  neqn="$Fgeqn -Tutf8"
     504  jneqn="$Fgeqn -Tutf8"
    502505  tbl="$Fgtbl"
    503506  col="$Fcol"
    504507  vgrind="$Fvgrind"
     
    964967
    965968# What sections do we anticipate?
    966969
    967 tmpsections="1 1p 8 2 3 3p 4 5 6 7 9 0p tcl n l p o"
     970tmpsections="1 1p 8 2 3 3p 3pm 4 5 6 7 9 0p tcl n l p o"
    968971
    969972if [ x$default = x ]; then
    970973  echo ""
  • msgs/inst.sh

    diff -Naur man-1.6g.orig/msgs/inst.sh man-1.6g/msgs/inst.sh
    old new  
    2727for j in $M; do
    2828  if [ -f $j ]; then
    2929    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/"`
    3231    echo "mkdir -p `dirname $dest`"
    3332    mkdir -p `dirname $dest`;
    3433    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  
    6060    esac
    6161done
    6262
     63# list of languages to look for
     64LANG_LIST=`echo $LANGUAGE:$LC_ALL:$LC_MESSAGES:$LANG | tr ':' ' '`
     65DIR_LIST=""
     66for d in /var/cache/man $manpath /usr/lib
     67do
     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
     85done
     86
    6387while [ "$1" != "" ]
    6488do
    6589    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
    6795    do
    6896        if [ -f $d/whatis ]
    6997        then
    70             if grep -"$grepopt1" "$grepopt2""$1" $d/whatis
     98            if FOO=`grep -"$grepopt1" "$grepopt2""$1" $d/whatis`
    7199            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
    73113# Some people are satisfied with a single occurrence
    74114# But it is better to give all
    75115#               break
  • src/makewhatis.sh

    diff -Naur man-1.6g.orig/src/makewhatis.sh man-1.6g/src/makewhatis.sh
    old new  
    5555dc=
    5656for d in /usr/man/preformat /usr/man /usr/share/man/preformat /usr/share/man
    5757do
     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
    5861    if [ -d $d ]; then
    5962        if [ x$dc = x ]; then dc=$d; else dc=$dc:$d; fi
    6063    fi
     
    227230            section=$i
    228231            curdir=$mandir/${pages}$i
    229232            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" '
    231234
    232235            function readline() {
    233236              if (use_zcat || use_bzcat || use_lzcat) {
     
    315318                  if ($1 ~ /^\.[Ss][HhYS]/ ||
    316319                    (pages == "cat" &&
    317320                    ($1 ~ /^S[yYeE]/ || $1 ~ /^DESCRIPTION/ ||
     321                     $1 ~ MAN_DESCRIPTION ||
    318322                     $1 ~ /^COMMAND/ || $1 ~ /^OVERVIEW/ ||
    319323                     $1 ~ /^STRUCTURES/ || $1 ~ /^INTRODUCTION/ ||
    320324                     $0 ~ /^[^ ]/))) {
  • src/manpath.c

    diff -Naur man-1.6g.orig/src/manpath.c man-1.6g/src/manpath.c
    old new  
    282282                /* We cannot use "lang = setlocale(LC_MESSAGES, NULL)" or so:
    283283                   the return value of setlocale is an opaque string. */
    284284                /* 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)
    286287                        split2(dir, lang, add_to_mandirlist_x, perrs);
    287                 if((lang = getenv("LC_MESSAGES")) != NULL)
     288                else if((lang = getenv("LC_ALL")) != NULL)
    288289                        split2(dir, lang, add_to_mandirlist_x, perrs);
    289                 if((lang = getenv("LANG")) != NULL)
     290                else if((lang = getenv("LC_MESSAGES")) != NULL)
    290291                        split2(dir, lang, add_to_mandirlist_x, perrs);
    291                 if((lang = getenv("LANGUAGE")) != NULL)
     292                else if((lang = getenv("LANG")) != NULL)
    292293                        split2(dir, lang, add_to_mandirlist_x, perrs);
    293294                add_to_mandirlist_x(dir, 0, perrs);
    294295        }
Note: See TracBrowser for help on using the repository browser.