2 * convert binary form of subnet description to ASCII
3 * Copyright (C) 1998, 1999 Henry Spencer.
5 * This library is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU Library General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version. See <http://www.fsf.org/copyleft/lgpl.txt>.
10 * This library is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13 * License for more details.
15 * RCSID $Id: subnettoa.c,v 1.7 1999/04/10 23:24:22 henry Exp $
21 - subnettoa - convert address and mask to ASCII "addr/mask"
22 * Output expresses the mask as a bit count if possible, else dotted decimal.
24 size_t /* space needed for full conversion */
25 subnettoa(addr, mask, format, dst, dstlen)
28 int format; /* character */
29 char *dst; /* need not be valid if dstlen is 0 */
45 len = addrtoa(addr, 0, dst, dstlen);
57 len += ultoa((unsigned long)n, 10, p, rest);
59 len += addrtoa(mask, 0, p, rest);