0N/A+/* Internationalize messages for bug 4256527... S Swales 5/25/00 */
0N/A static int change_host(Display *dpy, char *name, Bool add);
0N/A static char *get_hostname(XHostAddress *ha);
0N/A static int local_xerror(Display *dpy, XErrorEvent *rep);
0N/A@@ -193,10 +198,24 @@
0N/A+ /* Internationalize messages for bug 4256527... S Swales 5/25/00 */
0N/A+ setlocale(LC_ALL,"");
0N/A+ textdomain("xhost");
0N/A+ /* mainly for debugging */
0N/A+ if((domaindir=getenv("TEXTDOMAINDIR")) == NULL) {
0N/A+ bindtextdomain("xhost",domaindir);
0N/A ProgramName = argv[0];
837N/A if ((dpy = XOpenDisplay(NULL)) == NULL) {
0N/A- fprintf(stderr, "%s: unable to open display \"%s\"\n",
0N/A+ /* Internationalize messages for bug 4256527... S Swales 5/25/00 */
493N/A+ gettext("%s: unable to open display \"%s\"\n"),
0N/A ProgramName, XDisplayName (NULL));
0N/A sethostent(1); /* don't close the data base each time */
493N/A list = XListHosts(dpy, &nhosts, &enabled);
0N/A- printf ("access control enabled, only authorized clients can connect\n");
0N/A+ /* Internationalize messages for bug 4256527... S Swales 5/25/00 */
0N/A+ printf (gettext("access control enabled, only authorized clients can connect\n"));
0N/A- printf ("access control disabled, clients can connect from any host\n");
837N/A+ /* Internationalize messages for bug 4256527... S Swales 5/25/00 */
837N/A+ printf (gettext("access control disabled, clients can connect from any host\n"));
355N/A for (i = 0; i < nhosts; i++ ) {
0N/A- printf("<unknown family type %d>:", list[i].family);
0N/A+ printf(gettext("<unknown family type %d>:"), list[i].family);
0N/A printf ("%s", hostname);
0N/A- printf ("<unknown address in family %d>",
0N/A+ /* Internationalize messages for bug 4256527... S Swales 5/25/00 */
0N/A+ printf (gettext("<unknown address in family %d>"),
837N/A if (nameserver_timedout) {
837N/A- printf("\t(no nameserver response within %d seconds)\n",
222N/A+ /* Internationalize messages for bug 4256527... S Swales 5/25/00 */
+ printf(gettext("\t(no nameserver response within %d seconds)\n"),
if (argc == 2 && !strcmp(argv[1], "-help")) {
- fprintf(stderr, "usage: %s [[+-]hostname ...]\n", argv[0]);
+ /* Internationalize messages for bug 4256527... S Swales 5/25/00 */
+ fprintf(stderr, gettext("usage: %s [[+-]hostname ...]\n"), argv[0]);
if (!argv[i][1] && ((i+1) == argc)) {
- printf ("access control enabled, only authorized clients can connect\n");
+ /* Internationalize messages for bug 4256527... S Swales 5/25/00 */
+ printf (gettext("access control enabled, only authorized clients can connect\n"));
XEnableAccessControl(dpy);
arg = argv[i][1]? &argv[i][1] : argv[++i];
if (!change_host (dpy, arg, False)) {
- fprintf (stderr, "%s: bad hostname \"%s\"\n",
+ /* Internationalize messages for bug 4256527... S Swales 5/25/00 */
+ fprintf (stderr, gettext("%s: bad hostname \"%s\"\n"),
if (*arg == '+' && !argv[i][1] && ((i+1) == argc)) {
- printf ("access control disabled, clients can connect from any host\n");
+ /* Internationalize messages for bug 4256527... S Swales 5/25/00 */
+ printf (gettext("access control disabled, clients can connect from any host\n"));
XDisableAccessControl(dpy);
arg = argv[i][1]? &argv[i][1] : argv[++i];
if (!change_host (dpy, arg, True)) {
- fprintf (stderr, "%s: bad hostname \"%s\"\n",
+ /* Internationalize messages for bug 4256527... S Swales 5/25/00 */
+ fprintf (stderr, gettext("%s: bad hostname \"%s\"\n"),
static struct in_addr addr; /* so we can point at it */
#if defined(IPv6) && defined(AF_INET6)
static struct in6_addr addr6; /* so we can point at it */
struct dn_naddr *dnaddrp;
static struct dn_naddr dnaddr;
- static char *add_msg = "being added to access control list";
- static char *remove_msg = "being removed from access control list";
+ const char *add_msg = gettext("being added to access control list");
+ const char *remove_msg = gettext("being removed from access control list");
if ((lname = (char *)malloc(namelen+1)) == NULL) {
- fprintf (stderr, "%s: malloc bombed in change_host\n", ProgramName);
+ /* Internationalize messages for bug 4256527... S Swales 5/25/00 */
+ fprintf (stderr, gettext("%s: malloc bombed in change_host\n"),
for (i = 0; i < namelen; i++) {
if (!strncmp("inet:", lname, 5)) {
-#if defined(TCPCONN) || defined(STREAMSCONN)
+#if defined(TCPCONN) || defined(STREAMSCONN) || defined(AMTCPCONN)
- fprintf (stderr, "%s: not compiled for
TCP/IP\n", ProgramName);
+ /* Internationalize messages for bug 4256527... S Swales 5/25/00 */
+ fprintf (stderr, gettext("%s: not compiled for
TCP/IP\n"), ProgramName);
family = FamilyInternet6;
- fprintf (stderr, "%s: not compiled for IPv6\n", ProgramName);
+ /* Internationalize messages for bug 4256527... S Swales 5/25/00 */
+ fprintf (stderr, gettext("%s: not compiled for IPv6\n"), ProgramName);
family = FamilyInternet6;
- fprintf (stderr, "%s: not compiled for IPv6\n", ProgramName);
+ /* Internationalize messages for bug 4256527... S Swales 5/25/00 */
+ fprintf (stderr, gettext("%s: not compiled for IPv6\n"), ProgramName);
- fprintf (stderr, "%s: not compiled for DECnet\n", ProgramName);
+ /* Internationalize messages for bug 4256527... S Swales 5/25/00 */
+ fprintf (stderr, gettext("%s: not compiled for DECnet\n"), ProgramName);
- fprintf (stderr, "%s: not compiled for Secure RPC\n", ProgramName);
+ /* Internationalize messages for bug 4256527... S Swales 5/25/00 */
+ fprintf (stderr, gettext("%s: not compiled for Secure RPC\n"), ProgramName);
family = FamilyKrb5Principal;
- fprintf (stderr, "%s: not compiled for Kerberos 5\n", ProgramName);
+ /* Internationalize messages for bug 4256527... S Swales 5/25/00 */
+ fprintf (stderr, gettext("%s: not compiled for Kerberos 5\n"), ProgramName);
if (family == FamilyWild && (cp = strchr(lname, ':'))) {
- fprintf (stderr, "%s: unknown address family \"%s\"\n",
+ * Check to see if inet_pton() can grok it as an IPv6 address
+ family = FamilyInternet6;
+ /* Internationalize messages for bug 4256527... S Swales 5/25/00 */
+ fprintf (stderr, gettext("%s: unknown address family \"%s\"\n"),
if (cp == NULL || cp == name) {
- "%s: type must be specified for server interpreted family \"%s\"\n",
+ fprintf(stderr, gettext(
+ "%s: type must be specified for server interpreted family \"%s\"\n"),
if ((np = getnodebyname (name)) == NULL) {
- fprintf (stderr, "%s: unable to get node name for \"%s::\"\n",
+ /* Internationalize messages for bug 4256527... S Swales 5/25/00 */
+ fprintf (stderr, gettext("%s: unable to get node name for \"%s::\"\n"),
retval = krb5_parse_name(name, &princ);
krb5_init_ets(); /* init krb errs for error_message() */
- fprintf(stderr, "%s: cannot parse Kerberos name: %s\n",
+ /* Internationalize messages for bug 4256527... S Swales 5/25/00 */
+ fprintf(stderr, gettext("%s: cannot parse Kerberos name: %s\n"),
ProgramName, error_message(retval));
- printf( "non-network local connections %s\n", add ? add_msg : remove_msg);
+ printf( gettext("non-network local connections %s\n"), add ? add_msg : remove_msg);
- fprintf(stderr, "no such user \"%s\"\n", name);
+ /* Internationalize messages for bug 4256527... S Swales 5/25/00 */
+ fprintf(stderr, gettext("no such user \"%s\"\n"), name);
getdomainname(domainname, sizeof(domainname));
if (!user2netname(username, pwd->pw_uid, domainname)) {
- fprintf(stderr, "failed to get netname for \"%s\"\n", name);
+ /* Internationalize messages for bug 4256527... S Swales 5/25/00 */
+ fprintf(stderr, gettext("failed to get netname for \"%s\"\n"), name);
* First see if inet_addr() can grok the name; if so, then use it.
if (((family == FamilyWild) || (family == FamilyInternet)) &&
+ if (((family == FamilyWild) || (family == FamilyInternet)) &&
+ ((addr = inet_addr(name)) != -1)) {
- fprintf(stderr, "%s: unable to get %saddress for \"%s\"\n",
- ProgramName, familyMsg, name);
+ /* L10N_Comments - Parts composed to make full error string
+ 'unable to get' ['inet'|'inetv6'|''] 'address for' <address> */
+ fprintf (stderr, "%s: %s %s%s \"%s\"\n", ProgramName,
+ gettext("unable to get"), familyMsg, gettext("address for"),
get_hostname(XHostAddress *ha)
-#if (defined(TCPCONN) || defined(STREAMSCONN)) && \
+#if (defined(TCPCONN) || defined(STREAMSCONN) || defined(AMTCPCONN)) && \
(!defined(IPv6) || !defined(AF_INET6))
static struct hostent *hp = NULL;
-#if defined(TCPCONN) || defined(STREAMSCONN)
+#if defined(TCPCONN) || defined(STREAMSCONN) || defined(AMTCPCONN)
#if defined(IPv6) && defined(AF_INET6)
if ((ha->family == FamilyInternet) || (ha->family == FamilyInternet6)) {
struct sockaddr_storage saddr;
else return (inet_ntoa(*((struct in_addr *)(ha->address))));
+ else return (inet_ntoa(*((ipaddr_t *)(ha->address))));
local_xerror(Display *dpy, XErrorEvent *rep)
if ((rep->error_code == BadAccess) && (rep->request_code == X_ChangeHosts)) {
+ /* Internationalize messages for bug 4256527... S Swales 5/25/00 */
- "%s: must be on local machine to add or remove hosts.\n",
+ gettext("%s: must be on local machine to add or remove hosts.\n"),
} else if ((rep->error_code == BadAccess) &&
(rep->request_code == X_SetAccessControl)) {
+ /* Internationalize messages for bug 4256527... S Swales 5/25/00 */
- "%s: must be on local machine to enable or disable access control.\n",
+ gettext("%s: must be on local machine to enable or disable access control.\n"),
} else if ((rep->error_code == BadValue) &&