f875b4ebb1dd9fdbeb043557cab38ab3bf7f6e01rica * CDDL HEADER START
f875b4ebb1dd9fdbeb043557cab38ab3bf7f6e01rica * The contents of this file are subject to the terms of the
f875b4ebb1dd9fdbeb043557cab38ab3bf7f6e01rica * Common Development and Distribution License (the "License").
f875b4ebb1dd9fdbeb043557cab38ab3bf7f6e01rica * You may not use this file except in compliance with the License.
f875b4ebb1dd9fdbeb043557cab38ab3bf7f6e01rica * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
f875b4ebb1dd9fdbeb043557cab38ab3bf7f6e01rica * See the License for the specific language governing permissions
f875b4ebb1dd9fdbeb043557cab38ab3bf7f6e01rica * and limitations under the License.
f875b4ebb1dd9fdbeb043557cab38ab3bf7f6e01rica * When distributing Covered Code, include this CDDL HEADER in each
f875b4ebb1dd9fdbeb043557cab38ab3bf7f6e01rica * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
f875b4ebb1dd9fdbeb043557cab38ab3bf7f6e01rica * If applicable, add the following below this CDDL HEADER, with the
f875b4ebb1dd9fdbeb043557cab38ab3bf7f6e01rica * fields enclosed by brackets "[]" replaced with your own identifying
f875b4ebb1dd9fdbeb043557cab38ab3bf7f6e01rica * information: Portions Copyright [yyyy] [name of copyright owner]
f875b4ebb1dd9fdbeb043557cab38ab3bf7f6e01rica * CDDL HEADER END
50981ffc7e4c5048d14890df805afee6ec113991Tony Nguyen * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
f875b4ebb1dd9fdbeb043557cab38ab3bf7f6e01rica * Use is subject to license terms.
f875b4ebb1dd9fdbeb043557cab38ab3bf7f6e01rica * hextoalabel - Convert an internal label to its human readable
f875b4ebb1dd9fdbeb043557cab38ab3bf7f6e01rica * equivalent.
f875b4ebb1dd9fdbeb043557cab38ab3bf7f6e01rica#if !defined(TEXT_DOMAIN)
f875b4ebb1dd9fdbeb043557cab38ab3bf7f6e01rica#endif /* !defined(TEXT_DOMAIN) */
f875b4ebb1dd9fdbeb043557cab38ab3bf7f6e01ricastatic void
f875b4ebb1dd9fdbeb043557cab38ab3bf7f6e01rica switch (err) {
f875b4ebb1dd9fdbeb043557cab38ab3bf7f6e01rica /*NOTREACHED*/
f875b4ebb1dd9fdbeb043557cab38ab3bf7f6e01rica char *ascii = NULL; /* human readable label to print */
f875b4ebb1dd9fdbeb043557cab38ab3bf7f6e01rica switch (c) {
f875b4ebb1dd9fdbeb043557cab38ab3bf7f6e01rica gettext("usage: %s [-c] [hexadecimal label]\n"), argv[0]);
f875b4ebb1dd9fdbeb043557cab38ab3bf7f6e01rica /*NOTREACHED*/
f875b4ebb1dd9fdbeb043557cab38ab3bf7f6e01rica /* use label on command line */
f875b4ebb1dd9fdbeb043557cab38ab3bf7f6e01rica /* read label from standard input */
50981ffc7e4c5048d14890df805afee6ec113991Tony Nguyen if ((c = read(STDIN_FILENO, hex, sizeof (hex))) <= 0) {
f875b4ebb1dd9fdbeb043557cab38ab3bf7f6e01rica /*NOTREACHED*/
50981ffc7e4c5048d14890df805afee6ec113991Tony Nguyen * replace '\n' or (end of buffer) with end of string.
50981ffc7e4c5048d14890df805afee6ec113991Tony Nguyen * flush any remaining input past the size of the buffer.
f875b4ebb1dd9fdbeb043557cab38ab3bf7f6e01rica if (str_to_label(hex, &label, USER_CLEAR, L_NO_CORRECTION,
f875b4ebb1dd9fdbeb043557cab38ab3bf7f6e01rica if (label_to_str(label, &ascii, M_LABEL, DEF_NAMES) != 0) {
f875b4ebb1dd9fdbeb043557cab38ab3bf7f6e01rica if (str_to_label(hex, &label, MAC_LABEL, L_NO_CORRECTION,
f875b4ebb1dd9fdbeb043557cab38ab3bf7f6e01rica if (label_to_str(label, &ascii, M_LABEL, DEF_NAMES) != 0) {
f875b4ebb1dd9fdbeb043557cab38ab3bf7f6e01rica return (0); /* really exit(0); */