re-format

This commit is contained in:
Doug MacEachern 2005-03-11 21:09:58 +00:00
parent 634ac82d1c
commit 94f842e473
1 changed files with 197 additions and 199 deletions

View File

@ -47,7 +47,6 @@ static char copyright[] =
#include <stropts.h>
#include <unistd.h>
/*
* Local static values
*/
@ -60,7 +59,6 @@ static int Sd = -1; /* stream device descriptor; not open
* if -1 */
static char ErrMsg[GET_MIB2_ERRMSGL]; /* error message buffer */
/*
* close_mib2() - close MIB2 access
*
@ -72,10 +70,7 @@ static char ErrMsg[GET_MIB2_ERRMSGL]; /* error message buffer */
*/
int
close_mib2(
char **errmsg /* error message buffer return
* address */
)
close_mib2(char **errmsg)
{
*errmsg = ErrMsg;
if (Sd < 0) {
@ -115,14 +110,10 @@ close_mib2(
*/
int
get_mib2(
struct opthdr **opt, /* opthdr struct pointer return
* address */
char **data, /* data buffer return address */
int *datalen, /* data length return address */
char **errmsg /* error message buffer return
* address */
)
get_mib2(struct opthdr **opt,
char **data,
int *datalen,
char **errmsg)
{
static struct T_optmgmt_ack *a; /* message ACK pointer */
static struct strbuf c; /* streams control buffer */
@ -144,8 +135,9 @@ get_mib2(
/*
* Open access. Return on error.
*/
if ((err = open_mib2(errmsg)))
if ((err = open_mib2(errmsg))) {
return(err);
}
/*
* Set up message request and option.
*/
@ -201,17 +193,20 @@ get_mib2(
&& c.len >= sizeof(struct T_optmgmt_ack)
&& a->PRIM_type == T_OPTMGMT_ACK
&& a->MGMT_flags == T_SUCCESS
&& o->len == 0) {
&& o->len == 0)
{
err = close_mib2(errmsg);
if (err)
if (err) {
return(err);
}
return(GET_MIB2_EOD);
}
/*
* Check for error.
*/
if (c.len >= sizeof(struct T_error_ack)
&& e->PRIM_type == T_ERROR_ACK) {
&& e->PRIM_type == T_ERROR_ACK)
{
(void) sprintf(ErrMsg,
"get_mib2: T_ERROR_ACK: len=%d, TLI=%#x, UNIX=%#x",
c.len, (int)e->TLI_error, (int)e->UNIX_error);
@ -223,9 +218,11 @@ get_mib2(
if (rc != MOREDATA
|| c.len < sizeof(struct T_optmgmt_ack)
|| a->PRIM_type != T_OPTMGMT_ACK
|| a->MGMT_flags != T_SUCCESS) {
|| a->MGMT_flags != T_SUCCESS)
{
(void) sprintf(ErrMsg,
"get_mib2: T_OPTMGMT_ACK: rc=%d len=%d type=%#x flags=%#x",
"get_mib2: T_OPTMGMT_ACK: "
"rc=%d len=%d type=%#x flags=%#x",
rc, c.len, (int)a->PRIM_type, (int)a->MGMT_flags);
return(GET_MIB2_ERR_NODATA);
}
@ -234,10 +231,12 @@ get_mib2(
*/
if (o->len >= Dbl) {
Dbl = o->len;
if (Db == NULL)
if (Db == NULL) {
Db = (char *)malloc(Dbl);
else
}
else {
Db = (char *)realloc(Db, Dbl);
}
if (Db == NULL) {
(void) sprintf(ErrMsg,
"get_mib2: no space for %d byte data buffer", Dbl);
@ -283,10 +282,7 @@ get_mib2(
*/
int
open_mib2(
char **errmsg /* error message buffer return
* address */
)
open_mib2(char **errmsg)
{
*errmsg = ErrMsg;
/*
@ -318,10 +314,12 @@ open_mib2(
* Allocate a stream message buffer.
*/
Smbl = sizeof(struct opthdr) + sizeof(struct T_optmgmt_req);
if (Smbl < (sizeof (struct opthdr) + sizeof(struct T_optmgmt_ack)))
if (Smbl < (sizeof (struct opthdr) + sizeof(struct T_optmgmt_ack))) {
Smbl = sizeof (struct opthdr) + sizeof(struct T_optmgmt_ack);
if (Smbl < sizeof(struct T_error_ack))
}
if (Smbl < sizeof(struct T_error_ack)) {
Smbl = sizeof(struct T_error_ack);
}
if ((Smb = (char *)malloc(Smbl)) == NULL) {
(void) strcpy(ErrMsg,
"open_mib2: no space for stream message buffer");