This source file includes following definitions.
- main
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 #include <config.h>
19
20
21 #include <unistd.h>
22
23 #include "signature.h"
24 SIGNATURE_CHECK (getdomainname, int, (char *, size_t));
25
26 #include <stdio.h>
27 #include <string.h>
28 #include <errno.h>
29
30 #define YPMAXDOMAIN 64
31
32 #define NODOMAINNAME "magic-gnulib-test-string"
33
34 int
35 main (int argc, _GL_UNUSED char *argv[])
36 {
37 char buf[YPMAXDOMAIN];
38 int rc;
39
40 if (strlen (NODOMAINNAME) >= YPMAXDOMAIN)
41 {
42 printf ("YPMAXDOMAIN impossibly small?! %d\n", YPMAXDOMAIN);
43 return 2;
44 }
45
46 strcpy (buf, NODOMAINNAME);
47
48 rc = getdomainname (buf, sizeof (buf));
49
50 if (rc != 0)
51 {
52 printf ("getdomainname failed, rc %d errno %d\n", rc, errno);
53 return 1;
54 }
55
56 if (strcmp (buf, NODOMAINNAME) == 0)
57 {
58 printf ("getdomainname left buffer untouched.\n");
59 return 1;
60 }
61
62 if (argc > 1)
63 printf ("domainname: %s\n", buf);
64
65 return 0;
66 }