/*
* 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 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
#pragma ident "%Z%%M% %I% %E% SMI"
#include "mt.h"
#include "uucp.h"
#ifdef TLI
#include <stdio.h>
#include <string.h>
#include <memory.h>
#include <malloc.h>
#include <ctype.h>
#define OCT 0
/*
* #include <nsaddr.h>
*/
/*
* #define TRUE 1
* #define FALSE 0
*/
/* local static functions */
static int dobase(char *, char *, int);
static void memcp(char *, char *, int);
static char *xfer(char *, char *, unsigned, unsigned);
/*
* stoa - convert string to address
*
* If a string begins in \o or \O, the following address is octal
* " " " " " \x or \X, the following address is hex
*
* If ok, return pointer to netbuf structure.
* A NULL is returned on any error(s).
*/
/* Return netbuf ptr if success */
static struct netbuf *
{
static char *sbuf;
if (!str)
return (NULL);
++str;
return (NULL);
if (!addr) {
return (NULL);
}
return (NULL);
}
/* Now process the address */
if (*str == '\\') {
++str;
switch (*str) {
case 'X': /* hex */
case 'x':
break;
case 'o': /* octal */
case 'O':
break;
default: /* error */
break;
}
}
if (myadr)
return (NULL);
}
NULL)
return (NULL);
return (addr);
}
/*
* dobase : converts a hex or octal ASCII string
* to a binary address. Only HEX or OCT may be used
* for type.
* return length of binary string (in bytes), 0 if error.
* The binary result is placed at buf.
*/
static int
{
int shift = 0;
char *end;
;
/*
* any non-white, non-digits cause address to be rejected,
* other fields are ignored
*/
"dobase: Illegal trailer on address string\n");
buf[0] = '\0';
return (0);
}
--end;
if (shift > 5) {
}
} else /* hex */
--end;
}
if (bp == 0) {
return (0);
}
/* need to catch end case to avoid extra 0's in front */
if (!shift)
bp++;
}
static void
memcp(char *d, char *s, int n)
{
while (n--)
*d++ = *s++;
}
/*
* transfer block to a given destination or allocate one of the
* right size
* if max = 0 : ignore max
*/
static char *
{
return (NULL);
}
if (!dest)
return (NULL);
}
return (dest);
}
#endif /* TLI */