4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright 1998 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
28 /* All Rights Reserved */
32 * University Copyright- Copyright (c) 1982, 1986, 1988
33 * The Regents of the University of California
36 * University Acknowledgment- Portions of this document are derived from
37 * software developed by the University of California, Berkeley, and its
41 #pragma ident "%Z%%M% %I% %E% SMI"
44 * mailx -- a modified version of a University of California at Berkeley
47 * Code to figure out what host we are on.
51 #include "configdefs.h"
52 #include <sys/utsname.h>
55 #define MAILCNFG "/etc/mail/mailcnfg"
60 * Initialize the network name of the current host.
65 register struct netmach
*np
;
70 if (fp
= xgetenv("CLUSTER")) {
71 nstrcpy(host
, sizeof (host
), fp
);
74 nstrcpy(host
, sizeof (host
), name
.nodename
);
76 snprintf(domain
, sizeof (domain
), "%s%s", host
, maildomain());
77 for (np
= netmach
; np
->nt_machine
!= 0; np
++)
78 if (strcmp(np
->nt_machine
, EMPTY
) == 0)
80 if (np
->nt_machine
== 0) {
82 gettext("Cannot find empty slot for dynamic host entry\n"));
85 np
->nt_machine
= host
;
87 np
->nt_machine
= domain
;
88 if (debug
) fprintf(stderr
, "host '%s', domain '%s'\n", host
, domain
);