Unix V.4 gettxt() return type

Mike Verstegen mdv at comtst.domain.com
Thu Sep 13 07:22:58 AEST 1990


We are planning to migrate to the SVR4 messaging system using the text
strings routines designed for multiple locales such as gettxt().

In reading the documentation for gettxt(3C) (from the AT&T Unix SVR4
Programmer's Reference Manual) it gives a good write-up on how to call
the function, but it does not address on important point. Does the return
value "point to static data which is overwritten with each call" or is the
point good for multiple uses?

For example can I say

...
msg1 = gettxt("MYAPP:1", "hello ");	/* cache these messages */
msg2 = gettxt("MYAPP:2", "world");
...
printf ("%s%s\n", msg1, msg2);

or do I have to say
...
printf ("%s%s\n", gettxt("MYAPP:1", "hello "), gettxt("MYAPP:2", "world"));

and incur the expense of a gettxt call each time.

I know I could malloc my own space and copy this strings into my own space,
but we will have many copies of this application running and a private copy
obviously increases the working set of each copy (increasing paging activity
etc). This seems to be a good candidate for a memory mapped file.

Could someone with access to the source take a look and see what this thing
returns? Also does any one know a good channel to route message to for AT&T
documentation comments. It seems like this routine should document one way
or the other what it returns.



More information about the Comp.unix.questions mailing list