2 * Copyright (C) 2008-2011 Free Software Foundation, Inc.
3 * Written by Simon Josefsson.
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 3 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>. */
20 /* Get getdomainname() declaration. */
23 #include "signature.h"
24 SIGNATURE_CHECK (getdomainname, int, (char *, size_t));
30 #define YPMAXDOMAIN 64
32 #define NODOMAINNAME "magic-gnulib-test-string"
35 main (int argc, char *argv[] _GL_UNUSED)
37 char buf[YPMAXDOMAIN];
40 if (strlen (NODOMAINNAME) >= YPMAXDOMAIN)
42 printf ("YPMAXDOMAIN impossibly small?! %d\n", YPMAXDOMAIN);
46 strcpy (buf, NODOMAINNAME);
48 rc = getdomainname (buf, sizeof (buf));
52 printf ("getdomainname failed, rc %d errno %d\n", rc, errno);
56 if (strcmp (buf, NODOMAINNAME) == 0)
58 printf ("getdomainname left buffer untouched.\n");
63 printf ("domainname: %s\n", buf);