/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (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 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <strings.h>
#include <libintl.h>
#include <locale.h>
#include <libdscp.h>
#if !defined(TEXT_DOMAIN)
#endif
static void usage(void);
static void parse_options(int, char **, int *);
static int get_address(int, char *);
static void trace(char *, ...);
static void err(char *, ...);
static char *dscp_strerror(int);
static int verbose = 0;
int
{
int options;
(void) textdomain(TEXT_DOMAIN);
/*
* Get the desired IP addresses.
*/
exit(-1);
}
}
if ((options & OPT_DOMAIN) != 0) {
"Aborting.\n"));
exit(-1);
}
}
/*
* Print the IP addresses.
*/
} else if (options == OPT_DOMAIN) {
} else {
}
return (0);
}
/*
* parse_options()
*
* Parse the commandline options.
*/
static void
{
int i;
int c;
extern int opterr;
extern int optopt;
/*
* Unless told otherwise, print everything.
*/
/*
* Skip this routine if no options exist.
*/
if (argc == 1) {
return;
}
/*
* Scan for the -h option separately, so that
* other commandline options are ignored.
*/
for (i = 1; i < argc; i++) {
usage();
exit(0);
}
}
/*
* Disable the built-in error reporting, so that
* error messages can be properly internationalized.
*/
opterr = 0;
/*
* The main loop for parsing options.
*/
switch (c) {
case 'v':
verbose = 1;
break;
case 's':
if (*options == OPT_DOMAIN) {
usage();
exit(-1);
}
break;
case 'd':
usage();
exit(-1);
}
*options = OPT_DOMAIN;
break;
default:
usage();
exit(-1);
}
}
}
/*
* usage()
*
* Print a brief synopsis of the program's usage.
*/
static void
usage(void)
{
}
/*
* get_address()
*
* Retrieve a DSCP IP address using libdscp.
*/
static int
{
int len;
int error;
return (-1);
}
/* LINTED pointer cast may result in improper alignment */
return (-1);
}
return (0);
}
/*
* trace()
*
* Print tracing statements to stderr when in verbose mode.
*/
/*PRINTFLIKE1*/
static void
{
if (verbose != 0) {
}
}
/*
* err()
*
* Print error messages to stderr.
*/
/*PRINTFLIKE1*/
static void
{
}
/*
* dscp_strerror()
*
* Convert a DSCP error value into a localized string.
*/
static char *
{
switch (error) {
case DSCP_OK:
return (gettext("Success."));
case DSCP_ERROR:
return (gettext("General error."));
case DSCP_ERROR_ALREADY:
return (gettext("Socket already bound."));
case DSCP_ERROR_INVALID:
return (gettext("Invalid arguments."));
case DSCP_ERROR_NOENT:
return (gettext("No entry found."));
case DSCP_ERROR_DB:
return (gettext("Error reading database."));
case DSCP_ERROR_REJECT:
return (gettext("Connection rejected."));
default:
return (gettext("Unknown failure."));
}
}