New module 'getdomainname'.
[gnulib.git] / lib / getdomainname.c
1 /* getdomainname emulation for systems that doesn't have it.
2    Copyright (C) 2003 Free Software Foundation, Inc.
3
4    This program is free software; you can redistribute it and/or modify
5    it under the terms of the GNU General Public License as published by
6    the Free Software Foundation; either version 2, or (at your option)
7    any later version.
8
9    This program is distributed in the hope that it will be useful,
10    but WITHOUT ANY WARRANTY; without even the implied warranty of
11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12    GNU General Public License for more details.
13
14    You should have received a copy of the GNU General Public License
15    along with this program; if not, write to the Free Software Foundation,
16    Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
17
18 /* Written by Simon Josefsson.  */
19
20 #ifdef HAVE_CONFIG_H
21 # include <config.h>
22 #endif
23
24 /* Specification. */
25 #include "getdomainname.h"
26
27 #include <string.h>
28
29 /* Return the NIS domain name of the machine.
30    WARNING! The NIS domain name is unrelated to the fully qualified host name
31             of the machine.  It is also unrelated to email addresses.
32    WARNING! The NIS domain name is usually the empty string when not using NIS.
33
34    Put up to LEN bytes of the NIS domain name into NAME.
35    Null terminate it if the name is shorter than LEN.
36    Return 0 if successful, otherwise set errno and return -1.  */
37 int
38 getdomainname (char *name, size_t len)
39 {
40   strncpy (name, "", len);      /* Hardcode your domain name if you want.  */
41   return 0;
42 }