7bdc4eabef617ba1306a26f52b0979229093d7b5esaxe * CDDL HEADER START
7bdc4eabef617ba1306a26f52b0979229093d7b5esaxe * The contents of this file are subject to the terms of the
7bdc4eabef617ba1306a26f52b0979229093d7b5esaxe * Common Development and Distribution License (the "License").
7bdc4eabef617ba1306a26f52b0979229093d7b5esaxe * You may not use this file except in compliance with the License.
7bdc4eabef617ba1306a26f52b0979229093d7b5esaxe * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
7bdc4eabef617ba1306a26f52b0979229093d7b5esaxe * See the License for the specific language governing permissions
7bdc4eabef617ba1306a26f52b0979229093d7b5esaxe * and limitations under the License.
7bdc4eabef617ba1306a26f52b0979229093d7b5esaxe * When distributing Covered Code, include this CDDL HEADER in each
7bdc4eabef617ba1306a26f52b0979229093d7b5esaxe * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
7bdc4eabef617ba1306a26f52b0979229093d7b5esaxe * If applicable, add the following below this CDDL HEADER, with the
7bdc4eabef617ba1306a26f52b0979229093d7b5esaxe * fields enclosed by brackets "[]" replaced with your own identifying
7bdc4eabef617ba1306a26f52b0979229093d7b5esaxe * information: Portions Copyright [yyyy] [name of copyright owner]
7bdc4eabef617ba1306a26f52b0979229093d7b5esaxe * CDDL HEADER END
7bdc4eabef617ba1306a26f52b0979229093d7b5esaxe * University Copyright- Copyright (c) 1982, 1986, 1988
7bdc4eabef617ba1306a26f52b0979229093d7b5esaxe * The Regents of the University of California
7bdc4eabef617ba1306a26f52b0979229093d7b5esaxe * All Rights Reserved
7bdc4eabef617ba1306a26f52b0979229093d7b5esaxe * University Acknowledgment- Portions of this document are derived from
7bdc4eabef617ba1306a26f52b0979229093d7b5esaxe * software developed by the University of California, Berkeley, and its
7bdc4eabef617ba1306a26f52b0979229093d7b5esaxe * contributors.
20d159bb22d487d2a4feb5d283a2b7d832bff8d5stevel * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
7bdc4eabef617ba1306a26f52b0979229093d7b5esaxe * Use is subject to license terms.
20d159bb22d487d2a4feb5d283a2b7d832bff8d5stevel/* Portions Copyright 2007 Jeremy Teo */
20d159bb22d487d2a4feb5d283a2b7d832bff8d5stevel/* Portions Copyright 2006 Stephen P. Potter */
7bdc4eabef617ba1306a26f52b0979229093d7b5esaxe#define TEXT_DOMAIN "SYS_TEST" /* use this only if it wasn't */
5bebc427c96eee7cdbec9df37a3a6fdead337abaLauri Tirkkonen (void) fprintf(stderr, gettext("usage: %s [-s] [system_name]\n"),
7bdc4eabef617ba1306a26f52b0979229093d7b5esaxe while ((optlet = getopt(argc, argv, optstring)) != -1) {
5bebc427c96eee7cdbec9df37a3a6fdead337abaLauri Tirkkonen * if called with no arguments, just print out the hostname/nodename
20d159bb22d487d2a4feb5d283a2b7d832bff8d5stevel if (gethostname(c_hostname, sizeof (c_hostname)) < 0) {
5bebc427c96eee7cdbec9df37a3a6fdead337abaLauri Tirkkonen c_hostname[strcspn(c_hostname, ".")] = '\0';
7bdc4eabef617ba1306a26f52b0979229093d7b5esaxe * if called with an argument,
7bdc4eabef617ba1306a26f52b0979229093d7b5esaxe * we have to try to set the new hostname/nodename
7bdc4eabef617ba1306a26f52b0979229093d7b5esaxe return (0);