Jump to content
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
HP.com home

Transition Impacts

Tru64 UNIX Software Transition Kit
» 

DSPP Home

» HP STK home
Tru64 UNIX STK
» Home
» Overview
» Tools
» Documentation
» Transition impacts
» Identifier types
» Impact list
» Porting to HP-UX
» FAQ
» Glossary
» Help
» Send us feedback
Site maps
» Tru64 UNIX STK
» DSPP
Content starts here

critical impact:

catopen and catgets - incompatible data type; different behavior and functionality (CrCh186)

I18N Impacts IO Impacts

Problem description

The catopen and catgets functions behave differently on Tru64 UNIX and HP-UX, and some Tru64 UNIX specific features of catopen and catgets are not supported on HP-UX.

The data type nl_catd is incompatible on Tru64 UNIX and HP-UX.

For both HP-UX and Tru64 UNIX, message catalog files have names of the form %N.cat, where %N is the application name. Example catalog names are:

  • date.cat

  • find.cat

  • sh.cat

However, Tru64 UNIX and HP-UX differ in the way they define access to these catalogs using the catopen function. On Tru64 UNIX, a catopen call includes the value of the entire catalog name: %N.cat. Since the .cat extension is within the catopen call, it does not appear in the Tru64 UNIX system-wide default NLSPATH value. That default is:

/usr/lib/nls/msg/%L/%N

On Tru64 UNIX, a message catalog is not opened until execution of the first catgets call that refers to the catalog. HP-UX does the open immediately, rather than deferring it.

Because of this different behavior, the following errno values are set by the catgets function on Tru64 UNIX, but are set by the catopen function on HP-UX:

[EACCES]

Search permission is denied for a component of the path to the message catalog or read permission is denied for the catalog.

[EMFILE]

The process limit for open file descriptors per process has already reached OPEN_MAX.

[ENFILE]

The system limit for open file descriptors has been reached.

[ENOENT]

The message catalog does not exist.

HP-UX does not support codeset conversion of message catalogs.

On Tru64 UNIX, the nl_catd data type is defined as a pointer to a structure:

typedef struct __catalog_descriptor *nl_catd;
struct __catalog_descriptor {
        char            *_mem;
        char            *_name;
        char            *_lc_message;
        char            *_nlspath;
        struct _header  *_hd;
        struct _catset  *_set;
        struct _attrib  *_setattrib;    /* Ptr to set attribute records */
        void            *_iconv;        /* Ptr to iconv data */
        char            *_symstr;       /* Symbolic set conversion string */
        char            *_midfmt;       /* Message ID format string */
        int             _fd;            /* i/o descriptor */
        int             _catlen;        /* Size of mapped object */
        int             _setmax;        /* # message sets in file */
        int             _count;
        int             _magic;         /* Also holds copy of CAT_MAGIC */
        int             _n_sets;        /* max index in _set array */
        int             _sets_expanded;
        int             _midflag;       /* Enable message ID if set */
};

Identifiers

C/C++ Functionscatgets C/C++ Functionscatopen      

See also

Solution description

Review your code and the applicable manpages to determine if you use the Tru64 UNIX specific features that are not supported on HP-UX. You need to modify the catopen function call to use the correct format of the message catalog file name. The data type nl_catd is incompatible on Tru64 UNIX and HP-UX.

On HP-UX, catopen uses only the value of the %N portion of the catalog name. At runtime, catopen uses the value of NLSPATH to try to locate the requested catalog. If NLSPATH is not explicitly defined, HP-UX's catopen uses:

/usr/lib/nls/msg/%L/%N.cat:/usr/lib/nls/%l/%t/%c/%N.cat

where:

  • %N represents the message catalog filename

  • %L represents the current locale name defined for the LC_MESSAGES category, for example, fr_BE.ISO8859-1

  • %l represents the language element of the current locale name, for example, fr

  • %t represents the territory element from the current locale name, for example, BE

  • %c represents the code set element from the current locale name, for example, ISO8859-1

Since the HP-UX catopen function includes only the value of %N, the value of NLSPATH includes the .cat extension.

Because of these differences in catopen and the default NLSPATH values, you must currently use different syntax to open message catalogs on the two platforms. Since HP-UX's default NLSPATH appends the .cat extension, you must omit it when specifying the desired catalog. However, to display the same catalog on Tru64 UNIX, you would need to include the .cat extension. For example, to open a message catalog ls.cat within /usr/lib/nls/msg/%L, enter:

catd = catopen("ls", NL_CAT_LOCALE);     /* HP-UX */
catd = catopen("ls.cat", NL_CAT_LOCALE); /* Tru64 UNIX */

On HP-UX, nl_catd is defined as int, which is the catalog descriptor:

typedef int  nl_catd;        /* catalogue descriptor for catopen, catgetmsg,
                                catgets and catclose */

If you use any field of the structure *nl_catd on Tru64 UNIX, you need to modify your code since nl_catd on HP-UX is the file descriptor of the catalog file.

See also


Problem summary

classifications source types OS release severity type
I18N, IO C, C++ any HP-UX 11i version critical changed
Printable version
Privacy statement Using this site means you accept its terms Feedback to DSPP
© 2007 Hewlett-Packard Development Company, L.P.