/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (c) 1994, by Sun Microsytems, Inc.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <unistd.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
#include <errno.h>
#include <stdlib.h>
#include <libintl.h>
#include <locale.h>
#include "state.h"
static void describe_array (tnf_datum_t);
static void describe_brief (tnf_datum_t);
static void describe_record (tnf_datum_t);
static void describe_struct (tnf_datum_t);
static void describe_type (tnf_datum_t);
static void read_tnf_file (int, char *);
static void usage (void);
static void scanargs (int, char **, int *, char ***);
int
{
int i;
/* internationalization stuff */
#if !defined(TEXT_DOMAIN) /* Should be defined by cc -D */
#endif
(void) textdomain(TEXT_DOMAIN);
for (i = 0; i < numfiles; i++) {
}
if (!g_raw) {
if (table_get_num_elements() > 0) {
}
}
return (0);
}
static void
{
int c;
switch (c) {
case 'r':
break;
case 'x':
print_unsigned = "0x%x";
print_unsigned64 = "0x%llx";
break;
case '?':
break;
}
}
if (*nfiles <= 0) {
}
if (errflg) {
usage();
}
}
static void
{
int fd;
return;
}
return;
}
return;
}
== (caddr_t)-1) {
return;
}
if (raw)
g_file_base = p; /* for OFF() */
if (*p == 0) {
/*
* magic word is 0 - catch the error if entire file is zero.
* tnf_reader_begin() will catch the "not a TNF file" error.
*/
curr_p = p;
curr_p++;
gettext("%s: %s is an empty TNF file\n"),
return;
}
}
return;
}
/* Describe file header */
if (raw) {
}
/* Describe all other records */
/* Don't munmap for cooked output because we access records later */
if (raw)
}
static void
{
switch (tnf_get_kind(datum)) {
case TNF_K_STRUCT:
break;
case TNF_K_STRING:
case TNF_K_ARRAY:
break;
case TNF_K_TYPE:
break;
default:
break;
}
(void) printf("\t}\n");
}
void
{
switch (tnf_get_kind(datum)) {
case TNF_K_CHAR:
break;
case TNF_K_INT8:
break;
case TNF_K_UINT8:
break;
case TNF_K_INT16:
break;
case TNF_K_UINT16:
(void) printf(print_unsigned,
break;
case TNF_K_INT32:
break;
case TNF_K_UINT32:
!= TNF_DATUM_NULL) {
/* XXX */
(void) printf("0x%x",
} else {
(void) printf(print_unsigned,
}
break;
case TNF_K_INT64:
/* lint not updated, it complains: malformed format string */
break;
case TNF_K_UINT64:
!= TNF_DATUM_NULL) {
(void) printf("0x%llx",
} else {
/* lint not updated, it complains: malformed format string */
(void) printf(print_unsigned64,
}
break;
case TNF_K_FLOAT32:
break;
case TNF_K_FLOAT64:
break;
case TNF_K_SCALAR:
(void) printf("unhandled scalar");
break;
default:
break;
}
}
static void
{
unsigned n, i;
char *slotname;
n = tnf_get_slot_count(datum);
for (i = 0; i < n; i++) {
(void) printf("\n");
/* tag_arg heuristic */
if ((i == 0) && tnf_is_record(datum)) {
!= TNF_DATUM_NULL) {
(void) printf("\n");
}
}
}
}
static void
{
unsigned n, i;
if (tnf_is_string(datum))
else {
n = tnf_get_element_count(datum);
for (i = 0; i < n; i++) {
(void) printf("%24d ", i);
(void) printf("\n");
}
}
}
static void
{
}
static void
{
(void) printf("0x%-8x <NULL>", 0);
else if (tnf_is_scalar(datum))
else if (tnf_is_record(datum)) {
(void) printf("0x%-8x ",
switch (tnf_get_kind(datum)) {
case TNF_K_TYPE:
break;
case TNF_K_STRING:
break;
default:
}
} else
}
void
{
if (do_perror)
}
static void
usage(void)
{
gettext("Usage: %s [-r] <tnf_file> [<tnf_file> ...]\n"),
}