nsap_addr.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* Copyright 1997-2002 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* Copyright (c) 1996-1999 by Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAI!
* ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANT!
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
* CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF TH!
* SOFTWARE.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
static const char rcsid[] = "$Id: nsap_addr.c,v 8.12 2001/05/28 07:37:46 marka Exp $";
#endif /* LIBC_SCCS and not lint */
#include "port_before.h"
#include <ctype.h>
#include <resolv.h>
#include "port_after.h"
static char
xtob(int c) {
return (c - (((c >= '0') && (c <= '9')) ? '0' : '7'));
}
return (0);
ascii += 2;
if (c == '.' || c == '+' || c == '/')
continue;
if (!isascii(c))
return (0);
if (islower(c))
c = toupper(c);
if (isxdigit(c)) {
c = *ascii++;
if (c != '\0') {
c = toupper(c);
if (isxdigit(c)) {
len++;
} else
return (0);
}
else
return (0);
}
else
return (0);
}
return (len);
}
char *
int nib;
int i;
#ifdef SUNW_MT_RESOLVER
char *tmpbuf = inet_nsap_ntoa_tmpbuf;
#else
#endif /* SUNW_MT_RESOLVER */
char *start;
if (ascii)
else {
}
*ascii++ = '0';
*ascii++ = 'x';
if (binlen > 255)
binlen = 255;
for (i = 0; i < binlen; i++) {
*ascii++ = '.';
}
*ascii = '\0';
return (start);
}