Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
att
GitHub Repository: att/ast
Path: blob/master/src/cmd/tests/ip6.c
1808 views
1
/***********************************************************************
2
* *
3
* This software is part of the ast package *
4
* Copyright (c) 1999-2011 AT&T Intellectual Property *
5
* and is licensed under the *
6
* Eclipse Public License, Version 1.0 *
7
* by AT&T Intellectual Property *
8
* *
9
* A copy of the License is available at *
10
* http://www.eclipse.org/org/documents/epl-v10.html *
11
* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
12
* *
13
* Information and Software Systems Research *
14
* AT&T Research *
15
* Florham Park NJ *
16
* *
17
* Glenn Fowler <[email protected]> *
18
* *
19
***********************************************************************/
20
#pragma prototyped
21
22
#if _PACKAGE_ast
23
#include <ast.h>
24
#else
25
#include <string.h>
26
#endif
27
28
#include <stdio.h>
29
#include <ip6.h>
30
31
int
32
main(int argc, char** argv)
33
{
34
char* s;
35
char* e;
36
char* f;
37
unsigned char b;
38
unsigned char a[IP6ADDR];
39
int c;
40
int r;
41
int all = 1;
42
43
while (s = *++argv)
44
{
45
if (*s == '-' && !*(s + 1))
46
{
47
all = !all;
48
continue;
49
}
50
r = strtoip6(s, &e, a, &b);
51
f = fmtip6(a, b);
52
c = *e;
53
*e = 0;
54
if (r || all || strcmp(s, f))
55
{
56
*e = c;
57
printf("%d %32s %32s %s\n", r, s, e, f);
58
}
59
}
60
return 0;
61
}
62
63